Skip to content

Commit

Permalink
Fix building with & without -DOFX_SUPPORTS_OPENGLRENDER
Browse files Browse the repository at this point in the history
- include ofxGPURender.h instead of ofxOpenGLRender.h in all examples
- HostSupport/src/ofxhImageEffect.cpp: ensure all GPU constants are
  protected by ifdef OFX_SUPPORTS_OPENGLRENDER

Signed-off-by: Gary Oberbrunner <[email protected]>
  • Loading branch information
garyo committed Jun 15, 2023
1 parent bc2353e commit 95a1179
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if(APPLE)
endif()

option(BUILD_EXAMPLE_PLUGINS "Build example plugins" OFF)
option(OFX_SUPPORTS_OPENGLRENDER "Build with support for GPU rendering (OpenGL/CUDA/Metal/OpenCL)" ON)

# Flags
if(!MSVC)
Expand All @@ -31,6 +32,11 @@ set_property(GLOBAL PROPERTY OFX_PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}")
set(OFX_HEADER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
file(GLOB_RECURSE OFX_HEADER_FILES "${OFX_HEADER_DIR}/*.h")

# Defines
if(OFX_SUPPORTS_OPENGLRENDER)
add_compile_definitions(OFX_SUPPORTS_OPENGLRENDER)
endif()

# Build
add_subdirectory(HostSupport)
add_subdirectory(Support)
Expand Down
2 changes: 1 addition & 1 deletion Examples/OpenGL/opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "ofxImageEffect.h"
#include "ofxMemory.h"
#include "ofxMultiThread.h"
#include "ofxOpenGLRender.h"
#include "ofxGPURender.h"

#include "../include/ofxUtilities.H" // example support utils

Expand Down
2 changes: 1 addition & 1 deletion HostSupport/src/ofxhClip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "ofxhClip.h"
#include "ofxhImageEffect.h"
#ifdef OFX_SUPPORTS_OPENGLRENDER
#include "ofxOpenGLRender.h"
#include "ofxGPURender.h"
#endif

namespace OFX {
Expand Down
18 changes: 9 additions & 9 deletions HostSupport/src/ofxhImageEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ namespace OFX {
{ kOfxPluginPropFilePath, Property::eString, 1, true, ""},
#ifdef OFX_SUPPORTS_OPENGLRENDER
{ kOfxImageEffectPropOpenGLRenderSupported, Property::eString, 1, false, "false"}, // OFX 1.3
#endif
{ kOfxImageEffectPropCudaRenderSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropCudaStreamSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropMetalRenderSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropOpenCLRenderSupported, Property::eString, 1, false, "false" },
#endif

Property::propSpecEnd
};
Expand Down Expand Up @@ -320,18 +320,18 @@ namespace OFX {
{ kOfxImageEffectPropSupportsTiles, Property::eInt, 1, false, "1" }, // OFX 1.4
#ifdef OFX_SUPPORTS_OPENGLRENDER
{ kOfxImageEffectPropOpenGLRenderSupported, Property::eString, 1, false, "false"}, // OFX 1.4
#endif
{ kOfxImageEffectPropCudaRenderSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropCudaStreamSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropMetalRenderSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropOpenCLRenderSupported, Property::eString, 1, false, "false" },
#endif
Property::propSpecEnd
};

Instance::Instance(ImageEffectPlugin* plugin,
Descriptor &other,
Descriptor &other,
const std::string &context,
bool interactive)
bool interactive)
: Base(effectInstanceStuff)
, _plugin(plugin)
, _context(context)
Expand Down Expand Up @@ -2694,18 +2694,18 @@ namespace OFX {
{ kOfxImageEffectInstancePropSequentialRender, Property::eInt, 1, true, "0" }, // OFX 1.2
#ifdef OFX_SUPPORTS_OPENGLRENDER
{ kOfxImageEffectPropOpenGLRenderSupported, Property::eString, 1, true, "false"}, // OFX 1.3
#endif
{ kOfxImageEffectPropRenderQualityDraft, Property::eInt, 1, true, "0" }, // OFX 1.4
{ kOfxImageEffectHostPropNativeOrigin, Property::eString, 0, true, kOfxHostNativeOriginBottomLeft }, // OFX 1.4
{ kOfxImageEffectPropCudaRenderSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropCudaStreamSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropMetalRenderSupported, Property::eString, 1, false, "false" },
{ kOfxImageEffectPropOpenCLRenderSupported, Property::eString, 1, false, "false" },
#endif
{ kOfxImageEffectPropRenderQualityDraft, Property::eInt, 1, true, "0" }, // OFX 1.4
{ kOfxImageEffectHostPropNativeOrigin, Property::eString, 0, true, kOfxHostNativeOriginBottomLeft }, // OFX 1.4
Property::propSpecEnd
};
};

/// ctor
Host::Host()
Host::Host()
{
/// add the properties for an image effect host, derived classs to set most of them
_properties.addProperties(hostStuffs);
Expand Down
2 changes: 1 addition & 1 deletion Support/Library/ofxsImageEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#endif
#include <stdexcept>
#ifdef OFX_SUPPORTS_OPENGLRENDER
#include "ofxOpenGLRender.h"
#include "ofxGPURender.h"
#endif
#include "ofxsCore.h"

Expand Down
2 changes: 1 addition & 1 deletion Support/Library/ofxsPropertyValidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This file contains headers for classes that are used to validate property sets a
#include "ofxsSupportPrivate.h"
#include <stdarg.h>
#ifdef OFX_SUPPORTS_OPENGLRENDER
#include "ofxOpenGLRender.h"
#include "ofxGPURender.h"
#endif

/** @brief Null pointer definition */
Expand Down

0 comments on commit 95a1179

Please sign in to comment.