From 7ca4db3c9af79b74061e6cbffad9b80aca4174d6 Mon Sep 17 00:00:00 2001 From: Alexis Hetu Date: Mon, 4 May 2015 16:51:06 -0400 Subject: [PATCH] Added handling of a few more types of variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Nicolas Capens --- src/OpenGL/compiler/OutputASM.cpp | 61 ++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp index 4d080ddea..d66ead183 100644 --- a/src/OpenGL/compiler/OutputASM.cpp +++ b/src/OpenGL/compiler/OutputASM.cpp @@ -2368,8 +2368,9 @@ namespace glsl 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 @@ namespace glsl } } else UNREACHABLE(); - } - else if(type.getBasicType() == EbtInt) - { + break; + case EbtInt: if(type.isScalar()) { return GL_INT; @@ -2434,9 +2434,25 @@ namespace glsl } } 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 @@ namespace glsl } } 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; } -- 2.11.0