Comments (8)
This allows the host more visibility into plugin memory usage. It is not mandatory. For instance the host may pre-allocate and manage large image buffers, and give those to the plugins faster than system malloc. But in practice, many hosts just wrap malloc/free with these calls.
from openfx.
@garyo That makes sense. I don't see it as a big hassle to use imageMemoryAlloc
for image buffers since it's easy to have control over that, but for randoms strings, vectors, third party libraries and so on, it's hard or impossible to pipe all those allocations back to the host.
I also see that the support library manages the suites as global variables rather than storing the suites per plugin:
openfx/Support/Library/ofxsImageEffect.cpp
Line 118 in 95a1179
Is this really safe? Is is guaranteed that same suite would be returned for each individual plugin in the same library? Each plugin gets their own OfxHost
through setHost
and thus have their own fetchSuite
pointer. The host could send different suites to different plugins so is this really safe?
from openfx.
Both of these questions would be excellent clarifications to the spec, which is defined by the doc comments in the source.
No host would require all allocations like strings and vectors to go through the OpenFX API. You may get better performance, for instance the host may return pinned physical memory, and may avoid certain low-memory situations where the host has pre-allocated most of the physical RAM.
As for the suites, we could add a clarification to the spec that the host must return the same suite pointers to all plugins in the same shared lib. I'm pretty sure all existing hosts do that (it's not hard for the host to switch different behavior within a suite on a per-plugin basis if needed) and plugins I've seen store them as single globals, but as you point out nothing in the spec currently precludes them from doing that.
Feel free to add some clarifying text to the appropriate places in the spec if you like!
from openfx.
from openfx.
That's a fair point, Phil. Even if we think everyone does it that way today there is a risk.
Perhaps we could add this as "Recommended: hosts should return the same suite pointers to all plugins in the same shared lib" rather than a strict requirement. That should help future hosts behave nicely, and also serves to alert plugins that they may want to handle the case where a host behaves differently. What do you think of that?
from openfx.
from openfx.
From someone just starting out with OpenFX, I never made any assumptions about suite pointers being the same across plugins nor that they would all receive the same host pointer. The fact that each plugin declares its own setHost
function pointer is an indication that it could be different, otherwise it would be a top-level global exported function next to OfxGetPlugin
. Looking only at these things, it was very surprising to be to see the implementation of the support library using global vars for this - it felt instinctively incorrect.
However, if one wants to redirect normal allocations in one's language of choice to go through the OFX memory suite, it would be very annoying to do without the memory allocation being actually global.
from openfx.
Gary will add this note: "Recommended: hosts should return the same suite pointers to all plugins in the same shared lib or bundle"
from openfx.
Related Issues (20)
- CMakeLists.txt should have a package target that packages all headers, libs, and samples
- CI should build with and without -DOFX_SUPPORTS_OPENGLRENDER HOT 1
- Submit Conan recipe to conancenter
- Add VFX Platform 2023 to CI build matrix
- Consider adding a "LUT Generator" rendering path: NoSpatialAwareness HOT 4
- New Icons need to replace old one
- Add `OfxParamTypeStrChoice`, a string-backed enum of choices HOT 21
- Conan & cmake build fails on second build on Windows HOT 2
- Deprecate MacOS-x86_64 install folder HOT 1
- Clip and Image Metadata HOT 21
- 1.5 Release Status
- Binary data property type (Paul?) HOT 1
- Binary data Parameters HOT 39
- Support/Plugins/ChoiceParams has a couple of errors HOT 4
- update install instrution and package opencl HOT 9
- Color Managed Color Parameter
- Deprecate kOfxParamHostPropSupportsBooleanAnimation
- Windows ARM64 and ARM64EC support HOT 1
- Deterministic per-frame RNG HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openfx.