Pack texelFetch LOD as sampling coordinate's w component.
One less argument is emitted.
Vertex/PixelProgram sampleTexture function signature simplified.
Change-Id: I7aef3eb100ccb51a8bd9d5fd600c73b4843d30d9
Reviewed-on: https://swiftshader-review.googlesource.com/5600
Tested-by: Meng-Lin Wu <marleymoo@google.com>
Reviewed-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 e06efae..519b613 100644
--- a/src/OpenGL/compiler/OutputASM.cpp
+++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -1297,10 +1297,13 @@
{
if(argumentCount == 3 || (textureFunction.offset && argumentCount == 4))
{
+ Instruction *lod = emit(sw::Shader::OPCODE_MOV, &coord, arg[2]);
+ lod->dst.mask = 0x8;
+
TIntermNode *offset = textureFunction.offset ? arg[3] : nullptr;
emit(textureFunction.offset ? sw::Shader::OPCODE_TEXELFETCHOFFSET : sw::Shader::OPCODE_TEXELFETCH,
- result, arg[1], arg[0], arg[2], offset);
+ result, &coord, arg[0], offset);
}
else UNREACHABLE(argumentCount);
}