Omit types in most WGSL `var` statements.

Bug: None
Change-Id: Id6ed10d98a550d912784b688c5473f67f1889a8c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/54882
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Corentin Wallez 2021-06-17 21:36:11 +00:00 committed by Dawn LUCI CQ
parent fecd5a5977
commit b86e45f8ca
32 changed files with 59 additions and 59 deletions

View File

@ -40,7 +40,7 @@ void init() {
[[stage(vertex)]] fn main(
[[builtin(vertex_index)]] VertexIndex : u32
) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>( 0.0, 0.5),
vec2<f32>(-0.5, -0.5),
vec2<f32>( 0.5, -0.5)

View File

@ -315,7 +315,7 @@ int main(int argc, const char* argv[]) {
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]] fn main([[builtin(vertex_index)]] VertexIndex : u32)
-> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>( 0.0, 0.5),
vec2<f32>(-0.5, -0.5),
vec2<f32>( 0.5, -0.5)

View File

@ -48,7 +48,7 @@ namespace dawn_native {
[[stage(vertex)]] fn main(
[[builtin(vertex_index)]] VertexIndex : u32
) -> VertexOutputs {
var texcoord : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var texcoord = array<vec2<f32>, 3>(
vec2<f32>(-0.5, 0.0),
vec2<f32>( 1.5, 0.0),
vec2<f32>( 0.5, 2.0));
@ -58,7 +58,7 @@ namespace dawn_native {
// Y component of scale is calculated by the copySizeHeight / textureHeight. Only
// flipY case can get negative number.
var flipY : bool = uniforms.u_scale.y < 0.0;
var flipY = uniforms.u_scale.y < 0.0;
// Texture coordinate takes top-left as origin point. We need to map the
// texture to triangle carefully.
@ -88,13 +88,13 @@ namespace dawn_native {
[[location(0)]] texcoord : vec2<f32>
) -> [[location(0)]] vec4<f32> {
// Clamp the texcoord and discard the out-of-bound pixels.
var clampedTexcoord : vec2<f32> =
var clampedTexcoord =
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
if (!all(clampedTexcoord == texcoord)) {
discard;
}
var srcColor : vec4<f32> = textureSample(myTexture, mySampler, texcoord);
var srcColor = textureSample(myTexture, mySampler, texcoord);
// Swizzling of texture formats when sampling / rendering is handled by the
// hardware so we don't need special logic in this shader. This is covered by tests.
return srcColor;

View File

@ -67,9 +67,9 @@ namespace dawn_native {
fn main([[builtin(global_invocation_id)]] GlobalInvocationID : vec3<u32>) {
if (GlobalInvocationID.x >= params.count) { return; }
var index : u32 = GlobalInvocationID.x + params.offset / sizeofTimestamp;
var index = GlobalInvocationID.x + params.offset / sizeofTimestamp;
var timestamp : Timestamp = timestamps.t[index];
var timestamp = timestamps.t[index];
// Return 0 for the unavailable value.
if (availability.v[GlobalInvocationID.x + params.first] == 0u) {
@ -79,8 +79,8 @@ namespace dawn_native {
}
// Multiply the values in timestamps buffer by the period.
var period : f32 = params.period;
var w : u32 = 0u;
var period = params.period;
var w = 0u;
// If the product of low 32-bits and the period does not exceed the maximum of u32,
// directly do the multiplication, otherwise, use two u32 to represent the high
@ -88,14 +88,14 @@ namespace dawn_native {
if (timestamp.low <= u32(f32(0xFFFFFFFFu) / period)) {
timestamps.t[index].low = u32(round(f32(timestamp.low) * period));
} else {
var lo : u32 = timestamp.low & 0xFFFFu;
var hi : u32 = timestamp.low >> 16u;
var lo = timestamp.low & 0xFFFFu;
var hi = timestamp.low >> 16u;
var t0 : u32 = u32(round(f32(lo) * period));
var t1 : u32 = u32(round(f32(hi) * period)) + (t0 >> 16u);
var t0 = u32(round(f32(lo) * period));
var t1 = u32(round(f32(hi) * period)) + (t0 >> 16u);
w = t1 >> 16u;
var result : u32 = t1 << 16u;
var result = t1 << 16u;
result = result | (t0 & 0xFFFFu);
timestamps.t[index].low = result;
}

View File

@ -1197,7 +1197,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData(
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 3.0, -1.0),
vec2<f32>(-1.0, 3.0));

View File

@ -48,7 +48,7 @@ class BindGroupTests : public DawnTest {
return utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0));
@ -165,12 +165,12 @@ TEST_P(BindGroupTests, ReusedUBO) {
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0));
var transform : mat2x2<f32> = mat2x2<f32>(vertexUbo.transform.xy, vertexUbo.transform.zw);
var transform = mat2x2<f32>(vertexUbo.transform.xy, vertexUbo.transform.zw);
return vec4<f32>(transform * pos[VertexIndex], 0.0, 1.0);
})");
@ -242,12 +242,12 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0));
var transform : mat2x2<f32> = mat2x2<f32>(vertexUbo.transform.xy, vertexUbo.transform.zw);
var transform = mat2x2<f32>(vertexUbo.transform.xy, vertexUbo.transform.zw);
return vec4<f32>(transform * pos[VertexIndex], 0.0, 1.0);
})");
@ -353,7 +353,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0));
@ -939,7 +939,7 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0));
@ -1091,7 +1091,7 @@ TEST_P(BindGroupTests, ReadonlyStorage) {
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0));

