AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO
greaterThan() error with GPU_LANGUAGE_CG
- Dominant language
- C++
- Stars
- 2.1k
- Forks
- 503
- PR merge metrics
- No merged PRs in 30d
Description
When using the new ACES 1.3 ocio config, I'm getting the following error:
```
(283) : error C1101: ambiguous overloaded function reference "greaterThan(half4, half4)"
(0) : bool4 greaterThan(unsigned long4, unsigned long4)
(0) : bool4 greaterThan(long4, long4)
(0) : bool4 greaterThan(double4, double4)
(0) : bool4 greaterThan(unsigned int4, unsigned int4)
(0) : bool4 greaterThan(int4, int4)
(0) : bool4 greaterThan(float4, float4)
```
I'm using GPU_LANGUAGE_CG and the OpenColorIO generated shader uses `half` vectors as per the `getVecKeyword()` method in GpuShaderUtils.cpp. The GLSL method `greaterThan()` ([which does component-wise greater-than comparison of two vectors](https://registry.khronos.org/OpenGL-Refpages/gl4/html/greaterThan.xhtml)) doesn't support `half4` so I'm proposing the change below:
```
diff --git a/src/OpenColorIO/GpuShaderUtils.cpp b/src/OpenColorIO/GpuShaderUtils.cpp
index 711bde89..418f27df 100644
--- a/src/OpenColorIO/GpuShaderUtils.cpp
+++ b/src/OpenColorIO/GpuShaderUtils.cpp
@@ -985,11 +985,11 @@ std::string GpuShaderText::float3GreaterThan(const std::string & a,
case GPU_LANGUAGE_GLSL_4_0:
case GPU_LANGUAGE_GLSL_ES_1_0:
case GPU_LANGUAGE_GLSL_ES_3_0:
- case GPU_LANGUAGE_CG:
{
kw << float3Keyword() << "(greaterThan( " << a << ", " << b << "))";
break;
}
+ case GPU_LANGUAGE_CG:
case LANGUAGE_OSL_1:
case GPU_LANGUAGE_MSL_2_0:
case GPU_LANGUAGE_HLSL_DX11:
@@ -1020,13 +1020,13 @@ std::string GpuShaderText::float4GreaterThan(const std::string & a,
case GPU_LANGUAGE_GLSL_4_0:
case GPU_LANGUAGE_GLSL_ES_1_0:
case GPU_LANGUAGE_GLSL_ES_3_0:
- case GPU_LANGUAGE_CG:
{
kw << float4Keyword() << "(greaterThan( " << a << ", " << b << "))";
break;
}
case GPU_LANGUAGE_MSL_2_0:
case GPU_LANGUAGE_HLSL_DX11:
+ case GPU_LANGUAGE_CG:
{
kw << float4Keyword() << "("
<< "(" << a << "[0] > " << b << "[0]) ? 1.0 : 0.0, "
```
Contributor guide
Assessment
This issue has not been assessed yet.