Fix uniformity issue in CopyTextureForBrowserHelper

Calls to textureSample() must only happen in uniform control flow, so
move them to before the conditional discard.

Bug: tint:880
Change-Id: Idd6ca35a7acaa6917753da8deb6e9266284afe86
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88463
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
James Price 2022-05-02 14:53:36 +00:00
parent adc97421ae
commit 32f55426f2
1 changed files with 4 additions and 3 deletions

View File

@ -130,14 +130,15 @@ static const char sCopyTextureForBrowserShader[] = R"(
// Clamp the texcoord and discard the out-of-bound pixels.
var clampedTexcoord =
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
if (!all(clampedTexcoord == texcoord)) {
discard;
}
// Swizzling of texture formats when sampling / rendering is handled by the
// hardware so we don't need special logic in this shader. This is covered by tests.
var color = textureSample(myTexture, mySampler, texcoord);
if (!all(clampedTexcoord == texcoord)) {
discard;
}
let kUnpremultiplyStep = 0x01u;
let kDecodeToLinearStep = 0x02u;
let kConvertToDstGamutStep = 0x04u;