AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO
greaterThan() error with GPU_LANGUAGE_CG
- Lenguaje dominante
- C++
- Estrellas
- 2.1k
- Forks
- 503
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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, "
```
Guía de contribución
Línea de trabajo
Comienza en src/OpenColorIO/GpuShaderUtils.cpp leyendo float3GreaterThan y float4GreaterThan, así como las ramas GPU_LANGUAGE_CG. Genera o inspecciona el shader GPU de ACES 1.3 para CG y compara sus expresiones de mayor que con el error del compilador informado. Se considera terminado cuando la salida de CG ya no produce una referencia ambigua a greaterThan(half4, half4).
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp
- Área
- computer-graphics
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 45/100