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