Added handling of a few more types of variable Added a few missing types: - Unsigned ints and vectors - Signed and unsigned int samplers - 2D Array samplers Change-Id: I052f7da3b2cb24c5cd2bdd1cf1e3b3a2b0ee0a50 Reviewed-on: https://swiftshader-review.googlesource.com/3042 Tested-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp index 4d080dd..d66ead1 100644 --- a/src/OpenGL/compiler/OutputASM.cpp +++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -2368,8 +2368,9 @@ GLenum OutputASM::glVariableType(const TType &type) { - if(type.getBasicType() == EbtFloat) + switch(type.getBasicType()) { + case EbtFloat: if(type.isScalar()) { return GL_FLOAT; @@ -2416,9 +2417,8 @@ } } else UNREACHABLE(); - } - else if(type.getBasicType() == EbtInt) - { + break; + case EbtInt: if(type.isScalar()) { return GL_INT; @@ -2434,9 +2434,25 @@ } } else UNREACHABLE(); - } - else if(type.getBasicType() == EbtBool) - { + break; + case EbtUInt: + if(type.isScalar()) + { + return GL_UNSIGNED_INT; + } + else if(type.isVector()) + { + switch(type.getNominalSize()) + { + case 2: return GL_UNSIGNED_INT_VEC2; + case 3: return GL_UNSIGNED_INT_VEC3; + case 4: return GL_UNSIGNED_INT_VEC4; + default: UNREACHABLE(); + } + } + else UNREACHABLE(); + break; + case EbtBool: if(type.isScalar()) { return GL_BOOL; @@ -2452,24 +2468,29 @@ } } else UNREACHABLE(); - } - else if(type.getBasicType() == EbtSampler2D) - { + break; + case EbtSampler2D: + case EbtISampler2D: + case EbtUSampler2D: return GL_SAMPLER_2D; - } - else if(type.getBasicType() == EbtSamplerCube) - { + case EbtSamplerCube: + case EbtISamplerCube: + case EbtUSamplerCube: return GL_SAMPLER_CUBE; - } - else if(type.getBasicType() == EbtSamplerExternalOES) - { + case EbtSamplerExternalOES: return GL_SAMPLER_EXTERNAL_OES; - } - else if(type.getBasicType() == EbtSampler3D) - { + case EbtSampler3D: + case EbtISampler3D: + case EbtUSampler3D: return GL_SAMPLER_3D_OES; + case EbtSampler2DArray: + case EbtISampler2DArray: + case EbtUSampler2DArray: + return GL_SAMPLER_2D_ARRAY; + default: + UNREACHABLE(); + break; } - else UNREACHABLE(); return GL_NONE; }