GLSL mix implementation
Added mix implementation with a bvec as a 3rd argument,
which is basically a select.
Fixes 18 failures in dEQP-GLES3.
Change-Id: Ifaf4a27e1a25fbaad979a7d26ad4a424631acd08
Reviewed-on: https://swiftshader-review.googlesource.com/16288
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp
index 6afc880..5f05e46 100644
--- a/src/OpenGL/compiler/OutputASM.cpp
+++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -1649,7 +1649,19 @@
emit(getOpcode(sw::Shader::OPCODE_MIN, result), result, result, arg[2]);
}
break;
- case EOpMix: if(visit == PostVisit) emit(sw::Shader::OPCODE_LRP, result, arg[2], arg[1], arg[0]); break;
+ case EOpMix:
+ if(visit == PostVisit)
+ {
+ if(arg[2]->getAsTyped()->getBasicType() == EbtBool)
+ {
+ emit(sw::Shader::OPCODE_SELECT, result, arg[2], arg[1], arg[0]);
+ }
+ else
+ {
+ emit(sw::Shader::OPCODE_LRP, result, arg[2], arg[1], arg[0]);
+ }
+ }
+ break;
case EOpStep: if(visit == PostVisit) emit(sw::Shader::OPCODE_STEP, result, arg[0], arg[1]); break;
case EOpSmoothStep: if(visit == PostVisit) emit(sw::Shader::OPCODE_SMOOTH, result, arg[0], arg[1], arg[2]); break;
case EOpDistance: if(visit == PostVisit) emit(sw::Shader::OPCODE_DIST(dim(arg[0])), result, arg[0], arg[1]); break;