Fix assert on using GLSL sampler function arguments. Bug b/31651425 Change-Id: Ic6c1f16b1ec3ef039e15e72e70a1daee711fba2f Reviewed-on: https://swiftshader-review.googlesource.com/9748 Reviewed-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <capn@google.com> Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp index 49f62b1..a0b5500 100644 --- a/src/OpenGL/compiler/OutputASM.cpp +++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -2944,9 +2944,19 @@ TIntermSymbol *symbol = sampler->getAsSymbolNode(); TIntermBinary *binary = sampler->getAsBinaryNode(); - if(symbol && type.getQualifier() == EvqUniform) + if(symbol) { - return samplerRegister(symbol); + switch(type.getQualifier()) + { + case EvqUniform: + return samplerRegister(symbol); + case EvqIn: + case EvqConstReadOnly: + // Function arguments are not (uniform) sampler registers + return -1; + default: + UNREACHABLE(type.getQualifier()); + } } else if(binary) { @@ -2992,7 +3002,7 @@ } UNREACHABLE(0); - return -1; // Not a sampler register + return -1; // Not a (uniform) sampler register } int OutputASM::samplerRegister(TIntermSymbol *sampler)