Return alpha channel for single plane external textures
Fixes an issue where video alpha is not preserved when using external
textures.
Bug: dawn:1952
Change-Id: I2ee480b6cdc6e4bc02a24895bd91c1c8dc4a5772
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/145362
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/dawn/tests/end2end/ExternalTextureTests.cpp b/src/dawn/tests/end2end/ExternalTextureTests.cpp
index b01355f..46690c9 100644
--- a/src/dawn/tests/end2end/ExternalTextureTests.cpp
+++ b/src/dawn/tests/end2end/ExternalTextureTests.cpp
@@ -995,6 +995,78 @@
}
}
+// Test that sampling an external texture with non-one alpha preserves the alpha channel.
+TEST_P(ExternalTextureTests, SampleExternalTextureAlpha) {
+ // TODO(crbug.com/tint/1774): Tint has an issue compiling shaders that use external textures on
+ // OpenGL/OpenGLES.
+ DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES());
+
+ wgpu::Texture sampledTexture =
+ Create2DTexture(device, kWidth, kHeight, kFormat,
+ wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment);
+ wgpu::Texture renderTexture =
+ Create2DTexture(device, kWidth, kHeight, kFormat,
+ wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment);
+
+ // Create a texture view for the external texture
+ wgpu::TextureView externalView = sampledTexture.CreateView();
+
+ utils::RGBA8 kColor = {255, 255, 255, 128};
+
+ // Initialize texture with green to ensure it is sampled from later.
+ {
+ utils::ComboRenderPassDescriptor renderPass({externalView}, nullptr);
+ renderPass.cColorAttachments[0].clearValue = {kColor.r / 255.0f, kColor.g / 255.0f,
+ kColor.b / 255.0f, kColor.a / 255.0f};
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
+ pass.End();
+
+ wgpu::CommandBuffer commands = encoder.Finish();
+ queue.Submit(1, &commands);
+ }
+
+ // Pipeline Creation
+ utils::ComboRenderPipelineDescriptor descriptor;
+ descriptor.vertex.module = vsModule;
+ descriptor.cFragment.module = fsSampleExternalTextureModule;
+ descriptor.cTargets[0].format = kFormat;
+ wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
+
+ // Create an ExternalTextureDescriptor from the texture view
+ wgpu::ExternalTextureDescriptor externalDesc = CreateDefaultExternalTextureDescriptor();
+ externalDesc.plane0 = externalView;
+ externalDesc.visibleOrigin = {0, 0};
+ externalDesc.visibleSize = {kWidth, kHeight};
+
+ // Import the external texture
+ wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&externalDesc);
+
+ // Create a sampler and bind group
+ wgpu::Sampler sampler = device.CreateSampler();
+
+ wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
+ {{0, sampler}, {1, externalTexture}});
+
+ // Run the shader, which should sample from the external texture and draw a triangle into the
+ // upper left corner of the render texture.
+ wgpu::TextureView renderView = renderTexture.CreateView();
+ utils::ComboRenderPassDescriptor renderPass({renderView}, nullptr);
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
+ {
+ pass.SetPipeline(pipeline);
+ pass.SetBindGroup(0, bindGroup);
+ pass.Draw(3);
+ pass.End();
+ }
+
+ wgpu::CommandBuffer commands = encoder.Finish();
+ queue.Submit(1, &commands);
+
+ EXPECT_PIXEL_RGBA8_EQ(kColor, renderTexture, 0, 0);
+}
+
DAWN_INSTANTIATE_TEST(ExternalTextureTests,
D3D11Backend(),
D3D12Backend(),
diff --git a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc
index 5ebe504..089d72e 100644
--- a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc
+++ b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc
@@ -359,39 +359,47 @@
TINT_ICE() << "unhandled builtin: " << call_type;
}
- // var color: vec3<f32>;
- stmts.Push(b.Decl(b.Var("color", b.ty.vec3(b.ty.f32()))));
+ // var color: vec4<f32>;
+ stmts.Push(b.Decl(b.Var("color", b.ty.vec4(b.ty.f32()))));
// if ((params.numPlanes == 1u))
- stmts.Push(
- b.If(b.Equal(b.MemberAccessor("params", "numPlanes"), b.Expr(1_a)),
- b.Block(
- // color = textureLoad(plane0, coord, 0).rgb;
- b.Assign("color", b.MemberAccessor(single_plane_call, "rgb"))),
- b.Else(b.Block(
- // color = vec4<f32>(plane_0_call.r, plane_1_call.rg, 1.0) *
- // params.yuvToRgbConversionMatrix;
- b.Assign("color",
- b.Mul(b.Call<vec4<f32>>(b.MemberAccessor(plane_0_call, "r"),
- b.MemberAccessor(plane_1_call, "rg"), 1_a),
- b.MemberAccessor("params", "yuvToRgbConversionMatrix")))))));
+ stmts.Push(b.If(
+ b.Equal(b.MemberAccessor("params", "numPlanes"), b.Expr(1_a)),
+ b.Block(
+ // color = textureLoad(plane0, coord, 0).rgba;
+ b.Assign("color", b.MemberAccessor(single_plane_call, "rgba"))),
+ b.Else(b.Block(
+ // color = vec4<f32>(vec4<f32>(plane_0_call.r, plane_1_call.rg, 1.0) *
+ // params.yuvToRgbConversionMatrix));
+ b.Assign("color",
+ b.Call<vec4<f32>>(
+ b.Mul(b.Call<vec4<f32>>(b.MemberAccessor(plane_0_call, "r"),
+ b.MemberAccessor(plane_1_call, "rg"), 1_a),
+ b.MemberAccessor("params", "yuvToRgbConversionMatrix")),
+ 1_a))))));
// if (params.doYuvToRgbConversionOnly == 0u)
- stmts.Push(
- b.If(b.Equal(b.MemberAccessor("params", "doYuvToRgbConversionOnly"), b.Expr(0_a)),
- b.Block(
- // color = gammaConversion(color, gammaDecodeParams);
- b.Assign("color", b.Call("gammaCorrection", "color",
- b.MemberAccessor("params", "gammaDecodeParams"))),
- // color = (params.gamutConversionMatrix * color);
- b.Assign("color",
- b.Mul(b.MemberAccessor("params", "gamutConversionMatrix"), "color")),
- // color = gammaConversion(color, gammaEncodeParams);
- b.Assign("color", b.Call("gammaCorrection", "color",
- b.MemberAccessor("params", "gammaEncodeParams"))))));
+ stmts.Push(b.If(
+ b.Equal(b.MemberAccessor("params", "doYuvToRgbConversionOnly"), b.Expr(0_a)),
+ b.Block(
+ // color = vec4<f32>(gammaConversion(color.rgb, gammaDecodeParams), color.a);
+ b.Assign("color", b.Call<vec4<f32>>(
+ b.Call("gammaCorrection", b.MemberAccessor("color", "rgb"),
+ b.MemberAccessor("params", "gammaDecodeParams")),
+ b.MemberAccessor("color", "a"))),
+ // color = vec4<f32>(params.gamutConversionMatrix * color.rgb), color.a);
+ b.Assign("color", b.Call<vec4<f32>>(
+ b.Mul(b.MemberAccessor("params", "gamutConversionMatrix"),
+ b.MemberAccessor("color", "rgb")),
+ b.MemberAccessor("color", "a"))),
+ // color = vec4<f32>(gammaConversion(color.rgb, gammaEncodeParams), color.a);
+ b.Assign("color", b.Call<vec4<f32>>(
+ b.Call("gammaCorrection", b.MemberAccessor("color", "rgb"),
+ b.MemberAccessor("params", "gammaEncodeParams")),
+ b.MemberAccessor("color", "a"))))));
- // return vec4<f32>(color, 1.f);
- stmts.Push(b.Return(b.Call<vec4<f32>>("color", 1_a)));
+ // return color;
+ stmts.Push(b.Return("color"));
return stmts;
}
diff --git a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture_test.cc b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture_test.cc
index fda9b8d..62ab2b4 100644
--- a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture_test.cc
@@ -276,18 +276,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
@fragment
@@ -356,18 +356,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
@fragment
@@ -437,34 +437,34 @@
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureLoad(plane0, coord, 0).rgb;
+ color = textureLoad(plane0, coord, 0).rgba;
} else {
- color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn textureLoadExternal_1(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<u32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureLoad(plane0, coord, 0).rgb;
+ color = textureLoad(plane0, coord, 0).rgba;
} else {
- color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
@fragment
@@ -530,34 +530,34 @@
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureLoad(plane0, coord, 0).rgb;
+ color = textureLoad(plane0, coord, 0).rgba;
} else {
- color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn textureLoadExternal_1(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<u32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureLoad(plane0, coord, 0).rgb;
+ color = textureLoad(plane0, coord, 0).rgba;
} else {
- color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
@fragment
@@ -634,34 +634,34 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureLoad(plane0, coord, 0).rgb;
+ color = textureLoad(plane0, coord, 0).rgba;
} else {
- color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
@fragment
@@ -730,34 +730,34 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureLoad(plane0, coord, 0).rgb;
+ color = textureLoad(plane0, coord, 0).rgba;
} else {
- color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
@fragment
@@ -858,18 +858,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
@fragment
@@ -947,18 +947,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn f(t : texture_2d<f32>, ext_tex_plane_1_1 : texture_2d<f32>, ext_tex_params_1 : ExternalTextureParams, s : sampler) {
@@ -1045,18 +1045,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn f(t : texture_2d<f32>, ext_tex_plane_1_1 : texture_2d<f32>, ext_tex_params_1 : ExternalTextureParams, s : sampler) {
@@ -1133,18 +1133,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn f(s : sampler, t : texture_2d<f32>, ext_tex_plane_1_1 : texture_2d<f32>, ext_tex_params_1 : ExternalTextureParams) {
@@ -1232,18 +1232,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn f(t : texture_2d<f32>, ext_tex_plane_1_2 : texture_2d<f32>, ext_tex_params_2 : ExternalTextureParams, s : sampler, t2 : texture_2d<f32>, ext_tex_plane_1_3 : texture_2d<f32>, ext_tex_params_3 : ExternalTextureParams) {
@@ -1341,18 +1341,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn f(t : texture_2d<f32>, ext_tex_plane_1_2 : texture_2d<f32>, ext_tex_params_2 : ExternalTextureParams, s : sampler, t2 : texture_2d<f32>, ext_tex_plane_1_3 : texture_2d<f32>, ext_tex_params_3 : ExternalTextureParams) {
@@ -1437,18 +1437,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn nested(t : texture_2d<f32>, ext_tex_plane_1_1 : texture_2d<f32>, ext_tex_params_1 : ExternalTextureParams, s : sampler) {
@@ -1538,18 +1538,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn nested(t : texture_2d<f32>, ext_tex_plane_1_1 : texture_2d<f32>, ext_tex_params_1 : ExternalTextureParams, s : sampler) {
@@ -1681,18 +1681,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn f(t : texture_2d<f32>, ext_tex_plane_1_1 : texture_2d<f32>, ext_tex_params_1 : ExternalTextureParams, s : sampler) {
@@ -1780,18 +1780,18 @@
let plane1_dims = vec2<f32>(textureDimensions(plane1, 0));
let plane1_half_texel = (vec2<f32>(0.5) / plane1_dims);
let plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1 - plane1_half_texel));
- var color : vec3<f32>;
+ var color : vec4<f32>;
if ((params.numPlanes == 1)) {
- color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgb;
+ color = textureSampleLevel(plane0, smp, plane0_clamped, 0).rgba;
} else {
- color = (vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix);
+ color = vec4<f32>((vec4<f32>(textureSampleLevel(plane0, smp, plane0_clamped, 0).r, textureSampleLevel(plane1, smp, plane1_clamped, 0).rg, 1) * params.yuvToRgbConversionMatrix), 1);
}
if ((params.doYuvToRgbConversionOnly == 0)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4<f32>((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4<f32>(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4<f32>(color, 1);
+ return color;
}
fn f(t : texture_2d<f32>, ext_tex_plane_1_1 : texture_2d<f32>, ext_tex_params_1 : ExternalTextureParams, s : sampler) {
diff --git a/test/tint/bug/tint/1739.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1739.wgsl.expected.dxc.hlsl
index fee5a41..98c418a 100644
--- a/test/tint/bug/tint/1739.wgsl.expected.dxc.hlsl
+++ b/test/tint/bug/tint/1739.wgsl.expected.dxc.hlsl
@@ -34,18 +34,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(int3(coord, 0)).rgb;
+ color = plane0.Load(int3(coord, 0)).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/bug/tint/1739.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1739.wgsl.expected.fxc.hlsl
index fee5a41..98c418a 100644
--- a/test/tint/bug/tint/1739.wgsl.expected.fxc.hlsl
+++ b/test/tint/bug/tint/1739.wgsl.expected.fxc.hlsl
@@ -34,18 +34,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(int3(coord, 0)).rgb;
+ color = plane0.Load(int3(coord, 0)).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/bug/tint/1739.wgsl.expected.glsl b/test/tint/bug/tint/1739.wgsl.expected.glsl
index c32e19b..d0d8b33 100644
--- a/test/tint/bug/tint/1739.wgsl.expected.glsl
+++ b/test/tint/bug/tint/1739.wgsl.expected.glsl
@@ -60,18 +60,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, coord, 0).rgb;
+ color = texelFetch(plane0_1, coord, 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D t_1;
diff --git a/test/tint/bug/tint/1739.wgsl.expected.msl b/test/tint/bug/tint/1739.wgsl.expected.msl
index 34134b3..d626b35 100644
--- a/test/tint/bug/tint/1739.wgsl.expected.msl
+++ b/test/tint/bug/tint/1739.wgsl.expected.msl
@@ -85,18 +85,18 @@
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) {
int2 const coord1 = (coord >> uint2(1u));
- float3 color = 0.0f;
+ float4 color = 0.0f;
if ((params.numPlanes == 1u)) {
- color = plane0.read(uint2(coord), 0).rgb;
+ color = plane0.read(uint2(coord), 0).rgba;
} else {
- color = (float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = float4((float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color[3]);
+ color = float4((params.gamutConversionMatrix * color.rgb), color[3]);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color[3]);
}
- return float4(color, 1.0f);
+ return color;
}
kernel void tint_symbol(texture2d<float, access::sample> tint_symbol_1 [[texture(1)]], texture2d<float, access::sample> tint_symbol_2 [[texture(2)]], const constant ExternalTextureParams_tint_packed_vec3* tint_symbol_3 [[buffer(3)]], texture2d<float, access::write> tint_symbol_4 [[texture(0)]]) {
diff --git a/test/tint/bug/tint/1739.wgsl.expected.spvasm b/test/tint/bug/tint/1739.wgsl.expected.spvasm
index 01e7c86..3a685d0 100644
--- a/test/tint/bug/tint/1739.wgsl.expected.spvasm
+++ b/test/tint/bug/tint/1739.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 193
+; Bound: 216
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
@@ -139,25 +139,27 @@
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
%81 = OpConstantComposite %v2uint %uint_1 %uint_1
- %90 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %85 = OpConstantNull %v4float
+ %92 = OpConstantNull %int
%float_1 = OpConstant %float 1
- %103 = OpConstantNull %uint
- %121 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
+ %109 = OpConstantNull %uint
+ %uint_3 = OpConstant %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %146 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid
- %136 = OpTypeFunction %void
+ %161 = OpTypeFunction %void
%int_10 = OpConstant %int 10
- %145 = OpConstantComposite %v2int %int_10 %int_10
- %146 = OpConstantNull %v2int
+ %170 = OpConstantComposite %v2int %int_10 %int_10
+ %171 = OpConstantNull %v2int
%int_0 = OpConstant %int 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
-%_ptr_Function_v4float = OpTypePointer Function %v4float
- %159 = OpConstantNull %v4float
%int_70 = OpConstant %int 70
%int_118 = OpConstant %int 118
- %174 = OpConstantComposite %v2int %int_70 %int_118
+ %197 = OpConstantComposite %v2int %int_70 %int_118
%int_1 = OpConstant %int 1
- %187 = OpConstantComposite %v2int %int_1 %90
+ %210 = OpConstantComposite %v2int %int_1 %92
%tint_clamp = OpFunction %v2int None %20
%e = OpFunctionParameter %v2int
%low = OpFunctionParameter %v2int
@@ -209,115 +211,136 @@
%coord = OpFunctionParameter %v2int
%params_0 = OpFunctionParameter %ExternalTextureParams
%78 = OpLabel
- %color = OpVariable %_ptr_Function_v3float Function %50
+ %color = OpVariable %_ptr_Function_v4float Function %85
%82 = OpShiftRightArithmetic %v2int %coord %81
- %84 = OpCompositeExtract %uint %params_0 0
- %85 = OpIEqual %bool %84 %uint_1
- OpSelectionMerge %86 None
- OpBranchConditional %85 %87 %88
- %87 = OpLabel
- %89 = OpImageFetch %v4float %plane0 %coord Lod %90
- %91 = OpVectorShuffle %v3float %89 %89 0 1 2
- OpStore %color %91
- OpBranch %86
- %88 = OpLabel
- %92 = OpImageFetch %v4float %plane0 %coord Lod %90
- %93 = OpCompositeExtract %float %92 0
- %94 = OpImageFetch %v4float %plane1 %82 Lod %90
- %95 = OpVectorShuffle %v2float %94 %94 0 1
- %96 = OpCompositeExtract %float %95 0
- %97 = OpCompositeExtract %float %95 1
- %99 = OpCompositeConstruct %v4float %93 %96 %97 %float_1
- %100 = OpCompositeExtract %mat3v4float %params_0 2
- %101 = OpVectorTimesMatrix %v3float %99 %100
- OpStore %color %101
- OpBranch %86
- %86 = OpLabel
- %102 = OpCompositeExtract %uint %params_0 1
- %104 = OpIEqual %bool %102 %103
- OpSelectionMerge %105 None
- OpBranchConditional %104 %106 %105
- %106 = OpLabel
- %108 = OpLoad %v3float %color
- %109 = OpCompositeExtract %GammaTransferParams %params_0 3
- %107 = OpFunctionCall %v3float %gammaCorrection %108 %109
+ %86 = OpCompositeExtract %uint %params_0 0
+ %87 = OpIEqual %bool %86 %uint_1
+ OpSelectionMerge %88 None
+ OpBranchConditional %87 %89 %90
+ %89 = OpLabel
+ %91 = OpImageFetch %v4float %plane0 %coord Lod %92
+ %93 = OpVectorShuffle %v4float %91 %91 0 1 2 3
+ OpStore %color %93
+ OpBranch %88
+ %90 = OpLabel
+ %94 = OpImageFetch %v4float %plane0 %coord Lod %92
+ %95 = OpCompositeExtract %float %94 0
+ %96 = OpImageFetch %v4float %plane1 %82 Lod %92
+ %97 = OpVectorShuffle %v2float %96 %96 0 1
+ %98 = OpCompositeExtract %float %97 0
+ %99 = OpCompositeExtract %float %97 1
+ %101 = OpCompositeConstruct %v4float %95 %98 %99 %float_1
+ %102 = OpCompositeExtract %mat3v4float %params_0 2
+ %103 = OpVectorTimesMatrix %v3float %101 %102
+ %104 = OpCompositeExtract %float %103 0
+ %105 = OpCompositeExtract %float %103 1
+ %106 = OpCompositeExtract %float %103 2
+ %107 = OpCompositeConstruct %v4float %104 %105 %106 %float_1
OpStore %color %107
- %110 = OpCompositeExtract %mat3v3float %params_0 5
- %111 = OpLoad %v3float %color
- %112 = OpMatrixTimesVector %v3float %110 %111
- OpStore %color %112
- %114 = OpLoad %v3float %color
- %115 = OpCompositeExtract %GammaTransferParams %params_0 4
- %113 = OpFunctionCall %v3float %gammaCorrection %114 %115
- OpStore %color %113
- OpBranch %105
- %105 = OpLabel
- %116 = OpLoad %v3float %color
- %117 = OpCompositeExtract %float %116 0
- %118 = OpCompositeExtract %float %116 1
- %119 = OpCompositeExtract %float %116 2
- %120 = OpCompositeConstruct %v4float %117 %118 %119 %float_1
- OpReturnValue %120
+ OpBranch %88
+ %88 = OpLabel
+ %108 = OpCompositeExtract %uint %params_0 1
+ %110 = OpIEqual %bool %108 %109
+ OpSelectionMerge %111 None
+ OpBranchConditional %110 %112 %111
+ %112 = OpLabel
+ %114 = OpLoad %v4float %color
+ %115 = OpVectorShuffle %v3float %114 %114 0 1 2
+ %116 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %113 = OpFunctionCall %v3float %gammaCorrection %115 %116
+ %117 = OpCompositeExtract %float %113 0
+ %118 = OpCompositeExtract %float %113 1
+ %119 = OpCompositeExtract %float %113 2
+ %122 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %123 = OpLoad %float %122
+ %124 = OpCompositeConstruct %v4float %117 %118 %119 %123
+ OpStore %color %124
+ %125 = OpCompositeExtract %mat3v3float %params_0 5
+ %126 = OpLoad %v4float %color
+ %127 = OpVectorShuffle %v3float %126 %126 0 1 2
+ %128 = OpMatrixTimesVector %v3float %125 %127
+ %129 = OpCompositeExtract %float %128 0
+ %130 = OpCompositeExtract %float %128 1
+ %131 = OpCompositeExtract %float %128 2
+ %132 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %133 = OpLoad %float %132
+ %134 = OpCompositeConstruct %v4float %129 %130 %131 %133
+ OpStore %color %134
+ %136 = OpLoad %v4float %color
+ %137 = OpVectorShuffle %v3float %136 %136 0 1 2
+ %138 = OpCompositeExtract %GammaTransferParams %params_0 4
+ %135 = OpFunctionCall %v3float %gammaCorrection %137 %138
+ %139 = OpCompositeExtract %float %135 0
+ %140 = OpCompositeExtract %float %135 1
+ %141 = OpCompositeExtract %float %135 2
+ %142 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %143 = OpLoad %float %142
+ %144 = OpCompositeConstruct %v4float %139 %140 %141 %143
+ OpStore %color %144
+ OpBranch %111
+ %111 = OpLabel
+ %145 = OpLoad %v4float %color
+ OpReturnValue %145
OpFunctionEnd
-%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %121
+%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %146
%val = OpFunctionParameter %ExternalTextureParams_std140
- %124 = OpLabel
- %125 = OpCompositeExtract %uint %val 0
- %126 = OpCompositeExtract %uint %val 1
- %127 = OpCompositeExtract %mat3v4float %val 2
- %128 = OpCompositeExtract %GammaTransferParams %val 3
- %129 = OpCompositeExtract %GammaTransferParams %val 4
- %130 = OpCompositeExtract %mat3v3float %val 5
- %131 = OpCompositeExtract %v2float %val 6
- %132 = OpCompositeExtract %v2float %val 7
- %133 = OpCompositeExtract %v2float %val 8
- %134 = OpCompositeConstruct %mat3v2float %131 %132 %133
- %135 = OpCompositeConstruct %ExternalTextureParams %125 %126 %127 %128 %129 %130 %134
- OpReturnValue %135
+ %149 = OpLabel
+ %150 = OpCompositeExtract %uint %val 0
+ %151 = OpCompositeExtract %uint %val 1
+ %152 = OpCompositeExtract %mat3v4float %val 2
+ %153 = OpCompositeExtract %GammaTransferParams %val 3
+ %154 = OpCompositeExtract %GammaTransferParams %val 4
+ %155 = OpCompositeExtract %mat3v3float %val 5
+ %156 = OpCompositeExtract %v2float %val 6
+ %157 = OpCompositeExtract %v2float %val 7
+ %158 = OpCompositeExtract %v2float %val 8
+ %159 = OpCompositeConstruct %mat3v2float %156 %157 %158
+ %160 = OpCompositeConstruct %ExternalTextureParams %150 %151 %152 %153 %154 %155 %159
+ OpReturnValue %160
OpFunctionEnd
- %main = OpFunction %void None %136
- %139 = OpLabel
- %red = OpVariable %_ptr_Function_v4float Function %159
- %green = OpVariable %_ptr_Function_v4float Function %159
- %141 = OpLoad %3 %t
- %142 = OpLoad %3 %ext_tex_plane_1
- %149 = OpLoad %3 %t
- %148 = OpImageQuerySizeLod %v2uint %149 %int_0
- %151 = OpISub %v2uint %148 %81
- %147 = OpBitcast %v2int %151
- %143 = OpFunctionCall %v2int %tint_clamp %145 %146 %147
- %155 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
- %156 = OpLoad %ExternalTextureParams_std140 %155
- %152 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %156
- %140 = OpFunctionCall %v4float %textureLoadExternal %141 %142 %143 %152
- OpStore %red %140
- %161 = OpLoad %19 %outImage
- %165 = OpLoad %19 %outImage
- %164 = OpImageQuerySize %v2uint %165
- %166 = OpISub %v2uint %164 %81
- %163 = OpBitcast %v2int %166
- %162 = OpFunctionCall %v2int %tint_clamp %146 %146 %163
- %167 = OpLoad %v4float %red
- OpImageWrite %161 %162 %167
- %169 = OpLoad %3 %t
- %170 = OpLoad %3 %ext_tex_plane_1
- %177 = OpLoad %3 %t
- %176 = OpImageQuerySizeLod %v2uint %177 %int_0
- %178 = OpISub %v2uint %176 %81
- %175 = OpBitcast %v2int %178
- %171 = OpFunctionCall %v2int %tint_clamp %174 %146 %175
+ %main = OpFunction %void None %161
+ %164 = OpLabel
+ %red = OpVariable %_ptr_Function_v4float Function %85
+ %green = OpVariable %_ptr_Function_v4float Function %85
+ %166 = OpLoad %3 %t
+ %167 = OpLoad %3 %ext_tex_plane_1
+ %174 = OpLoad %3 %t
+ %173 = OpImageQuerySizeLod %v2uint %174 %int_0
+ %176 = OpISub %v2uint %173 %81
+ %172 = OpBitcast %v2int %176
+ %168 = OpFunctionCall %v2int %tint_clamp %170 %171 %172
%180 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
%181 = OpLoad %ExternalTextureParams_std140 %180
- %179 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %181
- %168 = OpFunctionCall %v4float %textureLoadExternal %169 %170 %171 %179
- OpStore %green %168
+ %177 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %181
+ %165 = OpFunctionCall %v4float %textureLoadExternal %166 %167 %168 %177
+ OpStore %red %165
%184 = OpLoad %19 %outImage
- %190 = OpLoad %19 %outImage
- %189 = OpImageQuerySize %v2uint %190
- %191 = OpISub %v2uint %189 %81
- %188 = OpBitcast %v2int %191
- %185 = OpFunctionCall %v2int %tint_clamp %187 %146 %188
- %192 = OpLoad %v4float %green
- OpImageWrite %184 %185 %192
+ %188 = OpLoad %19 %outImage
+ %187 = OpImageQuerySize %v2uint %188
+ %189 = OpISub %v2uint %187 %81
+ %186 = OpBitcast %v2int %189
+ %185 = OpFunctionCall %v2int %tint_clamp %171 %171 %186
+ %190 = OpLoad %v4float %red
+ OpImageWrite %184 %185 %190
+ %192 = OpLoad %3 %t
+ %193 = OpLoad %3 %ext_tex_plane_1
+ %200 = OpLoad %3 %t
+ %199 = OpImageQuerySizeLod %v2uint %200 %int_0
+ %201 = OpISub %v2uint %199 %81
+ %198 = OpBitcast %v2int %201
+ %194 = OpFunctionCall %v2int %tint_clamp %197 %171 %198
+ %203 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
+ %204 = OpLoad %ExternalTextureParams_std140 %203
+ %202 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %204
+ %191 = OpFunctionCall %v4float %textureLoadExternal %192 %193 %194 %202
+ OpStore %green %191
+ %207 = OpLoad %19 %outImage
+ %213 = OpLoad %19 %outImage
+ %212 = OpImageQuerySize %v2uint %213
+ %214 = OpISub %v2uint %212 %81
+ %211 = OpBitcast %v2int %214
+ %208 = OpFunctionCall %v2int %tint_clamp %210 %171 %211
+ %215 = OpLoad %v4float %green
+ OpImageWrite %207 %208 %215
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
index ffc7aef..2f49262 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
@@ -33,18 +33,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
const uint2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(uint3(coord, uint(0))).rgb;
+ color = plane0.Load(uint3(coord, uint(0))).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
index ffc7aef..2f49262 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
@@ -33,18 +33,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
const uint2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(uint3(coord, uint(0))).rgb;
+ color = plane0.Load(uint3(coord, uint(0))).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl
index 2fd2ef4..6894104 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl
@@ -59,18 +59,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -163,18 +163,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -261,18 +261,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.msl
index f5f7e00..e2c5422 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.msl
@@ -81,18 +81,18 @@
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, uint2 coord, ExternalTextureParams params) {
uint2 const coord1 = (coord >> uint2(1u));
- float3 color = 0.0f;
+ float4 color = 0.0f;
if ((params.numPlanes == 1u)) {
- color = plane0.read(uint2(coord), 0).rgb;
+ color = plane0.read(uint2(coord), 0).rgba;
} else {
- color = (float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = float4((float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color[3]);
+ color = float4((params.gamutConversionMatrix * color.rgb), color[3]);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color[3]);
}
- return float4(color, 1.0f);
+ return color;
}
void textureLoad_1bfdfb(texture2d<float, access::sample> tint_symbol_1, texture2d<float, access::sample> tint_symbol_2, const constant ExternalTextureParams_tint_packed_vec3* const tint_symbol_3, device float4* const tint_symbol_4) {
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.spvasm
index 11e3ff2..5dabd15 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 163
+; Bound: 186
; Schema: 0
OpCapability Shader
%32 = OpExtInstImport "GLSL.std.450"
@@ -150,18 +150,20 @@
%66 = OpTypeFunction %v4float %11 %11 %v2uint %ExternalTextureParams
%uint_1 = OpConstant %uint 1
%77 = OpConstantComposite %v2uint %uint_1 %uint_1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
%int = OpTypeInt 32 1
- %87 = OpConstantNull %int
+ %88 = OpConstantNull %int
%float_1 = OpConstant %float 1
- %100 = OpConstantNull %uint
- %118 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
+ %105 = OpConstantNull %uint
+ %uint_3 = OpConstant %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %142 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid
- %133 = OpTypeFunction %void
+ %157 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
-%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
- %150 = OpTypeFunction %v4float
+ %173 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %26
%v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams
@@ -204,106 +206,127 @@
%coord = OpFunctionParameter %v2uint
%params_0 = OpFunctionParameter %ExternalTextureParams
%75 = OpLabel
- %color = OpVariable %_ptr_Function_v3float Function %46
+ %color = OpVariable %_ptr_Function_v4float Function %5
%78 = OpShiftRightLogical %v2uint %coord %77
- %80 = OpCompositeExtract %uint %params_0 0
- %81 = OpIEqual %bool %80 %uint_1
- OpSelectionMerge %82 None
- OpBranchConditional %81 %83 %84
- %83 = OpLabel
- %85 = OpImageFetch %v4float %plane0 %coord Lod %87
- %88 = OpVectorShuffle %v3float %85 %85 0 1 2
- OpStore %color %88
- OpBranch %82
+ %81 = OpCompositeExtract %uint %params_0 0
+ %82 = OpIEqual %bool %81 %uint_1
+ OpSelectionMerge %83 None
+ OpBranchConditional %82 %84 %85
%84 = OpLabel
- %89 = OpImageFetch %v4float %plane0 %coord Lod %87
- %90 = OpCompositeExtract %float %89 0
- %91 = OpImageFetch %v4float %plane1 %78 Lod %87
- %92 = OpVectorShuffle %v2float %91 %91 0 1
- %93 = OpCompositeExtract %float %92 0
- %94 = OpCompositeExtract %float %92 1
- %96 = OpCompositeConstruct %v4float %90 %93 %94 %float_1
- %97 = OpCompositeExtract %mat3v4float %params_0 2
- %98 = OpVectorTimesMatrix %v3float %96 %97
- OpStore %color %98
- OpBranch %82
- %82 = OpLabel
- %99 = OpCompositeExtract %uint %params_0 1
- %101 = OpIEqual %bool %99 %100
- OpSelectionMerge %102 None
- OpBranchConditional %101 %103 %102
- %103 = OpLabel
- %105 = OpLoad %v3float %color
- %106 = OpCompositeExtract %GammaTransferParams %params_0 3
- %104 = OpFunctionCall %v3float %gammaCorrection %105 %106
- OpStore %color %104
- %107 = OpCompositeExtract %mat3v3float %params_0 5
- %108 = OpLoad %v3float %color
- %109 = OpMatrixTimesVector %v3float %107 %108
- OpStore %color %109
- %111 = OpLoad %v3float %color
- %112 = OpCompositeExtract %GammaTransferParams %params_0 4
- %110 = OpFunctionCall %v3float %gammaCorrection %111 %112
- OpStore %color %110
- OpBranch %102
- %102 = OpLabel
- %113 = OpLoad %v3float %color
- %114 = OpCompositeExtract %float %113 0
- %115 = OpCompositeExtract %float %113 1
- %116 = OpCompositeExtract %float %113 2
- %117 = OpCompositeConstruct %v4float %114 %115 %116 %float_1
- OpReturnValue %117
+ %86 = OpImageFetch %v4float %plane0 %coord Lod %88
+ %89 = OpVectorShuffle %v4float %86 %86 0 1 2 3
+ OpStore %color %89
+ OpBranch %83
+ %85 = OpLabel
+ %90 = OpImageFetch %v4float %plane0 %coord Lod %88
+ %91 = OpCompositeExtract %float %90 0
+ %92 = OpImageFetch %v4float %plane1 %78 Lod %88
+ %93 = OpVectorShuffle %v2float %92 %92 0 1
+ %94 = OpCompositeExtract %float %93 0
+ %95 = OpCompositeExtract %float %93 1
+ %97 = OpCompositeConstruct %v4float %91 %94 %95 %float_1
+ %98 = OpCompositeExtract %mat3v4float %params_0 2
+ %99 = OpVectorTimesMatrix %v3float %97 %98
+ %100 = OpCompositeExtract %float %99 0
+ %101 = OpCompositeExtract %float %99 1
+ %102 = OpCompositeExtract %float %99 2
+ %103 = OpCompositeConstruct %v4float %100 %101 %102 %float_1
+ OpStore %color %103
+ OpBranch %83
+ %83 = OpLabel
+ %104 = OpCompositeExtract %uint %params_0 1
+ %106 = OpIEqual %bool %104 %105
+ OpSelectionMerge %107 None
+ OpBranchConditional %106 %108 %107
+ %108 = OpLabel
+ %110 = OpLoad %v4float %color
+ %111 = OpVectorShuffle %v3float %110 %110 0 1 2
+ %112 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %109 = OpFunctionCall %v3float %gammaCorrection %111 %112
+ %113 = OpCompositeExtract %float %109 0
+ %114 = OpCompositeExtract %float %109 1
+ %115 = OpCompositeExtract %float %109 2
+ %118 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %119 = OpLoad %float %118
+ %120 = OpCompositeConstruct %v4float %113 %114 %115 %119
+ OpStore %color %120
+ %121 = OpCompositeExtract %mat3v3float %params_0 5
+ %122 = OpLoad %v4float %color
+ %123 = OpVectorShuffle %v3float %122 %122 0 1 2
+ %124 = OpMatrixTimesVector %v3float %121 %123
+ %125 = OpCompositeExtract %float %124 0
+ %126 = OpCompositeExtract %float %124 1
+ %127 = OpCompositeExtract %float %124 2
+ %128 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %129 = OpLoad %float %128
+ %130 = OpCompositeConstruct %v4float %125 %126 %127 %129
+ OpStore %color %130
+ %132 = OpLoad %v4float %color
+ %133 = OpVectorShuffle %v3float %132 %132 0 1 2
+ %134 = OpCompositeExtract %GammaTransferParams %params_0 4
+ %131 = OpFunctionCall %v3float %gammaCorrection %133 %134
+ %135 = OpCompositeExtract %float %131 0
+ %136 = OpCompositeExtract %float %131 1
+ %137 = OpCompositeExtract %float %131 2
+ %138 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %139 = OpLoad %float %138
+ %140 = OpCompositeConstruct %v4float %135 %136 %137 %139
+ OpStore %color %140
+ OpBranch %107
+ %107 = OpLabel
+ %141 = OpLoad %v4float %color
+ OpReturnValue %141
OpFunctionEnd
-%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %118
+%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %142
%val = OpFunctionParameter %ExternalTextureParams_std140
- %121 = OpLabel
- %122 = OpCompositeExtract %uint %val 0
- %123 = OpCompositeExtract %uint %val 1
- %124 = OpCompositeExtract %mat3v4float %val 2
- %125 = OpCompositeExtract %GammaTransferParams %val 3
- %126 = OpCompositeExtract %GammaTransferParams %val 4
- %127 = OpCompositeExtract %mat3v3float %val 5
- %128 = OpCompositeExtract %v2float %val 6
- %129 = OpCompositeExtract %v2float %val 7
- %130 = OpCompositeExtract %v2float %val 8
- %131 = OpCompositeConstruct %mat3v2float %128 %129 %130
- %132 = OpCompositeConstruct %ExternalTextureParams %122 %123 %124 %125 %126 %127 %131
- OpReturnValue %132
+ %145 = OpLabel
+ %146 = OpCompositeExtract %uint %val 0
+ %147 = OpCompositeExtract %uint %val 1
+ %148 = OpCompositeExtract %mat3v4float %val 2
+ %149 = OpCompositeExtract %GammaTransferParams %val 3
+ %150 = OpCompositeExtract %GammaTransferParams %val 4
+ %151 = OpCompositeExtract %mat3v3float %val 5
+ %152 = OpCompositeExtract %v2float %val 6
+ %153 = OpCompositeExtract %v2float %val 7
+ %154 = OpCompositeExtract %v2float %val 8
+ %155 = OpCompositeConstruct %mat3v2float %152 %153 %154
+ %156 = OpCompositeConstruct %ExternalTextureParams %146 %147 %148 %149 %150 %151 %155
+ OpReturnValue %156
OpFunctionEnd
-%textureLoad_1bfdfb = OpFunction %void None %133
- %136 = OpLabel
+%textureLoad_1bfdfb = OpFunction %void None %157
+ %160 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %138 = OpLoad %11 %arg_0
- %139 = OpLoad %11 %ext_tex_plane_1
- %143 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
- %144 = OpLoad %ExternalTextureParams_std140 %143
- %140 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %144
- %137 = OpFunctionCall %v4float %textureLoadExternal %138 %139 %77 %140
- OpStore %res %137
- %148 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
- %149 = OpLoad %v4float %res
- OpStore %148 %149
+ %162 = OpLoad %11 %arg_0
+ %163 = OpLoad %11 %ext_tex_plane_1
+ %167 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
+ %168 = OpLoad %ExternalTextureParams_std140 %167
+ %164 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %168
+ %161 = OpFunctionCall %v4float %textureLoadExternal %162 %163 %77 %164
+ OpStore %res %161
+ %171 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
+ %172 = OpLoad %v4float %res
+ OpStore %171 %172
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %150
- %152 = OpLabel
- %153 = OpFunctionCall %void %textureLoad_1bfdfb
+%vertex_main_inner = OpFunction %v4float None %173
+ %175 = OpLabel
+ %176 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %133
- %155 = OpLabel
- %156 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %156
+%vertex_main = OpFunction %void None %157
+ %178 = OpLabel
+ %179 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %179
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %133
- %158 = OpLabel
- %159 = OpFunctionCall %void %textureLoad_1bfdfb
+%fragment_main = OpFunction %void None %157
+ %181 = OpLabel
+ %182 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %133
- %161 = OpLabel
- %162 = OpFunctionCall %void %textureLoad_1bfdfb
+%compute_main = OpFunction %void None %157
+ %184 = OpLabel
+ %185 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.dxc.hlsl
index 682ef71..afd58fa 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.dxc.hlsl
@@ -33,18 +33,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(int3(coord, 0)).rgb;
+ color = plane0.Load(int3(coord, 0)).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.fxc.hlsl
index 682ef71..afd58fa 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.fxc.hlsl
@@ -33,18 +33,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(int3(coord, 0)).rgb;
+ color = plane0.Load(int3(coord, 0)).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl
index 1523959..29aa817 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl
@@ -59,18 +59,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, coord, 0).rgb;
+ color = texelFetch(plane0_1, coord, 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -163,18 +163,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, coord, 0).rgb;
+ color = texelFetch(plane0_1, coord, 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -261,18 +261,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, coord, 0).rgb;
+ color = texelFetch(plane0_1, coord, 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.msl
index d685600..0f06bb1 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.msl
@@ -81,18 +81,18 @@
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) {
int2 const coord1 = (coord >> uint2(1u));
- float3 color = 0.0f;
+ float4 color = 0.0f;
if ((params.numPlanes == 1u)) {
- color = plane0.read(uint2(coord), 0).rgb;
+ color = plane0.read(uint2(coord), 0).rgba;
} else {
- color = (float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = float4((float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color[3]);
+ color = float4((params.gamutConversionMatrix * color.rgb), color[3]);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color[3]);
}
- return float4(color, 1.0f);
+ return color;
}
void textureLoad_8acf41(texture2d<float, access::sample> tint_symbol_1, texture2d<float, access::sample> tint_symbol_2, const constant ExternalTextureParams_tint_packed_vec3* const tint_symbol_3, device float4* const tint_symbol_4) {
diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.spvasm
index ed333d8..b783ed9 100644
--- a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 166
+; Bound: 189
; Schema: 0
OpCapability Shader
%32 = OpExtInstImport "GLSL.std.450"
@@ -152,19 +152,21 @@
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
%79 = OpConstantComposite %v2uint %uint_1 %uint_1
- %88 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %89 = OpConstantNull %int
%float_1 = OpConstant %float 1
- %101 = OpConstantNull %uint
- %119 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
+ %106 = OpConstantNull %uint
+ %uint_3 = OpConstant %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %143 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid
- %134 = OpTypeFunction %void
+ %158 = OpTypeFunction %void
%int_1 = OpConstant %int 1
- %142 = OpConstantComposite %v2int %int_1 %int_1
+ %166 = OpConstantComposite %v2int %int_1 %int_1
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
-%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
- %153 = OpTypeFunction %v4float
+ %176 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %26
%v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams
@@ -207,106 +209,127 @@
%coord = OpFunctionParameter %v2int
%params_0 = OpFunctionParameter %ExternalTextureParams
%76 = OpLabel
- %color = OpVariable %_ptr_Function_v3float Function %46
+ %color = OpVariable %_ptr_Function_v4float Function %5
%80 = OpShiftRightArithmetic %v2int %coord %79
- %82 = OpCompositeExtract %uint %params_0 0
- %83 = OpIEqual %bool %82 %uint_1
- OpSelectionMerge %84 None
- OpBranchConditional %83 %85 %86
- %85 = OpLabel
- %87 = OpImageFetch %v4float %plane0 %coord Lod %88
- %89 = OpVectorShuffle %v3float %87 %87 0 1 2
- OpStore %color %89
- OpBranch %84
+ %83 = OpCompositeExtract %uint %params_0 0
+ %84 = OpIEqual %bool %83 %uint_1
+ OpSelectionMerge %85 None
+ OpBranchConditional %84 %86 %87
%86 = OpLabel
- %90 = OpImageFetch %v4float %plane0 %coord Lod %88
- %91 = OpCompositeExtract %float %90 0
- %92 = OpImageFetch %v4float %plane1 %80 Lod %88
- %93 = OpVectorShuffle %v2float %92 %92 0 1
- %94 = OpCompositeExtract %float %93 0
- %95 = OpCompositeExtract %float %93 1
- %97 = OpCompositeConstruct %v4float %91 %94 %95 %float_1
- %98 = OpCompositeExtract %mat3v4float %params_0 2
- %99 = OpVectorTimesMatrix %v3float %97 %98
- OpStore %color %99
- OpBranch %84
- %84 = OpLabel
- %100 = OpCompositeExtract %uint %params_0 1
- %102 = OpIEqual %bool %100 %101
- OpSelectionMerge %103 None
- OpBranchConditional %102 %104 %103
- %104 = OpLabel
- %106 = OpLoad %v3float %color
- %107 = OpCompositeExtract %GammaTransferParams %params_0 3
- %105 = OpFunctionCall %v3float %gammaCorrection %106 %107
- OpStore %color %105
- %108 = OpCompositeExtract %mat3v3float %params_0 5
- %109 = OpLoad %v3float %color
- %110 = OpMatrixTimesVector %v3float %108 %109
- OpStore %color %110
- %112 = OpLoad %v3float %color
- %113 = OpCompositeExtract %GammaTransferParams %params_0 4
- %111 = OpFunctionCall %v3float %gammaCorrection %112 %113
- OpStore %color %111
- OpBranch %103
- %103 = OpLabel
- %114 = OpLoad %v3float %color
- %115 = OpCompositeExtract %float %114 0
- %116 = OpCompositeExtract %float %114 1
- %117 = OpCompositeExtract %float %114 2
- %118 = OpCompositeConstruct %v4float %115 %116 %117 %float_1
- OpReturnValue %118
+ %88 = OpImageFetch %v4float %plane0 %coord Lod %89
+ %90 = OpVectorShuffle %v4float %88 %88 0 1 2 3
+ OpStore %color %90
+ OpBranch %85
+ %87 = OpLabel
+ %91 = OpImageFetch %v4float %plane0 %coord Lod %89
+ %92 = OpCompositeExtract %float %91 0
+ %93 = OpImageFetch %v4float %plane1 %80 Lod %89
+ %94 = OpVectorShuffle %v2float %93 %93 0 1
+ %95 = OpCompositeExtract %float %94 0
+ %96 = OpCompositeExtract %float %94 1
+ %98 = OpCompositeConstruct %v4float %92 %95 %96 %float_1
+ %99 = OpCompositeExtract %mat3v4float %params_0 2
+ %100 = OpVectorTimesMatrix %v3float %98 %99
+ %101 = OpCompositeExtract %float %100 0
+ %102 = OpCompositeExtract %float %100 1
+ %103 = OpCompositeExtract %float %100 2
+ %104 = OpCompositeConstruct %v4float %101 %102 %103 %float_1
+ OpStore %color %104
+ OpBranch %85
+ %85 = OpLabel
+ %105 = OpCompositeExtract %uint %params_0 1
+ %107 = OpIEqual %bool %105 %106
+ OpSelectionMerge %108 None
+ OpBranchConditional %107 %109 %108
+ %109 = OpLabel
+ %111 = OpLoad %v4float %color
+ %112 = OpVectorShuffle %v3float %111 %111 0 1 2
+ %113 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %110 = OpFunctionCall %v3float %gammaCorrection %112 %113
+ %114 = OpCompositeExtract %float %110 0
+ %115 = OpCompositeExtract %float %110 1
+ %116 = OpCompositeExtract %float %110 2
+ %119 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %120 = OpLoad %float %119
+ %121 = OpCompositeConstruct %v4float %114 %115 %116 %120
+ OpStore %color %121
+ %122 = OpCompositeExtract %mat3v3float %params_0 5
+ %123 = OpLoad %v4float %color
+ %124 = OpVectorShuffle %v3float %123 %123 0 1 2
+ %125 = OpMatrixTimesVector %v3float %122 %124
+ %126 = OpCompositeExtract %float %125 0
+ %127 = OpCompositeExtract %float %125 1
+ %128 = OpCompositeExtract %float %125 2
+ %129 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %130 = OpLoad %float %129
+ %131 = OpCompositeConstruct %v4float %126 %127 %128 %130
+ OpStore %color %131
+ %133 = OpLoad %v4float %color
+ %134 = OpVectorShuffle %v3float %133 %133 0 1 2
+ %135 = OpCompositeExtract %GammaTransferParams %params_0 4
+ %132 = OpFunctionCall %v3float %gammaCorrection %134 %135
+ %136 = OpCompositeExtract %float %132 0
+ %137 = OpCompositeExtract %float %132 1
+ %138 = OpCompositeExtract %float %132 2
+ %139 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %140 = OpLoad %float %139
+ %141 = OpCompositeConstruct %v4float %136 %137 %138 %140
+ OpStore %color %141
+ OpBranch %108
+ %108 = OpLabel
+ %142 = OpLoad %v4float %color
+ OpReturnValue %142
OpFunctionEnd
-%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %119
+%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %143
%val = OpFunctionParameter %ExternalTextureParams_std140
- %122 = OpLabel
- %123 = OpCompositeExtract %uint %val 0
- %124 = OpCompositeExtract %uint %val 1
- %125 = OpCompositeExtract %mat3v4float %val 2
- %126 = OpCompositeExtract %GammaTransferParams %val 3
- %127 = OpCompositeExtract %GammaTransferParams %val 4
- %128 = OpCompositeExtract %mat3v3float %val 5
- %129 = OpCompositeExtract %v2float %val 6
- %130 = OpCompositeExtract %v2float %val 7
- %131 = OpCompositeExtract %v2float %val 8
- %132 = OpCompositeConstruct %mat3v2float %129 %130 %131
- %133 = OpCompositeConstruct %ExternalTextureParams %123 %124 %125 %126 %127 %128 %132
- OpReturnValue %133
+ %146 = OpLabel
+ %147 = OpCompositeExtract %uint %val 0
+ %148 = OpCompositeExtract %uint %val 1
+ %149 = OpCompositeExtract %mat3v4float %val 2
+ %150 = OpCompositeExtract %GammaTransferParams %val 3
+ %151 = OpCompositeExtract %GammaTransferParams %val 4
+ %152 = OpCompositeExtract %mat3v3float %val 5
+ %153 = OpCompositeExtract %v2float %val 6
+ %154 = OpCompositeExtract %v2float %val 7
+ %155 = OpCompositeExtract %v2float %val 8
+ %156 = OpCompositeConstruct %mat3v2float %153 %154 %155
+ %157 = OpCompositeConstruct %ExternalTextureParams %147 %148 %149 %150 %151 %152 %156
+ OpReturnValue %157
OpFunctionEnd
-%textureLoad_8acf41 = OpFunction %void None %134
- %137 = OpLabel
+%textureLoad_8acf41 = OpFunction %void None %158
+ %161 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %139 = OpLoad %11 %arg_0
- %140 = OpLoad %11 %ext_tex_plane_1
- %146 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
- %147 = OpLoad %ExternalTextureParams_std140 %146
- %143 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %147
- %138 = OpFunctionCall %v4float %textureLoadExternal %139 %140 %142 %143
- OpStore %res %138
- %151 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
- %152 = OpLoad %v4float %res
- OpStore %151 %152
+ %163 = OpLoad %11 %arg_0
+ %164 = OpLoad %11 %ext_tex_plane_1
+ %170 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
+ %171 = OpLoad %ExternalTextureParams_std140 %170
+ %167 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %171
+ %162 = OpFunctionCall %v4float %textureLoadExternal %163 %164 %166 %167
+ OpStore %res %162
+ %174 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
+ %175 = OpLoad %v4float %res
+ OpStore %174 %175
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %153
- %155 = OpLabel
- %156 = OpFunctionCall %void %textureLoad_8acf41
+%vertex_main_inner = OpFunction %v4float None %176
+ %178 = OpLabel
+ %179 = OpFunctionCall %void %textureLoad_8acf41
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %134
- %158 = OpLabel
- %159 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %159
+%vertex_main = OpFunction %void None %158
+ %181 = OpLabel
+ %182 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %182
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %134
- %161 = OpLabel
- %162 = OpFunctionCall %void %textureLoad_8acf41
+%fragment_main = OpFunction %void None %158
+ %184 = OpLabel
+ %185 = OpFunctionCall %void %textureLoad_8acf41
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %134
- %164 = OpLabel
- %165 = OpFunctionCall %void %textureLoad_8acf41
+%compute_main = OpFunction %void None %158
+ %187 = OpLabel
+ %188 = OpFunctionCall %void %textureLoad_8acf41
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.dxc.hlsl
index 308c0d8..73051f0 100644
--- a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.dxc.hlsl
@@ -44,18 +44,18 @@
const float2 plane1_dims = float2(tint_tmp_1.xy);
const float2 plane1_half_texel = ((0.5f).xx / plane1_dims);
const float2 plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.SampleLevel(smp, plane0_clamped, 0.0f).rgb;
+ color = plane0.SampleLevel(smp, plane0_clamped, 0.0f).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, plane0_clamped, 0.0f).r, plane1.SampleLevel(smp, plane1_clamped, 0.0f).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, plane0_clamped, 0.0f).r, plane1.SampleLevel(smp, plane1_clamped, 0.0f).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.fxc.hlsl
index 308c0d8..73051f0 100644
--- a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.fxc.hlsl
@@ -44,18 +44,18 @@
const float2 plane1_dims = float2(tint_tmp_1.xy);
const float2 plane1_half_texel = ((0.5f).xx / plane1_dims);
const float2 plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.SampleLevel(smp, plane0_clamped, 0.0f).rgb;
+ color = plane0.SampleLevel(smp, plane0_clamped, 0.0f).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, plane0_clamped, 0.0f).r, plane1.SampleLevel(smp, plane1_clamped, 0.0f).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, plane0_clamped, 0.0f).r, plane1.SampleLevel(smp, plane1_clamped, 0.0f).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
index 3fd7f14..f660021 100644
--- a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
@@ -66,18 +66,18 @@
vec2 plane1_dims = vec2(uvec2(textureSize(plane1_1, 0)));
vec2 plane1_half_texel = (vec2(0.5f) / plane1_dims);
vec2 plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgb;
+ color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgba;
} else {
- color = (vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -179,18 +179,18 @@
vec2 plane1_dims = vec2(uvec2(textureSize(plane1_1, 0)));
vec2 plane1_half_texel = (vec2(0.5f) / plane1_dims);
vec2 plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgb;
+ color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgba;
} else {
- color = (vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -286,18 +286,18 @@
vec2 plane1_dims = vec2(uvec2(textureSize(plane1_1, 0)));
vec2 plane1_half_texel = (vec2(0.5f) / plane1_dims);
vec2 plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgb;
+ color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgba;
} else {
- color = (vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
diff --git a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.msl
index 0a3c0eb..082481f 100644
--- a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.msl
@@ -87,18 +87,18 @@
float2 const plane1_dims = float2(uint2(plane1.get_width(0), plane1.get_height(0)));
float2 const plane1_half_texel = (float2(0.5f) / plane1_dims);
float2 const plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- float3 color = 0.0f;
+ float4 color = 0.0f;
if ((params.numPlanes == 1u)) {
- color = plane0.sample(smp, plane0_clamped, level(0.0f)).rgb;
+ color = plane0.sample(smp, plane0_clamped, level(0.0f)).rgba;
} else {
- color = (float4(plane0.sample(smp, plane0_clamped, level(0.0f))[0], plane1.sample(smp, plane1_clamped, level(0.0f)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = float4((float4(plane0.sample(smp, plane0_clamped, level(0.0f))[0], plane1.sample(smp, plane1_clamped, level(0.0f)).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color[3]);
+ color = float4((params.gamutConversionMatrix * color.rgb), color[3]);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color[3]);
}
- return float4(color, 1.0f);
+ return color;
}
void textureSampleBaseClampToEdge_7c04e6(texture2d<float, access::sample> tint_symbol_1, texture2d<float, access::sample> tint_symbol_2, sampler tint_symbol_3, const constant ExternalTextureParams_tint_packed_vec3* const tint_symbol_4, device float4* const tint_symbol_5) {
diff --git a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.spvasm
index 3f3fbe0..318b5ba 100644
--- a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 194
+; Bound: 217
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
@@ -163,18 +163,20 @@
%91 = OpConstantComposite %v2float %float_0_5 %float_0_5
%_ptr_Function_v2float = OpTypePointer Function %v2float
%97 = OpConstantNull %v2float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
%uint_1 = OpConstant %uint 1
- %114 = OpTypeSampledImage %11
- %129 = OpConstantNull %uint
- %147 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
+ %115 = OpTypeSampledImage %11
+ %134 = OpConstantNull %uint
+ %uint_3 = OpConstant %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %171 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid
- %162 = OpTypeFunction %void
- %170 = OpConstantComposite %v2float %float_1 %float_1
+ %186 = OpTypeFunction %void
+ %194 = OpConstantComposite %v2float %float_1 %float_1
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
-%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
- %181 = OpTypeFunction %v4float
+ %204 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %29
%v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams
@@ -220,7 +222,7 @@
%78 = OpLabel
%95 = OpVariable %_ptr_Function_v2float Function %97
%104 = OpVariable %_ptr_Function_v2float Function %97
- %color = OpVariable %_ptr_Function_v3float Function %49
+ %color = OpVariable %_ptr_Function_v4float Function %5
%79 = OpCompositeExtract %mat3v2float %params_0 6
%80 = OpCompositeExtract %float %coord 0
%81 = OpCompositeExtract %float %coord 1
@@ -238,108 +240,129 @@
%105 = OpCompositeConstruct %v2float %float_1 %float_1
%103 = OpFSub %v2float %105 %101
%102 = OpExtInst %v2float %35 NClamp %84 %101 %103
- %107 = OpCompositeExtract %uint %params_0 0
- %109 = OpIEqual %bool %107 %uint_1
- OpSelectionMerge %110 None
- OpBranchConditional %109 %111 %112
- %111 = OpLabel
- %115 = OpSampledImage %114 %plane0 %smp
- %113 = OpImageSampleExplicitLod %v4float %115 %93 Lod %8
- %116 = OpVectorShuffle %v3float %113 %113 0 1 2
- OpStore %color %116
- OpBranch %110
+ %108 = OpCompositeExtract %uint %params_0 0
+ %110 = OpIEqual %bool %108 %uint_1
+ OpSelectionMerge %111 None
+ OpBranchConditional %110 %112 %113
%112 = OpLabel
- %118 = OpSampledImage %114 %plane0 %smp
- %117 = OpImageSampleExplicitLod %v4float %118 %93 Lod %8
- %119 = OpCompositeExtract %float %117 0
- %121 = OpSampledImage %114 %plane1 %smp
- %120 = OpImageSampleExplicitLod %v4float %121 %102 Lod %8
- %122 = OpVectorShuffle %v2float %120 %120 0 1
- %123 = OpCompositeExtract %float %122 0
- %124 = OpCompositeExtract %float %122 1
- %125 = OpCompositeConstruct %v4float %119 %123 %124 %float_1
- %126 = OpCompositeExtract %mat3v4float %params_0 2
- %127 = OpVectorTimesMatrix %v3float %125 %126
- OpStore %color %127
- OpBranch %110
- %110 = OpLabel
- %128 = OpCompositeExtract %uint %params_0 1
- %130 = OpIEqual %bool %128 %129
- OpSelectionMerge %131 None
- OpBranchConditional %130 %132 %131
- %132 = OpLabel
- %134 = OpLoad %v3float %color
- %135 = OpCompositeExtract %GammaTransferParams %params_0 3
- %133 = OpFunctionCall %v3float %gammaCorrection %134 %135
- OpStore %color %133
- %136 = OpCompositeExtract %mat3v3float %params_0 5
- %137 = OpLoad %v3float %color
- %138 = OpMatrixTimesVector %v3float %136 %137
- OpStore %color %138
- %140 = OpLoad %v3float %color
- %141 = OpCompositeExtract %GammaTransferParams %params_0 4
- %139 = OpFunctionCall %v3float %gammaCorrection %140 %141
- OpStore %color %139
- OpBranch %131
- %131 = OpLabel
- %142 = OpLoad %v3float %color
- %143 = OpCompositeExtract %float %142 0
- %144 = OpCompositeExtract %float %142 1
- %145 = OpCompositeExtract %float %142 2
- %146 = OpCompositeConstruct %v4float %143 %144 %145 %float_1
- OpReturnValue %146
+ %116 = OpSampledImage %115 %plane0 %smp
+ %114 = OpImageSampleExplicitLod %v4float %116 %93 Lod %8
+ %117 = OpVectorShuffle %v4float %114 %114 0 1 2 3
+ OpStore %color %117
+ OpBranch %111
+ %113 = OpLabel
+ %119 = OpSampledImage %115 %plane0 %smp
+ %118 = OpImageSampleExplicitLod %v4float %119 %93 Lod %8
+ %120 = OpCompositeExtract %float %118 0
+ %122 = OpSampledImage %115 %plane1 %smp
+ %121 = OpImageSampleExplicitLod %v4float %122 %102 Lod %8
+ %123 = OpVectorShuffle %v2float %121 %121 0 1
+ %124 = OpCompositeExtract %float %123 0
+ %125 = OpCompositeExtract %float %123 1
+ %126 = OpCompositeConstruct %v4float %120 %124 %125 %float_1
+ %127 = OpCompositeExtract %mat3v4float %params_0 2
+ %128 = OpVectorTimesMatrix %v3float %126 %127
+ %129 = OpCompositeExtract %float %128 0
+ %130 = OpCompositeExtract %float %128 1
+ %131 = OpCompositeExtract %float %128 2
+ %132 = OpCompositeConstruct %v4float %129 %130 %131 %float_1
+ OpStore %color %132
+ OpBranch %111
+ %111 = OpLabel
+ %133 = OpCompositeExtract %uint %params_0 1
+ %135 = OpIEqual %bool %133 %134
+ OpSelectionMerge %136 None
+ OpBranchConditional %135 %137 %136
+ %137 = OpLabel
+ %139 = OpLoad %v4float %color
+ %140 = OpVectorShuffle %v3float %139 %139 0 1 2
+ %141 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %138 = OpFunctionCall %v3float %gammaCorrection %140 %141
+ %142 = OpCompositeExtract %float %138 0
+ %143 = OpCompositeExtract %float %138 1
+ %144 = OpCompositeExtract %float %138 2
+ %147 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %148 = OpLoad %float %147
+ %149 = OpCompositeConstruct %v4float %142 %143 %144 %148
+ OpStore %color %149
+ %150 = OpCompositeExtract %mat3v3float %params_0 5
+ %151 = OpLoad %v4float %color
+ %152 = OpVectorShuffle %v3float %151 %151 0 1 2
+ %153 = OpMatrixTimesVector %v3float %150 %152
+ %154 = OpCompositeExtract %float %153 0
+ %155 = OpCompositeExtract %float %153 1
+ %156 = OpCompositeExtract %float %153 2
+ %157 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %158 = OpLoad %float %157
+ %159 = OpCompositeConstruct %v4float %154 %155 %156 %158
+ OpStore %color %159
+ %161 = OpLoad %v4float %color
+ %162 = OpVectorShuffle %v3float %161 %161 0 1 2
+ %163 = OpCompositeExtract %GammaTransferParams %params_0 4
+ %160 = OpFunctionCall %v3float %gammaCorrection %162 %163
+ %164 = OpCompositeExtract %float %160 0
+ %165 = OpCompositeExtract %float %160 1
+ %166 = OpCompositeExtract %float %160 2
+ %167 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %168 = OpLoad %float %167
+ %169 = OpCompositeConstruct %v4float %164 %165 %166 %168
+ OpStore %color %169
+ OpBranch %136
+ %136 = OpLabel
+ %170 = OpLoad %v4float %color
+ OpReturnValue %170
OpFunctionEnd
-%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %147
+%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %171
%val = OpFunctionParameter %ExternalTextureParams_std140
- %150 = OpLabel
- %151 = OpCompositeExtract %uint %val 0
- %152 = OpCompositeExtract %uint %val 1
- %153 = OpCompositeExtract %mat3v4float %val 2
- %154 = OpCompositeExtract %GammaTransferParams %val 3
- %155 = OpCompositeExtract %GammaTransferParams %val 4
- %156 = OpCompositeExtract %mat3v3float %val 5
- %157 = OpCompositeExtract %v2float %val 6
- %158 = OpCompositeExtract %v2float %val 7
- %159 = OpCompositeExtract %v2float %val 8
- %160 = OpCompositeConstruct %mat3v2float %157 %158 %159
- %161 = OpCompositeConstruct %ExternalTextureParams %151 %152 %153 %154 %155 %156 %160
- OpReturnValue %161
+ %174 = OpLabel
+ %175 = OpCompositeExtract %uint %val 0
+ %176 = OpCompositeExtract %uint %val 1
+ %177 = OpCompositeExtract %mat3v4float %val 2
+ %178 = OpCompositeExtract %GammaTransferParams %val 3
+ %179 = OpCompositeExtract %GammaTransferParams %val 4
+ %180 = OpCompositeExtract %mat3v3float %val 5
+ %181 = OpCompositeExtract %v2float %val 6
+ %182 = OpCompositeExtract %v2float %val 7
+ %183 = OpCompositeExtract %v2float %val 8
+ %184 = OpCompositeConstruct %mat3v2float %181 %182 %183
+ %185 = OpCompositeConstruct %ExternalTextureParams %175 %176 %177 %178 %179 %180 %184
+ OpReturnValue %185
OpFunctionEnd
-%textureSampleBaseClampToEdge_7c04e6 = OpFunction %void None %162
- %165 = OpLabel
+%textureSampleBaseClampToEdge_7c04e6 = OpFunction %void None %186
+ %189 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %167 = OpLoad %11 %arg_0
- %168 = OpLoad %11 %ext_tex_plane_1
- %169 = OpLoad %25 %arg_1
- %174 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
- %175 = OpLoad %ExternalTextureParams_std140 %174
- %171 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %175
- %166 = OpFunctionCall %v4float %textureSampleExternal %167 %168 %169 %170 %171
- OpStore %res %166
- %179 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
- %180 = OpLoad %v4float %res
- OpStore %179 %180
+ %191 = OpLoad %11 %arg_0
+ %192 = OpLoad %11 %ext_tex_plane_1
+ %193 = OpLoad %25 %arg_1
+ %198 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
+ %199 = OpLoad %ExternalTextureParams_std140 %198
+ %195 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %199
+ %190 = OpFunctionCall %v4float %textureSampleExternal %191 %192 %193 %194 %195
+ OpStore %res %190
+ %202 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
+ %203 = OpLoad %v4float %res
+ OpStore %202 %203
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %181
- %183 = OpLabel
- %184 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
+%vertex_main_inner = OpFunction %v4float None %204
+ %206 = OpLabel
+ %207 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %162
- %186 = OpLabel
- %187 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %187
+%vertex_main = OpFunction %void None %186
+ %209 = OpLabel
+ %210 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %210
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %162
- %189 = OpLabel
- %190 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
+%fragment_main = OpFunction %void None %186
+ %212 = OpLabel
+ %213 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %162
- %192 = OpLabel
- %193 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
+%compute_main = OpFunction %void None %186
+ %215 = OpLabel
+ %216 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
index b87f80b..fba72ec 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
@@ -33,18 +33,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
const uint2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(uint3(coord, uint(0))).rgb;
+ color = plane0.Load(uint3(coord, uint(0))).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
index b87f80b..fba72ec 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
@@ -33,18 +33,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
const uint2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(uint3(coord, uint(0))).rgb;
+ color = plane0.Load(uint3(coord, uint(0))).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl
index f45001e..ba3978f 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl
@@ -59,18 +59,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -164,18 +164,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -263,18 +263,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.msl
index 8d2b9d2..01899f1 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.msl
@@ -81,18 +81,18 @@
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, uint2 coord, ExternalTextureParams params) {
uint2 const coord1 = (coord >> uint2(1u));
- float3 color = 0.0f;
+ float4 color = 0.0f;
if ((params.numPlanes == 1u)) {
- color = plane0.read(uint2(coord), 0).rgb;
+ color = plane0.read(uint2(coord), 0).rgba;
} else {
- color = (float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = float4((float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color[3]);
+ color = float4((params.gamutConversionMatrix * color.rgb), color[3]);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color[3]);
}
- return float4(color, 1.0f);
+ return color;
}
void textureLoad_1bfdfb(texture2d<float, access::sample> tint_symbol_1, texture2d<float, access::sample> tint_symbol_2, const constant ExternalTextureParams_tint_packed_vec3* const tint_symbol_3, device float4* const tint_symbol_4) {
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.spvasm
index c8196ff..62f7556 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 167
+; Bound: 190
; Schema: 0
OpCapability Shader
%32 = OpExtInstImport "GLSL.std.450"
@@ -151,20 +151,22 @@
%66 = OpTypeFunction %v4float %11 %11 %v2uint %ExternalTextureParams
%uint_1 = OpConstant %uint 1
%77 = OpConstantComposite %v2uint %uint_1 %uint_1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
%int = OpTypeInt 32 1
- %87 = OpConstantNull %int
+ %88 = OpConstantNull %int
%float_1 = OpConstant %float 1
- %100 = OpConstantNull %uint
- %118 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
+ %105 = OpConstantNull %uint
+ %uint_3 = OpConstant %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %142 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid
- %133 = OpTypeFunction %void
+ %157 = OpTypeFunction %void
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
- %139 = OpConstantNull %v2uint
+ %163 = OpConstantNull %v2uint
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
-%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
- %154 = OpTypeFunction %v4float
+ %177 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %26
%v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams
@@ -207,109 +209,130 @@
%coord = OpFunctionParameter %v2uint
%params_0 = OpFunctionParameter %ExternalTextureParams
%75 = OpLabel
- %color = OpVariable %_ptr_Function_v3float Function %46
+ %color = OpVariable %_ptr_Function_v4float Function %5
%78 = OpShiftRightLogical %v2uint %coord %77
- %80 = OpCompositeExtract %uint %params_0 0
- %81 = OpIEqual %bool %80 %uint_1
- OpSelectionMerge %82 None
- OpBranchConditional %81 %83 %84
- %83 = OpLabel
- %85 = OpImageFetch %v4float %plane0 %coord Lod %87
- %88 = OpVectorShuffle %v3float %85 %85 0 1 2
- OpStore %color %88
- OpBranch %82
+ %81 = OpCompositeExtract %uint %params_0 0
+ %82 = OpIEqual %bool %81 %uint_1
+ OpSelectionMerge %83 None
+ OpBranchConditional %82 %84 %85
%84 = OpLabel
- %89 = OpImageFetch %v4float %plane0 %coord Lod %87
- %90 = OpCompositeExtract %float %89 0
- %91 = OpImageFetch %v4float %plane1 %78 Lod %87
- %92 = OpVectorShuffle %v2float %91 %91 0 1
- %93 = OpCompositeExtract %float %92 0
- %94 = OpCompositeExtract %float %92 1
- %96 = OpCompositeConstruct %v4float %90 %93 %94 %float_1
- %97 = OpCompositeExtract %mat3v4float %params_0 2
- %98 = OpVectorTimesMatrix %v3float %96 %97
- OpStore %color %98
- OpBranch %82
- %82 = OpLabel
- %99 = OpCompositeExtract %uint %params_0 1
- %101 = OpIEqual %bool %99 %100
- OpSelectionMerge %102 None
- OpBranchConditional %101 %103 %102
- %103 = OpLabel
- %105 = OpLoad %v3float %color
- %106 = OpCompositeExtract %GammaTransferParams %params_0 3
- %104 = OpFunctionCall %v3float %gammaCorrection %105 %106
- OpStore %color %104
- %107 = OpCompositeExtract %mat3v3float %params_0 5
- %108 = OpLoad %v3float %color
- %109 = OpMatrixTimesVector %v3float %107 %108
- OpStore %color %109
- %111 = OpLoad %v3float %color
- %112 = OpCompositeExtract %GammaTransferParams %params_0 4
- %110 = OpFunctionCall %v3float %gammaCorrection %111 %112
- OpStore %color %110
- OpBranch %102
- %102 = OpLabel
- %113 = OpLoad %v3float %color
- %114 = OpCompositeExtract %float %113 0
- %115 = OpCompositeExtract %float %113 1
- %116 = OpCompositeExtract %float %113 2
- %117 = OpCompositeConstruct %v4float %114 %115 %116 %float_1
- OpReturnValue %117
+ %86 = OpImageFetch %v4float %plane0 %coord Lod %88
+ %89 = OpVectorShuffle %v4float %86 %86 0 1 2 3
+ OpStore %color %89
+ OpBranch %83
+ %85 = OpLabel
+ %90 = OpImageFetch %v4float %plane0 %coord Lod %88
+ %91 = OpCompositeExtract %float %90 0
+ %92 = OpImageFetch %v4float %plane1 %78 Lod %88
+ %93 = OpVectorShuffle %v2float %92 %92 0 1
+ %94 = OpCompositeExtract %float %93 0
+ %95 = OpCompositeExtract %float %93 1
+ %97 = OpCompositeConstruct %v4float %91 %94 %95 %float_1
+ %98 = OpCompositeExtract %mat3v4float %params_0 2
+ %99 = OpVectorTimesMatrix %v3float %97 %98
+ %100 = OpCompositeExtract %float %99 0
+ %101 = OpCompositeExtract %float %99 1
+ %102 = OpCompositeExtract %float %99 2
+ %103 = OpCompositeConstruct %v4float %100 %101 %102 %float_1
+ OpStore %color %103
+ OpBranch %83
+ %83 = OpLabel
+ %104 = OpCompositeExtract %uint %params_0 1
+ %106 = OpIEqual %bool %104 %105
+ OpSelectionMerge %107 None
+ OpBranchConditional %106 %108 %107
+ %108 = OpLabel
+ %110 = OpLoad %v4float %color
+ %111 = OpVectorShuffle %v3float %110 %110 0 1 2
+ %112 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %109 = OpFunctionCall %v3float %gammaCorrection %111 %112
+ %113 = OpCompositeExtract %float %109 0
+ %114 = OpCompositeExtract %float %109 1
+ %115 = OpCompositeExtract %float %109 2
+ %118 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %119 = OpLoad %float %118
+ %120 = OpCompositeConstruct %v4float %113 %114 %115 %119
+ OpStore %color %120
+ %121 = OpCompositeExtract %mat3v3float %params_0 5
+ %122 = OpLoad %v4float %color
+ %123 = OpVectorShuffle %v3float %122 %122 0 1 2
+ %124 = OpMatrixTimesVector %v3float %121 %123
+ %125 = OpCompositeExtract %float %124 0
+ %126 = OpCompositeExtract %float %124 1
+ %127 = OpCompositeExtract %float %124 2
+ %128 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %129 = OpLoad %float %128
+ %130 = OpCompositeConstruct %v4float %125 %126 %127 %129
+ OpStore %color %130
+ %132 = OpLoad %v4float %color
+ %133 = OpVectorShuffle %v3float %132 %132 0 1 2
+ %134 = OpCompositeExtract %GammaTransferParams %params_0 4
+ %131 = OpFunctionCall %v3float %gammaCorrection %133 %134
+ %135 = OpCompositeExtract %float %131 0
+ %136 = OpCompositeExtract %float %131 1
+ %137 = OpCompositeExtract %float %131 2
+ %138 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %139 = OpLoad %float %138
+ %140 = OpCompositeConstruct %v4float %135 %136 %137 %139
+ OpStore %color %140
+ OpBranch %107
+ %107 = OpLabel
+ %141 = OpLoad %v4float %color
+ OpReturnValue %141
OpFunctionEnd
-%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %118
+%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %142
%val = OpFunctionParameter %ExternalTextureParams_std140
- %121 = OpLabel
- %122 = OpCompositeExtract %uint %val 0
- %123 = OpCompositeExtract %uint %val 1
- %124 = OpCompositeExtract %mat3v4float %val 2
- %125 = OpCompositeExtract %GammaTransferParams %val 3
- %126 = OpCompositeExtract %GammaTransferParams %val 4
- %127 = OpCompositeExtract %mat3v3float %val 5
- %128 = OpCompositeExtract %v2float %val 6
- %129 = OpCompositeExtract %v2float %val 7
- %130 = OpCompositeExtract %v2float %val 8
- %131 = OpCompositeConstruct %mat3v2float %128 %129 %130
- %132 = OpCompositeConstruct %ExternalTextureParams %122 %123 %124 %125 %126 %127 %131
- OpReturnValue %132
+ %145 = OpLabel
+ %146 = OpCompositeExtract %uint %val 0
+ %147 = OpCompositeExtract %uint %val 1
+ %148 = OpCompositeExtract %mat3v4float %val 2
+ %149 = OpCompositeExtract %GammaTransferParams %val 3
+ %150 = OpCompositeExtract %GammaTransferParams %val 4
+ %151 = OpCompositeExtract %mat3v3float %val 5
+ %152 = OpCompositeExtract %v2float %val 6
+ %153 = OpCompositeExtract %v2float %val 7
+ %154 = OpCompositeExtract %v2float %val 8
+ %155 = OpCompositeConstruct %mat3v2float %152 %153 %154
+ %156 = OpCompositeConstruct %ExternalTextureParams %146 %147 %148 %149 %150 %151 %155
+ OpReturnValue %156
OpFunctionEnd
-%textureLoad_1bfdfb = OpFunction %void None %133
- %136 = OpLabel
- %arg_1 = OpVariable %_ptr_Function_v2uint Function %139
+%textureLoad_1bfdfb = OpFunction %void None %157
+ %160 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %163
%res = OpVariable %_ptr_Function_v4float Function %5
OpStore %arg_1 %77
- %141 = OpLoad %11 %arg_0
- %142 = OpLoad %11 %ext_tex_plane_1
- %143 = OpLoad %v2uint %arg_1
- %147 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
- %148 = OpLoad %ExternalTextureParams_std140 %147
- %144 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %148
- %140 = OpFunctionCall %v4float %textureLoadExternal %141 %142 %143 %144
- OpStore %res %140
- %152 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
- %153 = OpLoad %v4float %res
- OpStore %152 %153
+ %165 = OpLoad %11 %arg_0
+ %166 = OpLoad %11 %ext_tex_plane_1
+ %167 = OpLoad %v2uint %arg_1
+ %171 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
+ %172 = OpLoad %ExternalTextureParams_std140 %171
+ %168 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %172
+ %164 = OpFunctionCall %v4float %textureLoadExternal %165 %166 %167 %168
+ OpStore %res %164
+ %175 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
+ %176 = OpLoad %v4float %res
+ OpStore %175 %176
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %154
- %156 = OpLabel
- %157 = OpFunctionCall %void %textureLoad_1bfdfb
+%vertex_main_inner = OpFunction %v4float None %177
+ %179 = OpLabel
+ %180 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %133
- %159 = OpLabel
- %160 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %160
+%vertex_main = OpFunction %void None %157
+ %182 = OpLabel
+ %183 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %183
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %133
- %162 = OpLabel
- %163 = OpFunctionCall %void %textureLoad_1bfdfb
+%fragment_main = OpFunction %void None %157
+ %185 = OpLabel
+ %186 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %133
- %165 = OpLabel
- %166 = OpFunctionCall %void %textureLoad_1bfdfb
+%compute_main = OpFunction %void None %157
+ %188 = OpLabel
+ %189 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.dxc.hlsl
index 4d121ee..84647f6 100644
--- a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.dxc.hlsl
@@ -33,18 +33,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(int3(coord, 0)).rgb;
+ color = plane0.Load(int3(coord, 0)).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.fxc.hlsl
index 4d121ee..84647f6 100644
--- a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.fxc.hlsl
@@ -33,18 +33,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(int3(coord, 0)).rgb;
+ color = plane0.Load(int3(coord, 0)).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl
index f94ebbd..1474fd3 100644
--- a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl
@@ -59,18 +59,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, coord, 0).rgb;
+ color = texelFetch(plane0_1, coord, 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -164,18 +164,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, coord, 0).rgb;
+ color = texelFetch(plane0_1, coord, 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -263,18 +263,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, coord, 0).rgb;
+ color = texelFetch(plane0_1, coord, 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl
index 1fd84bd..7256ccb 100644
--- a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl
@@ -81,18 +81,18 @@
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) {
int2 const coord1 = (coord >> uint2(1u));
- float3 color = 0.0f;
+ float4 color = 0.0f;
if ((params.numPlanes == 1u)) {
- color = plane0.read(uint2(coord), 0).rgb;
+ color = plane0.read(uint2(coord), 0).rgba;
} else {
- color = (float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = float4((float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color[3]);
+ color = float4((params.gamutConversionMatrix * color.rgb), color[3]);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color[3]);
}
- return float4(color, 1.0f);
+ return color;
}
void textureLoad_8acf41(texture2d<float, access::sample> tint_symbol_1, texture2d<float, access::sample> tint_symbol_2, const constant ExternalTextureParams_tint_packed_vec3* const tint_symbol_3, device float4* const tint_symbol_4) {
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm
index ef7e7ed..0ef2df4 100644
--- a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 170
+; Bound: 193
; Schema: 0
OpCapability Shader
%32 = OpExtInstImport "GLSL.std.450"
@@ -153,21 +153,23 @@
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
%79 = OpConstantComposite %v2uint %uint_1 %uint_1
- %88 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %89 = OpConstantNull %int
%float_1 = OpConstant %float 1
- %101 = OpConstantNull %uint
- %119 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
+ %106 = OpConstantNull %uint
+ %uint_3 = OpConstant %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %143 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid
- %134 = OpTypeFunction %void
+ %158 = OpTypeFunction %void
%int_1 = OpConstant %int 1
- %139 = OpConstantComposite %v2int %int_1 %int_1
+ %163 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v2int = OpTypePointer Function %v2int
- %142 = OpConstantNull %v2int
+ %166 = OpConstantNull %v2int
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
-%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
- %157 = OpTypeFunction %v4float
+ %180 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %26
%v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams
@@ -210,109 +212,130 @@
%coord = OpFunctionParameter %v2int
%params_0 = OpFunctionParameter %ExternalTextureParams
%76 = OpLabel
- %color = OpVariable %_ptr_Function_v3float Function %46
+ %color = OpVariable %_ptr_Function_v4float Function %5
%80 = OpShiftRightArithmetic %v2int %coord %79
- %82 = OpCompositeExtract %uint %params_0 0
- %83 = OpIEqual %bool %82 %uint_1
- OpSelectionMerge %84 None
- OpBranchConditional %83 %85 %86
- %85 = OpLabel
- %87 = OpImageFetch %v4float %plane0 %coord Lod %88
- %89 = OpVectorShuffle %v3float %87 %87 0 1 2
- OpStore %color %89
- OpBranch %84
+ %83 = OpCompositeExtract %uint %params_0 0
+ %84 = OpIEqual %bool %83 %uint_1
+ OpSelectionMerge %85 None
+ OpBranchConditional %84 %86 %87
%86 = OpLabel
- %90 = OpImageFetch %v4float %plane0 %coord Lod %88
- %91 = OpCompositeExtract %float %90 0
- %92 = OpImageFetch %v4float %plane1 %80 Lod %88
- %93 = OpVectorShuffle %v2float %92 %92 0 1
- %94 = OpCompositeExtract %float %93 0
- %95 = OpCompositeExtract %float %93 1
- %97 = OpCompositeConstruct %v4float %91 %94 %95 %float_1
- %98 = OpCompositeExtract %mat3v4float %params_0 2
- %99 = OpVectorTimesMatrix %v3float %97 %98
- OpStore %color %99
- OpBranch %84
- %84 = OpLabel
- %100 = OpCompositeExtract %uint %params_0 1
- %102 = OpIEqual %bool %100 %101
- OpSelectionMerge %103 None
- OpBranchConditional %102 %104 %103
- %104 = OpLabel
- %106 = OpLoad %v3float %color
- %107 = OpCompositeExtract %GammaTransferParams %params_0 3
- %105 = OpFunctionCall %v3float %gammaCorrection %106 %107
- OpStore %color %105
- %108 = OpCompositeExtract %mat3v3float %params_0 5
- %109 = OpLoad %v3float %color
- %110 = OpMatrixTimesVector %v3float %108 %109
- OpStore %color %110
- %112 = OpLoad %v3float %color
- %113 = OpCompositeExtract %GammaTransferParams %params_0 4
- %111 = OpFunctionCall %v3float %gammaCorrection %112 %113
- OpStore %color %111
- OpBranch %103
- %103 = OpLabel
- %114 = OpLoad %v3float %color
- %115 = OpCompositeExtract %float %114 0
- %116 = OpCompositeExtract %float %114 1
- %117 = OpCompositeExtract %float %114 2
- %118 = OpCompositeConstruct %v4float %115 %116 %117 %float_1
- OpReturnValue %118
+ %88 = OpImageFetch %v4float %plane0 %coord Lod %89
+ %90 = OpVectorShuffle %v4float %88 %88 0 1 2 3
+ OpStore %color %90
+ OpBranch %85
+ %87 = OpLabel
+ %91 = OpImageFetch %v4float %plane0 %coord Lod %89
+ %92 = OpCompositeExtract %float %91 0
+ %93 = OpImageFetch %v4float %plane1 %80 Lod %89
+ %94 = OpVectorShuffle %v2float %93 %93 0 1
+ %95 = OpCompositeExtract %float %94 0
+ %96 = OpCompositeExtract %float %94 1
+ %98 = OpCompositeConstruct %v4float %92 %95 %96 %float_1
+ %99 = OpCompositeExtract %mat3v4float %params_0 2
+ %100 = OpVectorTimesMatrix %v3float %98 %99
+ %101 = OpCompositeExtract %float %100 0
+ %102 = OpCompositeExtract %float %100 1
+ %103 = OpCompositeExtract %float %100 2
+ %104 = OpCompositeConstruct %v4float %101 %102 %103 %float_1
+ OpStore %color %104
+ OpBranch %85
+ %85 = OpLabel
+ %105 = OpCompositeExtract %uint %params_0 1
+ %107 = OpIEqual %bool %105 %106
+ OpSelectionMerge %108 None
+ OpBranchConditional %107 %109 %108
+ %109 = OpLabel
+ %111 = OpLoad %v4float %color
+ %112 = OpVectorShuffle %v3float %111 %111 0 1 2
+ %113 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %110 = OpFunctionCall %v3float %gammaCorrection %112 %113
+ %114 = OpCompositeExtract %float %110 0
+ %115 = OpCompositeExtract %float %110 1
+ %116 = OpCompositeExtract %float %110 2
+ %119 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %120 = OpLoad %float %119
+ %121 = OpCompositeConstruct %v4float %114 %115 %116 %120
+ OpStore %color %121
+ %122 = OpCompositeExtract %mat3v3float %params_0 5
+ %123 = OpLoad %v4float %color
+ %124 = OpVectorShuffle %v3float %123 %123 0 1 2
+ %125 = OpMatrixTimesVector %v3float %122 %124
+ %126 = OpCompositeExtract %float %125 0
+ %127 = OpCompositeExtract %float %125 1
+ %128 = OpCompositeExtract %float %125 2
+ %129 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %130 = OpLoad %float %129
+ %131 = OpCompositeConstruct %v4float %126 %127 %128 %130
+ OpStore %color %131
+ %133 = OpLoad %v4float %color
+ %134 = OpVectorShuffle %v3float %133 %133 0 1 2
+ %135 = OpCompositeExtract %GammaTransferParams %params_0 4
+ %132 = OpFunctionCall %v3float %gammaCorrection %134 %135
+ %136 = OpCompositeExtract %float %132 0
+ %137 = OpCompositeExtract %float %132 1
+ %138 = OpCompositeExtract %float %132 2
+ %139 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %140 = OpLoad %float %139
+ %141 = OpCompositeConstruct %v4float %136 %137 %138 %140
+ OpStore %color %141
+ OpBranch %108
+ %108 = OpLabel
+ %142 = OpLoad %v4float %color
+ OpReturnValue %142
OpFunctionEnd
-%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %119
+%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %143
%val = OpFunctionParameter %ExternalTextureParams_std140
- %122 = OpLabel
- %123 = OpCompositeExtract %uint %val 0
- %124 = OpCompositeExtract %uint %val 1
- %125 = OpCompositeExtract %mat3v4float %val 2
- %126 = OpCompositeExtract %GammaTransferParams %val 3
- %127 = OpCompositeExtract %GammaTransferParams %val 4
- %128 = OpCompositeExtract %mat3v3float %val 5
- %129 = OpCompositeExtract %v2float %val 6
- %130 = OpCompositeExtract %v2float %val 7
- %131 = OpCompositeExtract %v2float %val 8
- %132 = OpCompositeConstruct %mat3v2float %129 %130 %131
- %133 = OpCompositeConstruct %ExternalTextureParams %123 %124 %125 %126 %127 %128 %132
- OpReturnValue %133
+ %146 = OpLabel
+ %147 = OpCompositeExtract %uint %val 0
+ %148 = OpCompositeExtract %uint %val 1
+ %149 = OpCompositeExtract %mat3v4float %val 2
+ %150 = OpCompositeExtract %GammaTransferParams %val 3
+ %151 = OpCompositeExtract %GammaTransferParams %val 4
+ %152 = OpCompositeExtract %mat3v3float %val 5
+ %153 = OpCompositeExtract %v2float %val 6
+ %154 = OpCompositeExtract %v2float %val 7
+ %155 = OpCompositeExtract %v2float %val 8
+ %156 = OpCompositeConstruct %mat3v2float %153 %154 %155
+ %157 = OpCompositeConstruct %ExternalTextureParams %147 %148 %149 %150 %151 %152 %156
+ OpReturnValue %157
OpFunctionEnd
-%textureLoad_8acf41 = OpFunction %void None %134
- %137 = OpLabel
- %arg_1 = OpVariable %_ptr_Function_v2int Function %142
+%textureLoad_8acf41 = OpFunction %void None %158
+ %161 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %166
%res = OpVariable %_ptr_Function_v4float Function %5
- OpStore %arg_1 %139
- %144 = OpLoad %11 %arg_0
- %145 = OpLoad %11 %ext_tex_plane_1
- %146 = OpLoad %v2int %arg_1
- %150 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
- %151 = OpLoad %ExternalTextureParams_std140 %150
- %147 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %151
- %143 = OpFunctionCall %v4float %textureLoadExternal %144 %145 %146 %147
- OpStore %res %143
- %155 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
- %156 = OpLoad %v4float %res
- OpStore %155 %156
+ OpStore %arg_1 %163
+ %168 = OpLoad %11 %arg_0
+ %169 = OpLoad %11 %ext_tex_plane_1
+ %170 = OpLoad %v2int %arg_1
+ %174 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
+ %175 = OpLoad %ExternalTextureParams_std140 %174
+ %171 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %175
+ %167 = OpFunctionCall %v4float %textureLoadExternal %168 %169 %170 %171
+ OpStore %res %167
+ %178 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
+ %179 = OpLoad %v4float %res
+ OpStore %178 %179
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %157
- %159 = OpLabel
- %160 = OpFunctionCall %void %textureLoad_8acf41
+%vertex_main_inner = OpFunction %v4float None %180
+ %182 = OpLabel
+ %183 = OpFunctionCall %void %textureLoad_8acf41
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %134
- %162 = OpLabel
- %163 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %163
+%vertex_main = OpFunction %void None %158
+ %185 = OpLabel
+ %186 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %186
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %134
- %165 = OpLabel
- %166 = OpFunctionCall %void %textureLoad_8acf41
+%fragment_main = OpFunction %void None %158
+ %188 = OpLabel
+ %189 = OpFunctionCall %void %textureLoad_8acf41
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %134
- %168 = OpLabel
- %169 = OpFunctionCall %void %textureLoad_8acf41
+%compute_main = OpFunction %void None %158
+ %191 = OpLabel
+ %192 = OpFunctionCall %void %textureLoad_8acf41
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.dxc.hlsl
index 5880e0b..e62aa1b 100644
--- a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.dxc.hlsl
@@ -44,18 +44,18 @@
const float2 plane1_dims = float2(tint_tmp_1.xy);
const float2 plane1_half_texel = ((0.5f).xx / plane1_dims);
const float2 plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.SampleLevel(smp, plane0_clamped, 0.0f).rgb;
+ color = plane0.SampleLevel(smp, plane0_clamped, 0.0f).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, plane0_clamped, 0.0f).r, plane1.SampleLevel(smp, plane1_clamped, 0.0f).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, plane0_clamped, 0.0f).r, plane1.SampleLevel(smp, plane1_clamped, 0.0f).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.fxc.hlsl
index 5880e0b..e62aa1b 100644
--- a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.fxc.hlsl
@@ -44,18 +44,18 @@
const float2 plane1_dims = float2(tint_tmp_1.xy);
const float2 plane1_half_texel = ((0.5f).xx / plane1_dims);
const float2 plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.SampleLevel(smp, plane0_clamped, 0.0f).rgb;
+ color = plane0.SampleLevel(smp, plane0_clamped, 0.0f).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, plane0_clamped, 0.0f).r, plane1.SampleLevel(smp, plane1_clamped, 0.0f).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, plane0_clamped, 0.0f).r, plane1.SampleLevel(smp, plane1_clamped, 0.0f).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float3x4 ext_tex_params_load_2(uint offset) {
diff --git a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
index b1920e7..e23a64b 100644
--- a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl
@@ -66,18 +66,18 @@
vec2 plane1_dims = vec2(uvec2(textureSize(plane1_1, 0)));
vec2 plane1_half_texel = (vec2(0.5f) / plane1_dims);
vec2 plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgb;
+ color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgba;
} else {
- color = (vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -180,18 +180,18 @@
vec2 plane1_dims = vec2(uvec2(textureSize(plane1_1, 0)));
vec2 plane1_half_texel = (vec2(0.5f) / plane1_dims);
vec2 plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgb;
+ color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgba;
} else {
- color = (vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
@@ -288,18 +288,18 @@
vec2 plane1_dims = vec2(uvec2(textureSize(plane1_1, 0)));
vec2 plane1_half_texel = (vec2(0.5f) / plane1_dims);
vec2 plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgb;
+ color = textureLod(plane0_smp, plane0_clamped, 0.0f).rgba;
} else {
- color = (vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(textureLod(plane0_smp, plane0_clamped, 0.0f).r, textureLod(plane1_smp, plane1_clamped, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
uniform highp sampler2D arg_0_1;
diff --git a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.msl
index dbe6998..a3ba7fd 100644
--- a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.msl
@@ -87,18 +87,18 @@
float2 const plane1_dims = float2(uint2(plane1.get_width(0), plane1.get_height(0)));
float2 const plane1_half_texel = (float2(0.5f) / plane1_dims);
float2 const plane1_clamped = clamp(modifiedCoords, plane1_half_texel, (1.0f - plane1_half_texel));
- float3 color = 0.0f;
+ float4 color = 0.0f;
if ((params.numPlanes == 1u)) {
- color = plane0.sample(smp, plane0_clamped, level(0.0f)).rgb;
+ color = plane0.sample(smp, plane0_clamped, level(0.0f)).rgba;
} else {
- color = (float4(plane0.sample(smp, plane0_clamped, level(0.0f))[0], plane1.sample(smp, plane1_clamped, level(0.0f)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = float4((float4(plane0.sample(smp, plane0_clamped, level(0.0f))[0], plane1.sample(smp, plane1_clamped, level(0.0f)).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color[3]);
+ color = float4((params.gamutConversionMatrix * color.rgb), color[3]);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color[3]);
}
- return float4(color, 1.0f);
+ return color;
}
void textureSampleBaseClampToEdge_7c04e6(texture2d<float, access::sample> tint_symbol_1, texture2d<float, access::sample> tint_symbol_2, sampler tint_symbol_3, const constant ExternalTextureParams_tint_packed_vec3* const tint_symbol_4, device float4* const tint_symbol_5) {
diff --git a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.spvasm
index 6cdb21d..2d2e059 100644
--- a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 196
+; Bound: 219
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
@@ -164,18 +164,20 @@
%91 = OpConstantComposite %v2float %float_0_5 %float_0_5
%_ptr_Function_v2float = OpTypePointer Function %v2float
%97 = OpConstantNull %v2float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
%uint_1 = OpConstant %uint 1
- %114 = OpTypeSampledImage %11
- %129 = OpConstantNull %uint
- %147 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
+ %115 = OpTypeSampledImage %11
+ %134 = OpConstantNull %uint
+ %uint_3 = OpConstant %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %171 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid
- %162 = OpTypeFunction %void
- %166 = OpConstantComposite %v2float %float_1 %float_1
+ %186 = OpTypeFunction %void
+ %190 = OpConstantComposite %v2float %float_1 %float_1
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
-%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
- %183 = OpTypeFunction %v4float
+ %206 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %29
%v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams
@@ -221,7 +223,7 @@
%78 = OpLabel
%95 = OpVariable %_ptr_Function_v2float Function %97
%104 = OpVariable %_ptr_Function_v2float Function %97
- %color = OpVariable %_ptr_Function_v3float Function %49
+ %color = OpVariable %_ptr_Function_v4float Function %5
%79 = OpCompositeExtract %mat3v2float %params_0 6
%80 = OpCompositeExtract %float %coord 0
%81 = OpCompositeExtract %float %coord 1
@@ -239,111 +241,132 @@
%105 = OpCompositeConstruct %v2float %float_1 %float_1
%103 = OpFSub %v2float %105 %101
%102 = OpExtInst %v2float %35 NClamp %84 %101 %103
- %107 = OpCompositeExtract %uint %params_0 0
- %109 = OpIEqual %bool %107 %uint_1
- OpSelectionMerge %110 None
- OpBranchConditional %109 %111 %112
- %111 = OpLabel
- %115 = OpSampledImage %114 %plane0 %smp
- %113 = OpImageSampleExplicitLod %v4float %115 %93 Lod %8
- %116 = OpVectorShuffle %v3float %113 %113 0 1 2
- OpStore %color %116
- OpBranch %110
+ %108 = OpCompositeExtract %uint %params_0 0
+ %110 = OpIEqual %bool %108 %uint_1
+ OpSelectionMerge %111 None
+ OpBranchConditional %110 %112 %113
%112 = OpLabel
- %118 = OpSampledImage %114 %plane0 %smp
- %117 = OpImageSampleExplicitLod %v4float %118 %93 Lod %8
- %119 = OpCompositeExtract %float %117 0
- %121 = OpSampledImage %114 %plane1 %smp
- %120 = OpImageSampleExplicitLod %v4float %121 %102 Lod %8
- %122 = OpVectorShuffle %v2float %120 %120 0 1
- %123 = OpCompositeExtract %float %122 0
- %124 = OpCompositeExtract %float %122 1
- %125 = OpCompositeConstruct %v4float %119 %123 %124 %float_1
- %126 = OpCompositeExtract %mat3v4float %params_0 2
- %127 = OpVectorTimesMatrix %v3float %125 %126
- OpStore %color %127
- OpBranch %110
- %110 = OpLabel
- %128 = OpCompositeExtract %uint %params_0 1
- %130 = OpIEqual %bool %128 %129
- OpSelectionMerge %131 None
- OpBranchConditional %130 %132 %131
- %132 = OpLabel
- %134 = OpLoad %v3float %color
- %135 = OpCompositeExtract %GammaTransferParams %params_0 3
- %133 = OpFunctionCall %v3float %gammaCorrection %134 %135
- OpStore %color %133
- %136 = OpCompositeExtract %mat3v3float %params_0 5
- %137 = OpLoad %v3float %color
- %138 = OpMatrixTimesVector %v3float %136 %137
- OpStore %color %138
- %140 = OpLoad %v3float %color
- %141 = OpCompositeExtract %GammaTransferParams %params_0 4
- %139 = OpFunctionCall %v3float %gammaCorrection %140 %141
- OpStore %color %139
- OpBranch %131
- %131 = OpLabel
- %142 = OpLoad %v3float %color
- %143 = OpCompositeExtract %float %142 0
- %144 = OpCompositeExtract %float %142 1
- %145 = OpCompositeExtract %float %142 2
- %146 = OpCompositeConstruct %v4float %143 %144 %145 %float_1
- OpReturnValue %146
+ %116 = OpSampledImage %115 %plane0 %smp
+ %114 = OpImageSampleExplicitLod %v4float %116 %93 Lod %8
+ %117 = OpVectorShuffle %v4float %114 %114 0 1 2 3
+ OpStore %color %117
+ OpBranch %111
+ %113 = OpLabel
+ %119 = OpSampledImage %115 %plane0 %smp
+ %118 = OpImageSampleExplicitLod %v4float %119 %93 Lod %8
+ %120 = OpCompositeExtract %float %118 0
+ %122 = OpSampledImage %115 %plane1 %smp
+ %121 = OpImageSampleExplicitLod %v4float %122 %102 Lod %8
+ %123 = OpVectorShuffle %v2float %121 %121 0 1
+ %124 = OpCompositeExtract %float %123 0
+ %125 = OpCompositeExtract %float %123 1
+ %126 = OpCompositeConstruct %v4float %120 %124 %125 %float_1
+ %127 = OpCompositeExtract %mat3v4float %params_0 2
+ %128 = OpVectorTimesMatrix %v3float %126 %127
+ %129 = OpCompositeExtract %float %128 0
+ %130 = OpCompositeExtract %float %128 1
+ %131 = OpCompositeExtract %float %128 2
+ %132 = OpCompositeConstruct %v4float %129 %130 %131 %float_1
+ OpStore %color %132
+ OpBranch %111
+ %111 = OpLabel
+ %133 = OpCompositeExtract %uint %params_0 1
+ %135 = OpIEqual %bool %133 %134
+ OpSelectionMerge %136 None
+ OpBranchConditional %135 %137 %136
+ %137 = OpLabel
+ %139 = OpLoad %v4float %color
+ %140 = OpVectorShuffle %v3float %139 %139 0 1 2
+ %141 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %138 = OpFunctionCall %v3float %gammaCorrection %140 %141
+ %142 = OpCompositeExtract %float %138 0
+ %143 = OpCompositeExtract %float %138 1
+ %144 = OpCompositeExtract %float %138 2
+ %147 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %148 = OpLoad %float %147
+ %149 = OpCompositeConstruct %v4float %142 %143 %144 %148
+ OpStore %color %149
+ %150 = OpCompositeExtract %mat3v3float %params_0 5
+ %151 = OpLoad %v4float %color
+ %152 = OpVectorShuffle %v3float %151 %151 0 1 2
+ %153 = OpMatrixTimesVector %v3float %150 %152
+ %154 = OpCompositeExtract %float %153 0
+ %155 = OpCompositeExtract %float %153 1
+ %156 = OpCompositeExtract %float %153 2
+ %157 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %158 = OpLoad %float %157
+ %159 = OpCompositeConstruct %v4float %154 %155 %156 %158
+ OpStore %color %159
+ %161 = OpLoad %v4float %color
+ %162 = OpVectorShuffle %v3float %161 %161 0 1 2
+ %163 = OpCompositeExtract %GammaTransferParams %params_0 4
+ %160 = OpFunctionCall %v3float %gammaCorrection %162 %163
+ %164 = OpCompositeExtract %float %160 0
+ %165 = OpCompositeExtract %float %160 1
+ %166 = OpCompositeExtract %float %160 2
+ %167 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %168 = OpLoad %float %167
+ %169 = OpCompositeConstruct %v4float %164 %165 %166 %168
+ OpStore %color %169
+ OpBranch %136
+ %136 = OpLabel
+ %170 = OpLoad %v4float %color
+ OpReturnValue %170
OpFunctionEnd
-%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %147
+%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %171
%val = OpFunctionParameter %ExternalTextureParams_std140
- %150 = OpLabel
- %151 = OpCompositeExtract %uint %val 0
- %152 = OpCompositeExtract %uint %val 1
- %153 = OpCompositeExtract %mat3v4float %val 2
- %154 = OpCompositeExtract %GammaTransferParams %val 3
- %155 = OpCompositeExtract %GammaTransferParams %val 4
- %156 = OpCompositeExtract %mat3v3float %val 5
- %157 = OpCompositeExtract %v2float %val 6
- %158 = OpCompositeExtract %v2float %val 7
- %159 = OpCompositeExtract %v2float %val 8
- %160 = OpCompositeConstruct %mat3v2float %157 %158 %159
- %161 = OpCompositeConstruct %ExternalTextureParams %151 %152 %153 %154 %155 %156 %160
- OpReturnValue %161
+ %174 = OpLabel
+ %175 = OpCompositeExtract %uint %val 0
+ %176 = OpCompositeExtract %uint %val 1
+ %177 = OpCompositeExtract %mat3v4float %val 2
+ %178 = OpCompositeExtract %GammaTransferParams %val 3
+ %179 = OpCompositeExtract %GammaTransferParams %val 4
+ %180 = OpCompositeExtract %mat3v3float %val 5
+ %181 = OpCompositeExtract %v2float %val 6
+ %182 = OpCompositeExtract %v2float %val 7
+ %183 = OpCompositeExtract %v2float %val 8
+ %184 = OpCompositeConstruct %mat3v2float %181 %182 %183
+ %185 = OpCompositeConstruct %ExternalTextureParams %175 %176 %177 %178 %179 %180 %184
+ OpReturnValue %185
OpFunctionEnd
-%textureSampleBaseClampToEdge_7c04e6 = OpFunction %void None %162
- %165 = OpLabel
+%textureSampleBaseClampToEdge_7c04e6 = OpFunction %void None %186
+ %189 = OpLabel
%arg_2 = OpVariable %_ptr_Function_v2float Function %97
%res = OpVariable %_ptr_Function_v4float Function %5
- OpStore %arg_2 %166
- %169 = OpLoad %11 %arg_0
- %170 = OpLoad %11 %ext_tex_plane_1
- %171 = OpLoad %25 %arg_1
- %172 = OpLoad %v2float %arg_2
- %176 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
- %177 = OpLoad %ExternalTextureParams_std140 %176
- %173 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %177
- %168 = OpFunctionCall %v4float %textureSampleExternal %169 %170 %171 %172 %173
- OpStore %res %168
- %181 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
- %182 = OpLoad %v4float %res
- OpStore %181 %182
+ OpStore %arg_2 %190
+ %193 = OpLoad %11 %arg_0
+ %194 = OpLoad %11 %ext_tex_plane_1
+ %195 = OpLoad %25 %arg_1
+ %196 = OpLoad %v2float %arg_2
+ %200 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
+ %201 = OpLoad %ExternalTextureParams_std140 %200
+ %197 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %201
+ %192 = OpFunctionCall %v4float %textureSampleExternal %193 %194 %195 %196 %197
+ OpStore %res %192
+ %204 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
+ %205 = OpLoad %v4float %res
+ OpStore %204 %205
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %183
- %185 = OpLabel
- %186 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
+%vertex_main_inner = OpFunction %v4float None %206
+ %208 = OpLabel
+ %209 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %162
- %188 = OpLabel
- %189 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %189
+%vertex_main = OpFunction %void None %186
+ %211 = OpLabel
+ %212 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %212
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %162
- %191 = OpLabel
- %192 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
+%fragment_main = OpFunction %void None %186
+ %214 = OpLabel
+ %215 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %162
- %194 = OpLabel
- %195 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
+%compute_main = OpFunction %void None %186
+ %217 = OpLabel
+ %218 = OpFunctionCall %void %textureSampleBaseClampToEdge_7c04e6
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.dxc.hlsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.dxc.hlsl
index 6feb649..3703a12 100644
--- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.dxc.hlsl
@@ -33,18 +33,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(int3(coord, 0)).rgb;
+ color = plane0.Load(int3(coord, 0)).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float4 textureLoad2d(Texture2D<float4> tint_symbol, Texture2D<float4> ext_tex_plane_1_1, ExternalTextureParams ext_tex_params_1, int2 coords) {
diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.fxc.hlsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.fxc.hlsl
index 6feb649..3703a12 100644
--- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.fxc.hlsl
@@ -33,18 +33,18 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
- float3 color = float3(0.0f, 0.0f, 0.0f);
+ float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(int3(coord, 0)).rgb;
+ color = plane0.Load(int3(coord, 0)).rgba;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
+ color = float4(mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f)), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = mul(color, params.gamutConversionMatrix);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = float4(mul(color.rgb, params.gamutConversionMatrix), color.a);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return float4(color, 1.0f);
+ return color;
}
float4 textureLoad2d(Texture2D<float4> tint_symbol, Texture2D<float4> ext_tex_plane_1_1, ExternalTextureParams ext_tex_params_1, int2 coords) {
diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl
index b1f3084..24cd2b1 100644
--- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl
+++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl
@@ -59,18 +59,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, coord, 0).rgb;
+ color = texelFetch(plane0_1, coord, 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_1_1_1, ExternalTextureParams ext_tex_params_1, ivec2 coords) {
@@ -162,18 +162,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, coord, 0).rgb;
+ color = texelFetch(plane0_1, coord, 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_1_1_1, ExternalTextureParams ext_tex_params_1, ivec2 coords) {
@@ -259,18 +259,18 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
- vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, coord, 0).rgb;
+ color = texelFetch(plane0_1, coord, 0).rgba;
} else {
- color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = vec4((vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = vec4(gammaCorrection(color.rgb, params.gammaDecodeParams), color.a);
+ color = vec4((params.gamutConversionMatrix * color.rgb), color.a);
+ color = vec4(gammaCorrection(color.rgb, params.gammaEncodeParams), color.a);
}
- return vec4(color, 1.0f);
+ return color;
}
vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_1_1_1, ExternalTextureParams ext_tex_params_1, ivec2 coords) {
diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.msl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.msl
index 08cc5d5..5c92b89 100644
--- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.msl
+++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.msl
@@ -81,18 +81,18 @@
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) {
int2 const coord1 = (coord >> uint2(1u));
- float3 color = 0.0f;
+ float4 color = 0.0f;
if ((params.numPlanes == 1u)) {
- color = plane0.read(uint2(coord), 0).rgb;
+ color = plane0.read(uint2(coord), 0).rgba;
} else {
- color = (float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = float4((float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix), 1.0f);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
- color = gammaCorrection(color, params.gammaDecodeParams);
- color = (params.gamutConversionMatrix * color);
- color = gammaCorrection(color, params.gammaEncodeParams);
+ color = float4(gammaCorrection(color.rgb, params.gammaDecodeParams), color[3]);
+ color = float4((params.gamutConversionMatrix * color.rgb), color[3]);
+ color = float4(gammaCorrection(color.rgb, params.gammaEncodeParams), color[3]);
}
- return float4(color, 1.0f);
+ return color;
}
float4 textureLoad2d(texture2d<float, access::sample> tint_symbol, texture2d<float, access::sample> ext_tex_plane_1_1, ExternalTextureParams ext_tex_params_1, int2 coords) {
diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.spvasm b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.spvasm
index 61528e5..4edaa6c 100644
--- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.spvasm
+++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 167
+; Bound: 190
; Schema: 0
OpCapability Shader
%29 = OpExtInstImport "GLSL.std.450"
@@ -147,18 +147,20 @@
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
%76 = OpConstantComposite %v2uint %uint_1 %uint_1
- %85 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %86 = OpConstantNull %int
%float_1 = OpConstant %float 1
- %98 = OpConstantNull %uint
- %116 = OpTypeFunction %v4float %11 %11 %ExternalTextureParams %v2int
- %124 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
+ %103 = OpConstantNull %uint
+ %uint_3 = OpConstant %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %140 = OpTypeFunction %v4float %11 %11 %ExternalTextureParams %v2int
+ %148 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid
- %139 = OpTypeFunction %void
+ %163 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
- %151 = OpConstantNull %v2int
-%_ptr_Function_v4float = OpTypePointer Function %v4float
- %154 = OpTypeFunction %v4float
+ %175 = OpConstantNull %v2int
+ %177 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %23
%v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams
@@ -201,112 +203,133 @@
%coord = OpFunctionParameter %v2int
%params_0 = OpFunctionParameter %ExternalTextureParams
%73 = OpLabel
- %color = OpVariable %_ptr_Function_v3float Function %43
+ %color = OpVariable %_ptr_Function_v4float Function %5
%77 = OpShiftRightArithmetic %v2int %coord %76
- %79 = OpCompositeExtract %uint %params_0 0
- %80 = OpIEqual %bool %79 %uint_1
- OpSelectionMerge %81 None
- OpBranchConditional %80 %82 %83
- %82 = OpLabel
- %84 = OpImageFetch %v4float %plane0 %coord Lod %85
- %86 = OpVectorShuffle %v3float %84 %84 0 1 2
- OpStore %color %86
- OpBranch %81
+ %80 = OpCompositeExtract %uint %params_0 0
+ %81 = OpIEqual %bool %80 %uint_1
+ OpSelectionMerge %82 None
+ OpBranchConditional %81 %83 %84
%83 = OpLabel
- %87 = OpImageFetch %v4float %plane0 %coord Lod %85
- %88 = OpCompositeExtract %float %87 0
- %89 = OpImageFetch %v4float %plane1 %77 Lod %85
- %90 = OpVectorShuffle %v2float %89 %89 0 1
- %91 = OpCompositeExtract %float %90 0
- %92 = OpCompositeExtract %float %90 1
- %94 = OpCompositeConstruct %v4float %88 %91 %92 %float_1
- %95 = OpCompositeExtract %mat3v4float %params_0 2
- %96 = OpVectorTimesMatrix %v3float %94 %95
- OpStore %color %96
- OpBranch %81
- %81 = OpLabel
- %97 = OpCompositeExtract %uint %params_0 1
- %99 = OpIEqual %bool %97 %98
- OpSelectionMerge %100 None
- OpBranchConditional %99 %101 %100
- %101 = OpLabel
- %103 = OpLoad %v3float %color
- %104 = OpCompositeExtract %GammaTransferParams %params_0 3
- %102 = OpFunctionCall %v3float %gammaCorrection %103 %104
- OpStore %color %102
- %105 = OpCompositeExtract %mat3v3float %params_0 5
- %106 = OpLoad %v3float %color
- %107 = OpMatrixTimesVector %v3float %105 %106
- OpStore %color %107
- %109 = OpLoad %v3float %color
- %110 = OpCompositeExtract %GammaTransferParams %params_0 4
- %108 = OpFunctionCall %v3float %gammaCorrection %109 %110
- OpStore %color %108
- OpBranch %100
- %100 = OpLabel
- %111 = OpLoad %v3float %color
- %112 = OpCompositeExtract %float %111 0
- %113 = OpCompositeExtract %float %111 1
- %114 = OpCompositeExtract %float %111 2
- %115 = OpCompositeConstruct %v4float %112 %113 %114 %float_1
- OpReturnValue %115
+ %85 = OpImageFetch %v4float %plane0 %coord Lod %86
+ %87 = OpVectorShuffle %v4float %85 %85 0 1 2 3
+ OpStore %color %87
+ OpBranch %82
+ %84 = OpLabel
+ %88 = OpImageFetch %v4float %plane0 %coord Lod %86
+ %89 = OpCompositeExtract %float %88 0
+ %90 = OpImageFetch %v4float %plane1 %77 Lod %86
+ %91 = OpVectorShuffle %v2float %90 %90 0 1
+ %92 = OpCompositeExtract %float %91 0
+ %93 = OpCompositeExtract %float %91 1
+ %95 = OpCompositeConstruct %v4float %89 %92 %93 %float_1
+ %96 = OpCompositeExtract %mat3v4float %params_0 2
+ %97 = OpVectorTimesMatrix %v3float %95 %96
+ %98 = OpCompositeExtract %float %97 0
+ %99 = OpCompositeExtract %float %97 1
+ %100 = OpCompositeExtract %float %97 2
+ %101 = OpCompositeConstruct %v4float %98 %99 %100 %float_1
+ OpStore %color %101
+ OpBranch %82
+ %82 = OpLabel
+ %102 = OpCompositeExtract %uint %params_0 1
+ %104 = OpIEqual %bool %102 %103
+ OpSelectionMerge %105 None
+ OpBranchConditional %104 %106 %105
+ %106 = OpLabel
+ %108 = OpLoad %v4float %color
+ %109 = OpVectorShuffle %v3float %108 %108 0 1 2
+ %110 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %107 = OpFunctionCall %v3float %gammaCorrection %109 %110
+ %111 = OpCompositeExtract %float %107 0
+ %112 = OpCompositeExtract %float %107 1
+ %113 = OpCompositeExtract %float %107 2
+ %116 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %117 = OpLoad %float %116
+ %118 = OpCompositeConstruct %v4float %111 %112 %113 %117
+ OpStore %color %118
+ %119 = OpCompositeExtract %mat3v3float %params_0 5
+ %120 = OpLoad %v4float %color
+ %121 = OpVectorShuffle %v3float %120 %120 0 1 2
+ %122 = OpMatrixTimesVector %v3float %119 %121
+ %123 = OpCompositeExtract %float %122 0
+ %124 = OpCompositeExtract %float %122 1
+ %125 = OpCompositeExtract %float %122 2
+ %126 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %127 = OpLoad %float %126
+ %128 = OpCompositeConstruct %v4float %123 %124 %125 %127
+ OpStore %color %128
+ %130 = OpLoad %v4float %color
+ %131 = OpVectorShuffle %v3float %130 %130 0 1 2
+ %132 = OpCompositeExtract %GammaTransferParams %params_0 4
+ %129 = OpFunctionCall %v3float %gammaCorrection %131 %132
+ %133 = OpCompositeExtract %float %129 0
+ %134 = OpCompositeExtract %float %129 1
+ %135 = OpCompositeExtract %float %129 2
+ %136 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %137 = OpLoad %float %136
+ %138 = OpCompositeConstruct %v4float %133 %134 %135 %137
+ OpStore %color %138
+ OpBranch %105
+ %105 = OpLabel
+ %139 = OpLoad %v4float %color
+ OpReturnValue %139
OpFunctionEnd
-%textureLoad2d = OpFunction %v4float None %116
+%textureLoad2d = OpFunction %v4float None %140
%texture = OpFunctionParameter %11
%ext_tex_plane_1_1 = OpFunctionParameter %11
%ext_tex_params_1 = OpFunctionParameter %ExternalTextureParams
%coords = OpFunctionParameter %v2int
- %122 = OpLabel
- %123 = OpFunctionCall %v4float %textureLoadExternal %texture %ext_tex_plane_1_1 %coords %ext_tex_params_1
- OpReturnValue %123
+ %146 = OpLabel
+ %147 = OpFunctionCall %v4float %textureLoadExternal %texture %ext_tex_plane_1_1 %coords %ext_tex_params_1
+ OpReturnValue %147
OpFunctionEnd
-%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %124
+%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %148
%val = OpFunctionParameter %ExternalTextureParams_std140
- %127 = OpLabel
- %128 = OpCompositeExtract %uint %val 0
- %129 = OpCompositeExtract %uint %val 1
- %130 = OpCompositeExtract %mat3v4float %val 2
- %131 = OpCompositeExtract %GammaTransferParams %val 3
- %132 = OpCompositeExtract %GammaTransferParams %val 4
- %133 = OpCompositeExtract %mat3v3float %val 5
- %134 = OpCompositeExtract %v2float %val 6
- %135 = OpCompositeExtract %v2float %val 7
- %136 = OpCompositeExtract %v2float %val 8
- %137 = OpCompositeConstruct %mat3v2float %134 %135 %136
- %138 = OpCompositeConstruct %ExternalTextureParams %128 %129 %130 %131 %132 %133 %137
- OpReturnValue %138
+ %151 = OpLabel
+ %152 = OpCompositeExtract %uint %val 0
+ %153 = OpCompositeExtract %uint %val 1
+ %154 = OpCompositeExtract %mat3v4float %val 2
+ %155 = OpCompositeExtract %GammaTransferParams %val 3
+ %156 = OpCompositeExtract %GammaTransferParams %val 4
+ %157 = OpCompositeExtract %mat3v3float %val 5
+ %158 = OpCompositeExtract %v2float %val 6
+ %159 = OpCompositeExtract %v2float %val 7
+ %160 = OpCompositeExtract %v2float %val 8
+ %161 = OpCompositeConstruct %mat3v2float %158 %159 %160
+ %162 = OpCompositeConstruct %ExternalTextureParams %152 %153 %154 %155 %156 %157 %161
+ OpReturnValue %162
OpFunctionEnd
-%doTextureLoad = OpFunction %void None %139
- %142 = OpLabel
+%doTextureLoad = OpFunction %void None %163
+ %166 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %144 = OpLoad %11 %arg_0
- %145 = OpLoad %11 %ext_tex_plane_1
- %149 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
- %150 = OpLoad %ExternalTextureParams_std140 %149
- %146 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %150
- %143 = OpFunctionCall %v4float %textureLoad2d %144 %145 %146 %151
- OpStore %res %143
+ %168 = OpLoad %11 %arg_0
+ %169 = OpLoad %11 %ext_tex_plane_1
+ %173 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
+ %174 = OpLoad %ExternalTextureParams_std140 %173
+ %170 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %174
+ %167 = OpFunctionCall %v4float %textureLoad2d %168 %169 %170 %175
+ OpStore %res %167
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %154
- %156 = OpLabel
- %157 = OpFunctionCall %void %doTextureLoad
+%vertex_main_inner = OpFunction %v4float None %177
+ %179 = OpLabel
+ %180 = OpFunctionCall %void %doTextureLoad
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %139
- %159 = OpLabel
- %160 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %160
+%vertex_main = OpFunction %void None %163
+ %182 = OpLabel
+ %183 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %183
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %139
- %162 = OpLabel
- %163 = OpFunctionCall %void %doTextureLoad
+%fragment_main = OpFunction %void None %163
+ %185 = OpLabel
+ %186 = OpFunctionCall %void %doTextureLoad
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %139
- %165 = OpLabel
- %166 = OpFunctionCall %void %doTextureLoad
+%compute_main = OpFunction %void None %163
+ %188 = OpLabel
+ %189 = OpFunctionCall %void %doTextureLoad
OpReturn
OpFunctionEnd