Commit 48be735f by Alexis Hetu Committed by Alexis Hétu

Removed some unnecessary instructions from programs

Removed a few unnecessary/bad instructions from PixelProgram and VertexProgram. Also added the proper implementation for printing out a shader instruction that includes indexing an array with a uniform. Change-Id: Icd37dd4f70419874bb65c54438409b8b9c3ee836 Reviewed-on: https://swiftshader-review.googlesource.com/4753Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 36037b7e
...@@ -954,9 +954,7 @@ namespace sw ...@@ -954,9 +954,7 @@ namespace sw
} }
else if(var.rel.type == Shader::PARAMETER_CONST) else if(var.rel.type == Shader::PARAMETER_CONST)
{ {
RValue<Int4> c = *Pointer<Int4>(uniformAddress(bufferIndex, var.rel.index)); return *Pointer<Int>(uniformAddress(bufferIndex, var.rel.index)) * var.rel.scale;
return Extract(c, 0) * var.rel.scale;
} }
else if(var.rel.type == Shader::PARAMETER_LOOP) else if(var.rel.type == Shader::PARAMETER_LOOP)
{ {
......
...@@ -456,6 +456,19 @@ namespace sw ...@@ -456,6 +456,19 @@ namespace sw
{ {
return "[aL]"; return "[aL]";
} }
else if(rel.type == PARAMETER_CONST)
{
std::ostringstream buffer;
buffer << rel.index;
switch(rel.swizzle & 0x03)
{
case 0: return "[c" + buffer.str() + ".x]";
case 1: return "[c" + buffer.str() + ".y]";
case 2: return "[c" + buffer.str() + ".z]";
case 3: return "[c" + buffer.str() + ".w]";
}
}
else ASSERT(false); else ASSERT(false);
} }
......
...@@ -831,8 +831,6 @@ namespace sw ...@@ -831,8 +831,6 @@ namespace sw
c.x = c.y = c.z = c.w = *Pointer<Float4>(uniformAddress(src.bufferIndex, i, a)); c.x = c.y = c.z = c.w = *Pointer<Float4>(uniformAddress(src.bufferIndex, i, a));
c.x = c.y = c.z = c.w = *Pointer<Float4>(data + OFFSET(DrawData,vs.c[i]) + a * 16);
c.x = c.x.xxxx; c.x = c.x.xxxx;
c.y = c.y.yyyy; c.y = c.y.yyyy;
c.z = c.z.zzzz; c.z = c.z.zzzz;
...@@ -892,9 +890,7 @@ namespace sw ...@@ -892,9 +890,7 @@ namespace sw
} }
else if(var.rel.type == Shader::PARAMETER_CONST) else if(var.rel.type == Shader::PARAMETER_CONST)
{ {
RValue<Int4> c = *Pointer<Int4>(uniformAddress(bufferIndex, var.rel.index)); return *Pointer<Int>(uniformAddress(bufferIndex, var.rel.index)) * var.rel.scale;
return Extract(c, 0) * var.rel.scale;
} }
else if(var.rel.type == Shader::PARAMETER_LOOP) else if(var.rel.type == Shader::PARAMETER_LOOP)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment