|
virtual GpuShaderCreatorRcPtr | clone () const =0 |
|
const char * | getUniqueID () const noexcept |
|
void | setUniqueID (const char *uid) noexcept |
|
GpuLanguage | getLanguage () const noexcept |
|
void | setLanguage (GpuLanguage lang) noexcept |
| Set the shader program language. More...
|
|
const char * | getFunctionName () const noexcept |
|
void | setFunctionName (const char *name) noexcept |
|
const char * | getPixelName () const noexcept |
|
void | setPixelName (const char *name) noexcept |
| Set the pixel name variable holding the color values. More...
|
|
const char * | getResourcePrefix () const noexcept |
|
void | setResourcePrefix (const char *prefix) noexcept |
| Set a prefix to the resource name. More...
|
|
virtual const char * | getCacheID () const noexcept |
|
virtual void | begin (const char *uid) |
| Start to collect the shader data. More...
|
|
virtual void | end () |
| End to collect the shader data. More...
|
|
virtual void | setTextureMaxWidth (unsigned maxWidth)=0 |
| Some graphic cards could have 1D & 2D textures with size limitations. More...
|
|
virtual unsigned | getTextureMaxWidth () const noexcept=0 |
|
virtual void | setAllowTexture1D (bool allowed)=0 |
| Allow 1D GPU resource type, otherwise always using 2D resources for 1D LUTs. More...
|
|
virtual bool | getAllowTexture1D () const =0 |
|
unsigned | getNextResourceIndex () noexcept |
|
virtual bool | addUniform (const char *name, const DoubleGetter &getDouble)=0 |
|
virtual bool | addUniform (const char *name, const BoolGetter &getBool)=0 |
|
virtual bool | addUniform (const char *name, const Float3Getter &getFloat3)=0 |
|
virtual bool | addUniform (const char *name, const SizeGetter &getSize, const VectorFloatGetter &getVectorFloat)=0 |
|
virtual bool | addUniform (const char *name, const SizeGetter &getSize, const VectorIntGetter &getVectorInt)=0 |
|
void | addDynamicProperty (DynamicPropertyRcPtr &prop) |
| Adds the property (used internally). More...
|
|
unsigned | getNumDynamicProperties () const noexcept |
| Dynamic Property related methods. More...
|
|
DynamicPropertyRcPtr | getDynamicProperty (unsigned index) const |
|
bool | hasDynamicProperty (DynamicPropertyType type) const |
|
DynamicPropertyRcPtr | getDynamicProperty (DynamicPropertyType type) const |
|
virtual void | addTexture (const char *textureName, const char *samplerName, unsigned width, unsigned height, TextureType channel, TextureDimensions dimensions, Interpolation interpolation, const float *values)=0 |
|
virtual void | add3DTexture (const char *textureName, const char *samplerName, unsigned edgelen, Interpolation interpolation, const float *values)=0 |
|
virtual void | addToDeclareShaderCode (const char *shaderCode) |
|
virtual void | addToHelperShaderCode (const char *shaderCode) |
|
virtual void | addToFunctionHeaderShaderCode (const char *shaderCode) |
|
virtual void | addToFunctionShaderCode (const char *shaderCode) |
|
virtual void | addToFunctionFooterShaderCode (const char *shaderCode) |
|
virtual void | createShaderText (const char *shaderDeclarations, const char *shaderHelperMethods, const char *shaderFunctionHeader, const char *shaderFunctionBody, const char *shaderFunctionFooter) |
| Create the OCIO shader program. More...
|
|
virtual void | finalize () |
|
| GpuShaderCreator (const GpuShaderCreator &)=delete |
|
GpuShaderCreator & | operator= (const GpuShaderCreator &)=delete |
|
virtual | ~GpuShaderCreator () |
| Do not use (needed only for pybind11). More...
|
|
Inherit from the class to fully customize the implementation of a GPU shader program from a color transformation.
When no customizations are needed and the intermediate in-memory step is acceptable then the GpuShaderDesc is a better choice.
- Note
- To better decouple the DynamicProperties from their GPU implementation, the code provides several addUniform() methods i.e. one per access function types. For example, an ExposureContrastTransform instance owns three DynamicProperties and they are all implemented by a double. When creating the GPU fragment shader program, the addUniform() with GpuShaderCreator::DoubleGetter is called when property is dynamic, up to three times.
An OCIO shader program could contain:
- A declaration part e.g., uniform sampled3D tex3;
- Some helper methods
- The OCIO shader function may be broken down as:
- The function header e.g., void OCIODisplay(in vec4 inColor) {
- The function body e.g., vec4 outColor.rgb = texture3D(tex3, inColor.rgb).rgb;
- The function footer e.g., return outColor; }
Usage Example:
Below is a code snippet to highlight the different parts of the OCIO shader program.
uniform sampled3D tex3;
vec3 computePosition(vec3
color)
{
}
vec4 OCIODisplay(in vec4 inColor)
{
vec4 outColor = inColor;
outColor.rgb = texture3D(tex3, computePosition(inColor.rgb)).rgb;
return outColor;
}
Definition at line 3166 of file OpenColorIO.h.