@@ -2044,7 +2044,7 @@ class OCIOEXPORT ColorSpace
20442044 *
20452045 * Currently supported attribute names are "amf_transform_ids" and
20462046 * "icc_profile_name". Using any other name will throw. If the attribute is
2047- * not defined, it'll return an empty string. Setting the value to an empty
2047+ * not defined, it will return an empty string. Setting the value to an empty
20482048 * string will effectively delete the attribute.
20492049 *
20502050 * The AMF transform IDs are used to identify specific transforms in the
@@ -2407,6 +2407,22 @@ class OCIOEXPORT Look
24072407 const char * getDescription () const ;
24082408 void setDescription (const char * description);
24092409
2410+ /* *
2411+ * Get/Set the interchange attributes.
2412+ *
2413+ * Currently the only supported attribute name is "amf_transform_ids". Using
2414+ * any other name will throw. If the attribute is not defined, it will return
2415+ * an empty string. Setting the value to an empty string will effectively
2416+ * delete the attribute.
2417+ *
2418+ * The AMF transform IDs are used to identify specific transforms in the ACES
2419+ * Metadata File. Multiple transform IDs can be specified in a
2420+ * newline-separated string.
2421+ */
2422+ const char *getInterchangeAttribute (const char *attrName) const ;
2423+ void setInterchangeAttribute (const char * attrName, const char *value);
2424+ std::map<std::string, std::string> getInterchangeAttributes () const noexcept ;
2425+
24102426 Look (const Look &) = delete ;
24112427 Look& operator = (const Look &) = delete ;
24122428 // / Do not use (needed only for pybind11).
@@ -2542,6 +2558,22 @@ class OCIOEXPORT ViewTransform
25422558 const char * getDescription () const noexcept ;
25432559 void setDescription (const char * description);
25442560
2561+ /* *
2562+ * Get/Set the interchange attributes.
2563+ *
2564+ * Currently the only supported attribute name is "amf_transform_ids". Using
2565+ * any other name will throw. If the attribute is not defined, it will return
2566+ * an empty string. Setting the value to an empty string will effectively
2567+ * delete the attribute.
2568+ *
2569+ * The AMF transform IDs are used to identify specific transforms in the ACES
2570+ * Metadata File. Multiple transform IDs can be specified in a
2571+ * newline-separated string.
2572+ */
2573+ const char *getInterchangeAttribute (const char *attrName) const ;
2574+ void setInterchangeAttribute (const char * attrName, const char *value);
2575+ std::map<std::string, std::string> getInterchangeAttributes () const noexcept ;
2576+
25452577 // / \see ColorSpace::hasCategory
25462578 bool hasCategory (const char * category) const ;
25472579 // / \see ColorSpace::addCategory
@@ -3351,6 +3383,23 @@ class OCIOEXPORT GpuShaderCreator
33513383 // / Set a prefix to the resource name
33523384 void setResourcePrefix (const char * prefix) noexcept ;
33533385
3386+ /* *
3387+ * \brief Set the descriptor set index and texture binding start index to use for the shader program.
3388+ *
3389+ * \note Only supported for shading languages, such as Vulkan, that use descriptor sets and texture bindings.
3390+ *
3391+ * \param index The descriptor set index to use.
3392+ * \param textureBindingStart The texture binding start index to use. The default index starts at 1
3393+ * and is incremented by 1 for each texture. Otherwise, the texture binding starts
3394+ * at textureBindingStart and is incremented by 1 for each texture.
3395+ * The binding of a texture is equal to the texture index + textureBindingStart.
3396+ * The texture binding start index must be greater than 0, as binding 0 is reserved
3397+ * for the uniform buffer binding
3398+ * */
3399+ void setDescriptorSetIndex (unsigned index, unsigned textureBindingStart = 1 );
3400+ unsigned getDescriptorSetIndex () const noexcept ;
3401+ unsigned getTextureBindingStart () const noexcept ;
3402+
33543403 virtual const char * getCacheID () const noexcept ;
33553404
33563405 // / Start to collect the shader data.
@@ -3394,13 +3443,23 @@ class OCIOEXPORT GpuShaderCreator
33943443 virtual bool addUniform (const char * name,
33953444 const Float3Getter & getFloat3) = 0;
33963445
3446+ // / The size of the vector can be smaller than the size of the corresponding
3447+ // / array that is declared in the shader. The parameter maxSize must be used
3448+ // / to pass the size of the array declared in the shader. This is important for
3449+ // / being able to calculate the correct uniform buffer offset for subsequent uniforms
33973450 virtual bool addUniform (const char * name,
33983451 const SizeGetter & getSize,
3399- const VectorFloatGetter & getVectorFloat) = 0;
3452+ const VectorFloatGetter & getVectorFloat,
3453+ const unsigned maxSize) = 0;
34003454
3455+ // / The size of the vector can be smaller than the size of the corresponding
3456+ // / array that is declared in the shader. The parameter maxSize must be used
3457+ // / to pass the size of the array declared in the shader. This is important for
3458+ // / being able to calculate the correct uniform buffer offset for subsequent uniforms
34013459 virtual bool addUniform (const char * name,
34023460 const SizeGetter & getSize,
3403- const VectorIntGetter & getVectorInt) = 0;
3461+ const VectorIntGetter & getVectorInt,
3462+ const unsigned maxSize) = 0;
34043463
34053464 // / Adds the property (used internally).
34063465 void addDynamicProperty (DynamicPropertyRcPtr & prop);
@@ -3436,14 +3495,17 @@ class OCIOEXPORT GpuShaderCreator
34363495 * \note
34373496 * The 'values' parameter contains the LUT data which must be used as-is as the dimensions and
34383497 * origin are hard-coded in the fragment shader program. So, it means one GPU texture per entry.
3498+ *
3499+ * \return Index of the texture. For shading languages using explicit texture bindings, the return
3500+ * value is the same as the texture binding index in the generated shader program.
34393501 **/
3440- virtual void addTexture (const char * textureName,
3441- const char * samplerName,
3442- unsigned width, unsigned height,
3443- TextureType channel,
3444- TextureDimensions dimensions,
3445- Interpolation interpolation,
3446- const float * values) = 0;
3502+ virtual unsigned addTexture (const char * textureName,
3503+ const char * samplerName,
3504+ unsigned width, unsigned height,
3505+ TextureType channel,
3506+ TextureDimensions dimensions,
3507+ Interpolation interpolation,
3508+ const float * values) = 0;
34473509
34483510 /* *
34493511 * Add a 3D texture with RGB channel type.
@@ -3452,15 +3514,19 @@ class OCIOEXPORT GpuShaderCreator
34523514 * The 'values' parameter contains the 3D LUT data which must be used as-is as the dimension
34533515 * and origin are hard-coded in the fragment shader program. So, it means one GPU 3D texture
34543516 * per entry.
3517+ *
3518+ * \return Index of the texture. For shading languages using explicit texture bindings, the return
3519+ * value is the same as the texture binding index in the generated shader program.
34553520 **/
3456- virtual void add3DTexture (const char * textureName,
3521+ virtual unsigned add3DTexture (const char * textureName,
34573522 const char * samplerName,
34583523 unsigned edgelen,
34593524 Interpolation interpolation,
34603525 const float * values) = 0;
34613526
34623527 // Methods to specialize parts of a OCIO shader program
3463- virtual void addToDeclareShaderCode (const char * shaderCode);
3528+ virtual void addToParameterDeclareShaderCode (const char * shaderCode);
3529+ virtual void addToTextureDeclareShaderCode (const char * shaderCode);
34643530 virtual void addToHelperShaderCode (const char * shaderCode);
34653531 virtual void addToFunctionHeaderShaderCode (const char * shaderCode);
34663532 virtual void addToFunctionShaderCode (const char * shaderCode);
@@ -3474,7 +3540,8 @@ class OCIOEXPORT GpuShaderCreator
34743540 * to change some parts. Some product integrations add the color processing
34753541 * within a client shader program, imposing constraints requiring this flexibility.
34763542 */
3477- virtual void createShaderText (const char * shaderDeclarations,
3543+ virtual void createShaderText (const char * shaderParameterDeclarations,
3544+ const char * shaderTextureDeclarations,
34783545 const char * shaderHelperMethods,
34793546 const char * shaderFunctionHeader,
34803547 const char * shaderFunctionBody,
@@ -3663,10 +3730,16 @@ class OCIOEXPORT GpuShaderDesc : public GpuShaderCreator
36633730 * * UNIFORM_FLOAT3: m_getFloat3.
36643731 * * UNIFORM_VECTOR_FLOAT: m_vectorFloat.
36653732 * * UNIFORM_VECTOR_INT: m_vectorInt.
3733+ *
3734+ * The m_bufferOffset is the offset in bytes from the start of the uniform buffer.
3735+ * For shading languages that use uniform buffers, the offset can be used to
3736+ * determine the location of the uniform in the buffer and fill it with the
3737+ * corresponding data.
36663738 */
36673739 struct UniformData
36683740 {
36693741 UniformDataType m_type{ UNIFORM_UNKNOWN };
3742+ std::size_t m_bufferOffset{};
36703743 DoubleGetter m_getDouble{};
36713744 BoolGetter m_getBool{};
36723745 Float3Getter m_getFloat3{};
@@ -3685,6 +3758,16 @@ class OCIOEXPORT GpuShaderDesc : public GpuShaderCreator
36853758 // / Returns name of uniform and data as parameter.
36863759 virtual const char * getUniform (unsigned index, UniformData & data) const = 0;
36873760
3761+ /* *
3762+ * For shading languages that use uniform buffers, a uniform buffer
3763+ * containing all uniforms is generated in the shader code. This method can
3764+ * be used to create a buffer of the same size in the client code that can
3765+ * be filled with the corresponding data.
3766+ *
3767+ * \return Size of the uniform buffer in bytes
3768+ **/
3769+ virtual std::size_t getUniformBufferSize () const noexcept = 0;
3770+
36883771 // 1D lut related methods
36893772 virtual unsigned getNumTextures () const noexcept = 0;
36903773 virtual void getTexture (unsigned index,
0 commit comments