API Docs are a work in progress, expect them to improve over time.

class GpuShaderCreator

Inherit from the class to fully customize the implementation of a GPU shader program from a color transformation.

When no customizations are needed then the GpuShaderDesc is a better choice.

Subclassed by OpenColorIO::GpuShaderDesc

enum TextureType



Only use the red channel of the texture.


Public Functions

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.

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.

const char *getResourcePrefix() const noexcept

Note Some applications require that textures, uniforms, and helper methods be uniquely named because several processor instances could coexist.

void setResourcePrefix(const char *prefix) noexcept

Set a prefix to the resource name.

const char *getCacheID() const noexcept
void begin(const char *uid)

Start to collect the shader data.

void end()

End to collect the shader data.

void setTextureMaxWidth(unsigned maxWidth) = 0

Some graphic cards could have 1D & 2D textures with size limitations.

unsigned getTextureMaxWidth() const noexcept = 0
unsigned getNextResourceIndex() noexcept

To avoid texture/unform name clashes always append an increasing number to the resource name.

bool addUniform(const char *name, const DynamicPropertyRcPtr &value) = 0
void addTexture(const char *textureName, const char *samplerName, const char *uid, unsigned width, unsigned height, TextureType channel, Interpolation interpolation, const float *values) = 0
void add3DTexture(const char *textureName, const char *samplerName, const char *uid, unsigned edgelen, Interpolation interpolation, const float *values) = 0
void addToDeclareShaderCode(const char *shaderCode)
void addToHelperShaderCode(const char *shaderCode)
void addToFunctionHeaderShaderCode(const char *shaderCode)
void addToFunctionShaderCode(const char *shaderCode)
void addToFunctionFooterShaderCode(const char *shaderCode)
void createShaderText(const char *shaderDeclarations, const char *shaderHelperMethods, const char *shaderFunctionHeader, const char *shaderFunctionBody, const char *shaderFunctionFooter)

Create the OCIO shader program.

The OCIO shader program is decomposed to allow a specific implementation to change some parts. Some product integrations add the color processing within a client shader program, imposing constraints requiring this flexibility.


void finalize()
class TextureType


add3DTexture(self: PyOpenColorIO.GpuShaderCreator, textureName: str, samplerName: str, uid: str, edgeLen: int, interpolation: PyOpenColorIO.Interpolation, values: float) → None
addTexture(self: PyOpenColorIO.GpuShaderCreator, textureName: str, samplerName: str, uid: str, width: int, height: int, channel: OpenColorIO_v2_0dev::GpuShaderCreator::TextureType, interpolation: PyOpenColorIO.Interpolation, values: float) → None
addToDeclareShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) → None
addToFunctionFooterShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) → None
addToFunctionHeaderShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) → None
addToFunctionShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) → None
addToHelperShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) → None
addUniform(self: PyOpenColorIO.GpuShaderCreator, name: str, value: PyOpenColorIO.DynamicProperty) → bool
begin(self: PyOpenColorIO.GpuShaderCreator, uid: str) → None
clone(self: PyOpenColorIO.GpuShaderCreator) → `PyOpenColorIO.GpuShaderCreator`_
createShaderText(self: PyOpenColorIO.GpuShaderCreator, shaderDeclarations: str, shaderHelperMethods: str, shaderFunctionHeader: str, shaderFunctionBody: str, shaderFunctionFooter: str) → None
end(self: PyOpenColorIO.GpuShaderCreator) → None
finalize(self: PyOpenColorIO.GpuShaderCreator) → None
getCacheID(self: PyOpenColorIO.GpuShaderCreator) → str
getFunctionName(self: PyOpenColorIO.GpuShaderCreator) → str
getLanguage(self: PyOpenColorIO.GpuShaderCreator) → str
getNextResourceIndex(self: PyOpenColorIO.GpuShaderCreator) → int
getPixelName(self: PyOpenColorIO.GpuShaderCreator) → str
getResourcePrefix(self: PyOpenColorIO.GpuShaderCreator) → str
getTextureMaxWidth(self: PyOpenColorIO.GpuShaderCreator) → int
getUniqueID(self: PyOpenColorIO.GpuShaderCreator) → str
setFunctionName(self: PyOpenColorIO.GpuShaderCreator, name: str) → None
setLanguage(self: PyOpenColorIO.GpuShaderCreator, language: str) → None
setPixelName(self: PyOpenColorIO.GpuShaderCreator, name: str) → None
setResourcePrefix(self: PyOpenColorIO.GpuShaderCreator, prefix: str) → None
setTextureMaxWidth(self: PyOpenColorIO.GpuShaderCreator, maxWidth: int) → None
setUniqueID(self: PyOpenColorIO.GpuShaderCreator, uid: str) → None