wgsl: Replace [[decoration]] with @decoration

Deprecate the old syntax. Migrate everything to the new syntax.

Bug: tint:1382
Change-Id: Ide12b2e927b17dc93b9714c7049090864cc568d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77260
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton
2022-01-19 22:46:57 +00:00
committed by Tint LUCI CQ
parent 8f1d5224ee
commit 01e4b6fc18
3200 changed files with 15906 additions and 15215 deletions

View File

@@ -2,15 +2,15 @@
u_scale : vec2<f32>;
u_offset : vec2<f32>;
};
[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;
@binding(0) @group(0) var<uniform> uniforms : Uniforms;
struct VertexOutputs {
[[location(0)]] texcoords : vec2<f32>;
[[builtin(position)]] position : vec4<f32>;
@location(0) texcoords : vec2<f32>;
@builtin(position) position : vec4<f32>;
};
[[stage(vertex)]] fn vs_main(
[[builtin(vertex_index)]] VertexIndex : u32
@stage(vertex) fn vs_main(
@builtin(vertex_index) VertexIndex : u32
) -> VertexOutputs {
var texcoord = array<vec2<f32>, 3>(
vec2<f32>(-0.5, 0.0),
@@ -43,12 +43,12 @@ struct VertexOutputs {
return output;
}
[[binding(1), group(0)]] var mySampler: sampler;
[[binding(2), group(0)]] var myTexture: texture_2d<f32>;
@binding(1) @group(0) var mySampler: sampler;
@binding(2) @group(0) var myTexture: texture_2d<f32>;
[[stage(fragment)]] fn fs_main(
[[location(0)]] texcoord : vec2<f32>
) -> [[location(0)]] vec4<f32> {
@stage(fragment) fn fs_main(
@location(0) texcoord : vec2<f32>
) -> @location(0) vec4<f32> {
// Clamp the texcoord and discard the out-of-bound pixels.
var clampedTexcoord =
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));

View File

@@ -3,17 +3,17 @@ struct Uniforms {
u_offset : vec2<f32>;
}
[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;
@binding(0) @group(0) var<uniform> uniforms : Uniforms;
struct VertexOutputs {
[[location(0)]]
@location(0)
texcoords : vec2<f32>;
[[builtin(position)]]
@builtin(position)
position : vec4<f32>;
}
[[stage(vertex)]]
fn vs_main([[builtin(vertex_index)]] VertexIndex : u32) -> VertexOutputs {
@stage(vertex)
fn vs_main(@builtin(vertex_index) VertexIndex : u32) -> VertexOutputs {
var texcoord = array<vec2<f32>, 3>(vec2<f32>(-0.5, 0.0), vec2<f32>(1.5, 0.0), vec2<f32>(0.5, 2.0));
var output : VertexOutputs;
output.position = vec4<f32>(((texcoord[VertexIndex] * 2.0) - vec2<f32>(1.0, 1.0)), 0.0, 1.0);
@@ -26,12 +26,12 @@ fn vs_main([[builtin(vertex_index)]] VertexIndex : u32) -> VertexOutputs {
return output;
}
[[binding(1), group(0)]] var mySampler : sampler;
@binding(1) @group(0) var mySampler : sampler;
[[binding(2), group(0)]] var myTexture : texture_2d<f32>;
@binding(2) @group(0) var myTexture : texture_2d<f32>;
[[stage(fragment)]]
fn fs_main([[location(0)]] texcoord : vec2<f32>) -> [[location(0)]] vec4<f32> {
@stage(fragment)
fn fs_main(@location(0) texcoord : vec2<f32>) -> @location(0) vec4<f32> {
var clampedTexcoord = clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
if (!(all((clampedTexcoord == texcoord)))) {
discard;