Fix more WGSL vector constructors

Constructor arguments need to match the vector element type.

Tint has new validation that now checks for this.

Bug: tint:632
Change-Id: Ifcb994260c167e326ce5c0776915d44954dd8aa9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44767
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Ben Clayton 2021-03-16 12:00:54 +00:00 committed by Commit Bot service account
parent 175a7eb826
commit e76a33b6eb
3 changed files with 7 additions and 7 deletions

View File

@ -999,7 +999,7 @@ TEST_P(BufferZeroInitTest, BoundAsUniformBuffer) {
[[group(0), binding(1)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[stage(compute)]] fn main() -> void {
if (all(ubo.value == vec4<u32>(0, 0, 0, 0))) {
if (all(ubo.value == vec4<u32>(0u, 0u, 0u, 0u))) {
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(0.0, 1.0, 0.0, 1.0));
} else {
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
@ -1041,7 +1041,7 @@ TEST_P(BufferZeroInitTest, BoundAsReadonlyStorageBuffer) {
[[group(0), binding(1)]] var outImage : [[access(write)]] texture_storage_2d<rgba8unorm>;
[[stage(compute)]] fn main() -> void {
if (all(ssbo.value == vec4<u32>(0, 0, 0, 0))) {
if (all(ssbo.value == vec4<u32>(0u, 0u, 0u, 0u))) {
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(0.0, 1.0, 0.0, 1.0));
} else {
textureStore(outImage, vec2<i32>(0, 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));

View File

@ -238,7 +238,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
[[stage(compute)]] fn main() -> void {
dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] +
vec4<u32>(0x1234, 0x1234, 0x1234, 0x1234);
vec4<u32>(0x1234u, 0x1234u, 0x1234u, 0x1234u);
}
)");
@ -306,7 +306,7 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPongInOnePass) {
[[stage(compute)]] fn main() -> void {
dst.data[GlobalInvocationID.x] = src.data[GlobalInvocationID.x] +
vec4<u32>(0x1234, 0x1234, 0x1234, 0x1234);
vec4<u32>(0x1234u, 0x1234u, 0x1234u, 0x1234u);
}
)");

View File

@ -208,8 +208,8 @@ class VertexFormatDeprecationTests : public DeprecationTests {
attribute += ";";
std::string attribAccess = dawn::VertexFormatNumComponents(vertexFormat) > 1
? "vec4<f32>(a.x, 0.0, 0.0, 1.0)"
: "vec4<f32>(a, 0.0, 0.0, 1.0)";
? "vec4<f32>(f32(a.x), 0.0, 0.0, 1.0)"
: "vec4<f32>(f32(a), 0.0, 0.0, 1.0)";
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, (attribute + R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
@ -272,4 +272,4 @@ DAWN_INSTANTIATE_TEST(VertexFormatDeprecationTests,
NullBackend(),
OpenGLBackend(),
OpenGLESBackend(),
VulkanBackend());
VulkanBackend());