Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing CUDA Stream params + PropOverlayInteractV2 #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Support/Library/ofxsImageEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,13 @@ namespace OFX {
_effectProps.propSetString(kOfxImageEffectPropOpenGLRenderSupported, (v ? "true" : "false"), false); // read/write from OFX 1.4
}
}

/** @brief Does the plugin require OpenGL accelerated rendering ? Can only be called from changedParam or changedClip. */
void ImageEffect::setNeedsOpenGLRender(bool v) {
if (gHostDescription.supportsOpenGLRender) {
_effectProps.propSetString(kOfxImageEffectPropOpenGLRenderSupported, (v ? "needed" : "false"), false); // read/write from OFX 1.4
}
}
#endif


Expand Down Expand Up @@ -3846,7 +3853,7 @@ namespace OFX {
gHostDescription.supportsCustomInteract = hostProps.propGetInt(kOfxParamHostPropSupportsCustomInteract) != 0;
gHostDescription.supportsChoiceAnimation = hostProps.propGetInt(kOfxParamHostPropSupportsChoiceAnimation) != 0;
#ifdef OFX_EXTENSIONS_RESOLVE
gHostDescription.supportsStrChoiceAnimation = hostProps.propGetInt(kOfxParamHostPropSupportsStrChoiceAnimation, false) != 0;
gHostDescription.supportsStrChoiceAnimation = hostProps.propGetInt(kOfxParamHostPropSupportsStrChoiceAnimation, false);
#endif
gHostDescription.supportsBooleanAnimation = hostProps.propGetInt(kOfxParamHostPropSupportsBooleanAnimation) != 0;
gHostDescription.supportsCustomAnimation = hostProps.propGetInt(kOfxParamHostPropSupportsCustomAnimation) != 0;
Expand Down Expand Up @@ -3964,11 +3971,17 @@ namespace OFX {
gMemorySuite = (OfxMemorySuiteV1 *) fetchSuite(kOfxMemorySuite, 1);
gThreadSuite = (OfxMultiThreadSuiteV1 *) fetchSuite(kOfxMultiThreadSuite, 1);
gMessageSuite = (OfxMessageSuiteV1 *) fetchSuite(kOfxMessageSuite, 1);
#ifndef OFX_EXTENSIONS_RESOLVE
//Resolve doesn't support OfxMessageSuiteV2, do not fetch to suppress warning
gMessageSuiteV2 = (OfxMessageSuiteV2 *) fetchSuite(kOfxMessageSuite, 2, true);
#endif
gProgressSuiteV1 = (OfxProgressSuiteV1 *) fetchSuite(kOfxProgressSuite, 1, true);
gProgressSuiteV2 = (OfxProgressSuiteV2 *) fetchSuite(kOfxProgressSuite, 2, true);
gTimeLineSuite = (OfxTimeLineSuiteV1 *) fetchSuite(kOfxTimeLineSuite, 1, true);
#ifndef OFX_EXTENSIONS_RESOLVE
// Resolve doesn't support OfxParametricParameterSuiteV1, do not fetch to suppress warning
gParametricParameterSuite = (OfxParametricParameterSuiteV1*) fetchSuite(kOfxParametricParameterSuite, 1, true);
#endif
#ifdef OFX_SUPPORTS_OPENGLRENDER
gOpenGLRenderSuite = (OfxImageEffectOpenGLRenderSuiteV1*) fetchSuite(kOfxOpenGLRenderSuite, 1, true);
#endif
Expand Down Expand Up @@ -4157,6 +4170,7 @@ namespace OFX {
args.isEnabledCudaRender = inArgs.propGetInt(kOfxImageEffectPropCudaEnabled, false) != 0;
args.isEnabledMetalRender = inArgs.propGetInt(kOfxImageEffectPropMetalEnabled, false) != 0;
args.pOpenCLCmdQ = inArgs.propGetPointer(kOfxImageEffectPropOpenCLCommandQueue, false);
args.pCudaStream = inArgs.propGetPointer(kOfxImageEffectPropCudaStream, false);
args.pMetalCmdQ = inArgs.propGetPointer(kOfxImageEffectPropMetalCommandQueue, false);
#endif

Expand Down Expand Up @@ -4261,6 +4275,7 @@ namespace OFX {
args.isEnabledCudaRender = inArgs.propGetInt(kOfxImageEffectPropCudaEnabled, false) != 0;
args.isEnabledMetalRender = inArgs.propGetInt(kOfxImageEffectPropMetalEnabled, false) != 0;
args.pOpenCLCmdQ = inArgs.propGetPointer(kOfxImageEffectPropOpenCLCommandQueue, false);
args.pCudaStream = inArgs.propGetPointer(kOfxImageEffectPropCudaStream, false);
args.pMetalCmdQ = inArgs.propGetPointer(kOfxImageEffectPropMetalCommandQueue, false);
#endif

Expand Down Expand Up @@ -4303,6 +4318,7 @@ namespace OFX {
args.isEnabledCudaRender = inArgs.propGetInt(kOfxImageEffectPropCudaEnabled, false) != 0;
args.isEnabledMetalRender = inArgs.propGetInt(kOfxImageEffectPropMetalEnabled, false) != 0;
args.pOpenCLCmdQ = inArgs.propGetPointer(kOfxImageEffectPropOpenCLCommandQueue, false);
args.pCudaStream = inArgs.propGetPointer(kOfxImageEffectPropCudaStream, false);
args.pMetalCmdQ = inArgs.propGetPointer(kOfxImageEffectPropMetalCommandQueue, false);
#endif
args.renderScale.x = args.renderScale.y = 1.;
Expand Down
3 changes: 2 additions & 1 deletion Support/Library/ofxsPropertyValidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ namespace OFX {

// Pointer props with defaults that can be checked against
PropertyDescription(kOfxImageEffectPluginPropOverlayInteractV1, OFX::ePointer, 1, eDescDefault, NULLPTR, eDescFinished),
PropertyDescription(kOfxImageEffectPluginPropOverlayInteractV2, OFX::ePointer, 1, eDescDefault, NULLPTR, eDescFinished),

// string props that have variable dimension, and can't be checked against for defaults
PropertyDescription(kOfxImageEffectPropSupportedContexts, OFX::eString, -1, eDescFinished),
Expand Down Expand Up @@ -1416,7 +1417,7 @@ namespace OFX {
gStrChoiceParamPropSet.addProperty(desc, true);
#endif

// do choice params animate
// do boolean params animate
desc = new PropertyDescription(kOfxParamPropAnimates, OFX::eInt, 1,
eDescDefault, int(getImageEffectHostDescription()->supportsBooleanAnimation),
eDescFinished);
Expand Down
5 changes: 5 additions & 0 deletions Support/include/ofxsImageEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,7 @@ namespace OFX {
bool isEnabledCudaRender;
bool isEnabledMetalRender;
void* pOpenCLCmdQ;
void* pCudaStream;
void* pMetalCmdQ;
#endif
#ifdef OFX_SUPPORTS_OPENGLRENDER
Expand All @@ -1518,6 +1519,7 @@ namespace OFX {
bool isEnabledCudaRender;
bool isEnabledMetalRender;
void* pOpenCLCmdQ;
void* pCudaStream;
void* pMetalCmdQ;
#endif
#ifdef OFX_SUPPORTS_OPENGLRENDER
Expand Down Expand Up @@ -1946,6 +1948,9 @@ namespace OFX {
#ifdef OFX_SUPPORTS_OPENGLRENDER
/** @brief Does the plugin support OpenGL accelerated rendering (but is also capable of CPU rendering) ? Can only be called from changedParam or changedClip (OFX 1.4). */
void setSupportsOpenGLRender(bool v);

/** @brief Does the plugin require OpenGL accelerated rendering ? Can only be called from changedParam or changedClip. */
void setNeedsOpenGLRender(bool v);
#endif

/** @brief notify host that the internal data structures need syncing back to parameters for persistence and so on. This is reset by the host after calling SyncPrivateData. */
Expand Down
13 changes: 13 additions & 0 deletions include/ofxImageEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,19 @@ The entry point pointed to must be one that handles custom interaction actions.
*/
#define kOfxImageEffectPluginPropOverlayInteractV1 "OfxImageEffectPluginPropOverlayInteractV1"

/** @brief Sets the entry for an effect's overlay interaction. Unlike
kOfxImageEffectPluginPropOverlayInteractV1, the overlay interact in the plug-in is expected
to implement the kOfxInteractActionDraw using the OfxDrawSuiteV1.

- Type - pointer X 1
- Property Set - plugin descriptor (read/write)
- Default - NULL
- Valid Values - must point to an ::OfxPluginEntryPoint

The entry point pointed to must be one that handles custom interaction actions.
*/
#define kOfxImageEffectPluginPropOverlayInteractV2 "OfxImageEffectPluginPropOverlayInteractV2"

/** @brief Indicates whether a plugin or host support multiple resolution images.

- Type - int X 1
Expand Down
9 changes: 7 additions & 2 deletions include/ofxInteract.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,13 @@ These are the list of actions passed to an interact's entry point function. For
/** @brief

This action is issued to an interact whenever the host needs the plugin
to redraw the given interact. The interact should issue any openGL calls
it needs at this point.
to redraw the given interact.

The interact should either issue OpenGL calls to draw itself, or use DrawSuite calls.

If this is called via kOfxImageEffectPluginPropOverlayInteractV2, drawing MUST use DrawSuite.

If this is called via kOfxImageEffectPluginPropOverlayInteractV1, drawing SHOULD use OpenGL. Some existing plugins may use DrawSuite via kOfxImageEffectPluginPropOverlayInteractV1 if it's supported by the host, but this is discouraged.

Note that the interact may (in the case of custom parameter GUIS) or may
not (in the case of image effect overlays) be required to swap buffers,
Expand Down