AcademySoftwareFoundation / OpenColorIO

A color management framework for visual effects and animation.
https://opencolorio.org
BSD 3-Clause "New" or "Revised" License
1.74k stars 430 forks source link

Add RGBA format in GpuShaderCreator for better Metal support (Issue #1956) #1984

Open wRosie opened 1 month ago

wRosie commented 1 month ago

Hi OCIO team,

As per the discussion in #1956, I added RGBA texture format in GpuShaderCreator and made GpuShaderCreator store LUTs in RGBA when the shader language is in metal.

Here is the interface and behavior change involved in this PR:

  1. AddTEXTURE_RGBA_CHANNEL value to enum TextureType

  2. Add a TextureType parameter to add3DTexture(). The signature is consistent with addTexture().

  3. Add a TextureType& field to get3DTexture().

The addTexture()/getTexture() functions already take TextureType as a parameter, so I will not change their function signature. However, I updated their behavior -- I changed GPUShaderCreator to use RGBA formats when GPULanguage is Metal. That involves updating functions such as GetLut1DGPUShaderProgram() and GetLut3DGPUShaderProgram(). Also, getTexture() and get3DTexture() will return textures in RGBA type in Metal mode.

Additionally, I updated the tests and function calls to work with the new interface.

I am aware that the behavior is not tested on a per-platform basis, and I would love suggestions on that. If possible, I'd like to add tests to ensure that RGBA is used only in metal mode.

Thanks!

linux-foundation-easycla[bot] commented 1 month ago

CLA Not Signed

doug-walker commented 1 month ago

Thank you for the PR @wRosie ! Have you started the process of getting the corporate CLA agreement signed? Please don't hesitate to reach out on Slack if you have any questions about that.

wRosie commented 1 month ago

Thank you for the PR @wRosie ! Have you started the process of getting the corporate CLA agreement signed? Please don't hesitate to reach out on Slack if you have any questions about that.

Yes I am working on that.