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

@@ -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;
}