View File

@ -28,7 +28,7 @@ class ClipSpaceTest : public DawnTest {
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec3<f32>, 6> = array<vec3<f32>, 6>(
var pos = array<vec3<f32>, 6>(
vec3<f32>(-1.0, 1.0, 1.0),
vec3<f32>(-1.0, -1.0, 0.5),
vec3<f32>( 1.0, 1.0, 0.5),

View File

@ -37,7 +37,7 @@ class ColorStateTest : public DawnTest {
vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0),
vec2<f32>(3.0, -1.0),
vec2<f32>(-1.0, 3.0));

View File

@ -147,7 +147,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> VertexOut {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-3.0, 1.0),
vec2<f32>( 3.0, 1.0),
vec2<f32>( 0.0, -2.0)

View File

@ -28,7 +28,7 @@ class CullingTest : public DawnTest {
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-1.0, 1.0),
vec2<f32>(-1.0, 0.0),
vec2<f32>( 0.0, 1.0),

View File

@ -238,7 +238,7 @@ namespace {
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> VertexOut {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-1.0, 1.0),
vec2<f32>(-1.0, -1.0),
vec2<f32>(1.0, -1.0),

View File

@ -38,7 +38,7 @@ class DepthBiasTests : public DawnTest {
vertexSource = R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 1.0, -1.0),
vec2<f32>(-1.0, 1.0),
@ -54,7 +54,7 @@ class DepthBiasTests : public DawnTest {
vertexSource = R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec3<f32>, 6> = array<vec3<f32>, 6>(
var pos = array<vec3<f32>, 6>(
vec3<f32>(-1.0, -1.0, 0.0),
vec3<f32>( 1.0, -1.0, 0.0),
vec3<f32>(-1.0, 1.0, 0.5),

View File

@ -31,7 +31,7 @@ class DepthStencilCopyTests : public DawnTest {
mVertexModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 0.0, -1.0),
vec2<f32>(-1.0, 0.0),

View File

@ -64,7 +64,7 @@ class DepthStencilStateTest : public DawnTest {
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-1.0, 1.0),
vec2<f32>(-1.0, -1.0),
vec2<f32>( 1.0, -1.0), // front-facing

View File

@ -96,7 +96,7 @@ class DynamicBufferOffsetTests : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 0.0),
vec2<f32>(-1.0, 1.0),
vec2<f32>( 0.0, 1.0));

View File

@ -255,7 +255,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> VertexOut {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-2.0, -2.0),
vec2<f32>(-2.0, 2.0),
vec2<f32>( 2.0, -2.0),
@ -263,7 +263,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
vec2<f32>( 2.0, -2.0),
vec2<f32>( 2.0, 2.0));
var texCoord : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var texCoord = array<vec2<f32>, 6>(
vec2<f32>(0.0, 0.0),
vec2<f32>(0.0, 1.0),
vec2<f32>(1.0, 0.0),

View File

@ -225,7 +225,7 @@ class MultisampledRenderingTest : public DawnTest {
const char* vs = R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>( 1.0, -1.0)
@ -237,7 +237,7 @@ class MultisampledRenderingTest : public DawnTest {
const char* vsFlipped = R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0)

View File

@ -83,7 +83,7 @@ class OcclusionQueryTests : public QueryTests {
vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0),
vec2<f32>( 1.0, -1.0));

View File

@ -79,7 +79,7 @@ class RenderPassLoadOpTests : public DawnTest {
const char* vsSource = R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>( 0.0, -1.0),
vec2<f32>( 1.0, -1.0),
vec2<f32>( 0.0, 1.0),

View File

@ -29,7 +29,7 @@ class RenderPassTest : public DawnTest {
mVSModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, -1.0),
vec2<f32>(-1.0, -1.0));

View File

@ -57,7 +57,7 @@ class SamplerTest : public DawnTest {
auto vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-2.0, -2.0),
vec2<f32>(-2.0, 2.0),
vec2<f32>( 2.0, -2.0),

View File

@ -23,7 +23,7 @@ class ScissorTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-1.0, -1.0),
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, -1.0),

View File

@ -101,7 +101,7 @@ TEST_P(ShaderTests, WGSLParamIO) {
std::string vertexShader = R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>( 0.0, -1.0));

View File

@ -145,7 +145,7 @@ class TextureFormatTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-3.0, -1.0),
vec2<f32>( 3.0, -1.0),
vec2<f32>( 0.0, 2.0));

