Simplify texture offset handling in HLSL

This commit is contained in:
Robert Konrad 2017-04-20 16:04:02 +02:00
parent 31afcbb4fe
commit de41ebf4d7

View File

@ -1129,7 +1129,7 @@ void CompilerHLSL::emit_texture_op(const Instruction &i)
if (gather) if (gather)
texop += ".Gather"; texop += ".Gather";
else if (offset || coffsets || bias) else if (bias)
texop += ".SampleBias"; texop += ".SampleBias";
else if (proj) else if (proj)
texop += ".Sample"; texop += ".Sample";
@ -1159,9 +1159,6 @@ void CompilerHLSL::emit_texture_op(const Instruction &i)
} }
} }
if (coffset || offset)
texop += "Offset";
expr += texop; expr += texop;
expr += "(_"; expr += "(_";
expr += to_expression(img); expr += to_expression(img);
@ -1263,20 +1260,12 @@ void CompilerHLSL::emit_texture_op(const Instruction &i)
if (coffset) if (coffset)
{ {
if (!bias)
{
expr += ", 0";
}
forward = forward && should_forward(coffset); forward = forward && should_forward(coffset);
expr += ", "; expr += ", ";
expr += to_expression(coffset); expr += to_expression(coffset);
} }
else if (offset) else if (offset)
{ {
if (!bias)
{
expr += ", 0";
}
forward = forward && should_forward(offset); forward = forward && should_forward(offset);
expr += ", "; expr += ", ";
expr += to_expression(offset); expr += to_expression(offset);