..
  SPDX-License-Identifier: CC-BY-4.0
  Copyright Contributors to the OpenColorIO Project.
  Do not edit! This file was automatically generated by share/docs/frozendoc.py.

.. py:class:: GpuShaderCreator
   :module: PyOpenColorIO

   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 :ref:`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 :ref:`ExposureContrastTransform` instance owns three DynamicProperties and they are all implemented by a double. When creating the GPU fragment shader program, the addUniform() with :ref:`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.

   .. code-block:: cpp

       // All global declarations
       uniform sampled3D tex3;

       // All helper methods
       vec3 computePosition(vec3 color)
       {
          vec3 coords = color;
          // Some processing...
          return coords;
       }

       // The shader function
       vec4 OCIODisplay(in vec4 inColor)     //
       {                                     // Function Header
          vec4 outColor = inColor;           //

          outColor.rgb = texture3D(tex3, computePosition(inColor.rgb)).rgb;

          return outColor;                   // Function Footer
       }                                     //


   .. py:attribute:: GpuShaderCreator.TEXTURE_1D
      :module: PyOpenColorIO
      :value: <TextureDimensions.TEXTURE_1D: 1>


   .. py:attribute:: GpuShaderCreator.TEXTURE_2D
      :module: PyOpenColorIO
      :value: <TextureDimensions.TEXTURE_2D: 2>


   .. py:class:: GpuShaderCreator.TextureDimensions
      :module: PyOpenColorIO
      :canonical: PyOpenColorIO.GpuShaderCreator.TextureDimensions

      Dimension enum used to differentiate between 1D and 2D object/resource types.

      Members:

        TEXTURE_1D

        TEXTURE_2D


      .. py:attribute:: GpuShaderCreator.TextureDimensions.TEXTURE_1D
         :module: PyOpenColorIO
         :value: <TextureDimensions.TEXTURE_1D: 1>


      .. py:attribute:: GpuShaderCreator.TextureDimensions.TEXTURE_2D
         :module: PyOpenColorIO
         :value: <TextureDimensions.TEXTURE_2D: 2>


      .. py:property:: GpuShaderCreator.TextureDimensions.name
         :module: PyOpenColorIO


      .. py:property:: GpuShaderCreator.TextureDimensions.value
         :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.addToDeclareShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) -> None
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.addToFunctionFooterShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) -> None
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.addToFunctionHeaderShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) -> None
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.addToFunctionShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) -> None
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.addToHelperShaderCode(self: PyOpenColorIO.GpuShaderCreator, shaderCode: str) -> None
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.begin(self: PyOpenColorIO.GpuShaderCreator, uid: str) -> None
      :module: PyOpenColorIO

      Start to collect the shader data.


   .. py:method:: GpuShaderCreator.clone(self: PyOpenColorIO.GpuShaderCreator) -> PyOpenColorIO.GpuShaderCreator
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.createShaderText(self: PyOpenColorIO.GpuShaderCreator, shaderDeclarations: str, shaderHelperMethods: str, shaderFunctionHeader: str, shaderFunctionBody: str, shaderFunctionFooter: str) -> None
      :module: PyOpenColorIO

      Create the OCIO shader program.

      .. note::
         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.


   .. py:method:: GpuShaderCreator.end(self: PyOpenColorIO.GpuShaderCreator) -> None
      :module: PyOpenColorIO

      End to collect the shader data.


   .. py:method:: GpuShaderCreator.finalize(self: PyOpenColorIO.GpuShaderCreator) -> None
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.getAllowTexture1D(self: PyOpenColorIO.GpuShaderCreator) -> bool
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.getCacheID(self: PyOpenColorIO.GpuShaderCreator) -> str
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.getDynamicProperties(self: PyOpenColorIO.GpuShaderCreator) -> PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.getDynamicProperty(self: PyOpenColorIO.GpuShaderCreator, type: PyOpenColorIO.DynamicPropertyType) -> PyOpenColorIO.DynamicProperty
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.getFunctionName(self: PyOpenColorIO.GpuShaderCreator) -> str
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.getLanguage(self: PyOpenColorIO.GpuShaderCreator) -> PyOpenColorIO.GpuLanguage
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.getNextResourceIndex(self: PyOpenColorIO.GpuShaderCreator) -> int
      :module: PyOpenColorIO

      To avoid global texture sampler and uniform name clashes always append an increasing index to the resource name.


   .. py:method:: GpuShaderCreator.getPixelName(self: PyOpenColorIO.GpuShaderCreator) -> str
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.getResourcePrefix(self: PyOpenColorIO.GpuShaderCreator) -> str
      :module: PyOpenColorIO

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


   .. py:method:: GpuShaderCreator.getTextureMaxWidth(self: PyOpenColorIO.GpuShaderCreator) -> int
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.getUniqueID(self: PyOpenColorIO.GpuShaderCreator) -> str
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.hasDynamicProperty(self: PyOpenColorIO.GpuShaderCreator, type: PyOpenColorIO.DynamicPropertyType) -> bool
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.setAllowTexture1D(self: PyOpenColorIO.GpuShaderCreator, allowed: bool) -> None
      :module: PyOpenColorIO

      Allow 1D GPU resource type, otherwise always using 2D resources for 1D LUTs.


   .. py:method:: GpuShaderCreator.setFunctionName(self: PyOpenColorIO.GpuShaderCreator, name: str) -> None
      :module: PyOpenColorIO


   .. py:method:: GpuShaderCreator.setLanguage(self: PyOpenColorIO.GpuShaderCreator, language: PyOpenColorIO.GpuLanguage) -> None
      :module: PyOpenColorIO

      Set the shader program language.


   .. py:method:: GpuShaderCreator.setPixelName(self: PyOpenColorIO.GpuShaderCreator, name: str) -> None
      :module: PyOpenColorIO

      Set the pixel name variable holding the color values.


   .. py:method:: GpuShaderCreator.setResourcePrefix(self: PyOpenColorIO.GpuShaderCreator, prefix: str) -> None
      :module: PyOpenColorIO

      Set a prefix to the resource name.


   .. py:method:: GpuShaderCreator.setTextureMaxWidth(self: PyOpenColorIO.GpuShaderCreator, maxWidth: int) -> None
      :module: PyOpenColorIO

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


   .. py:method:: GpuShaderCreator.setUniqueID(self: PyOpenColorIO.GpuShaderCreator, uid: str) -> None
      :module: PyOpenColorIO