View File

@ -52,7 +52,7 @@ class TextureSubresourceTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>(-1.0, -1.0),
vec2<f32>( 1.0, -1.0));
@ -89,7 +89,7 @@ class TextureSubresourceTest : public DawnTest {
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, 1.0),

View File

@ -69,14 +69,14 @@ namespace {
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> VertexOut {
var output : VertexOut;
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-2., -2.),
vec2<f32>(-2., 2.),
vec2<f32>( 2., -2.),
vec2<f32>(-2., 2.),
vec2<f32>( 2., -2.),
vec2<f32>( 2., 2.));
var texCoord : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var texCoord = array<vec2<f32>, 6>(
vec2<f32>(0., 0.),
vec2<f32>(0., 1.),
vec2<f32>(1., 0.),

View File

@ -85,7 +85,7 @@ class TextureZeroInitTest : public DawnTest {
std::string source = R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-1.0, -1.0),
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, -1.0),

View File

@ -269,7 +269,7 @@ class VertexFormatTest : public DawnTest {
[[stage(vertex)]]
fn main(input : VertexIn) -> VertexOut {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 2.0, 0.0),
vec2<f32>( 0.0, 2.0));

View File

@ -96,17 +96,17 @@ class VertexStateTest : public DawnTest {
// Hard code the triangle in the shader so that we don't have to add a vertex input for it.
// Also this places the triangle in the grid based on its VertexID and InstanceID
vs << " var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(\n"
vs << " var pos = array<vec2<f32>, 3>(\n"
" vec2<f32>(0.5, 1.0), vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 0.0));\n";
vs << " var offset : vec2<f32> = vec2<f32>(f32(input.VertexIndex / 3u), "
"f32(input.InstanceIndex));\n";
vs << " var worldPos : vec2<f32> = pos[input.VertexIndex % 3u] + offset;\n";
vs << " var position : vec4<f32> = vec4<f32>(0.5 * worldPos - vec2<f32>(1.0, 1.0), 0.0, "
vs << " var worldPos = pos[input.VertexIndex % 3u] + offset;\n";
vs << " var position = vec4<f32>(0.5 * worldPos - vec2<f32>(1.0, 1.0), 0.0, "
"1.0);\n";
vs << " output.position = vec4<f32>(position.x, -position.y, position.z, position.w);\n";
// Perform the checks by successively ANDing a boolean
vs << " var success : bool = true;\n";
vs << " var success = true;\n";
for (const auto& input : testSpec) {
for (int component = 0; component < 4; ++component) {
vs << " success = success && (input.input" << input.location << "[" << component

View File

@ -25,7 +25,7 @@ class ViewportTest : public DawnTest {
mQuadVS = utils::CreateShaderModule(device, R"(
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 6>(
vec2<f32>(-1.0, 1.0),
vec2<f32>(-1.0, -1.0),
vec2<f32>( 1.0, 1.0),

View File

@ -44,7 +44,7 @@ class D3D12DescriptorHeapTests : public DawnTest {
[[stage(vertex)]] fn main(
[[builtin(vertex_index)]] VertexIndex : u32
) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0)
@ -785,7 +785,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
[[stage(vertex)]] fn main(
[[builtin(vertex_index)]] VertexIndex : u32
) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0)

View File

@ -342,7 +342,7 @@ TEST_P(D3D12DescriptorResidencyTests, SwitchedViewHeapResidency) {
[[stage(vertex)]] fn main(
[[builtin(vertex_index)]] VertexIndex : u32
) -> [[builtin(position)]] vec4<f32> {
var pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, -1.0)