AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO
greaterThan() error with GPU_LANGUAGE_CG
- Lingua principale
- C++
- Stelle
- 2.1k
- Fork
- 503
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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, "
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia in src/OpenColorIO/GpuShaderUtils.cpp leggendo float3GreaterThan e float4GreaterThan e i rami GPU_LANGUAGE_CG. Genera o esamina lo shader GPU ACES 1.3 per CG e confronta le relative espressioni maggiore-di con l’errore del compilatore segnalato. Il lavoro è completato quando l’output CG non produce più un riferimento ambiguo a greaterThan(half4, half4).
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- computer-graphics
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100