Commit 4d63312f by Ben Clayton

SpirvShader: Implement GLSLstd450NClamp

Beware: the dEQP tests here are very weak - they do not seem to properly test the NaN handling of this instruction. Bug: b/126873455 Tests: dEQP-VK.spirv_assembly.instruction.compute.opnclamp.all Change-Id: I8d1f80f5536996ca46c30ee4895d9f6e2c29a03e Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28711Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 02de7e00
...@@ -3593,7 +3593,14 @@ namespace sw ...@@ -3593,7 +3593,14 @@ namespace sw
} }
case GLSLstd450NClamp: case GLSLstd450NClamp:
{ {
UNIMPLEMENTED("GLSLstd450NClamp"); auto x = GenericValue(this, routine, insn.word(5));
auto minVal = GenericValue(this, routine, insn.word(6));
auto maxVal = GenericValue(this, routine, insn.word(7));
for (auto i = 0u; i < type.sizeInComponents; i++)
{
auto clamp = NMin(NMax(x.Float(i), minVal.Float(i)), maxVal.Float(i));
dst.move(i, clamp);
}
break; break;
} }
default: default:
......
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