Shaders

GpuShaderCreator

class PyOpenColorIO.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 :ref:`GpuShaderDesc` is a better choice.

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.

addToDeclareShaderCode(shaderCode: str) → None
addToFunctionFooterShaderCode(shaderCode: str) → None
addToFunctionHeaderShaderCode(shaderCode: str) → None
addToFunctionShaderCode(shaderCode: str) → None
addToHelperShaderCode(shaderCode: str) → None
begin(uid: str) → None

Start to collect the shader data.

clone()PyOpenColorIO.GpuShaderCreator
createShaderText(shaderDeclarations: str, shaderHelperMethods: str, shaderFunctionHeader: str, shaderFunctionBody: str, shaderFunctionFooter: str) → None

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.

end() → None

End to collect the shader data.

finalize() → None
getCacheID() → str
getDynamicProperties()PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator
getDynamicProperty(type: PyOpenColorIO.DynamicPropertyType)PyOpenColorIO.DynamicProperty
getFunctionName() → str
getLanguage()PyOpenColorIO.GpuLanguage
getNextResourceIndex() → int

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

getPixelName() → str
getResourcePrefix() → str

Note

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

getTextureMaxWidth() → int
getUniqueID() → str
hasDynamicProperty(type: PyOpenColorIO.DynamicPropertyType) → bool
setFunctionName(name: str) → None
setLanguage(language: PyOpenColorIO.GpuLanguage) → None

Set the shader program language.

setPixelName(name: str) → None

Set the pixel name variable holding the color values.

setResourcePrefix(prefix: str) → None

Set a prefix to the resource name.

setTextureMaxWidth(maxWidth: int) → None

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

setUniqueID(uid: str) → None
class PyOpenColorIO.GpuShaderCreator.TextureType

Members:

TEXTURE_RED_CHANNEL

TEXTURE_RGB_CHANNEL

property name → str
TEXTURE_RED_CHANNEL = <TextureType.TEXTURE_RED_CHANNEL: 0>
TEXTURE_RGB_CHANNEL = <TextureType.TEXTURE_RGB_CHANNEL: 1>
property value
class PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator
self[arg0: int]PyOpenColorIO.DynamicProperty
iter(self)PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator
len(self) → int
next(self)PyOpenColorIO.DynamicProperty

GpuShaderDesc

class PyOpenColorIO.GpuShaderDesc
static CreateLegacyShaderDesc(edgeLen: int, language: PyOpenColorIO.GpuLanguage = <GpuLanguage.GPU_LANGUAGE_GLSL_1_2: 1>, functionName: str = 'OCIOMain', pixelName: str = 'outColor', resourcePrefix: str = 'ocio', uid: str = '')PyOpenColorIO.GpuShaderDesc

Create the legacy shader description.

static CreateShaderDesc(language: PyOpenColorIO.GpuLanguage = <GpuLanguage.GPU_LANGUAGE_GLSL_1_2: 1>, functionName: str = 'OCIOMain', pixelName: str = 'outColor', resourcePrefix: str = 'ocio', uid: str = '')PyOpenColorIO.GpuShaderDesc

Create the default shader description.

GpuShaderDesc(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

add3DTexture(textureName: str, samplerName: str, edgeLen: int, interpolation: PyOpenColorIO.Interpolation, values: buffer) → None
addTexture(textureName: str, samplerName: str, width: int, height: int, channel: PyOpenColorIO.GpuShaderCreator.TextureType, interpolation: PyOpenColorIO.Interpolation, values: buffer) → None
addToDeclareShaderCode(shaderCode: str) → None
addToFunctionFooterShaderCode(shaderCode: str) → None
addToFunctionHeaderShaderCode(shaderCode: str) → None
addToFunctionShaderCode(shaderCode: str) → None
addToHelperShaderCode(shaderCode: str) → None
begin(uid: str) → None

Start to collect the shader data.

clone()PyOpenColorIO.GpuShaderCreator
createShaderText(shaderDeclarations: str, shaderHelperMethods: str, shaderFunctionHeader: str, shaderFunctionBody: str, shaderFunctionFooter: str) → None

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.

end() → None

End to collect the shader data.

finalize() → None
get3DTextures()PyOpenColorIO.GpuShaderDesc.Texture3DIterator
getCacheID() → str
getDynamicProperties()PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator
getDynamicProperty(type: PyOpenColorIO.DynamicPropertyType)PyOpenColorIO.DynamicProperty
getFunctionName() → str
getLanguage()PyOpenColorIO.GpuLanguage
getNextResourceIndex() → int

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

getPixelName() → str
getResourcePrefix() → str

Note

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

getShaderText() → str

Get the complete OCIO shader program.

getTextureMaxWidth() → int
getTextures()PyOpenColorIO.GpuShaderDesc.TextureIterator
getUniforms()PyOpenColorIO.GpuShaderDesc.UniformIterator
getUniqueID() → str
hasDynamicProperty(type: PyOpenColorIO.DynamicPropertyType) → bool
setFunctionName(name: str) → None
setLanguage(language: PyOpenColorIO.GpuLanguage) → None

Set the shader program language.

setPixelName(name: str) → None

Set the pixel name variable holding the color values.

setResourcePrefix(prefix: str) → None

Set a prefix to the resource name.

setTextureMaxWidth(maxWidth: int) → None

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

setUniqueID(uid: str) → None
class PyOpenColorIO.GpuShaderDesc.TextureType

Members:

TEXTURE_RED_CHANNEL

TEXTURE_RGB_CHANNEL

property name → str
TEXTURE_RED_CHANNEL = <TextureType.TEXTURE_RED_CHANNEL: 0>
TEXTURE_RGB_CHANNEL = <TextureType.TEXTURE_RGB_CHANNEL: 1>
property value
class PyOpenColorIO.GpuShaderDesc.UniformData
getBool() → bool
getDouble() → float
getFloat3() → List[float[3]]
getVectorFloat() → numpy.ndarray
getVectorInt() → numpy.ndarray
property type
class PyOpenColorIO.GpuShaderDesc.Texture
property channel
getValues() → numpy.ndarray
property height
property interpolation
property samplerName
property textureName
property width
class PyOpenColorIO.GpuShaderDesc.Texture3D
property edgeLen
getValues() → numpy.ndarray
property interpolation
property samplerName
property textureName
class PyOpenColorIO.GpuShaderDesc.UniformIterator
self[arg0: int] → tuple
iter(self)PyOpenColorIO.GpuShaderDesc.UniformIterator
len(self) → int
next(self) → tuple
class PyOpenColorIO.GpuShaderDesc.TextureIterator
self[arg0: int]PyOpenColorIO.GpuShaderDesc.Texture
iter(self)PyOpenColorIO.GpuShaderDesc.TextureIterator
len(self) → int
next(self)PyOpenColorIO.GpuShaderDesc.Texture
class PyOpenColorIO.GpuShaderDesc.Texture3DIterator
self[arg0: int]PyOpenColorIO.GpuShaderDesc.Texture3D
iter(self)PyOpenColorIO.GpuShaderDesc.Texture3DIterator
len(self) → int
next(self)PyOpenColorIO.GpuShaderDesc.Texture3D
class PyOpenColorIO.GpuShaderDesc.DynamicPropertyIterator
self[arg0: int]PyOpenColorIO.DynamicProperty
iter(self)PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator
len(self) → int
next(self)PyOpenColorIO.DynamicProperty