This class holds the GPU-related information needed to build a shader program from a specific processor.
More...
|
GpuShaderCreatorRcPtr | clone () const override |
|
virtual unsigned | getNumUniforms () const noexcept=0 |
|
virtual const char * | getUniform (unsigned index, UniformData &data) const =0 |
| Returns name of uniform and data as parameter. More...
|
|
virtual unsigned | getNumTextures () const noexcept=0 |
|
virtual void | getTexture (unsigned index, const char *&textureName, const char *&samplerName, unsigned &width, unsigned &height, TextureType &channel, Interpolation &interpolation) const =0 |
|
virtual void | getTextureValues (unsigned index, const float *&values) const =0 |
|
virtual unsigned | getNum3DTextures () const noexcept=0 |
|
virtual void | get3DTexture (unsigned index, const char *&textureName, const char *&samplerName, unsigned &edgelen, Interpolation &interpolation) const =0 |
|
virtual void | get3DTextureValues (unsigned index, const float *&values) const =0 |
|
const char * | getShaderText () const noexcept |
| Get the complete OCIO shader program. More...
|
|
| GpuShaderDesc (const GpuShaderDesc &)=delete |
|
GpuShaderDesc & | operator= (const GpuShaderDesc &)=delete |
|
virtual | ~GpuShaderDesc () |
| Do not use (needed only for pybind11). More...
|
|
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 |
|
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, 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...
|
|
This class holds the GPU-related information needed to build a shader program from a specific processor.
This class defines the interface and there are two implementations provided. The "legacy" mode implements the OCIO v1 approach of baking certain ops in order to have at most one 3D-LUT. The "generic" mode is the v2 default and allows all the ops to be processed as-is, without baking, like the CPU renderer. Custom implementations could be written to accommodate the GPU needs of a specific client app.
The complete fragment shader program is decomposed in two main parts: the OCIO shader program for the color processing and the client shader program which consumes the pixel color processing.
The OCIO shader program is fully described by the GpuShaderDesc independently from the client shader program. The only critical point is the agreement on the OCIO function shader name.
To summarize, the complete shader program is:
Usage Example: Building a GPU shader
This example is based on the code in: src/apps/ociodisplay/main.cpp
= config->getProcessor("ACES - ACEScg", "Output - sRGB");
shaderDesc->setFunctionName("OCIODisplay");
processor->extractGpuShaderInfo(shaderDesc);
OpenGLBuilderRcPtr oglBuilder = OpenGLBuilder::Create(shaderDesc);
oglBuilder->allocateAllTextures();
g_programId = oglBuilder->buildProgram(g_fragShaderText);
oglBuilder->useAllTextures(g_programId);
m_oglBuilder->useAllUniforms();
Definition at line 3328 of file OpenColorIO.h.