.. py:class:: TextureType
   :module: PyOpenColorIO.GpuShaderCreator

   Members:

     TEXTURE_RED_CHANNEL

     TEXTURE_RGB_CHANNEL

   .. py:method:: name() -> str
      :property:

   .. py:attribute:: TextureType.TEXTURE_RED_CHANNEL
      :module: PyOpenColorIO.GpuShaderCreator
      :value: <TextureType.TEXTURE_RED_CHANNEL: 0>


   .. py:attribute:: TextureType.TEXTURE_RGB_CHANNEL
      :module: PyOpenColorIO.GpuShaderCreator
      :value: <TextureType.TEXTURE_RGB_CHANNEL: 1>


   .. py:property:: TextureType.value
      :module: PyOpenColorIO.GpuShaderCreator


.. py:class:: DynamicPropertyIterator
   :module: PyOpenColorIO.GpuShaderCreator


   .. py:method:: DynamicPropertyIterator.__getitem__(self: PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator, arg0: int) -> PyOpenColorIO.DynamicProperty
      :module: PyOpenColorIO.GpuShaderCreator


   .. py:method:: DynamicPropertyIterator.__iter__(self: PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator) -> PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator
      :module: PyOpenColorIO.GpuShaderCreator


   .. py:method:: DynamicPropertyIterator.__len__(self: PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator) -> int
      :module: PyOpenColorIO.GpuShaderCreator


   .. py:method:: DynamicPropertyIterator.__next__(self: PyOpenColorIO.GpuShaderCreator.DynamicPropertyIterator) -> PyOpenColorIO.DynamicProperty
      :module: PyOpenColorIO.GpuShaderCreator

