From 466d8a3569870d86c474984bf08f9fc7038cccbe Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Tue, 12 Dec 2023 11:30:03 -0800 Subject: [PATCH] [naga wgsl-out] Include the `f` suffix on `f32` literals. Without the suffix, `Expression::Literal(Literal::F32)` expressions get written without any suffix on the number, meaning that they get re-parsed as `AbstractFloat` values. In theory, this should always be fine, but since we don't actually support abstract types yet in all the places we should, having them appear in the output causes validation problems. See also: #4863, which did the same for `i32` literals. --- CHANGELOG.md | 2 + naga/src/back/wgsl/writer.rs | 32 +-- .../out/wgsl/210-bevy-2d-shader.vert.wgsl | 4 +- naga/tests/out/wgsl/210-bevy-shader.vert.wgsl | 6 +- naga/tests/out/wgsl/246-collatz.comp.wgsl | 2 +- naga/tests/out/wgsl/277-casting.frag.wgsl | 2 +- naga/tests/out/wgsl/280-matrix-cast.frag.wgsl | 2 +- .../wgsl/800-out-of-bounds-panic.vert.wgsl | 4 +- .../wgsl/900-implicit-conversions.frag.wgsl | 4 +- .../out/wgsl/901-lhs-field-select.frag.wgsl | 4 +- .../out/wgsl/931-constant-emitting.frag.wgsl | 2 +- naga/tests/out/wgsl/abstract-types-const.wgsl | 80 +++--- naga/tests/out/wgsl/abstract-types-var.wgsl | 94 +++---- naga/tests/out/wgsl/access.wgsl | 46 ++-- .../wgsl/array-in-function-return-type.wgsl | 4 +- .../tests/out/wgsl/atomicCompareExchange.wgsl | 4 +- naga/tests/out/wgsl/bevy-pbr.frag.wgsl | 86 +++--- naga/tests/out/wgsl/bevy-pbr.vert.wgsl | 2 +- .../out/wgsl/binding-arrays.dynamic.wgsl | 2 +- .../tests/out/wgsl/binding-arrays.static.wgsl | 2 +- naga/tests/out/wgsl/binding-arrays.wgsl | 36 +-- naga/tests/out/wgsl/bitcast.wgsl | 6 +- naga/tests/out/wgsl/bits.wgsl | 4 +- naga/tests/out/wgsl/bits_glsl.frag.wgsl | 4 +- naga/tests/out/wgsl/boids.wgsl | 24 +- naga/tests/out/wgsl/bool-select.frag.wgsl | 8 +- naga/tests/out/wgsl/clamp-splat.vert.wgsl | 4 +- naga/tests/out/wgsl/const-exprs.wgsl | 10 +- .../out/wgsl/constant-array-size.frag.wgsl | 2 +- naga/tests/out/wgsl/constructors.wgsl | 16 +- naga/tests/out/wgsl/declarations.frag.wgsl | 6 +- .../out/wgsl/double-math-functions.frag.wgsl | 2 +- naga/tests/out/wgsl/dualsource.wgsl | 4 +- naga/tests/out/wgsl/expressions.frag.wgsl | 32 +-- naga/tests/out/wgsl/extra.wgsl | 2 +- naga/tests/out/wgsl/fma.frag.wgsl | 8 +- naga/tests/out/wgsl/fragment-output.wgsl | 8 +- naga/tests/out/wgsl/functions.wgsl | 6 +- .../out/wgsl/global-constant-array.frag.wgsl | 2 +- naga/tests/out/wgsl/globals.wgsl | 16 +- naga/tests/out/wgsl/image.wgsl | 58 ++-- naga/tests/out/wgsl/images.frag.wgsl | 12 +- naga/tests/out/wgsl/interface.wgsl | 6 +- naga/tests/out/wgsl/interpolate.wgsl | 14 +- .../out/wgsl/local-var-init-in-loop.comp.wgsl | 4 +- .../tests/out/wgsl/long-form-matrix.frag.wgsl | 16 +- naga/tests/out/wgsl/math-functions.frag.wgsl | 10 +- naga/tests/out/wgsl/math-functions.wgsl | 36 +-- naga/tests/out/wgsl/module-scope.wgsl | 2 +- naga/tests/out/wgsl/operators.wgsl | 96 +++---- naga/tests/out/wgsl/padding.wgsl | 2 +- naga/tests/out/wgsl/prepostfix.frag.wgsl | 6 +- naga/tests/out/wgsl/quad-vert.wgsl | 4 +- naga/tests/out/wgsl/quad.wgsl | 8 +- naga/tests/out/wgsl/quad_glsl.frag.wgsl | 2 +- naga/tests/out/wgsl/quad_glsl.vert.wgsl | 4 +- .../out/wgsl/sampler-functions.frag.wgsl | 4 +- naga/tests/out/wgsl/samplers.frag.wgsl | 250 +++++++++--------- naga/tests/out/wgsl/shadow.wgsl | 20 +- naga/tests/out/wgsl/skybox.wgsl | 2 +- naga/tests/out/wgsl/struct-layout.wgsl | 8 +- naga/tests/out/wgsl/texture-arg.wgsl | 2 +- naga/tests/out/wgsl/type-alias.wgsl | 10 +- 63 files changed, 579 insertions(+), 581 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aacbbec3e..3783fd03c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -158,6 +158,8 @@ Passing an owned value `window` to `Surface` will return a `Surface<'static>`. S - In WGSL output, always include the `i` suffix on `i32` literals. By @jimblandy in [#4863](https://github.com/gfx-rs/wgpu/pull/4863). +- In WGSL output, always include the `f` suffix on `f32` literals. By @jimblandy in [#4869](https://github.com/gfx-rs/wgpu/pull/4869). + ### Bug Fixes #### General diff --git a/naga/src/back/wgsl/writer.rs b/naga/src/back/wgsl/writer.rs index 28faaf6690..25a6979515 100644 --- a/naga/src/back/wgsl/writer.rs +++ b/naga/src/back/wgsl/writer.rs @@ -1087,25 +1087,21 @@ impl Writer { use crate::Expression; match expressions[expr] { - Expression::Literal(literal) => { - match literal { - // Floats are written using `Debug` instead of `Display` because it always appends the - // decimal part even it's zero - crate::Literal::F32(value) => write!(self.out, "{:?}", value)?, - crate::Literal::U32(value) => write!(self.out, "{}u", value)?, - crate::Literal::I32(value) => write!(self.out, "{}i", value)?, - crate::Literal::Bool(value) => write!(self.out, "{}", value)?, - crate::Literal::F64(value) => write!(self.out, "{:?}lf", value)?, - crate::Literal::I64(_) => { - return Err(Error::Custom("unsupported i64 literal".to_string())); - } - crate::Literal::AbstractInt(_) | crate::Literal::AbstractFloat(_) => { - return Err(Error::Custom( - "Abstract types should not appear in IR presented to backends".into(), - )); - } + Expression::Literal(literal) => match literal { + crate::Literal::F32(value) => write!(self.out, "{}f", value)?, + crate::Literal::U32(value) => write!(self.out, "{}u", value)?, + crate::Literal::I32(value) => write!(self.out, "{}i", value)?, + crate::Literal::Bool(value) => write!(self.out, "{}", value)?, + crate::Literal::F64(value) => write!(self.out, "{:?}lf", value)?, + crate::Literal::I64(_) => { + return Err(Error::Custom("unsupported i64 literal".to_string())); } - } + crate::Literal::AbstractInt(_) | crate::Literal::AbstractFloat(_) => { + return Err(Error::Custom( + "Abstract types should not appear in IR presented to backends".into(), + )); + } + }, Expression::Constant(handle) => { let constant = &module.constants[handle]; if constant.name.is_some() { diff --git a/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl b/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl index 365fa3470e..5a8e54159a 100644 --- a/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl +++ b/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl @@ -34,11 +34,11 @@ fn main_1() { v_Uv = _e10; let _e11 = Vertex_Position_1; let _e12 = global_2.size; - position = (_e11 * vec3(_e12.x, _e12.y, 1.0)); + position = (_e11 * vec3(_e12.x, _e12.y, 1f)); let _e20 = global.ViewProj; let _e21 = global_1.Model; let _e23 = position; - gl_Position = ((_e20 * _e21) * vec4(_e23.x, _e23.y, _e23.z, 1.0)); + gl_Position = ((_e20 * _e21) * vec4(_e23.x, _e23.y, _e23.z, 1f)); return; } diff --git a/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl b/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl index f7932979b5..f929543ebf 100644 --- a/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl +++ b/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl @@ -28,18 +28,18 @@ var gl_Position: vec4; fn main_1() { let _e10 = global_1.Model; let _e11 = Vertex_Normal_1; - v_Normal = (_e10 * vec4(_e11.x, _e11.y, _e11.z, 1.0)).xyz; + v_Normal = (_e10 * vec4(_e11.x, _e11.y, _e11.z, 1f)).xyz; let _e19 = global_1.Model; let _e29 = Vertex_Normal_1; v_Normal = (mat3x3(_e19[0].xyz, _e19[1].xyz, _e19[2].xyz) * _e29); let _e31 = global_1.Model; let _e32 = Vertex_Position_1; - v_Position = (_e31 * vec4(_e32.x, _e32.y, _e32.z, 1.0)).xyz; + v_Position = (_e31 * vec4(_e32.x, _e32.y, _e32.z, 1f)).xyz; let _e40 = Vertex_Uv_1; v_Uv = _e40; let _e42 = global.ViewProj; let _e43 = v_Position; - gl_Position = (_e42 * vec4(_e43.x, _e43.y, _e43.z, 1.0)); + gl_Position = (_e42 * vec4(_e43.x, _e43.y, _e43.z, 1f)); return; } diff --git a/naga/tests/out/wgsl/246-collatz.comp.wgsl b/naga/tests/out/wgsl/246-collatz.comp.wgsl index 5d1ea64833..cd89fd831a 100644 --- a/naga/tests/out/wgsl/246-collatz.comp.wgsl +++ b/naga/tests/out/wgsl/246-collatz.comp.wgsl @@ -19,7 +19,7 @@ fn collatz_iterations(n: u32) -> u32 { { let _e14 = n_1; let _e15 = f32(_e14); - if ((_e15 - (floor((_e15 / 2.0)) * 2.0)) == 0.0) { + if ((_e15 - (floor((_e15 / 2f)) * 2f)) == 0f) { { let _e25 = n_1; n_1 = (_e25 / 2u); diff --git a/naga/tests/out/wgsl/277-casting.frag.wgsl b/naga/tests/out/wgsl/277-casting.frag.wgsl index 87761aff4e..c9ef2be74a 100644 --- a/naga/tests/out/wgsl/277-casting.frag.wgsl +++ b/naga/tests/out/wgsl/277-casting.frag.wgsl @@ -1,5 +1,5 @@ fn main_1() { - var a: f32 = 1.0; + var a: f32 = 1f; return; } diff --git a/naga/tests/out/wgsl/280-matrix-cast.frag.wgsl b/naga/tests/out/wgsl/280-matrix-cast.frag.wgsl index 7d432ee496..6cc18567cd 100644 --- a/naga/tests/out/wgsl/280-matrix-cast.frag.wgsl +++ b/naga/tests/out/wgsl/280-matrix-cast.frag.wgsl @@ -1,5 +1,5 @@ fn main_1() { - var a: mat4x4 = mat4x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); + var a: mat4x4 = mat4x4(vec4(1f, 0f, 0f, 0f), vec4(0f, 1f, 0f, 0f), vec4(0f, 0f, 1f, 0f), vec4(0f, 0f, 0f, 1f)); } diff --git a/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl b/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl index d749d5a1f4..820ab6194c 100644 --- a/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl +++ b/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl @@ -25,10 +25,10 @@ fn main_1() { let _e9 = global.view_matrix; let _e10 = global_1.world_matrix; let _e12 = position_1; - gl_Position = ((_e9 * _e10) * vec4(_e12.x, _e12.y, 0.0, 1.0)); + gl_Position = ((_e9 * _e10) * vec4(_e12.x, _e12.y, 0f, 1f)); let _e20 = gl_Position; let _e22 = gl_Position; - gl_Position.z = ((_e20.z + _e22.w) / 2.0); + gl_Position.z = ((_e20.z + _e22.w) / 2f); return; } diff --git a/naga/tests/out/wgsl/900-implicit-conversions.frag.wgsl b/naga/tests/out/wgsl/900-implicit-conversions.frag.wgsl index 8a6c9851fa..2c468dd929 100644 --- a/naga/tests/out/wgsl/900-implicit-conversions.frag.wgsl +++ b/naga/tests/out/wgsl/900-implicit-conversions.frag.wgsl @@ -56,8 +56,8 @@ fn implicit_dims_3(v_6: vec4) { fn main_1() { exact_1(1i); - implicit(1.0); - implicit_dims_2(vec3(1.0)); + implicit(1f); + implicit_dims_2(vec3(1f)); return; } diff --git a/naga/tests/out/wgsl/901-lhs-field-select.frag.wgsl b/naga/tests/out/wgsl/901-lhs-field-select.frag.wgsl index 341ef150e1..ae45360074 100644 --- a/naga/tests/out/wgsl/901-lhs-field-select.frag.wgsl +++ b/naga/tests/out/wgsl/901-lhs-field-select.frag.wgsl @@ -1,7 +1,7 @@ fn main_1() { - var a: vec4 = vec4(1.0); + var a: vec4 = vec4(1f); - a.x = 2.0; + a.x = 2f; return; } diff --git a/naga/tests/out/wgsl/931-constant-emitting.frag.wgsl b/naga/tests/out/wgsl/931-constant-emitting.frag.wgsl index 5ec5a77b1e..ac59a0c3ef 100644 --- a/naga/tests/out/wgsl/931-constant-emitting.frag.wgsl +++ b/naga/tests/out/wgsl/931-constant-emitting.frag.wgsl @@ -1,7 +1,7 @@ const constant: i32 = 10i; fn function() -> f32 { - return 0.0; + return 0f; } fn main_1() { diff --git a/naga/tests/out/wgsl/abstract-types-const.wgsl b/naga/tests/out/wgsl/abstract-types-const.wgsl index 90ee197fb5..195247bbbc 100644 --- a/naga/tests/out/wgsl/abstract-types-const.wgsl +++ b/naga/tests/out/wgsl/abstract-types-const.wgsl @@ -5,51 +5,51 @@ struct S { } const xvupaiai: vec2 = vec2(42u, 43u); -const xvfpaiai: vec2 = vec2(44.0, 45.0); +const xvfpaiai: vec2 = vec2(44f, 45f); const xvupuai: vec2 = vec2(42u, 43u); const xvupaiu: vec2 = vec2(42u, 43u); const xvuuai: vec2 = vec2(42u, 43u); const xvuaiu: vec2 = vec2(42u, 43u); -const xmfpaiaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const xmfpafaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const xmfpaiafaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const xmfpaiaiafai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const xmfpaiaiaiaf: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const imfpaiaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const imfpafaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const imfpafafafaf: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); +const xmfpaiaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const xmfpafaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const xmfpaiafaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const xmfpaiaiafai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const xmfpaiaiaiaf: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const imfpaiaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const imfpafaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const imfpafafafaf: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); const ivispai: vec2 = vec2(1i); -const ivfspaf: vec2 = vec2(1.0); +const ivfspaf: vec2 = vec2(1f); const ivis_ai: vec2 = vec2(1i); const ivus_ai: vec2 = vec2(1u); -const ivfs_ai: vec2 = vec2(1.0); -const ivfs_af: vec2 = vec2(1.0); -const iafafaf: array = array(1.0, 2.0); -const iafaiai: array = array(1.0, 2.0); -const iafpafaf: array = array(1.0, 2.0); -const iafpaiaf: array = array(1.0, 2.0); -const iafpafai: array = array(1.0, 2.0); -const xafpafaf: array = array(1.0, 2.0); -const s_f_i_u: S = S(1.0, 1i, 1u); -const s_f_iai: S = S(1.0, 1i, 1u); -const s_fai_u: S = S(1.0, 1i, 1u); -const s_faiai: S = S(1.0, 1i, 1u); -const saf_i_u: S = S(1.0, 1i, 1u); -const saf_iai: S = S(1.0, 1i, 1u); -const safai_u: S = S(1.0, 1i, 1u); -const safaiai: S = S(1.0, 1i, 1u); -const ivfr_f_f: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivfr_f_af: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivfraf_f: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivfraf_af: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivf_fr_f: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivf_fraf: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivf_afr_f: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivf_afraf: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivfr_f_ai: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivfrai_f: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivfrai_ai: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivf_frai: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivf_air_f: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivf_airai: vec3 = vec3(1.0, vec2(2.0, 3.0)); +const ivfs_ai: vec2 = vec2(1f); +const ivfs_af: vec2 = vec2(1f); +const iafafaf: array = array(1f, 2f); +const iafaiai: array = array(1f, 2f); +const iafpafaf: array = array(1f, 2f); +const iafpaiaf: array = array(1f, 2f); +const iafpafai: array = array(1f, 2f); +const xafpafaf: array = array(1f, 2f); +const s_f_i_u: S = S(1f, 1i, 1u); +const s_f_iai: S = S(1f, 1i, 1u); +const s_fai_u: S = S(1f, 1i, 1u); +const s_faiai: S = S(1f, 1i, 1u); +const saf_i_u: S = S(1f, 1i, 1u); +const saf_iai: S = S(1f, 1i, 1u); +const safai_u: S = S(1f, 1i, 1u); +const safaiai: S = S(1f, 1i, 1u); +const ivfr_f_f: vec3 = vec3(vec2(1f, 2f), 3f); +const ivfr_f_af: vec3 = vec3(vec2(1f, 2f), 3f); +const ivfraf_f: vec3 = vec3(vec2(1f, 2f), 3f); +const ivfraf_af: vec3 = vec3(vec2(1f, 2f), 3f); +const ivf_fr_f: vec3 = vec3(1f, vec2(2f, 3f)); +const ivf_fraf: vec3 = vec3(1f, vec2(2f, 3f)); +const ivf_afr_f: vec3 = vec3(1f, vec2(2f, 3f)); +const ivf_afraf: vec3 = vec3(1f, vec2(2f, 3f)); +const ivfr_f_ai: vec3 = vec3(vec2(1f, 2f), 3f); +const ivfrai_f: vec3 = vec3(vec2(1f, 2f), 3f); +const ivfrai_ai: vec3 = vec3(vec2(1f, 2f), 3f); +const ivf_frai: vec3 = vec3(1f, vec2(2f, 3f)); +const ivf_air_f: vec3 = vec3(1f, vec2(2f, 3f)); +const ivf_airai: vec3 = vec3(1f, vec2(2f, 3f)); diff --git a/naga/tests/out/wgsl/abstract-types-var.wgsl b/naga/tests/out/wgsl/abstract-types-var.wgsl index 1229261d9d..0533f19442 100644 --- a/naga/tests/out/wgsl/abstract-types-var.wgsl +++ b/naga/tests/out/wgsl/abstract-types-var.wgsl @@ -1,62 +1,62 @@ var xvipaiai_1: vec2 = vec2(42i, 43i); var xvupaiai_1: vec2 = vec2(44u, 45u); -var xvfpaiai_1: vec2 = vec2(46.0, 47.0); +var xvfpaiai_1: vec2 = vec2(46f, 47f); var xvupuai_2: vec2 = vec2(42u, 43u); var xvupaiu_2: vec2 = vec2(42u, 43u); var xvuuai_2: vec2 = vec2(42u, 43u); var xvuaiu_2: vec2 = vec2(42u, 43u); -var xmfpaiaiaiai_1: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -var xmfpafaiaiai_1: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -var xmfpaiafaiai_1: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -var xmfpaiaiafai_1: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -var xmfpaiaiaiaf_1: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); +var xmfpaiaiaiai_1: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +var xmfpafaiaiai_1: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +var xmfpaiafaiai_1: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +var xmfpaiaiafai_1: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +var xmfpaiaiaiaf_1: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); var xvispai_1: vec2 = vec2(1i); -var xvfspaf_1: vec2 = vec2(1.0); +var xvfspaf_1: vec2 = vec2(1f); var xvis_ai_1: vec2 = vec2(1i); var xvus_ai_1: vec2 = vec2(1u); -var xvfs_ai_1: vec2 = vec2(1.0); -var xvfs_af_1: vec2 = vec2(1.0); -var xafafaf_1: array = array(1.0, 2.0); -var xafaiai_1: array = array(1.0, 2.0); +var xvfs_ai_1: vec2 = vec2(1f); +var xvfs_af_1: vec2 = vec2(1f); +var xafafaf_1: array = array(1f, 2f); +var xafaiai_1: array = array(1f, 2f); var xafpaiai_1: array = array(1i, 2i); -var xafpaiaf_1: array = array(1.0, 2.0); -var xafpafai_1: array = array(1.0, 2.0); -var xafpafaf_1: array = array(1.0, 2.0); +var xafpaiaf_1: array = array(1f, 2f); +var xafpafai_1: array = array(1f, 2f); +var xafpafaf_1: array = array(1f, 2f); fn all_constant_arguments() { var xvipaiai: vec2 = vec2(42i, 43i); var xvupaiai: vec2 = vec2(44u, 45u); - var xvfpaiai: vec2 = vec2(46.0, 47.0); + var xvfpaiai: vec2 = vec2(46f, 47f); var xvupuai: vec2 = vec2(42u, 43u); var xvupaiu: vec2 = vec2(42u, 43u); var xvuuai: vec2 = vec2(42u, 43u); var xvuaiu: vec2 = vec2(42u, 43u); - var xmfpaiaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpafaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpaiafaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpaiaiafai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpaiaiaiaf: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfp_faiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpai_faiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpaiai_fai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpaiaiai_f: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + var xmfpaiaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpafaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpaiafaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpaiaiafai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpaiaiaiaf: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfp_faiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpai_faiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpaiai_fai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpaiaiai_f: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); var xvispai: vec2 = vec2(1i); - var xvfspaf: vec2 = vec2(1.0); + var xvfspaf: vec2 = vec2(1f); var xvis_ai: vec2 = vec2(1i); var xvus_ai: vec2 = vec2(1u); - var xvfs_ai: vec2 = vec2(1.0); - var xvfs_af: vec2 = vec2(1.0); - var xafafaf: array = array(1.0, 2.0); - var xaf_faf: array = array(1.0, 2.0); - var xafaf_f: array = array(1.0, 2.0); - var xafaiai: array = array(1.0, 2.0); + var xvfs_ai: vec2 = vec2(1f); + var xvfs_af: vec2 = vec2(1f); + var xafafaf: array = array(1f, 2f); + var xaf_faf: array = array(1f, 2f); + var xafaf_f: array = array(1f, 2f); + var xafaiai: array = array(1f, 2f); var xai_iai: array = array(1i, 2i); var xaiai_i: array = array(1i, 2i); var xaipaiai: array = array(1i, 2i); - var xafpaiai: array = array(1.0, 2.0); - var xafpaiaf: array = array(1.0, 2.0); - var xafpafai: array = array(1.0, 2.0); - var xafpafaf: array = array(1.0, 2.0); + var xafpaiai: array = array(1f, 2f); + var xafpaiaf: array = array(1f, 2f); + var xafpafai: array = array(1f, 2f); + var xafpafaf: array = array(1f, 2f); } @@ -94,33 +94,33 @@ fn mixed_constant_and_runtime_arguments() { let _e15 = u; xvuaiu_1 = vec2(42u, _e15); let _e19 = f; - xmfp_faiaiai_1 = mat2x2(vec2(_e19, 2.0), vec2(3.0, 4.0)); + xmfp_faiaiai_1 = mat2x2(vec2(_e19, 2f), vec2(3f, 4f)); let _e27 = f; - xmfpai_faiai_1 = mat2x2(vec2(1.0, _e27), vec2(3.0, 4.0)); + xmfpai_faiai_1 = mat2x2(vec2(1f, _e27), vec2(3f, 4f)); let _e35 = f; - xmfpaiai_fai_1 = mat2x2(vec2(1.0, 2.0), vec2(_e35, 4.0)); + xmfpaiai_fai_1 = mat2x2(vec2(1f, 2f), vec2(_e35, 4f)); let _e43 = f; - xmfpaiaiai_f_1 = mat2x2(vec2(1.0, 2.0), vec2(3.0, _e43)); + xmfpaiaiai_f_1 = mat2x2(vec2(1f, 2f), vec2(3f, _e43)); let _e51 = f; - xaf_faf_1 = array(_e51, 2.0); + xaf_faf_1 = array(_e51, 2f); let _e55 = f; - xafaf_f_1 = array(1.0, _e55); + xafaf_f_1 = array(1f, _e55); let _e59 = f; - xaf_fai = array(_e59, 2.0); + xaf_fai = array(_e59, 2f); let _e63 = f; - xafai_f = array(1.0, _e63); + xafai_f = array(1f, _e63); let _e67 = i; xai_iai_1 = array(_e67, 2i); let _e71 = i; xaiai_i_1 = array(1i, _e71); let _e75 = f; - xafp_faf = array(_e75, 2.0); + xafp_faf = array(_e75, 2f); let _e79 = f; - xafpaf_f = array(1.0, _e79); + xafpaf_f = array(1f, _e79); let _e83 = f; - xafp_fai = array(_e83, 2.0); + xafp_fai = array(_e83, 2f); let _e87 = f; - xafpai_f = array(1.0, _e87); + xafpai_f = array(1f, _e87); let _e91 = i; xaip_iai = array(_e91, 2i); let _e95 = i; diff --git a/naga/tests/out/wgsl/access.wgsl b/naga/tests/out/wgsl/access.wgsl index eb89d3a1cb..1409e80b11 100644 --- a/naga/tests/out/wgsl/access.wgsl +++ b/naga/tests/out/wgsl/access.wgsl @@ -37,7 +37,7 @@ var nested_mat_cx2_: MatCx2InArray; fn test_matrix_within_struct_accesses() { var idx: i32 = 1i; - var t: Baz = Baz(mat3x2(vec2(1.0), vec2(2.0), vec2(3.0))); + var t: Baz = Baz(mat3x2(vec2(1f), vec2(2f), vec2(3f))); let _e3 = idx; idx = (_e3 - 1i); @@ -55,18 +55,18 @@ fn test_matrix_within_struct_accesses() { let l6_ = baz.m[_e36][_e38]; let _e51 = idx; idx = (_e51 + 1i); - t.m = mat3x2(vec2(6.0), vec2(5.0), vec2(4.0)); - t.m[0] = vec2(9.0); + t.m = mat3x2(vec2(6f), vec2(5f), vec2(4f)); + t.m[0] = vec2(9f); let _e66 = idx; - t.m[_e66] = vec2(90.0); - t.m[0][1] = 10.0; + t.m[_e66] = vec2(90f); + t.m[0][1] = 10f; let _e76 = idx; - t.m[0][_e76] = 20.0; + t.m[0][_e76] = 20f; let _e80 = idx; - t.m[_e80][1] = 30.0; + t.m[_e80][1] = 30f; let _e85 = idx; let _e87 = idx; - t.m[_e85][_e87] = 40.0; + t.m[_e85][_e87] = 40f; return; } @@ -92,18 +92,18 @@ fn test_matrix_within_array_within_struct_accesses() { let _e55 = idx_1; idx_1 = (_e55 + 1i); t_1.am = array, 2>(); - t_1.am[0] = mat4x2(vec2(8.0), vec2(7.0), vec2(6.0), vec2(5.0)); - t_1.am[0][0] = vec2(9.0); + t_1.am[0] = mat4x2(vec2(8f), vec2(7f), vec2(6f), vec2(5f)); + t_1.am[0][0] = vec2(9f); let _e77 = idx_1; - t_1.am[0][_e77] = vec2(90.0); - t_1.am[0][0][1] = 10.0; + t_1.am[0][_e77] = vec2(90f); + t_1.am[0][0][1] = 10f; let _e89 = idx_1; - t_1.am[0][0][_e89] = 20.0; + t_1.am[0][0][_e89] = 20f; let _e94 = idx_1; - t_1.am[0][_e94][1] = 30.0; + t_1.am[0][_e94][1] = 30f; let _e100 = idx_1; let _e102 = idx_1; - t_1.am[0][_e100][_e102] = 40.0; + t_1.am[0][_e100][_e102] = 40f; return; } @@ -122,17 +122,17 @@ fn assign_through_ptr_fn(p: ptr) { } fn assign_array_through_ptr_fn(foo_2: ptr, 2>>) { - (*foo_2) = array, 2>(vec4(1.0), vec4(2.0)); + (*foo_2) = array, 2>(vec4(1f), vec4(2f)); return; } @vertex fn foo_vert(@builtin(vertex_index) vi: u32) -> @builtin(position) vec4 { - var foo: f32 = 0.0; + var foo: f32 = 0f; var c2_: array; let baz_1 = foo; - foo = 1.0; + foo = 1f; test_matrix_within_struct_accesses(); test_matrix_within_array_within_struct_accesses(); let _matrix = bar._matrix; @@ -146,23 +146,23 @@ fn foo_vert(@builtin(vertex_index) vi: u32) -> @builtin(position) vec4 { c2_[(vi + 1u)] = 42i; let value = c2_[vi]; let _e47 = test_arr_as_arg(array, 5>()); - return vec4((_matrix * vec4(vec4(value))), 2.0); + return vec4((_matrix * vec4(vec4(value))), 2f); } @fragment fn foo_frag() -> @location(0) vec4 { - bar._matrix[1][2] = 1.0; - bar._matrix = mat4x3(vec3(0.0), vec3(1.0), vec3(2.0), vec3(3.0)); + bar._matrix[1][2] = 1f; + bar._matrix = mat4x3(vec3(0f), vec3(1f), vec3(2f), vec3(3f)); bar.arr = array, 2>(vec2(0u), vec2(1u)); bar.data[1].value = 1i; qux = vec2(); - return vec4(0.0); + return vec4(0f); } @compute @workgroup_size(1, 1, 1) fn assign_through_ptr() { var val: u32 = 33u; - var arr: array, 2> = array, 2>(vec4(6.0), vec4(7.0)); + var arr: array, 2> = array, 2>(vec4(6f), vec4(7f)); assign_through_ptr_fn((&val)); assign_array_through_ptr_fn((&arr)); diff --git a/naga/tests/out/wgsl/array-in-function-return-type.wgsl b/naga/tests/out/wgsl/array-in-function-return-type.wgsl index 2d5b1e84aa..2beacd3ff4 100644 --- a/naga/tests/out/wgsl/array-in-function-return-type.wgsl +++ b/naga/tests/out/wgsl/array-in-function-return-type.wgsl @@ -1,9 +1,9 @@ fn ret_array() -> array { - return array(1.0, 2.0); + return array(1f, 2f); } @fragment fn main() -> @location(0) vec4 { let _e0 = ret_array(); - return vec4(_e0[0], _e0[1], 0.0, 1.0); + return vec4(_e0[0], _e0[1], 0f, 1f); } diff --git a/naga/tests/out/wgsl/atomicCompareExchange.wgsl b/naga/tests/out/wgsl/atomicCompareExchange.wgsl index 5f98c61969..17bd5144b1 100644 --- a/naga/tests/out/wgsl/atomicCompareExchange.wgsl +++ b/naga/tests/out/wgsl/atomicCompareExchange.wgsl @@ -30,7 +30,7 @@ fn test_atomic_compare_exchange_i32_() { } { let _e14 = old; - let new_ = bitcast((bitcast(_e14) + 1.0)); + let new_ = bitcast((bitcast(_e14) + 1f)); let _e20 = i; let _e22 = old; let _e23 = atomicCompareExchangeWeak((&arr_i32_[_e20]), _e22, new_); @@ -72,7 +72,7 @@ fn test_atomic_compare_exchange_u32_() { } { let _e14 = old_1; - let new_1 = bitcast((bitcast(_e14) + 1.0)); + let new_1 = bitcast((bitcast(_e14) + 1f)); let _e20 = i_1; let _e22 = old_1; let _e23 = atomicCompareExchangeWeak((&arr_u32_[_e20]), _e22, new_1); diff --git a/naga/tests/out/wgsl/bevy-pbr.frag.wgsl b/naga/tests/out/wgsl/bevy-pbr.frag.wgsl index f2c3710ee7..81d69d0736 100644 --- a/naga/tests/out/wgsl/bevy-pbr.frag.wgsl +++ b/naga/tests/out/wgsl/bevy-pbr.frag.wgsl @@ -50,7 +50,7 @@ struct FragmentOutput { const MAX_POINT_LIGHTS: i32 = 10i; const MAX_DIRECTIONAL_LIGHTS: i32 = 1i; -const PI: f32 = 3.1415927; +const PI: f32 = 3.1415927f; var v_WorldPosition_1: vec3; var v_WorldNormal_1: vec3; @@ -125,13 +125,13 @@ fn getDistanceAttenuation(distanceSquare: f32, inverseRangeSquared: f32) -> f32 let _e50 = factor; let _e56 = factor; let _e57 = factor; - smoothFactor = clamp((1.0 - (_e56 * _e57)), 0.0, 1.0); + smoothFactor = clamp((1f - (_e56 * _e57)), 0f, 1f); let _e64 = smoothFactor; let _e65 = smoothFactor; attenuation = (_e64 * _e65); let _e68 = attenuation; let _e73 = distanceSquare_1; - return ((_e68 * 1.0) / max(_e73, 0.001)); + return ((_e68 * 1f) / max(_e73, 0.001f)); } fn D_GGX(roughness: f32, NoH: f32, h: vec3) -> f32 { @@ -146,7 +146,7 @@ fn D_GGX(roughness: f32, NoH: f32, h: vec3) -> f32 { NoH_1 = NoH; let _e46 = NoH_1; let _e47 = NoH_1; - oneMinusNoHSquared = (1.0 - (_e46 * _e47)); + oneMinusNoHSquared = (1f - (_e46 * _e47)); let _e51 = NoH_1; let _e52 = roughness_1; a = (_e51 * _e52); @@ -157,7 +157,7 @@ fn D_GGX(roughness: f32, NoH: f32, h: vec3) -> f32 { k = (_e55 / (_e56 + (_e57 * _e58))); let _e63 = k; let _e64 = k; - d = ((_e63 * _e64) * 0.31830987); + d = ((_e63 * _e64) * 0.31830987f); let _e71 = d; return _e71; } @@ -203,7 +203,7 @@ fn V_SmithGGXCorrelated(roughness_2: f32, NoV: f32, NoL: f32) -> f32 { lambdaL = (_e72 * sqrt((((_e82 - (_e83 * _e84)) * _e87) + _e89))); let _e95 = lambdaV; let _e96 = lambdaL; - v = (0.5 / (_e95 + _e96)); + v = (0.5f / (_e95 + _e96)); let _e100 = v; return _e100; } @@ -217,7 +217,7 @@ fn F_Schlick(f0_: vec3, f90_: f32, VoH: f32) -> vec3 { let _e45 = f90_1; let _e49 = VoH_1; let _e52 = VoH_1; - let _e54 = pow5_((1.0 - _e52)); + let _e54 = pow5_((1f - _e52)); return (f0_ + ((vec3(_e45) - f0_) * _e54)); } @@ -234,7 +234,7 @@ fn F_Schlick_1(f0_1: f32, f90_2: f32, VoH_2: f32) -> f32 { let _e48 = f0_2; let _e51 = VoH_3; let _e54 = VoH_3; - let _e56 = pow5_((1.0 - _e54)); + let _e56 = pow5_((1f - _e54)); return (_e46 + ((_e47 - _e48) * _e56)); } @@ -247,7 +247,7 @@ fn fresnel(f0_3: vec3, LoH: f32) -> vec3 { LoH_1 = LoH; let _e49 = f0_4; let _e62 = f0_4; - f90_4 = clamp(dot(_e62, vec3(16.5)), 0.0, 1.0); + f90_4 = clamp(dot(_e62, vec3(16.5f)), 0f, 1f); let _e75 = f0_4; let _e76 = f90_4; let _e77 = LoH_1; @@ -310,26 +310,26 @@ fn Fd_Burley(roughness_6: f32, NoV_4: f32, NoL_4: f32, LoH_4: f32) -> f32 { let _e50 = roughness_7; let _e52 = LoH_5; let _e54 = LoH_5; - f90_5 = (0.5 + (((2.0 * _e50) * _e52) * _e54)); + f90_5 = (0.5f + (((2f * _e50) * _e52) * _e54)); let _e62 = f90_5; let _e63 = NoL_5; - let _e64 = F_Schlick_1(1.0, _e62, _e63); + let _e64 = F_Schlick_1(1f, _e62, _e63); lightScatter = _e64; let _e70 = f90_5; let _e71 = NoV_5; - let _e72 = F_Schlick_1(1.0, _e70, _e71); + let _e72 = F_Schlick_1(1f, _e70, _e71); viewScatter = _e72; let _e74 = lightScatter; let _e75 = viewScatter; - return ((_e74 * _e75) * 0.31830987); + return ((_e74 * _e75) * 0.31830987f); } fn EnvBRDFApprox(f0_7: vec3, perceptual_roughness: f32, NoV_6: f32) -> vec3 { var f0_8: vec3; var perceptual_roughness_1: f32; var NoV_7: f32; - var c0_: vec4 = vec4(-1.0, -0.0275, -0.572, 0.022); - var c1_: vec4 = vec4(1.0, 0.0425, 1.04, -0.04); + var c0_: vec4 = vec4(-1f, -0.0275f, -0.572f, 0.022f); + var c1_: vec4 = vec4(1f, 0.0425f, 1.04f, -0.04f); var r: vec4; var a004_: f32; var AB: vec2; @@ -351,10 +351,10 @@ fn EnvBRDFApprox(f0_7: vec3, perceptual_roughness: f32, NoV_6: f32) -> vec3 let _e94 = NoV_7; let _e98 = r; let _e101 = r; - a004_ = ((min((_e83.x * _e85.x), exp2((-9.28 * _e94))) * _e98.x) + _e101.y); + a004_ = ((min((_e83.x * _e85.x), exp2((-9.28f * _e94))) * _e98.x) + _e101.y); let _e109 = a004_; let _e112 = r; - AB = ((vec2(-1.04, 1.04) * vec2(_e109)) + _e112.zw); + AB = ((vec2(-1.04f, 1.04f) * vec2(_e109)) + _e112.zw); let _e116 = f0_8; let _e117 = AB; let _e121 = AB; @@ -367,7 +367,7 @@ fn perceptualRoughnessToRoughness(perceptualRoughness: f32) -> f32 { perceptualRoughness_1 = perceptualRoughness; let _e45 = perceptualRoughness_1; - clampedPerceptualRoughness = clamp(_e45, 0.089, 1.0); + clampedPerceptualRoughness = clamp(_e45, 0.089f, 1f); let _e50 = clampedPerceptualRoughness; let _e51 = clampedPerceptualRoughness; return (_e50 * _e51); @@ -379,7 +379,7 @@ fn reinhard(color: vec3) -> vec3 { color_1 = color; let _e42 = color_1; let _e45 = color_1; - return (_e42 / (vec3(1.0) + _e45)); + return (_e42 / (vec3(1f) + _e45)); } fn reinhard_extended(color_2: vec3, max_white: f32) -> vec3 { @@ -393,10 +393,10 @@ fn reinhard_extended(color_2: vec3, max_white: f32) -> vec3 { let _e47 = color_3; let _e48 = max_white_1; let _e49 = max_white_1; - numerator = (_e44 * (vec3(1.0) + (_e47 / vec3((_e48 * _e49))))); + numerator = (_e44 * (vec3(1f) + (_e47 / vec3((_e48 * _e49))))); let _e56 = numerator; let _e59 = color_3; - return (_e56 / (vec3(1.0) + _e59)); + return (_e56 / (vec3(1f) + _e59)); } fn luminance(v_1: vec3) -> f32 { @@ -404,7 +404,7 @@ fn luminance(v_1: vec3) -> f32 { v_2 = v_1; let _e47 = v_2; - return dot(_e47, vec3(0.2126, 0.7152, 0.0722)); + return dot(_e47, vec3(0.2126f, 0.7152f, 0.0722f)); } fn change_luminance(c_in: vec3, l_out: f32) -> vec3 { @@ -434,7 +434,7 @@ fn reinhard_luminance(color_4: vec3) -> vec3 { l_old = _e44; let _e46 = l_old; let _e48 = l_old; - l_new = (_e46 / (1.0 + _e48)); + l_new = (_e46 / (1f + _e48)); let _e54 = color_5; let _e55 = l_new; let _e56 = change_luminance(_e54, _e55); @@ -457,10 +457,10 @@ fn reinhard_extended_luminance(color_6: vec3, max_white_l: f32) -> vec3, V_ let _e116 = centerToRay; let _e120 = centerToRay; let _e121 = centerToRay; - closestPoint = (_e95 + (_e96 * clamp((_e112 * inverseSqrt(dot(_e120, _e121))), 0.0, 1.0))); + closestPoint = (_e95 + (_e96 * clamp((_e112 * inverseSqrt(dot(_e120, _e121))), 0f, 1f))); let _e133 = closestPoint; let _e134 = closestPoint; let _e138 = closestPoint; @@ -547,7 +547,7 @@ fn point_light(light: PointLight, roughness_8: f32, NdotV: f32, N: vec3, V_ let _e153 = a_1; let _e154 = radius; let _e157 = LspecLengthInverse; - normalizationFactor = (_e143 / clamp((_e153 + ((_e154 * 0.5) * _e157)), 0.0, 1.0)); + normalizationFactor = (_e143 / clamp((_e153 + ((_e154 * 0.5f) * _e157)), 0f, 1f)); let _e165 = normalizationFactor; let _e166 = normalizationFactor; specularIntensity_2 = (_e165 * _e166); @@ -563,17 +563,17 @@ fn point_light(light: PointLight, roughness_8: f32, NdotV: f32, N: vec3, V_ let _e184 = L; let _e190 = N_1; let _e191 = L; - NoL_6 = clamp(dot(_e190, _e191), 0.0, 1.0); + NoL_6 = clamp(dot(_e190, _e191), 0f, 1f); let _e199 = N_1; let _e200 = H; let _e206 = N_1; let _e207 = H; - NoH_4 = clamp(dot(_e206, _e207), 0.0, 1.0); + NoH_4 = clamp(dot(_e206, _e207), 0f, 1f); let _e215 = L; let _e216 = H; let _e222 = L; let _e223 = H; - LoH_6 = clamp(dot(_e222, _e223), 0.0, 1.0); + LoH_6 = clamp(dot(_e222, _e223), 0f, 1f); let _e237 = F0_1; let _e238 = roughness_9; let _e239 = H; @@ -595,17 +595,17 @@ fn point_light(light: PointLight, roughness_8: f32, NdotV: f32, N: vec3, V_ let _e260 = L; let _e266 = N_1; let _e267 = L; - NoL_6 = clamp(dot(_e266, _e267), 0.0, 1.0); + NoL_6 = clamp(dot(_e266, _e267), 0f, 1f); let _e274 = N_1; let _e275 = H; let _e281 = N_1; let _e282 = H; - NoH_4 = clamp(dot(_e281, _e282), 0.0, 1.0); + NoH_4 = clamp(dot(_e281, _e282), 0f, 1f); let _e289 = L; let _e290 = H; let _e296 = L; let _e297 = H; - LoH_6 = clamp(dot(_e296, _e297), 0.0, 1.0); + LoH_6 = clamp(dot(_e296, _e297), 0f, 1f); let _e302 = diffuseColor_1; let _e307 = roughness_9; let _e308 = NdotV_1; @@ -636,7 +636,7 @@ fn dir_light(light_2: DirectionalLight, roughness_10: f32, NdotV_2: f32, normal: var NoH_5: f32; var LoH_7: f32; var diffuse_1: vec3; - var specularIntensity_3: f32 = 1.0; + var specularIntensity_3: f32 = 1f; var specular_2: vec3; light_3 = light_2; @@ -658,17 +658,17 @@ fn dir_light(light_2: DirectionalLight, roughness_10: f32, NdotV_2: f32, normal: let _e71 = incident_light; let _e77 = normal_1; let _e78 = incident_light; - NoL_7 = clamp(dot(_e77, _e78), 0.0, 1.0); + NoL_7 = clamp(dot(_e77, _e78), 0f, 1f); let _e86 = normal_1; let _e87 = half_vector; let _e93 = normal_1; let _e94 = half_vector; - NoH_5 = clamp(dot(_e93, _e94), 0.0, 1.0); + NoH_5 = clamp(dot(_e93, _e94), 0f, 1f); let _e102 = incident_light; let _e103 = half_vector; let _e109 = incident_light; let _e110 = half_vector; - LoH_7 = clamp(dot(_e109, _e110), 0.0, 1.0); + LoH_7 = clamp(dot(_e109, _e110), 0f, 1f); let _e116 = diffuseColor_3; let _e121 = roughness_11; let _e122 = NdotV_3; @@ -713,7 +713,7 @@ fn main_1() { var F0_4: vec3; var diffuseColor_4: vec3; var R_4: vec3; - var light_accum: vec3 = vec3(0.0); + var light_accum: vec3 = vec3(0f); var i: i32 = 0i; var i_1: i32 = 0i; var diffuse_ambient: vec3; @@ -785,7 +785,7 @@ fn main_1() { let _e123 = textureSample(StandardMaterial_normal_map, StandardMaterial_normal_map_sampler, _e122); let _e131 = v_Uv_1; let _e132 = textureSample(StandardMaterial_normal_map, StandardMaterial_normal_map_sampler, _e131); - N_2 = (_e120 * normalize(((_e132.xyz * 2.0) - vec3(1.0)))); + N_2 = (_e120 * normalize(((_e132.xyz * 2f) - vec3(1f)))); let _e142 = v_Uv_1; let _e143 = textureSample(StandardMaterial_occlusion_texture, StandardMaterial_occlusion_texture_sampler, _e142); occlusion = _e143.x; @@ -808,16 +808,16 @@ fn main_1() { let _e178 = V_3; let _e183 = N_2; let _e184 = V_3; - NdotV_4 = max(dot(_e183, _e184), 0.001); + NdotV_4 = max(dot(_e183, _e184), 0.001f); let _e190 = global_6.reflectance; let _e192 = global_6.reflectance; let _e195 = metallic; let _e199 = output_color; let _e201 = metallic; - F0_4 = (vec3((((0.16 * _e190) * _e192) * (1.0 - _e195))) + (_e199.xyz * vec3(_e201))); + F0_4 = (vec3((((0.16f * _e190) * _e192) * (1f - _e195))) + (_e199.xyz * vec3(_e201))); let _e206 = output_color; let _e209 = metallic; - diffuseColor_4 = (_e206.xyz * vec3((1.0 - _e209))); + diffuseColor_4 = (_e206.xyz * vec3((1f - _e209))); let _e214 = V_3; let _e217 = V_3; let _e219 = N_2; @@ -878,7 +878,7 @@ fn main_1() { } let _e302 = diffuseColor_4; let _e304 = NdotV_4; - let _e305 = EnvBRDFApprox(_e302, 1.0, _e304); + let _e305 = EnvBRDFApprox(_e302, 1f, _e304); diffuse_ambient = _e305; let _e310 = F0_4; let _e311 = perceptual_roughness_2; diff --git a/naga/tests/out/wgsl/bevy-pbr.vert.wgsl b/naga/tests/out/wgsl/bevy-pbr.vert.wgsl index ac13dcdfdc..71cf8d2fe6 100644 --- a/naga/tests/out/wgsl/bevy-pbr.vert.wgsl +++ b/naga/tests/out/wgsl/bevy-pbr.vert.wgsl @@ -33,7 +33,7 @@ fn main_1() { let _e12 = global_1.Model; let _e13 = Vertex_Position_1; - world_position = (_e12 * vec4(_e13.x, _e13.y, _e13.z, 1.0)); + world_position = (_e12 * vec4(_e13.x, _e13.y, _e13.z, 1f)); let _e21 = world_position; v_WorldPosition = _e21.xyz; let _e23 = global_1.Model; diff --git a/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl b/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl index e429fbeecb..4b2f079206 100644 --- a/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl +++ b/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl @@ -5,7 +5,7 @@ var global_1: binding_array; var global_2: vec4; fn function() { - let _e8 = textureSampleLevel(global[1i], global_1[1i], vec2(0.5, 0.5), 0.0); + let _e8 = textureSampleLevel(global[1i], global_1[1i], vec2(0.5f, 0.5f), 0f); global_2 = _e8; return; } diff --git a/naga/tests/out/wgsl/binding-arrays.static.wgsl b/naga/tests/out/wgsl/binding-arrays.static.wgsl index 09376b4be7..bf87a16844 100644 --- a/naga/tests/out/wgsl/binding-arrays.static.wgsl +++ b/naga/tests/out/wgsl/binding-arrays.static.wgsl @@ -5,7 +5,7 @@ var global_1: binding_array; var global_2: vec4; fn function() { - let _e8 = textureSampleLevel(global[1i], global_1[1i], vec2(0.5, 0.5), 0.0); + let _e8 = textureSampleLevel(global[1i], global_1[1i], vec2(0.5f, 0.5f), 0f); global_2 = _e8; return; } diff --git a/naga/tests/out/wgsl/binding-arrays.wgsl b/naga/tests/out/wgsl/binding-arrays.wgsl index 43f2d7ded4..86bcfc1bff 100644 --- a/naga/tests/out/wgsl/binding-arrays.wgsl +++ b/naga/tests/out/wgsl/binding-arrays.wgsl @@ -29,12 +29,12 @@ var uni: UniformIndex; fn main(fragment_in: FragmentIn) -> @location(0) vec4 { var u1_: u32 = 0u; var u2_: vec2 = vec2(0u); - var v1_: f32 = 0.0; - var v4_: vec4 = vec4(0.0); + var v1_: f32 = 0f; + var v4_: vec4 = vec4(0f); let uniform_index = uni.index; let non_uniform_index = fragment_in.index; - let uv = vec2(0.0); + let uv = vec2(0f); let pix = vec2(0i); let _e21 = textureDimensions(texture_array_unbounded[0]); let _e22 = u2_; @@ -54,13 +54,13 @@ fn main(fragment_in: FragmentIn) -> @location(0) vec4 { let _e52 = textureGather(0, texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv); let _e53 = v4_; v4_ = (_e53 + _e52); - let _e60 = textureGatherCompare(texture_array_depth[0], samp_comp[0], uv, 0.0); + let _e60 = textureGatherCompare(texture_array_depth[0], samp_comp[0], uv, 0f); let _e61 = v4_; v4_ = (_e61 + _e60); - let _e68 = textureGatherCompare(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0.0); + let _e68 = textureGatherCompare(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0f); let _e69 = v4_; v4_ = (_e69 + _e68); - let _e76 = textureGatherCompare(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0.0); + let _e76 = textureGatherCompare(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0f); let _e77 = v4_; v4_ = (_e77 + _e76); let _e82 = textureLoad(texture_array_unbounded[0], pix, 0i); @@ -108,31 +108,31 @@ fn main(fragment_in: FragmentIn) -> @location(0) vec4 { let _e160 = textureSample(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv); let _e161 = v4_; v4_ = (_e161 + _e160); - let _e168 = textureSampleBias(texture_array_bounded[0], samp[0], uv, 0.0); + let _e168 = textureSampleBias(texture_array_bounded[0], samp[0], uv, 0f); let _e169 = v4_; v4_ = (_e169 + _e168); - let _e176 = textureSampleBias(texture_array_bounded[uniform_index], samp[uniform_index], uv, 0.0); + let _e176 = textureSampleBias(texture_array_bounded[uniform_index], samp[uniform_index], uv, 0f); let _e177 = v4_; v4_ = (_e177 + _e176); - let _e184 = textureSampleBias(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, 0.0); + let _e184 = textureSampleBias(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, 0f); let _e185 = v4_; v4_ = (_e185 + _e184); - let _e192 = textureSampleCompare(texture_array_depth[0], samp_comp[0], uv, 0.0); + let _e192 = textureSampleCompare(texture_array_depth[0], samp_comp[0], uv, 0f); let _e193 = v1_; v1_ = (_e193 + _e192); - let _e200 = textureSampleCompare(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0.0); + let _e200 = textureSampleCompare(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0f); let _e201 = v1_; v1_ = (_e201 + _e200); - let _e208 = textureSampleCompare(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0.0); + let _e208 = textureSampleCompare(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0f); let _e209 = v1_; v1_ = (_e209 + _e208); - let _e216 = textureSampleCompareLevel(texture_array_depth[0], samp_comp[0], uv, 0.0); + let _e216 = textureSampleCompareLevel(texture_array_depth[0], samp_comp[0], uv, 0f); let _e217 = v1_; v1_ = (_e217 + _e216); - let _e224 = textureSampleCompareLevel(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0.0); + let _e224 = textureSampleCompareLevel(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0f); let _e225 = v1_; v1_ = (_e225 + _e224); - let _e232 = textureSampleCompareLevel(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0.0); + let _e232 = textureSampleCompareLevel(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0f); let _e233 = v1_; v1_ = (_e233 + _e232); let _e239 = textureSampleGrad(texture_array_bounded[0], samp[0], uv, uv, uv); @@ -144,13 +144,13 @@ fn main(fragment_in: FragmentIn) -> @location(0) vec4 { let _e253 = textureSampleGrad(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, uv, uv); let _e254 = v4_; v4_ = (_e254 + _e253); - let _e261 = textureSampleLevel(texture_array_bounded[0], samp[0], uv, 0.0); + let _e261 = textureSampleLevel(texture_array_bounded[0], samp[0], uv, 0f); let _e262 = v4_; v4_ = (_e262 + _e261); - let _e269 = textureSampleLevel(texture_array_bounded[uniform_index], samp[uniform_index], uv, 0.0); + let _e269 = textureSampleLevel(texture_array_bounded[uniform_index], samp[uniform_index], uv, 0f); let _e270 = v4_; v4_ = (_e270 + _e269); - let _e277 = textureSampleLevel(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, 0.0); + let _e277 = textureSampleLevel(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, 0f); let _e278 = v4_; v4_ = (_e278 + _e277); let _e282 = v4_; diff --git a/naga/tests/out/wgsl/bitcast.wgsl b/naga/tests/out/wgsl/bitcast.wgsl index e0ce18ed75..1f36ce5e66 100644 --- a/naga/tests/out/wgsl/bitcast.wgsl +++ b/naga/tests/out/wgsl/bitcast.wgsl @@ -6,9 +6,9 @@ fn main() { var u2_: vec2 = vec2(0u); var u3_: vec3 = vec3(0u); var u4_: vec4 = vec4(0u); - var f2_: vec2 = vec2(0.0); - var f3_: vec3 = vec3(0.0); - var f4_: vec4 = vec4(0.0); + var f2_: vec2 = vec2(0f); + var f3_: vec3 = vec3(0f); + var f4_: vec4 = vec4(0f); let _e27 = i2_; u2_ = bitcast>(_e27); diff --git a/naga/tests/out/wgsl/bits.wgsl b/naga/tests/out/wgsl/bits.wgsl index afe99fe246..05915549ad 100644 --- a/naga/tests/out/wgsl/bits.wgsl +++ b/naga/tests/out/wgsl/bits.wgsl @@ -8,8 +8,8 @@ fn main() { var u2_: vec2 = vec2(0u); var u3_: vec3 = vec3(0u); var u4_: vec4 = vec4(0u); - var f2_: vec2 = vec2(0.0); - var f4_: vec4 = vec4(0.0); + var f2_: vec2 = vec2(0f); + var f4_: vec4 = vec4(0f); let _e28 = f4_; u = pack4x8snorm(_e28); diff --git a/naga/tests/out/wgsl/bits_glsl.frag.wgsl b/naga/tests/out/wgsl/bits_glsl.frag.wgsl index c3535c95b1..e8365dd1ee 100644 --- a/naga/tests/out/wgsl/bits_glsl.frag.wgsl +++ b/naga/tests/out/wgsl/bits_glsl.frag.wgsl @@ -7,8 +7,8 @@ fn main_1() { var u2_: vec2 = vec2(0u); var u3_: vec3 = vec3(0u); var u4_: vec4 = vec4(0u); - var f2_: vec2 = vec2(0.0); - var f4_: vec4 = vec4(0.0); + var f2_: vec2 = vec2(0f); + var f4_: vec4 = vec4(0f); let _e33 = f4_; u = pack4x8snorm(_e33); diff --git a/naga/tests/out/wgsl/boids.wgsl b/naga/tests/out/wgsl/boids.wgsl index 017d701a5c..ee28ca6786 100644 --- a/naga/tests/out/wgsl/boids.wgsl +++ b/naga/tests/out/wgsl/boids.wgsl @@ -30,9 +30,9 @@ var particlesDst: Particles; fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { var vPos: vec2; var vVel: vec2; - var cMass: vec2 = vec2(0.0, 0.0); - var cVel: vec2 = vec2(0.0, 0.0); - var colVel: vec2 = vec2(0.0, 0.0); + var cMass: vec2 = vec2(0f, 0f); + var cVel: vec2 = vec2(0f, 0f); + var colVel: vec2 = vec2(0f, 0f); var cMassCount: i32 = 0i; var cVelCount: i32 = 0i; var pos: vec2; @@ -119,26 +119,26 @@ fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { vVel = (((_e112 + (_e113 * _e116)) + (_e119 * _e122)) + (_e125 * _e128)); let _e131 = vVel; let _e133 = vVel; - vVel = (normalize(_e131) * clamp(length(_e133), 0.0, 0.1)); + vVel = (normalize(_e131) * clamp(length(_e133), 0f, 0.1f)); let _e139 = vPos; let _e140 = vVel; let _e143 = params.deltaT; vPos = (_e139 + (_e140 * _e143)); let _e147 = vPos.x; - if (_e147 < -1.0) { - vPos.x = 1.0; + if (_e147 < -1f) { + vPos.x = 1f; } let _e153 = vPos.x; - if (_e153 > 1.0) { - vPos.x = -1.0; + if (_e153 > 1f) { + vPos.x = -1f; } let _e159 = vPos.y; - if (_e159 < -1.0) { - vPos.y = 1.0; + if (_e159 < -1f) { + vPos.y = 1f; } let _e165 = vPos.y; - if (_e165 > 1.0) { - vPos.y = -1.0; + if (_e165 > 1f) { + vPos.y = -1f; } let _e174 = vPos; particlesDst.particles[index].pos = _e174; diff --git a/naga/tests/out/wgsl/bool-select.frag.wgsl b/naga/tests/out/wgsl/bool-select.frag.wgsl index f34c54243d..747ff677a2 100644 --- a/naga/tests/out/wgsl/bool-select.frag.wgsl +++ b/naga/tests/out/wgsl/bool-select.frag.wgsl @@ -12,7 +12,7 @@ fn TevPerCompGT(a: f32, b: f32) -> f32 { b_1 = b; let _e5 = a_1; let _e6 = b_1; - return select(0.0, 1.0, (_e5 > _e6)); + return select(0f, 1f, (_e5 > _e6)); } fn TevPerCompGT_1(a_2: vec3, b_2: vec3) -> vec3 { @@ -23,16 +23,16 @@ fn TevPerCompGT_1(a_2: vec3, b_2: vec3) -> vec3 { b_3 = b_2; let _e7 = a_3; let _e8 = b_3; - return select(vec3(0.0), vec3(1.0), (_e7 > _e8)); + return select(vec3(0f), vec3(1f), (_e7 > _e8)); } fn main_1() { let _e1 = o_color; - let _e11 = TevPerCompGT_1(vec3(3.0), vec3(5.0)); + let _e11 = TevPerCompGT_1(vec3(3f), vec3(5f)); o_color.x = _e11.x; o_color.y = _e11.y; o_color.z = _e11.z; - let _e23 = TevPerCompGT(3.0, 5.0); + let _e23 = TevPerCompGT(3f, 5f); o_color.w = _e23; return; } diff --git a/naga/tests/out/wgsl/clamp-splat.vert.wgsl b/naga/tests/out/wgsl/clamp-splat.vert.wgsl index 6b5fe96de2..5dcc28e979 100644 --- a/naga/tests/out/wgsl/clamp-splat.vert.wgsl +++ b/naga/tests/out/wgsl/clamp-splat.vert.wgsl @@ -7,8 +7,8 @@ var gl_Position: vec4; fn main_1() { let _e5 = a_pos_1; - let _e10 = clamp(_e5, vec2(0.0), vec2(1.0)); - gl_Position = vec4(_e10.x, _e10.y, 0.0, 1.0); + let _e10 = clamp(_e5, vec2(0f), vec2(1f)); + gl_Position = vec4(_e10.x, _e10.y, 0f, 1f); return; } diff --git a/naga/tests/out/wgsl/const-exprs.wgsl b/naga/tests/out/wgsl/const-exprs.wgsl index 457d4f87d7..20a43e2044 100644 --- a/naga/tests/out/wgsl/const-exprs.wgsl +++ b/naga/tests/out/wgsl/const-exprs.wgsl @@ -4,13 +4,13 @@ const FOUR: i32 = 4i; const FOUR_ALIAS: i32 = 4i; const TEST_CONSTANT_ADDITION: i32 = 8i; const TEST_CONSTANT_ALIAS_ADDITION: i32 = 8i; -const PI: f32 = 3.141; -const phi_sun: f32 = 6.282; -const DIV: vec4 = vec4(0.44444445, 0.0, 0.0, 0.0); +const PI: f32 = 3.141f; +const phi_sun: f32 = 6.282f; +const DIV: vec4 = vec4(0.44444445f, 0f, 0f, 0f); const TEXTURE_KIND_REGULAR: i32 = 0i; const TEXTURE_KIND_WARP: i32 = 1i; const TEXTURE_KIND_SKY: i32 = 2i; -const add_vec: vec2 = vec2(4.0, 5.0); +const add_vec: vec2 = vec2(4f, 5f); const compare_vec: vec2 = vec2(true, false); fn swizzle_of_compose() { @@ -58,7 +58,7 @@ fn compose_of_constant() { } fn compose_of_splat() { - var x_1: vec4 = vec4(2.0, 1.0, 1.0, 1.0); + var x_1: vec4 = vec4(2f, 1f, 1f, 1f); } diff --git a/naga/tests/out/wgsl/constant-array-size.frag.wgsl b/naga/tests/out/wgsl/constant-array-size.frag.wgsl index 08fb0e3ab8..46697cb7c2 100644 --- a/naga/tests/out/wgsl/constant-array-size.frag.wgsl +++ b/naga/tests/out/wgsl/constant-array-size.frag.wgsl @@ -8,7 +8,7 @@ const NUM_VECS: i32 = 42i; var global: Data; fn function() -> vec4 { - var sum: vec4 = vec4(0.0); + var sum: vec4 = vec4(0f); var i: i32 = 0i; loop { diff --git a/naga/tests/out/wgsl/constructors.wgsl b/naga/tests/out/wgsl/constructors.wgsl index f482c10a4f..a8f62dfecd 100644 --- a/naga/tests/out/wgsl/constructors.wgsl +++ b/naga/tests/out/wgsl/constructors.wgsl @@ -3,9 +3,9 @@ struct Foo { b: i32, } -const const2_: vec3 = vec3(0.0, 1.0, 2.0); -const const3_: mat2x2 = mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0)); -const const4_: array, 1> = array, 1>(mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0))); +const const2_: vec3 = vec3(0f, 1f, 2f); +const const3_: mat2x2 = mat2x2(vec2(0f, 1f), vec2(2f, 3f)); +const const4_: array, 1> = array, 1>(mat2x2(vec2(0f, 1f), vec2(2f, 3f))); const cz0_: bool = bool(); const cz1_: i32 = i32(); const cz2_: u32 = u32(); @@ -20,13 +20,13 @@ const cp3_: array = array(0i, 1i, 2i, 3i); fn main() { var foo: Foo; - foo = Foo(vec4(1.0), 1i); - let m0_ = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); - let m1_ = mat4x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); + foo = Foo(vec4(1f), 1i); + let m0_ = mat2x2(vec2(1f, 0f), vec2(0f, 1f)); + let m1_ = mat4x4(vec4(1f, 0f, 0f, 0f), vec4(0f, 1f, 0f, 0f), vec4(0f, 0f, 1f, 0f), vec4(0f, 0f, 0f, 1f)); let cit0_ = vec2(0u); - let cit1_ = mat2x2(vec2(0.0), vec2(0.0)); + let cit1_ = mat2x2(vec2(0f), vec2(0f)); let cit2_ = array(0i, 1i, 2i, 3i); let ic0_ = bool(bool()); let ic4_ = vec2(0u, 0u); - let ic5_ = mat2x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + let ic5_ = mat2x3(vec3(0f, 0f, 0f), vec3(0f, 0f, 0f)); } diff --git a/naga/tests/out/wgsl/declarations.frag.wgsl b/naga/tests/out/wgsl/declarations.frag.wgsl index 32330d19d6..c0c0236ad6 100644 --- a/naga/tests/out/wgsl/declarations.frag.wgsl +++ b/naga/tests/out/wgsl/declarations.frag.wgsl @@ -38,8 +38,8 @@ var array_2d: array, 2>; var array_toomanyd: array, 2>, 2>, 2>, 2>, 2>, 2>; fn main_1() { - var positions: array, 2> = array, 2>(vec3(-1.0, 1.0, 0.0), vec3(-1.0, -1.0, 0.0)); - var strct: TestStruct = TestStruct(1.0, 2.0); + var positions: array, 2> = array, 2>(vec3(-1f, 1f, 0f), vec3(-1f, -1f, 0f)); + var strct: TestStruct = TestStruct(1f, 2f); var from_input_array: vec4; var a_1: f32; var b: f32; @@ -50,7 +50,7 @@ fn main_1() { a_1 = _e41; let _e57 = array_toomanyd[0][0][0][0][0][0][0]; b = _e57; - out_array[0i] = vec4(2.0); + out_array[0i] = vec4(2f); return; } diff --git a/naga/tests/out/wgsl/double-math-functions.frag.wgsl b/naga/tests/out/wgsl/double-math-functions.frag.wgsl index c7ed6a119e..914af92d24 100644 --- a/naga/tests/out/wgsl/double-math-functions.frag.wgsl +++ b/naga/tests/out/wgsl/double-math-functions.frag.wgsl @@ -92,7 +92,7 @@ fn main_1() { let _e150 = a; let _e152 = i; ldexpOut = ldexp(_e150.x, _e152); - smoothStepScalar = f64(smoothstep(0.0, 1.0, 0.5)); + smoothStepScalar = f64(smoothstep(0f, 1f, 0.5f)); smoothStepVector = smoothstep(vec4(0.0lf), vec4(1.0lf), vec4(0.5lf)); smoothStepMixed = smoothstep(vec4(0.0lf), vec4(1.0lf), vec4(0.5lf)); return; diff --git a/naga/tests/out/wgsl/dualsource.wgsl b/naga/tests/out/wgsl/dualsource.wgsl index 8d03f244a9..505159bb45 100644 --- a/naga/tests/out/wgsl/dualsource.wgsl +++ b/naga/tests/out/wgsl/dualsource.wgsl @@ -5,8 +5,8 @@ struct FragmentOutput { @fragment fn main(@builtin(position) position: vec4) -> FragmentOutput { - var color: vec4 = vec4(0.4, 0.3, 0.2, 0.1); - var mask: vec4 = vec4(0.9, 0.8, 0.7, 0.6); + var color: vec4 = vec4(0.4f, 0.3f, 0.2f, 0.1f); + var mask: vec4 = vec4(0.9f, 0.8f, 0.7f, 0.6f); let _e13 = color; let _e14 = mask; diff --git a/naga/tests/out/wgsl/expressions.frag.wgsl b/naga/tests/out/wgsl/expressions.frag.wgsl index 556ec7b009..0ba5962ab2 100644 --- a/naga/tests/out/wgsl/expressions.frag.wgsl +++ b/naga/tests/out/wgsl/expressions.frag.wgsl @@ -29,13 +29,13 @@ fn testBinOpVecFloat(a: vec4, b: f32) { a_1 = a; b_1 = b; let _e5 = a_1; - v = (_e5 * 2.0); + v = (_e5 * 2f); let _e8 = a_1; - v = (_e8 / vec4(2.0)); + v = (_e8 / vec4(2f)); let _e12 = a_1; - v = (_e12 + vec4(2.0)); + v = (_e12 + vec4(2f)); let _e16 = a_1; - v = (_e16 - vec4(2.0)); + v = (_e16 - vec4(2f)); return; } @@ -268,12 +268,12 @@ fn testUnaryOpMat(a_16: mat3x3) { let _e3 = a_17; v_8 = -(_e3); let _e5 = a_17; - let _e7 = vec3(1.0); + let _e7 = vec3(1f); let _e9 = (_e5 - mat3x3(_e7, _e7, _e7)); a_17 = _e9; v_8 = _e9; let _e10 = a_17; - let _e12 = vec3(1.0); + let _e12 = vec3(1f); a_17 = (_e10 - mat3x3(_e12, _e12, _e12)); v_8 = _e10; return; @@ -285,12 +285,12 @@ fn testStructConstructor() { } fn testNonScalarToScalarConstructor() { - var f: f32 = 1.0; + var f: f32 = 1f; } fn testArrayConstructor() { - var tree_1: array = array(0.0); + var tree_1: array = array(0f); } @@ -408,15 +408,15 @@ fn testSwizzleWrites(a_27: vec3) { a_28 = a_27; let _e6 = a_28; - a_28.z = 3.0; - a_28.x = 4.0; + a_28.z = 3f; + a_28.x = 4f; let _e14 = a_28; let _e16 = a_28; - let _e19 = (_e16.xy * 5.0); + let _e19 = (_e16.xy * 5f); a_28.x = _e19.x; a_28.y = _e19.y; let _e24 = a_28; - let _e28 = (_e24.zy + vec2(1.0)); + let _e28 = (_e24.zy + vec2(1f)); a_28.z = _e28.x; a_28.y = _e28.y; return; @@ -431,10 +431,10 @@ fn main_1() { let _e8 = local_6; global = _e8; let _e9 = o_color; - o_color.x = 1.0; - o_color.y = 1.0; - o_color.z = 1.0; - o_color.w = 1.0; + o_color.x = 1f; + o_color.y = 1f; + o_color.z = 1f; + o_color.w = 1f; return; } diff --git a/naga/tests/out/wgsl/extra.wgsl b/naga/tests/out/wgsl/extra.wgsl index b6cfaea7d3..25f894e7f5 100644 --- a/naga/tests/out/wgsl/extra.wgsl +++ b/naga/tests/out/wgsl/extra.wgsl @@ -16,6 +16,6 @@ fn main(in: FragmentIn) -> @location(0) vec4 { if (in.primitive_index == _e4) { return in.color; } else { - return vec4((vec3(1.0) - in.color.xyz), in.color.w); + return vec4((vec3(1f) - in.color.xyz), in.color.w); } } diff --git a/naga/tests/out/wgsl/fma.frag.wgsl b/naga/tests/out/wgsl/fma.frag.wgsl index 8708539786..57d11c1d24 100644 --- a/naga/tests/out/wgsl/fma.frag.wgsl +++ b/naga/tests/out/wgsl/fma.frag.wgsl @@ -33,10 +33,10 @@ fn Fma(d: ptr, m: Mat4x3_, s: f32) { fn main_1() { let _e1 = o_color; - o_color.x = 1.0; - o_color.y = 1.0; - o_color.z = 1.0; - o_color.w = 1.0; + o_color.x = 1f; + o_color.y = 1f; + o_color.z = 1f; + o_color.w = 1f; return; } diff --git a/naga/tests/out/wgsl/fragment-output.wgsl b/naga/tests/out/wgsl/fragment-output.wgsl index 849ee75748..1a17003979 100644 --- a/naga/tests/out/wgsl/fragment-output.wgsl +++ b/naga/tests/out/wgsl/fragment-output.wgsl @@ -20,10 +20,10 @@ struct FragmentOutputVec2Scalar { fn main_vec4vec3_() -> FragmentOutputVec4Vec3_ { var output: FragmentOutputVec4Vec3_; - output.vec4f = vec4(0.0); + output.vec4f = vec4(0f); output.vec4i = vec4(0i); output.vec4u = vec4(0u); - output.vec3f = vec3(0.0); + output.vec3f = vec3(0f); output.vec3i = vec3(0i); output.vec3u = vec3(0u); let _e19 = output; @@ -34,10 +34,10 @@ fn main_vec4vec3_() -> FragmentOutputVec4Vec3_ { fn main_vec2scalar() -> FragmentOutputVec2Scalar { var output_1: FragmentOutputVec2Scalar; - output_1.vec2f = vec2(0.0); + output_1.vec2f = vec2(0f); output_1.vec2i = vec2(0i); output_1.vec2u = vec2(0u); - output_1.scalarf = 0.0; + output_1.scalarf = 0f; output_1.scalari = 0i; output_1.scalaru = 0u; let _e16 = output_1; diff --git a/naga/tests/out/wgsl/functions.wgsl b/naga/tests/out/wgsl/functions.wgsl index fcaf23d91e..79f000ce22 100644 --- a/naga/tests/out/wgsl/functions.wgsl +++ b/naga/tests/out/wgsl/functions.wgsl @@ -1,7 +1,7 @@ fn test_fma() -> vec2 { - let a = vec2(2.0, 2.0); - let b = vec2(0.5, 0.5); - let c = vec2(0.5, 0.5); + let a = vec2(2f, 2f); + let b = vec2(0.5f, 0.5f); + let c = vec2(0.5f, 0.5f); return fma(a, b, c); } diff --git a/naga/tests/out/wgsl/global-constant-array.frag.wgsl b/naga/tests/out/wgsl/global-constant-array.frag.wgsl index d6d4bfb61a..bdb509dc35 100644 --- a/naga/tests/out/wgsl/global-constant-array.frag.wgsl +++ b/naga/tests/out/wgsl/global-constant-array.frag.wgsl @@ -1,4 +1,4 @@ -const array_: array = array(1.0, 2.0); +const array_: array = array(1f, 2f); var i: u32; diff --git a/naga/tests/out/wgsl/globals.wgsl b/naga/tests/out/wgsl/globals.wgsl index 485522c8f5..229d40ccf6 100644 --- a/naga/tests/out/wgsl/globals.wgsl +++ b/naga/tests/out/wgsl/globals.wgsl @@ -29,24 +29,24 @@ fn test_msl_packed_vec3_as_arg(arg: vec3) { fn test_msl_packed_vec3_() { var idx: i32 = 1i; - alignment.v3_ = vec3(1.0); - alignment.v3_.x = 1.0; - alignment.v3_.x = 2.0; + alignment.v3_ = vec3(1f); + alignment.v3_.x = 1f; + alignment.v3_.x = 2f; let _e16 = idx; - alignment.v3_[_e16] = 3.0; + alignment.v3_[_e16] = 3f; let data = alignment; let l0_ = data.v3_; let l1_ = data.v3_.zx; test_msl_packed_vec3_as_arg(data.v3_); let mvm0_ = (data.v3_ * mat3x3()); let mvm1_ = (mat3x3() * data.v3_); - let svm0_ = (data.v3_ * 2.0); - let svm1_ = (2.0 * data.v3_); + let svm0_ = (data.v3_ * 2f); + let svm1_ = (2f * data.v3_); } @compute @workgroup_size(1, 1, 1) fn main() { - var Foo: f32 = 1.0; + var Foo: f32 = 1f; var at: bool = true; test_msl_packed_vec3_(); @@ -64,7 +64,7 @@ fn main() { wg[3] = _e37; let _e43 = alignment.v3_.x; wg[2] = _e43; - alignment.v1_ = 4.0; + alignment.v1_ = 4f; wg[1] = f32(arrayLength((&dummy))); atomicStore((&at_1), 2u); return; diff --git a/naga/tests/out/wgsl/image.wgsl b/naga/tests/out/wgsl/image.wgsl index 941b2f4d4d..008b4c20c1 100644 --- a/naga/tests/out/wgsl/image.wgsl +++ b/naga/tests/out/wgsl/image.wgsl @@ -110,8 +110,8 @@ fn levels_queries() -> @builtin(position) vec4 { fn texture_sample() -> @location(0) vec4 { var a: vec4; - let tc = vec2(0.5); - let tc3_ = vec3(0.5); + let tc = vec2(0.5f); + let tc3_ = vec3(0.5f); let _e9 = textureSample(image_1d, sampler_reg, tc.x); let _e10 = a; a = (_e10 + _e9); @@ -121,13 +121,13 @@ fn texture_sample() -> @location(0) vec4 { let _e19 = textureSample(image_2d, sampler_reg, tc, vec2(3i, 1i)); let _e20 = a; a = (_e20 + _e19); - let _e24 = textureSampleLevel(image_2d, sampler_reg, tc, 2.3); + let _e24 = textureSampleLevel(image_2d, sampler_reg, tc, 2.3f); let _e25 = a; a = (_e25 + _e24); - let _e29 = textureSampleLevel(image_2d, sampler_reg, tc, 2.3, vec2(3i, 1i)); + let _e29 = textureSampleLevel(image_2d, sampler_reg, tc, 2.3f, vec2(3i, 1i)); let _e30 = a; a = (_e30 + _e29); - let _e35 = textureSampleBias(image_2d, sampler_reg, tc, 2.0, vec2(3i, 1i)); + let _e35 = textureSampleBias(image_2d, sampler_reg, tc, 2f, vec2(3i, 1i)); let _e36 = a; a = (_e36 + _e35); let _e41 = textureSample(image_2d_array, sampler_reg, tc, 0u); @@ -136,13 +136,13 @@ fn texture_sample() -> @location(0) vec4 { let _e47 = textureSample(image_2d_array, sampler_reg, tc, 0u, vec2(3i, 1i)); let _e48 = a; a = (_e48 + _e47); - let _e53 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, 2.3); + let _e53 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, 2.3f); let _e54 = a; a = (_e54 + _e53); - let _e59 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, 2.3, vec2(3i, 1i)); + let _e59 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, 2.3f, vec2(3i, 1i)); let _e60 = a; a = (_e60 + _e59); - let _e66 = textureSampleBias(image_2d_array, sampler_reg, tc, 0u, 2.0, vec2(3i, 1i)); + let _e66 = textureSampleBias(image_2d_array, sampler_reg, tc, 0u, 2f, vec2(3i, 1i)); let _e67 = a; a = (_e67 + _e66); let _e72 = textureSample(image_2d_array, sampler_reg, tc, 0i); @@ -151,31 +151,31 @@ fn texture_sample() -> @location(0) vec4 { let _e78 = textureSample(image_2d_array, sampler_reg, tc, 0i, vec2(3i, 1i)); let _e79 = a; a = (_e79 + _e78); - let _e84 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0i, 2.3); + let _e84 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0i, 2.3f); let _e85 = a; a = (_e85 + _e84); - let _e90 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0i, 2.3, vec2(3i, 1i)); + let _e90 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0i, 2.3f, vec2(3i, 1i)); let _e91 = a; a = (_e91 + _e90); - let _e97 = textureSampleBias(image_2d_array, sampler_reg, tc, 0i, 2.0, vec2(3i, 1i)); + let _e97 = textureSampleBias(image_2d_array, sampler_reg, tc, 0i, 2f, vec2(3i, 1i)); let _e98 = a; a = (_e98 + _e97); let _e103 = textureSample(image_cube_array, sampler_reg, tc3_, 0u); let _e104 = a; a = (_e104 + _e103); - let _e109 = textureSampleLevel(image_cube_array, sampler_reg, tc3_, 0u, 2.3); + let _e109 = textureSampleLevel(image_cube_array, sampler_reg, tc3_, 0u, 2.3f); let _e110 = a; a = (_e110 + _e109); - let _e116 = textureSampleBias(image_cube_array, sampler_reg, tc3_, 0u, 2.0); + let _e116 = textureSampleBias(image_cube_array, sampler_reg, tc3_, 0u, 2f); let _e117 = a; a = (_e117 + _e116); let _e122 = textureSample(image_cube_array, sampler_reg, tc3_, 0i); let _e123 = a; a = (_e123 + _e122); - let _e128 = textureSampleLevel(image_cube_array, sampler_reg, tc3_, 0i, 2.3); + let _e128 = textureSampleLevel(image_cube_array, sampler_reg, tc3_, 0i, 2.3f); let _e129 = a; a = (_e129 + _e128); - let _e135 = textureSampleBias(image_cube_array, sampler_reg, tc3_, 0i, 2.0); + let _e135 = textureSampleBias(image_cube_array, sampler_reg, tc3_, 0i, 2f); let _e136 = a; a = (_e136 + _e135); let _e138 = a; @@ -186,30 +186,30 @@ fn texture_sample() -> @location(0) vec4 { fn texture_sample_comparison() -> @location(0) f32 { var a_1: f32; - let tc_1 = vec2(0.5); - let tc3_1 = vec3(0.5); - let _e8 = textureSampleCompare(image_2d_depth, sampler_cmp, tc_1, 0.5); + let tc_1 = vec2(0.5f); + let tc3_1 = vec3(0.5f); + let _e8 = textureSampleCompare(image_2d_depth, sampler_cmp, tc_1, 0.5f); let _e9 = a_1; a_1 = (_e9 + _e8); - let _e14 = textureSampleCompare(image_2d_array_depth, sampler_cmp, tc_1, 0u, 0.5); + let _e14 = textureSampleCompare(image_2d_array_depth, sampler_cmp, tc_1, 0u, 0.5f); let _e15 = a_1; a_1 = (_e15 + _e14); - let _e20 = textureSampleCompare(image_2d_array_depth, sampler_cmp, tc_1, 0i, 0.5); + let _e20 = textureSampleCompare(image_2d_array_depth, sampler_cmp, tc_1, 0i, 0.5f); let _e21 = a_1; a_1 = (_e21 + _e20); - let _e25 = textureSampleCompare(image_cube_depth, sampler_cmp, tc3_1, 0.5); + let _e25 = textureSampleCompare(image_cube_depth, sampler_cmp, tc3_1, 0.5f); let _e26 = a_1; a_1 = (_e26 + _e25); - let _e30 = textureSampleCompareLevel(image_2d_depth, sampler_cmp, tc_1, 0.5); + let _e30 = textureSampleCompareLevel(image_2d_depth, sampler_cmp, tc_1, 0.5f); let _e31 = a_1; a_1 = (_e31 + _e30); - let _e36 = textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc_1, 0u, 0.5); + let _e36 = textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc_1, 0u, 0.5f); let _e37 = a_1; a_1 = (_e37 + _e36); - let _e42 = textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc_1, 0i, 0.5); + let _e42 = textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc_1, 0i, 0.5f); let _e43 = a_1; a_1 = (_e43 + _e42); - let _e47 = textureSampleCompareLevel(image_cube_depth, sampler_cmp, tc3_1, 0.5); + let _e47 = textureSampleCompareLevel(image_cube_depth, sampler_cmp, tc3_1, 0.5f); let _e48 = a_1; a_1 = (_e48 + _e47); let _e50 = a_1; @@ -218,11 +218,11 @@ fn texture_sample_comparison() -> @location(0) f32 { @fragment fn gather() -> @location(0) vec4 { - let tc_2 = vec2(0.5); + let tc_2 = vec2(0.5f); let s2d = textureGather(1, image_2d, sampler_reg, tc_2); let s2d_offset = textureGather(3, image_2d, sampler_reg, tc_2, vec2(3i, 1i)); - let s2d_depth = textureGatherCompare(image_2d_depth, sampler_cmp, tc_2, 0.5); - let s2d_depth_offset = textureGatherCompare(image_2d_depth, sampler_cmp, tc_2, 0.5, vec2(3i, 1i)); + let s2d_depth = textureGatherCompare(image_2d_depth, sampler_cmp, tc_2, 0.5f); + let s2d_depth_offset = textureGatherCompare(image_2d_depth, sampler_cmp, tc_2, 0.5f, vec2(3i, 1i)); let u = textureGather(0, image_2d_u32_, sampler_reg, tc_2); let i = textureGather(0, image_2d_i32_, sampler_reg, tc_2); let f = (vec4(u) + vec4(i)); @@ -231,7 +231,7 @@ fn gather() -> @location(0) vec4 { @fragment fn depth_no_comparison() -> @location(0) vec4 { - let tc_3 = vec2(0.5); + let tc_3 = vec2(0.5f); let s2d_1 = textureSample(image_2d_depth, sampler_reg, tc_3); let s2d_gather = textureGather(image_2d_depth, sampler_reg, tc_3); return (vec4(s2d_1) + s2d_gather); diff --git a/naga/tests/out/wgsl/images.frag.wgsl b/naga/tests/out/wgsl/images.frag.wgsl index 2edcb9c0ea..e7eada96e8 100644 --- a/naga/tests/out/wgsl/images.frag.wgsl +++ b/naga/tests/out/wgsl/images.frag.wgsl @@ -24,7 +24,7 @@ fn testImg1D(coord: i32) { let _e10 = textureDimensions(img1D); size = i32(_e10); let _e17 = coord_1; - textureStore(img1D, _e17, vec4(2.0)); + textureStore(img1D, _e17, vec4(2f)); let _e22 = coord_1; let _e23 = textureLoad(img1D, _e22); c = _e23; @@ -44,7 +44,7 @@ fn testImg1DArray(coord_2: vec2) { let _e20 = textureLoad(img1DArray, _e17.x, _e17.y); c_1 = _e20; let _e26 = coord_3; - textureStore(img1DArray, _e26.x, _e26.y, vec4(2.0)); + textureStore(img1DArray, _e26.x, _e26.y, vec4(2f)); return; } @@ -60,7 +60,7 @@ fn testImg2D(coord_4: vec2) { let _e16 = textureLoad(img2D, _e15); c_2 = _e16; let _e22 = coord_5; - textureStore(img2D, _e22, vec4(2.0)); + textureStore(img2D, _e22, vec4(2f)); return; } @@ -77,7 +77,7 @@ fn testImg2DArray(coord_6: vec3) { let _e22 = textureLoad(img2DArray, _e19.xy, _e19.z); c_3 = _e22; let _e28 = coord_7; - textureStore(img2DArray, _e28.xy, _e28.z, vec4(2.0)); + textureStore(img2DArray, _e28.xy, _e28.z, vec4(2f)); return; } @@ -93,7 +93,7 @@ fn testImg3D(coord_8: vec3) { let _e16 = textureLoad(img3D, _e15); c_4 = _e16; let _e22 = coord_9; - textureStore(img3D, _e22, vec4(2.0)); + textureStore(img3D, _e22, vec4(2f)); return; } @@ -119,7 +119,7 @@ fn testImgWriteOnly(coord_12: vec2) { let _e10 = textureDimensions(img2D); size_6 = vec2(vec2(_e10)); let _e18 = coord_13; - textureStore(imgWriteOnly, _e18, vec4(2.0)); + textureStore(imgWriteOnly, _e18, vec4(2f)); return; } diff --git a/naga/tests/out/wgsl/interface.wgsl b/naga/tests/out/wgsl/interface.wgsl index 96713aae95..1f46278ab8 100644 --- a/naga/tests/out/wgsl/interface.wgsl +++ b/naga/tests/out/wgsl/interface.wgsl @@ -22,13 +22,13 @@ var output: array; @vertex fn vertex(@builtin(vertex_index) vertex_index: u32, @builtin(instance_index) instance_index: u32, @location(10) @interpolate(flat) color: u32) -> VertexOutput { let tmp: u32 = ((vertex_index + instance_index) + color); - return VertexOutput(vec4(1.0), f32(tmp)); + return VertexOutput(vec4(1f), f32(tmp)); } @fragment fn fragment(in: VertexOutput, @builtin(front_facing) front_facing: bool, @builtin(sample_index) sample_index: u32, @builtin(sample_mask) sample_mask: u32) -> FragmentOutput { let mask: u32 = (sample_mask & (1u << sample_index)); - let color_1: f32 = select(0.0, 1.0, front_facing); + let color_1: f32 = select(0f, 1f, front_facing); return FragmentOutput(in._varying, mask, color_1); } @@ -43,5 +43,5 @@ fn vertex_two_structs(in1_: Input1_, in2_: Input2_) -> @builtin(position) @invar var index: u32 = 2u; let _e8: u32 = index; - return vec4(f32(in1_.index), f32(in2_.index), f32(_e8), 0.0); + return vec4(f32(in1_.index), f32(in2_.index), f32(_e8), 0f); } diff --git a/naga/tests/out/wgsl/interpolate.wgsl b/naga/tests/out/wgsl/interpolate.wgsl index e2c4ce28b4..402e60cef5 100644 --- a/naga/tests/out/wgsl/interpolate.wgsl +++ b/naga/tests/out/wgsl/interpolate.wgsl @@ -13,14 +13,14 @@ struct FragmentInput { fn vert_main() -> FragmentInput { var out: FragmentInput; - out.position = vec4(2.0, 4.0, 5.0, 6.0); + out.position = vec4(2f, 4f, 5f, 6f); out._flat = 8u; - out._linear = 27.0; - out.linear_centroid = vec2(64.0, 125.0); - out.linear_sample = vec3(216.0, 343.0, 512.0); - out.perspective = vec4(729.0, 1000.0, 1331.0, 1728.0); - out.perspective_centroid = 2197.0; - out.perspective_sample = 2744.0; + out._linear = 27f; + out.linear_centroid = vec2(64f, 125f); + out.linear_sample = vec3(216f, 343f, 512f); + out.perspective = vec4(729f, 1000f, 1331f, 1728f); + out.perspective_centroid = 2197f; + out.perspective_sample = 2744f; let _e30 = out; return _e30; } diff --git a/naga/tests/out/wgsl/local-var-init-in-loop.comp.wgsl b/naga/tests/out/wgsl/local-var-init-in-loop.comp.wgsl index c7e47c2e68..a4bb55437a 100644 --- a/naga/tests/out/wgsl/local-var-init-in-loop.comp.wgsl +++ b/naga/tests/out/wgsl/local-var-init-in-loop.comp.wgsl @@ -1,5 +1,5 @@ fn main_1() { - var sum: vec4 = vec4(0.0); + var sum: vec4 = vec4(0f); var i: i32 = 0i; var a: vec4; @@ -9,7 +9,7 @@ fn main_1() { break; } { - a = vec4(1.0); + a = vec4(1f); let _e17 = sum; let _e18 = a; sum = (_e17 + _e18); diff --git a/naga/tests/out/wgsl/long-form-matrix.frag.wgsl b/naga/tests/out/wgsl/long-form-matrix.frag.wgsl index cadfe936c4..c69439159a 100644 --- a/naga/tests/out/wgsl/long-form-matrix.frag.wgsl +++ b/naga/tests/out/wgsl/long-form-matrix.frag.wgsl @@ -1,12 +1,12 @@ fn main_1() { - var splat: mat2x2 = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); - var normal: mat2x2 = mat2x2(vec2(1.0, 1.0), vec2(2.0, 2.0)); - var from_matrix: mat2x4 = mat2x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0)); - var a: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var b: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var c: mat3x3 = mat3x3(vec3(1.0, 2.0, 3.0), vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0)); - var d: mat3x3 = mat3x3(vec3(2.0, 2.0, 1.0), vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0)); - var e: mat4x4 = mat4x4(vec4(2.0, 2.0, 1.0, 1.0), vec4(1.0, 1.0, 2.0, 2.0), vec4(1.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + var splat: mat2x2 = mat2x2(vec2(1f, 0f), vec2(0f, 1f)); + var normal: mat2x2 = mat2x2(vec2(1f, 1f), vec2(2f, 2f)); + var from_matrix: mat2x4 = mat2x4(vec4(1f, 0f, 0f, 0f), vec4(0f, 1f, 0f, 0f)); + var a: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var b: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var c: mat3x3 = mat3x3(vec3(1f, 2f, 3f), vec3(1f, 1f, 1f), vec3(1f, 1f, 1f)); + var d: mat3x3 = mat3x3(vec3(2f, 2f, 1f), vec3(1f, 1f, 1f), vec3(1f, 1f, 1f)); + var e: mat4x4 = mat4x4(vec4(2f, 2f, 1f, 1f), vec4(1f, 1f, 2f, 2f), vec4(1f, 1f, 1f, 1f), vec4(1f, 1f, 1f, 1f)); } diff --git a/naga/tests/out/wgsl/math-functions.frag.wgsl b/naga/tests/out/wgsl/math-functions.frag.wgsl index dfe3b79eee..b01c3322ae 100644 --- a/naga/tests/out/wgsl/math-functions.frag.wgsl +++ b/naga/tests/out/wgsl/math-functions.frag.wgsl @@ -1,6 +1,6 @@ fn main_1() { - var a: vec4 = vec4(1.0); - var b: vec4 = vec4(2.0); + var a: vec4 = vec4(1f); + var b: vec4 = vec4(2f); var m: mat4x4; var i: i32 = 5i; var ceilOut: vec4; @@ -155,9 +155,9 @@ fn main_1() { let _e235 = a; let _e237 = a; deg = degrees(_e237.x); - smoothStepScalar = smoothstep(0.0, 1.0, 0.5); - smoothStepVector = smoothstep(vec4(0.0), vec4(1.0), vec4(0.5)); - smoothStepMixed = smoothstep(vec4(0.0), vec4(1.0), vec4(0.5)); + smoothStepScalar = smoothstep(0f, 1f, 0.5f); + smoothStepVector = smoothstep(vec4(0f), vec4(1f), vec4(0.5f)); + smoothStepMixed = smoothstep(vec4(0f), vec4(1f), vec4(0.5f)); return; } diff --git a/naga/tests/out/wgsl/math-functions.wgsl b/naga/tests/out/wgsl/math-functions.wgsl index 1863f8bccc..92f391038d 100644 --- a/naga/tests/out/wgsl/math-functions.wgsl +++ b/naga/tests/out/wgsl/math-functions.wgsl @@ -1,16 +1,16 @@ @fragment fn main() { - let v = vec4(0.0); - let a = degrees(1.0); - let b = radians(1.0); + let v = vec4(0f); + let a = degrees(1f); + let b = radians(1f); let c = degrees(v); let d = radians(v); let e = saturate(v); - let g = refract(v, v, 1.0); + let g = refract(v, v, 1f); let sign_a = sign(-1i); let sign_b = sign(vec4(-1i)); - let sign_c = sign(-1.0); - let sign_d = sign(vec4(-1.0)); + let sign_c = sign(-1f); + let sign_d = sign(vec4(-1f)); let const_dot = dot(vec2(), vec2()); let first_leading_bit_abs = firstLeadingBit(abs(0u)); let flb_a = firstLeadingBit(-1i); @@ -32,16 +32,16 @@ fn main() { let clz_b = countLeadingZeros(1u); let clz_c = countLeadingZeros(vec2(-1i)); let clz_d = countLeadingZeros(vec2(1u)); - let lde_a = ldexp(1.0, 2i); - let lde_b = ldexp(vec2(1.0, 2.0), vec2(3i, 4i)); - let modf_a = modf(1.5); - let modf_b = modf(1.5).fract; - let modf_c = modf(1.5).whole; - let modf_d = modf(vec2(1.5, 1.5)); - let modf_e = modf(vec4(1.5, 1.5, 1.5, 1.5)).whole.x; - let modf_f = modf(vec2(1.5, 1.5)).fract.y; - let frexp_a = frexp(1.5); - let frexp_b = frexp(1.5).fract; - let frexp_c = frexp(1.5).exp; - let frexp_d = frexp(vec4(1.5, 1.5, 1.5, 1.5)).exp.x; + let lde_a = ldexp(1f, 2i); + let lde_b = ldexp(vec2(1f, 2f), vec2(3i, 4i)); + let modf_a = modf(1.5f); + let modf_b = modf(1.5f).fract; + let modf_c = modf(1.5f).whole; + let modf_d = modf(vec2(1.5f, 1.5f)); + let modf_e = modf(vec4(1.5f, 1.5f, 1.5f, 1.5f)).whole.x; + let modf_f = modf(vec2(1.5f, 1.5f)).fract.y; + let frexp_a = frexp(1.5f); + let frexp_b = frexp(1.5f).fract; + let frexp_c = frexp(1.5f).exp; + let frexp_d = frexp(vec4(1.5f, 1.5f, 1.5f, 1.5f)).exp.x; } diff --git a/naga/tests/out/wgsl/module-scope.wgsl b/naga/tests/out/wgsl/module-scope.wgsl index 5ee6bb244c..48e3325e53 100644 --- a/naga/tests/out/wgsl/module-scope.wgsl +++ b/naga/tests/out/wgsl/module-scope.wgsl @@ -20,6 +20,6 @@ fn returns() -> S { fn call() { statement(); let _e0 = returns(); - let s = textureSample(Texture, Sampler, vec2(1.0)); + let s = textureSample(Texture, Sampler, vec2(1f)); } diff --git a/naga/tests/out/wgsl/operators.wgsl b/naga/tests/out/wgsl/operators.wgsl index e255de0704..dbf39556de 100644 --- a/naga/tests/out/wgsl/operators.wgsl +++ b/naga/tests/out/wgsl/operators.wgsl @@ -1,6 +1,6 @@ -const v_f32_one: vec4 = vec4(1.0, 1.0, 1.0, 1.0); -const v_f32_zero: vec4 = vec4(0.0, 0.0, 0.0, 0.0); -const v_f32_half: vec4 = vec4(0.5, 0.5, 0.5, 0.5); +const v_f32_one: vec4 = vec4(1f, 1f, 1f, 1f); +const v_f32_zero: vec4 = vec4(0f, 0f, 0f, 0f); +const v_f32_half: vec4 = vec4(0.5f, 0.5f, 0.5f, 0.5f); const v_i32_one: vec4 = vec4(1i, 1i, 1i, 1i); fn builtins() -> vec4 { @@ -8,7 +8,7 @@ fn builtins() -> vec4 { let s2_ = select(v_f32_zero, v_f32_one, true); let s3_ = select(v_f32_one, v_f32_zero, vec4(false, false, false, false)); let m1_ = mix(v_f32_zero, v_f32_one, v_f32_half); - let m2_ = mix(v_f32_zero, v_f32_one, 0.1); + let m2_ = mix(v_f32_zero, v_f32_one, 0.1f); let b1_ = bitcast(1i); let b2_ = bitcast>(v_i32_one); let v_i32_zero = vec4(0i, 0i, 0i, 0i); @@ -16,20 +16,20 @@ fn builtins() -> vec4 { } fn splat(m: f32, n: i32) -> vec4 { - let a_2 = (((vec2(2.0) + vec2(m)) - vec2(4.0)) / vec2(8.0)); + let a_2 = (((vec2(2f) + vec2(m)) - vec2(4f)) / vec2(8f)); let b = (vec4(n) % vec4(2i)); return (a_2.xyxy + vec4(b)); } fn splat_assignment() -> vec2 { - var a: vec2 = vec2(2.0); + var a: vec2 = vec2(2f); let _e4 = a; - a = (_e4 + vec2(1.0)); + a = (_e4 + vec2(1f)); let _e8 = a; - a = (_e8 - vec2(3.0)); + a = (_e8 - vec2(3f)); let _e12 = a; - a = (_e12 / vec2(4.0)); + a = (_e12 / vec2(4f)); let _e15 = a; return _e15; } @@ -51,77 +51,77 @@ fn logical() { } fn arithmetic() { - let neg0_1 = -(1.0); + let neg0_1 = -(1f); let neg1_1 = -(vec2(1i)); - let neg2_ = -(vec2(1.0)); + let neg2_ = -(vec2(1f)); let add0_ = (2i + 1i); let add1_ = (2u + 1u); - let add2_ = (2.0 + 1.0); + let add2_ = (2f + 1f); let add3_ = (vec2(2i) + vec2(1i)); let add4_ = (vec3(2u) + vec3(1u)); - let add5_ = (vec4(2.0) + vec4(1.0)); + let add5_ = (vec4(2f) + vec4(1f)); let sub0_ = (2i - 1i); let sub1_ = (2u - 1u); - let sub2_ = (2.0 - 1.0); + let sub2_ = (2f - 1f); let sub3_ = (vec2(2i) - vec2(1i)); let sub4_ = (vec3(2u) - vec3(1u)); - let sub5_ = (vec4(2.0) - vec4(1.0)); + let sub5_ = (vec4(2f) - vec4(1f)); let mul0_ = (2i * 1i); let mul1_ = (2u * 1u); - let mul2_ = (2.0 * 1.0); + let mul2_ = (2f * 1f); let mul3_ = (vec2(2i) * vec2(1i)); let mul4_ = (vec3(2u) * vec3(1u)); - let mul5_ = (vec4(2.0) * vec4(1.0)); + let mul5_ = (vec4(2f) * vec4(1f)); let div0_ = (2i / 1i); let div1_ = (2u / 1u); - let div2_ = (2.0 / 1.0); + let div2_ = (2f / 1f); let div3_ = (vec2(2i) / vec2(1i)); let div4_ = (vec3(2u) / vec3(1u)); - let div5_ = (vec4(2.0) / vec4(1.0)); + let div5_ = (vec4(2f) / vec4(1f)); let rem0_ = (2i % 1i); let rem1_ = (2u % 1u); - let rem2_ = (2.0 % 1.0); + let rem2_ = (2f % 1f); let rem3_ = (vec2(2i) % vec2(1i)); let rem4_ = (vec3(2u) % vec3(1u)); - let rem5_ = (vec4(2.0) % vec4(1.0)); + let rem5_ = (vec4(2f) % vec4(1f)); { let add0_1 = (vec2(2i) + vec2(1i)); let add1_1 = (vec2(2i) + vec2(1i)); let add2_1 = (vec2(2u) + vec2(1u)); let add3_1 = (vec2(2u) + vec2(1u)); - let add4_1 = (vec2(2.0) + vec2(1.0)); - let add5_1 = (vec2(2.0) + vec2(1.0)); + let add4_1 = (vec2(2f) + vec2(1f)); + let add5_1 = (vec2(2f) + vec2(1f)); let sub0_1 = (vec2(2i) - vec2(1i)); let sub1_1 = (vec2(2i) - vec2(1i)); let sub2_1 = (vec2(2u) - vec2(1u)); let sub3_1 = (vec2(2u) - vec2(1u)); - let sub4_1 = (vec2(2.0) - vec2(1.0)); - let sub5_1 = (vec2(2.0) - vec2(1.0)); + let sub4_1 = (vec2(2f) - vec2(1f)); + let sub5_1 = (vec2(2f) - vec2(1f)); let mul0_1 = (vec2(2i) * 1i); let mul1_1 = (2i * vec2(1i)); let mul2_1 = (vec2(2u) * 1u); let mul3_1 = (2u * vec2(1u)); - let mul4_1 = (vec2(2.0) * 1.0); - let mul5_1 = (2.0 * vec2(1.0)); + let mul4_1 = (vec2(2f) * 1f); + let mul5_1 = (2f * vec2(1f)); let div0_1 = (vec2(2i) / vec2(1i)); let div1_1 = (vec2(2i) / vec2(1i)); let div2_1 = (vec2(2u) / vec2(1u)); let div3_1 = (vec2(2u) / vec2(1u)); - let div4_1 = (vec2(2.0) / vec2(1.0)); - let div5_1 = (vec2(2.0) / vec2(1.0)); + let div4_1 = (vec2(2f) / vec2(1f)); + let div5_1 = (vec2(2f) / vec2(1f)); let rem0_1 = (vec2(2i) % vec2(1i)); let rem1_1 = (vec2(2i) % vec2(1i)); let rem2_1 = (vec2(2u) % vec2(1u)); let rem3_1 = (vec2(2u) % vec2(1u)); - let rem4_1 = (vec2(2.0) % vec2(1.0)); - let rem5_1 = (vec2(2.0) % vec2(1.0)); + let rem4_1 = (vec2(2f) % vec2(1f)); + let rem5_1 = (vec2(2f) % vec2(1f)); } let add = (mat3x3() + mat3x3()); let sub = (mat3x3() - mat3x3()); - let mul_scalar0_ = (mat3x3() * 1.0); - let mul_scalar1_ = (2.0 * mat3x3()); - let mul_vector0_ = (mat4x3() * vec4(1.0)); - let mul_vector1_ = (vec3(2.0) * mat4x3()); + let mul_scalar0_ = (mat3x3() * 1f); + let mul_scalar1_ = (2f * mat3x3()); + let mul_vector0_ = (mat4x3() * vec4(1f)); + let mul_vector1_ = (vec3(2f) * mat4x3()); let mul = (mat4x3() * mat3x4()); } @@ -155,40 +155,40 @@ fn bit() { fn comparison() { let eq0_ = (2i == 1i); let eq1_ = (2u == 1u); - let eq2_ = (2.0 == 1.0); + let eq2_ = (2f == 1f); let eq3_ = (vec2(2i) == vec2(1i)); let eq4_ = (vec3(2u) == vec3(1u)); - let eq5_ = (vec4(2.0) == vec4(1.0)); + let eq5_ = (vec4(2f) == vec4(1f)); let neq0_ = (2i != 1i); let neq1_ = (2u != 1u); - let neq2_ = (2.0 != 1.0); + let neq2_ = (2f != 1f); let neq3_ = (vec2(2i) != vec2(1i)); let neq4_ = (vec3(2u) != vec3(1u)); - let neq5_ = (vec4(2.0) != vec4(1.0)); + let neq5_ = (vec4(2f) != vec4(1f)); let lt0_ = (2i < 1i); let lt1_ = (2u < 1u); - let lt2_ = (2.0 < 1.0); + let lt2_ = (2f < 1f); let lt3_ = (vec2(2i) < vec2(1i)); let lt4_ = (vec3(2u) < vec3(1u)); - let lt5_ = (vec4(2.0) < vec4(1.0)); + let lt5_ = (vec4(2f) < vec4(1f)); let lte0_ = (2i <= 1i); let lte1_ = (2u <= 1u); - let lte2_ = (2.0 <= 1.0); + let lte2_ = (2f <= 1f); let lte3_ = (vec2(2i) <= vec2(1i)); let lte4_ = (vec3(2u) <= vec3(1u)); - let lte5_ = (vec4(2.0) <= vec4(1.0)); + let lte5_ = (vec4(2f) <= vec4(1f)); let gt0_ = (2i > 1i); let gt1_ = (2u > 1u); - let gt2_ = (2.0 > 1.0); + let gt2_ = (2f > 1f); let gt3_ = (vec2(2i) > vec2(1i)); let gt4_ = (vec3(2u) > vec3(1u)); - let gt5_ = (vec4(2.0) > vec4(1.0)); + let gt5_ = (vec4(2f) > vec4(1f)); let gte0_ = (2i >= 1i); let gte1_ = (2u >= 1u); - let gte2_ = (2.0 >= 1.0); + let gte2_ = (2f >= 1f); let gte3_ = (vec2(2i) >= vec2(1i)); let gte4_ = (vec3(2u) >= vec3(1u)); - let gte5_ = (vec4(2.0) >= vec4(1.0)); + let gte5_ = (vec4(2f) >= vec4(1f)); } fn assignment() { @@ -244,7 +244,7 @@ fn negation_avoids_prefix_decrement() { fn main(@builtin(workgroup_id) id: vec3) { let _e1 = builtins(); let _e6 = splat(f32(id.x), i32(id.y)); - let _e11 = bool_cast(vec3(1.0, 1.0, 1.0)); + let _e11 = bool_cast(vec3(1f, 1f, 1f)); logical(); arithmetic(); bit(); diff --git a/naga/tests/out/wgsl/padding.wgsl b/naga/tests/out/wgsl/padding.wgsl index 9893747ca7..62a5c7d567 100644 --- a/naga/tests/out/wgsl/padding.wgsl +++ b/naga/tests/out/wgsl/padding.wgsl @@ -29,5 +29,5 @@ fn vertex() -> @builtin(position) vec4 { let _e4 = input1_.b; let _e8 = input2_.b; let _e12 = input3_.b; - return (((vec4(1.0) * _e4) * _e8) * _e12); + return (((vec4(1f) * _e4) * _e8) * _e12); } diff --git a/naga/tests/out/wgsl/prepostfix.frag.wgsl b/naga/tests/out/wgsl/prepostfix.frag.wgsl index 63e97e6dab..d2c59a0dd9 100644 --- a/naga/tests/out/wgsl/prepostfix.frag.wgsl +++ b/naga/tests/out/wgsl/prepostfix.frag.wgsl @@ -4,7 +4,7 @@ fn main_1() { var vec_target: vec2; var vec: vec2 = vec2(1u); var mat_target: mat4x3; - var mat: mat4x3 = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + var mat: mat4x3 = mat4x3(vec3(1f, 0f, 0f), vec3(0f, 1f, 0f), vec3(0f, 0f, 1f), vec3(0f, 0f, 0f)); let _e3 = scalar; scalar = (_e3 + 1i); @@ -21,11 +21,11 @@ fn main_1() { vec = _e21; vec_target = _e21; let _e32 = mat; - let _e34 = vec3(1.0); + let _e34 = vec3(1f); mat = (_e32 + mat4x3(_e34, _e34, _e34, _e34)); mat_target = _e32; let _e37 = mat; - let _e39 = vec3(1.0); + let _e39 = vec3(1f); let _e41 = (_e37 - mat4x3(_e39, _e39, _e39, _e39)); mat = _e41; mat_target = _e41; diff --git a/naga/tests/out/wgsl/quad-vert.wgsl b/naga/tests/out/wgsl/quad-vert.wgsl index df7c6d0001..28a2317e91 100644 --- a/naga/tests/out/wgsl/quad-vert.wgsl +++ b/naga/tests/out/wgsl/quad-vert.wgsl @@ -12,14 +12,14 @@ struct VertexOutput { var v_uv: vec2; var a_uv_1: vec2; -var perVertexStruct: gl_PerVertex = gl_PerVertex(vec4(0.0, 0.0, 0.0, 1.0), 1.0, array(), array()); +var perVertexStruct: gl_PerVertex = gl_PerVertex(vec4(0f, 0f, 0f, 1f), 1f, array(), array()); var a_pos_1: vec2; fn main_1() { let _e6 = a_uv_1; v_uv = _e6; let _e7 = a_pos_1; - perVertexStruct.gl_Position = vec4(_e7.x, _e7.y, 0.0, 1.0); + perVertexStruct.gl_Position = vec4(_e7.x, _e7.y, 0f, 1f); return; } diff --git a/naga/tests/out/wgsl/quad.wgsl b/naga/tests/out/wgsl/quad.wgsl index 3a92981d95..05e5c0e7b9 100644 --- a/naga/tests/out/wgsl/quad.wgsl +++ b/naga/tests/out/wgsl/quad.wgsl @@ -3,7 +3,7 @@ struct VertexOutput { @builtin(position) position: vec4, } -const c_scale: f32 = 1.2; +const c_scale: f32 = 1.2f; @group(0) @binding(0) var u_texture: texture_2d; @@ -12,13 +12,13 @@ var u_sampler: sampler; @vertex fn vert_main(@location(0) pos: vec2, @location(1) uv: vec2) -> VertexOutput { - return VertexOutput(uv, vec4((c_scale * pos), 0.0, 1.0)); + return VertexOutput(uv, vec4((c_scale * pos), 0f, 1f)); } @fragment fn frag_main(@location(0) uv_1: vec2) -> @location(0) vec4 { let color = textureSample(u_texture, u_sampler, uv_1); - if (color.w == 0.0) { + if (color.w == 0f) { discard; } let premultiplied = (color.w * color); @@ -27,5 +27,5 @@ fn frag_main(@location(0) uv_1: vec2) -> @location(0) vec4 { @fragment fn fs_extra() -> @location(0) vec4 { - return vec4(0.0, 0.5, 0.0, 0.5); + return vec4(0f, 0.5f, 0f, 0.5f); } diff --git a/naga/tests/out/wgsl/quad_glsl.frag.wgsl b/naga/tests/out/wgsl/quad_glsl.frag.wgsl index e90e5640d3..9de0a19c4b 100644 --- a/naga/tests/out/wgsl/quad_glsl.frag.wgsl +++ b/naga/tests/out/wgsl/quad_glsl.frag.wgsl @@ -6,7 +6,7 @@ var v_uv_1: vec2; var o_color: vec4; fn main_1() { - o_color = vec4(1.0, 1.0, 1.0, 1.0); + o_color = vec4(1f, 1f, 1f, 1f); return; } diff --git a/naga/tests/out/wgsl/quad_glsl.vert.wgsl b/naga/tests/out/wgsl/quad_glsl.vert.wgsl index 1cec36afaf..5c5ee71041 100644 --- a/naga/tests/out/wgsl/quad_glsl.vert.wgsl +++ b/naga/tests/out/wgsl/quad_glsl.vert.wgsl @@ -3,7 +3,7 @@ struct VertexOutput { @builtin(position) member: vec4, } -const c_scale: f32 = 1.2; +const c_scale: f32 = 1.2f; var a_pos_1: vec2; var a_uv_1: vec2; @@ -15,7 +15,7 @@ fn main_1() { v_uv = _e4; let _e6 = a_pos_1; let _e8 = (c_scale * _e6); - gl_Position = vec4(_e8.x, _e8.y, 0.0, 1.0); + gl_Position = vec4(_e8.x, _e8.y, 0f, 1f); return; } diff --git a/naga/tests/out/wgsl/sampler-functions.frag.wgsl b/naga/tests/out/wgsl/sampler-functions.frag.wgsl index 39e51e93de..3530629088 100644 --- a/naga/tests/out/wgsl/sampler-functions.frag.wgsl +++ b/naga/tests/out/wgsl/sampler-functions.frag.wgsl @@ -1,6 +1,6 @@ fn CalcShadowPCF1_(T_P_t_TextureDepth: texture_depth_2d, S_P_t_TextureDepth: sampler_comparison, t_ProjCoord: vec3) -> f32 { var t_ProjCoord_1: vec3; - var t_Res: f32 = 0.0; + var t_Res: f32 = 0f; t_ProjCoord_1 = t_ProjCoord; let _e6 = t_Res; @@ -8,7 +8,7 @@ fn CalcShadowPCF1_(T_P_t_TextureDepth: texture_depth_2d, S_P_t_TextureDepth: sam let _e9 = t_ProjCoord_1; let _e10 = _e9.xyz; let _e13 = textureSampleCompare(T_P_t_TextureDepth, S_P_t_TextureDepth, _e10.xy, _e10.z); - t_Res = (_e6 + (_e13 * 0.2)); + t_Res = (_e6 + (_e13 * 0.2f)); let _e19 = t_Res; return _e19; } diff --git a/naga/tests/out/wgsl/samplers.frag.wgsl b/naga/tests/out/wgsl/samplers.frag.wgsl index 093ee00ffc..4306e6683f 100644 --- a/naga/tests/out/wgsl/samplers.frag.wgsl +++ b/naga/tests/out/wgsl/samplers.frag.wgsl @@ -43,105 +43,105 @@ fn testTex1D(coord: f32) { let _e26 = textureSample(tex1D, samp, _e25); c = _e26; let _e29 = coord_1; - let _e31 = textureSampleBias(tex1D, samp, _e29, 2.0); + let _e31 = textureSampleBias(tex1D, samp, _e29, 2f); c = _e31; let _e35 = coord_1; - let _e38 = textureSampleGrad(tex1D, samp, _e35, 4.0, 4.0); + let _e38 = textureSampleGrad(tex1D, samp, _e35, 4f, 4f); c = _e38; let _e43 = coord_1; - let _e47 = textureSampleGrad(tex1D, samp, _e43, 4.0, 4.0, 5i); + let _e47 = textureSampleGrad(tex1D, samp, _e43, 4f, 4f, 5i); c = _e47; let _e50 = coord_1; - let _e52 = textureSampleLevel(tex1D, samp, _e50, 3.0); + let _e52 = textureSampleLevel(tex1D, samp, _e50, 3f); c = _e52; let _e56 = coord_1; - let _e59 = textureSampleLevel(tex1D, samp, _e56, 3.0, 5i); + let _e59 = textureSampleLevel(tex1D, samp, _e56, 3f, 5i); c = _e59; let _e62 = coord_1; let _e64 = textureSample(tex1D, samp, _e62, 5i); c = _e64; let _e68 = coord_1; - let _e71 = textureSampleBias(tex1D, samp, _e68, 2.0, 5i); + let _e71 = textureSampleBias(tex1D, samp, _e68, 2f, 5i); c = _e71; let _e72 = coord_1; let _e75 = coord_1; - let _e77 = vec2(_e75, 6.0); + let _e77 = vec2(_e75, 6f); let _e81 = textureSample(tex1D, samp, (_e77.x / _e77.y)); c = _e81; let _e82 = coord_1; let _e87 = coord_1; - let _e91 = vec4(_e87, 0.0, 0.0, 6.0); + let _e91 = vec4(_e87, 0f, 0f, 6f); let _e97 = textureSample(tex1D, samp, (_e91.xyz / vec3(_e91.w)).x); c = _e97; let _e98 = coord_1; let _e102 = coord_1; - let _e104 = vec2(_e102, 6.0); - let _e109 = textureSampleBias(tex1D, samp, (_e104.x / _e104.y), 2.0); + let _e104 = vec2(_e102, 6f); + let _e109 = textureSampleBias(tex1D, samp, (_e104.x / _e104.y), 2f); c = _e109; let _e110 = coord_1; let _e116 = coord_1; - let _e120 = vec4(_e116, 0.0, 0.0, 6.0); - let _e127 = textureSampleBias(tex1D, samp, (_e120.xyz / vec3(_e120.w)).x, 2.0); + let _e120 = vec4(_e116, 0f, 0f, 6f); + let _e127 = textureSampleBias(tex1D, samp, (_e120.xyz / vec3(_e120.w)).x, 2f); c = _e127; let _e128 = coord_1; let _e133 = coord_1; - let _e135 = vec2(_e133, 6.0); - let _e141 = textureSampleGrad(tex1D, samp, (_e135.x / _e135.y), 4.0, 4.0); + let _e135 = vec2(_e133, 6f); + let _e141 = textureSampleGrad(tex1D, samp, (_e135.x / _e135.y), 4f, 4f); c = _e141; let _e142 = coord_1; let _e149 = coord_1; - let _e153 = vec4(_e149, 0.0, 0.0, 6.0); - let _e161 = textureSampleGrad(tex1D, samp, (_e153.xyz / vec3(_e153.w)).x, 4.0, 4.0); + let _e153 = vec4(_e149, 0f, 0f, 6f); + let _e161 = textureSampleGrad(tex1D, samp, (_e153.xyz / vec3(_e153.w)).x, 4f, 4f); c = _e161; let _e162 = coord_1; let _e168 = coord_1; - let _e170 = vec2(_e168, 6.0); - let _e177 = textureSampleGrad(tex1D, samp, (_e170.x / _e170.y), 4.0, 4.0, 5i); + let _e170 = vec2(_e168, 6f); + let _e177 = textureSampleGrad(tex1D, samp, (_e170.x / _e170.y), 4f, 4f, 5i); c = _e177; let _e178 = coord_1; let _e186 = coord_1; - let _e190 = vec4(_e186, 0.0, 0.0, 6.0); - let _e199 = textureSampleGrad(tex1D, samp, (_e190.xyz / vec3(_e190.w)).x, 4.0, 4.0, 5i); + let _e190 = vec4(_e186, 0f, 0f, 6f); + let _e199 = textureSampleGrad(tex1D, samp, (_e190.xyz / vec3(_e190.w)).x, 4f, 4f, 5i); c = _e199; let _e200 = coord_1; let _e204 = coord_1; - let _e206 = vec2(_e204, 6.0); - let _e211 = textureSampleLevel(tex1D, samp, (_e206.x / _e206.y), 3.0); + let _e206 = vec2(_e204, 6f); + let _e211 = textureSampleLevel(tex1D, samp, (_e206.x / _e206.y), 3f); c = _e211; let _e212 = coord_1; let _e218 = coord_1; - let _e222 = vec4(_e218, 0.0, 0.0, 6.0); - let _e229 = textureSampleLevel(tex1D, samp, (_e222.xyz / vec3(_e222.w)).x, 3.0); + let _e222 = vec4(_e218, 0f, 0f, 6f); + let _e229 = textureSampleLevel(tex1D, samp, (_e222.xyz / vec3(_e222.w)).x, 3f); c = _e229; let _e230 = coord_1; let _e235 = coord_1; - let _e237 = vec2(_e235, 6.0); - let _e243 = textureSampleLevel(tex1D, samp, (_e237.x / _e237.y), 3.0, 5i); + let _e237 = vec2(_e235, 6f); + let _e243 = textureSampleLevel(tex1D, samp, (_e237.x / _e237.y), 3f, 5i); c = _e243; let _e244 = coord_1; let _e251 = coord_1; - let _e255 = vec4(_e251, 0.0, 0.0, 6.0); - let _e263 = textureSampleLevel(tex1D, samp, (_e255.xyz / vec3(_e255.w)).x, 3.0, 5i); + let _e255 = vec4(_e251, 0f, 0f, 6f); + let _e263 = textureSampleLevel(tex1D, samp, (_e255.xyz / vec3(_e255.w)).x, 3f, 5i); c = _e263; let _e264 = coord_1; let _e268 = coord_1; - let _e270 = vec2(_e268, 6.0); + let _e270 = vec2(_e268, 6f); let _e275 = textureSample(tex1D, samp, (_e270.x / _e270.y), 5i); c = _e275; let _e276 = coord_1; let _e282 = coord_1; - let _e286 = vec4(_e282, 0.0, 0.0, 6.0); + let _e286 = vec4(_e282, 0f, 0f, 6f); let _e293 = textureSample(tex1D, samp, (_e286.xyz / vec3(_e286.w)).x, 5i); c = _e293; let _e294 = coord_1; let _e299 = coord_1; - let _e301 = vec2(_e299, 6.0); - let _e307 = textureSampleBias(tex1D, samp, (_e301.x / _e301.y), 2.0, 5i); + let _e301 = vec2(_e299, 6f); + let _e307 = textureSampleBias(tex1D, samp, (_e301.x / _e301.y), 2f, 5i); c = _e307; let _e308 = coord_1; let _e315 = coord_1; - let _e319 = vec4(_e315, 0.0, 0.0, 6.0); - let _e327 = textureSampleBias(tex1D, samp, (_e319.xyz / vec3(_e319.w)).x, 2.0, 5i); + let _e319 = vec4(_e315, 0f, 0f, 6f); + let _e327 = textureSampleBias(tex1D, samp, (_e319.xyz / vec3(_e319.w)).x, 2f, 5i); c = _e327; let _e328 = coord_1; let _e331 = coord_1; @@ -167,25 +167,25 @@ fn testTex1DArray(coord_2: vec2) { let _e31 = textureSample(tex1DArray, samp, _e27.x, i32(_e27.y)); c_1 = _e31; let _e34 = coord_3; - let _e39 = textureSampleBias(tex1DArray, samp, _e34.x, i32(_e34.y), 2.0); + let _e39 = textureSampleBias(tex1DArray, samp, _e34.x, i32(_e34.y), 2f); c_1 = _e39; let _e43 = coord_3; - let _e49 = textureSampleGrad(tex1DArray, samp, _e43.x, i32(_e43.y), 4.0, 4.0); + let _e49 = textureSampleGrad(tex1DArray, samp, _e43.x, i32(_e43.y), 4f, 4f); c_1 = _e49; let _e54 = coord_3; - let _e61 = textureSampleGrad(tex1DArray, samp, _e54.x, i32(_e54.y), 4.0, 4.0, 5i); + let _e61 = textureSampleGrad(tex1DArray, samp, _e54.x, i32(_e54.y), 4f, 4f, 5i); c_1 = _e61; let _e64 = coord_3; - let _e69 = textureSampleLevel(tex1DArray, samp, _e64.x, i32(_e64.y), 3.0); + let _e69 = textureSampleLevel(tex1DArray, samp, _e64.x, i32(_e64.y), 3f); c_1 = _e69; let _e73 = coord_3; - let _e79 = textureSampleLevel(tex1DArray, samp, _e73.x, i32(_e73.y), 3.0, 5i); + let _e79 = textureSampleLevel(tex1DArray, samp, _e73.x, i32(_e73.y), 3f, 5i); c_1 = _e79; let _e82 = coord_3; let _e87 = textureSample(tex1DArray, samp, _e82.x, i32(_e82.y), 5i); c_1 = _e87; let _e91 = coord_3; - let _e97 = textureSampleBias(tex1DArray, samp, _e91.x, i32(_e91.y), 2.0, 5i); + let _e97 = textureSampleBias(tex1DArray, samp, _e91.x, i32(_e91.y), 2f, 5i); c_1 = _e97; let _e98 = coord_3; let _e101 = coord_3; @@ -212,105 +212,105 @@ fn testTex2D(coord_4: vec2) { let _e26 = textureSample(tex2D, samp, _e25); c_2 = _e26; let _e29 = coord_5; - let _e31 = textureSampleBias(tex2D, samp, _e29, 2.0); + let _e31 = textureSampleBias(tex2D, samp, _e29, 2f); c_2 = _e31; let _e37 = coord_5; - let _e42 = textureSampleGrad(tex2D, samp, _e37, vec2(4.0), vec2(4.0)); + let _e42 = textureSampleGrad(tex2D, samp, _e37, vec2(4f), vec2(4f)); c_2 = _e42; let _e50 = coord_5; - let _e57 = textureSampleGrad(tex2D, samp, _e50, vec2(4.0), vec2(4.0), vec2(5i)); + let _e57 = textureSampleGrad(tex2D, samp, _e50, vec2(4f), vec2(4f), vec2(5i)); c_2 = _e57; let _e60 = coord_5; - let _e62 = textureSampleLevel(tex2D, samp, _e60, 3.0); + let _e62 = textureSampleLevel(tex2D, samp, _e60, 3f); c_2 = _e62; let _e67 = coord_5; - let _e71 = textureSampleLevel(tex2D, samp, _e67, 3.0, vec2(5i)); + let _e71 = textureSampleLevel(tex2D, samp, _e67, 3f, vec2(5i)); c_2 = _e71; let _e75 = coord_5; let _e78 = textureSample(tex2D, samp, _e75, vec2(5i)); c_2 = _e78; let _e83 = coord_5; - let _e87 = textureSampleBias(tex2D, samp, _e83, 2.0, vec2(5i)); + let _e87 = textureSampleBias(tex2D, samp, _e83, 2f, vec2(5i)); c_2 = _e87; let _e88 = coord_5; let _e93 = coord_5; - let _e97 = vec3(_e93.x, _e93.y, 6.0); + let _e97 = vec3(_e93.x, _e93.y, 6f); let _e102 = textureSample(tex2D, samp, (_e97.xy / vec2(_e97.z))); c_2 = _e102; let _e103 = coord_5; let _e109 = coord_5; - let _e114 = vec4(_e109.x, _e109.y, 0.0, 6.0); + let _e114 = vec4(_e109.x, _e109.y, 0f, 6f); let _e120 = textureSample(tex2D, samp, (_e114.xyz / vec3(_e114.w)).xy); c_2 = _e120; let _e121 = coord_5; let _e127 = coord_5; - let _e131 = vec3(_e127.x, _e127.y, 6.0); - let _e137 = textureSampleBias(tex2D, samp, (_e131.xy / vec2(_e131.z)), 2.0); + let _e131 = vec3(_e127.x, _e127.y, 6f); + let _e137 = textureSampleBias(tex2D, samp, (_e131.xy / vec2(_e131.z)), 2f); c_2 = _e137; let _e138 = coord_5; let _e145 = coord_5; - let _e150 = vec4(_e145.x, _e145.y, 0.0, 6.0); - let _e157 = textureSampleBias(tex2D, samp, (_e150.xyz / vec3(_e150.w)).xy, 2.0); + let _e150 = vec4(_e145.x, _e145.y, 0f, 6f); + let _e157 = textureSampleBias(tex2D, samp, (_e150.xyz / vec3(_e150.w)).xy, 2f); c_2 = _e157; let _e158 = coord_5; let _e167 = coord_5; - let _e171 = vec3(_e167.x, _e167.y, 6.0); - let _e180 = textureSampleGrad(tex2D, samp, (_e171.xy / vec2(_e171.z)), vec2(4.0), vec2(4.0)); + let _e171 = vec3(_e167.x, _e167.y, 6f); + let _e180 = textureSampleGrad(tex2D, samp, (_e171.xy / vec2(_e171.z)), vec2(4f), vec2(4f)); c_2 = _e180; let _e181 = coord_5; let _e191 = coord_5; - let _e196 = vec4(_e191.x, _e191.y, 0.0, 6.0); - let _e206 = textureSampleGrad(tex2D, samp, (_e196.xyz / vec3(_e196.w)).xy, vec2(4.0), vec2(4.0)); + let _e196 = vec4(_e191.x, _e191.y, 0f, 6f); + let _e206 = textureSampleGrad(tex2D, samp, (_e196.xyz / vec3(_e196.w)).xy, vec2(4f), vec2(4f)); c_2 = _e206; let _e207 = coord_5; let _e218 = coord_5; - let _e222 = vec3(_e218.x, _e218.y, 6.0); - let _e233 = textureSampleGrad(tex2D, samp, (_e222.xy / vec2(_e222.z)), vec2(4.0), vec2(4.0), vec2(5i)); + let _e222 = vec3(_e218.x, _e218.y, 6f); + let _e233 = textureSampleGrad(tex2D, samp, (_e222.xy / vec2(_e222.z)), vec2(4f), vec2(4f), vec2(5i)); c_2 = _e233; let _e234 = coord_5; let _e246 = coord_5; - let _e251 = vec4(_e246.x, _e246.y, 0.0, 6.0); - let _e263 = textureSampleGrad(tex2D, samp, (_e251.xyz / vec3(_e251.w)).xy, vec2(4.0), vec2(4.0), vec2(5i)); + let _e251 = vec4(_e246.x, _e246.y, 0f, 6f); + let _e263 = textureSampleGrad(tex2D, samp, (_e251.xyz / vec3(_e251.w)).xy, vec2(4f), vec2(4f), vec2(5i)); c_2 = _e263; let _e264 = coord_5; let _e270 = coord_5; - let _e274 = vec3(_e270.x, _e270.y, 6.0); - let _e280 = textureSampleLevel(tex2D, samp, (_e274.xy / vec2(_e274.z)), 3.0); + let _e274 = vec3(_e270.x, _e270.y, 6f); + let _e280 = textureSampleLevel(tex2D, samp, (_e274.xy / vec2(_e274.z)), 3f); c_2 = _e280; let _e281 = coord_5; let _e288 = coord_5; - let _e293 = vec4(_e288.x, _e288.y, 0.0, 6.0); - let _e300 = textureSampleLevel(tex2D, samp, (_e293.xyz / vec3(_e293.w)).xy, 3.0); + let _e293 = vec4(_e288.x, _e288.y, 0f, 6f); + let _e300 = textureSampleLevel(tex2D, samp, (_e293.xyz / vec3(_e293.w)).xy, 3f); c_2 = _e300; let _e301 = coord_5; let _e309 = coord_5; - let _e313 = vec3(_e309.x, _e309.y, 6.0); - let _e321 = textureSampleLevel(tex2D, samp, (_e313.xy / vec2(_e313.z)), 3.0, vec2(5i)); + let _e313 = vec3(_e309.x, _e309.y, 6f); + let _e321 = textureSampleLevel(tex2D, samp, (_e313.xy / vec2(_e313.z)), 3f, vec2(5i)); c_2 = _e321; let _e322 = coord_5; let _e331 = coord_5; - let _e336 = vec4(_e331.x, _e331.y, 0.0, 6.0); - let _e345 = textureSampleLevel(tex2D, samp, (_e336.xyz / vec3(_e336.w)).xy, 3.0, vec2(5i)); + let _e336 = vec4(_e331.x, _e331.y, 0f, 6f); + let _e345 = textureSampleLevel(tex2D, samp, (_e336.xyz / vec3(_e336.w)).xy, 3f, vec2(5i)); c_2 = _e345; let _e346 = coord_5; let _e353 = coord_5; - let _e357 = vec3(_e353.x, _e353.y, 6.0); + let _e357 = vec3(_e353.x, _e353.y, 6f); let _e364 = textureSample(tex2D, samp, (_e357.xy / vec2(_e357.z)), vec2(5i)); c_2 = _e364; let _e365 = coord_5; let _e373 = coord_5; - let _e378 = vec4(_e373.x, _e373.y, 0.0, 6.0); + let _e378 = vec4(_e373.x, _e373.y, 0f, 6f); let _e386 = textureSample(tex2D, samp, (_e378.xyz / vec3(_e378.w)).xy, vec2(5i)); c_2 = _e386; let _e387 = coord_5; let _e395 = coord_5; - let _e399 = vec3(_e395.x, _e395.y, 6.0); - let _e407 = textureSampleBias(tex2D, samp, (_e399.xy / vec2(_e399.z)), 2.0, vec2(5i)); + let _e399 = vec3(_e395.x, _e395.y, 6f); + let _e407 = textureSampleBias(tex2D, samp, (_e399.xy / vec2(_e399.z)), 2f, vec2(5i)); c_2 = _e407; let _e408 = coord_5; let _e417 = coord_5; - let _e422 = vec4(_e417.x, _e417.y, 0.0, 6.0); - let _e431 = textureSampleBias(tex2D, samp, (_e422.xyz / vec3(_e422.w)).xy, 2.0, vec2(5i)); + let _e422 = vec4(_e417.x, _e417.y, 0f, 6f); + let _e431 = textureSampleBias(tex2D, samp, (_e422.xyz / vec3(_e422.w)).xy, 2f, vec2(5i)); c_2 = _e431; let _e432 = coord_5; let _e435 = coord_5; @@ -333,67 +333,67 @@ fn testTex2DShadow(coord_6: vec2) { size2DShadow = vec2(_e20); let _e24 = coord_7; let _e29 = coord_7; - let _e33 = vec3(_e29.x, _e29.y, 1.0); + let _e33 = vec3(_e29.x, _e29.y, 1f); let _e36 = textureSampleCompare(tex2DShadow, sampShadow, _e33.xy, _e33.z); d = _e36; let _e37 = coord_7; let _e46 = coord_7; - let _e50 = vec3(_e46.x, _e46.y, 1.0); + let _e50 = vec3(_e46.x, _e46.y, 1f); let _e57 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e50.xy, _e50.z); d = _e57; let _e58 = coord_7; let _e69 = coord_7; - let _e73 = vec3(_e69.x, _e69.y, 1.0); + let _e73 = vec3(_e69.x, _e69.y, 1f); let _e82 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e73.xy, _e73.z, vec2(5i)); d = _e82; let _e83 = coord_7; let _e89 = coord_7; - let _e93 = vec3(_e89.x, _e89.y, 1.0); + let _e93 = vec3(_e89.x, _e89.y, 1f); let _e97 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e93.xy, _e93.z); d = _e97; let _e98 = coord_7; let _e106 = coord_7; - let _e110 = vec3(_e106.x, _e106.y, 1.0); + let _e110 = vec3(_e106.x, _e106.y, 1f); let _e116 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e110.xy, _e110.z, vec2(5i)); d = _e116; let _e117 = coord_7; let _e124 = coord_7; - let _e128 = vec3(_e124.x, _e124.y, 1.0); + let _e128 = vec3(_e124.x, _e124.y, 1f); let _e133 = textureSampleCompare(tex2DShadow, sampShadow, _e128.xy, _e128.z, vec2(5i)); d = _e133; let _e134 = coord_7; let _e140 = coord_7; - let _e145 = vec4(_e140.x, _e140.y, 1.0, 6.0); + let _e145 = vec4(_e140.x, _e140.y, 1f, 6f); let _e149 = (_e145.xyz / vec3(_e145.w)); let _e152 = textureSampleCompare(tex2DShadow, sampShadow, _e149.xy, _e149.z); d = _e152; let _e153 = coord_7; let _e163 = coord_7; - let _e168 = vec4(_e163.x, _e163.y, 1.0, 6.0); + let _e168 = vec4(_e163.x, _e163.y, 1f, 6f); let _e176 = (_e168.xyz / vec3(_e168.w)); let _e179 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e176.xy, _e176.z); d = _e179; let _e180 = coord_7; let _e192 = coord_7; - let _e197 = vec4(_e192.x, _e192.y, 1.0, 6.0); + let _e197 = vec4(_e192.x, _e192.y, 1f, 6f); let _e207 = (_e197.xyz / vec3(_e197.w)); let _e210 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e207.xy, _e207.z, vec2(5i)); d = _e210; let _e211 = coord_7; let _e218 = coord_7; - let _e223 = vec4(_e218.x, _e218.y, 1.0, 6.0); + let _e223 = vec4(_e218.x, _e218.y, 1f, 6f); let _e228 = (_e223.xyz / vec3(_e223.w)); let _e231 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e228.xy, _e228.z); d = _e231; let _e232 = coord_7; let _e241 = coord_7; - let _e246 = vec4(_e241.x, _e241.y, 1.0, 6.0); + let _e246 = vec4(_e241.x, _e241.y, 1f, 6f); let _e253 = (_e246.xyz / vec3(_e246.w)); let _e256 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e253.xy, _e253.z, vec2(5i)); d = _e256; let _e257 = coord_7; let _e265 = coord_7; - let _e270 = vec4(_e265.x, _e265.y, 1.0, 6.0); + let _e270 = vec4(_e265.x, _e265.y, 1f, 6f); let _e276 = (_e270.xyz / vec3(_e270.w)); let _e279 = textureSampleCompare(tex2DShadow, sampShadow, _e276.xy, _e276.z, vec2(5i)); d = _e279; @@ -413,25 +413,25 @@ fn testTex2DArray(coord_8: vec3) { let _e33 = textureSample(tex2DArray, samp, _e29.xy, i32(_e29.z)); c_3 = _e33; let _e36 = coord_9; - let _e41 = textureSampleBias(tex2DArray, samp, _e36.xy, i32(_e36.z), 2.0); + let _e41 = textureSampleBias(tex2DArray, samp, _e36.xy, i32(_e36.z), 2f); c_3 = _e41; let _e47 = coord_9; - let _e55 = textureSampleGrad(tex2DArray, samp, _e47.xy, i32(_e47.z), vec2(4.0), vec2(4.0)); + let _e55 = textureSampleGrad(tex2DArray, samp, _e47.xy, i32(_e47.z), vec2(4f), vec2(4f)); c_3 = _e55; let _e63 = coord_9; - let _e73 = textureSampleGrad(tex2DArray, samp, _e63.xy, i32(_e63.z), vec2(4.0), vec2(4.0), vec2(5i)); + let _e73 = textureSampleGrad(tex2DArray, samp, _e63.xy, i32(_e63.z), vec2(4f), vec2(4f), vec2(5i)); c_3 = _e73; let _e76 = coord_9; - let _e81 = textureSampleLevel(tex2DArray, samp, _e76.xy, i32(_e76.z), 3.0); + let _e81 = textureSampleLevel(tex2DArray, samp, _e76.xy, i32(_e76.z), 3f); c_3 = _e81; let _e86 = coord_9; - let _e93 = textureSampleLevel(tex2DArray, samp, _e86.xy, i32(_e86.z), 3.0, vec2(5i)); + let _e93 = textureSampleLevel(tex2DArray, samp, _e86.xy, i32(_e86.z), 3f, vec2(5i)); c_3 = _e93; let _e97 = coord_9; let _e103 = textureSample(tex2DArray, samp, _e97.xy, i32(_e97.z), vec2(5i)); c_3 = _e103; let _e108 = coord_9; - let _e115 = textureSampleBias(tex2DArray, samp, _e108.xy, i32(_e108.z), 2.0, vec2(5i)); + let _e115 = textureSampleBias(tex2DArray, samp, _e108.xy, i32(_e108.z), 2f, vec2(5i)); c_3 = _e115; let _e116 = coord_9; let _e119 = coord_9; @@ -457,22 +457,22 @@ fn testTex2DArrayShadow(coord_10: vec3) { size2DArrayShadow = vec3(vec3(_e20.x, _e20.y, _e23)); let _e28 = coord_11; let _e34 = coord_11; - let _e39 = vec4(_e34.x, _e34.y, _e34.z, 1.0); + let _e39 = vec4(_e34.x, _e34.y, _e34.z, 1f); let _e44 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e39.xy, i32(_e39.z), _e39.w); d_1 = _e44; let _e45 = coord_11; let _e55 = coord_11; - let _e60 = vec4(_e55.x, _e55.y, _e55.z, 1.0); + let _e60 = vec4(_e55.x, _e55.y, _e55.z, 1f); let _e69 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e60.xy, i32(_e60.z), _e60.w); d_1 = _e69; let _e70 = coord_11; let _e82 = coord_11; - let _e87 = vec4(_e82.x, _e82.y, _e82.z, 1.0); + let _e87 = vec4(_e82.x, _e82.y, _e82.z, 1f); let _e98 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e87.xy, i32(_e87.z), _e87.w, vec2(5i)); d_1 = _e98; let _e99 = coord_11; let _e107 = coord_11; - let _e112 = vec4(_e107.x, _e107.y, _e107.z, 1.0); + let _e112 = vec4(_e107.x, _e107.y, _e107.z, 1f); let _e119 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e112.xy, i32(_e112.z), _e112.w, vec2(5i)); d_1 = _e119; return; @@ -490,13 +490,13 @@ fn testTexCube(coord_12: vec3) { let _e26 = textureSample(texCube, samp, _e25); c_4 = _e26; let _e29 = coord_13; - let _e31 = textureSampleBias(texCube, samp, _e29, 2.0); + let _e31 = textureSampleBias(texCube, samp, _e29, 2f); c_4 = _e31; let _e37 = coord_13; - let _e42 = textureSampleGrad(texCube, samp, _e37, vec3(4.0), vec3(4.0)); + let _e42 = textureSampleGrad(texCube, samp, _e37, vec3(4f), vec3(4f)); c_4 = _e42; let _e45 = coord_13; - let _e47 = textureSampleLevel(texCube, samp, _e45, 3.0); + let _e47 = textureSampleLevel(texCube, samp, _e45, 3f); c_4 = _e47; return; } @@ -511,12 +511,12 @@ fn testTexCubeShadow(coord_14: vec3) { sizeCubeShadow = vec2(_e20); let _e24 = coord_15; let _e30 = coord_15; - let _e35 = vec4(_e30.x, _e30.y, _e30.z, 1.0); + let _e35 = vec4(_e30.x, _e30.y, _e30.z, 1f); let _e38 = textureSampleCompare(texCubeShadow, sampShadow, _e35.xyz, _e35.w); d_2 = _e38; let _e39 = coord_15; let _e49 = coord_15; - let _e54 = vec4(_e49.x, _e49.y, _e49.z, 1.0); + let _e54 = vec4(_e49.x, _e49.y, _e49.z, 1f); let _e61 = textureSampleCompareLevel(texCubeShadow, sampShadow, _e54.xyz, _e54.w); d_2 = _e61; return; @@ -535,13 +535,13 @@ fn testTexCubeArray(coord_16: vec4) { let _e33 = textureSample(texCubeArray, samp, _e29.xyz, i32(_e29.w)); c_5 = _e33; let _e36 = coord_17; - let _e41 = textureSampleBias(texCubeArray, samp, _e36.xyz, i32(_e36.w), 2.0); + let _e41 = textureSampleBias(texCubeArray, samp, _e36.xyz, i32(_e36.w), 2f); c_5 = _e41; let _e47 = coord_17; - let _e55 = textureSampleGrad(texCubeArray, samp, _e47.xyz, i32(_e47.w), vec3(4.0), vec3(4.0)); + let _e55 = textureSampleGrad(texCubeArray, samp, _e47.xyz, i32(_e47.w), vec3(4f), vec3(4f)); c_5 = _e55; let _e58 = coord_17; - let _e63 = textureSampleLevel(texCubeArray, samp, _e58.xyz, i32(_e58.w), 3.0); + let _e63 = textureSampleLevel(texCubeArray, samp, _e58.xyz, i32(_e58.w), 3f); c_5 = _e63; return; } @@ -556,7 +556,7 @@ fn testTexCubeArrayShadow(coord_18: vec4) { let _e23 = textureNumLayers(texCubeArrayShadow); sizeCubeArrayShadow = vec3(vec3(_e20.x, _e20.y, _e23)); let _e30 = coord_19; - let _e35 = textureSampleCompare(texCubeArrayShadow, sampShadow, _e30.xyz, i32(_e30.w), 1.0); + let _e35 = textureSampleCompare(texCubeArrayShadow, sampShadow, _e30.xyz, i32(_e30.w), 1f); d_3 = _e35; return; } @@ -573,65 +573,65 @@ fn testTex3D(coord_20: vec3) { let _e26 = textureSample(tex3D, samp, _e25); c_6 = _e26; let _e29 = coord_21; - let _e31 = textureSampleBias(tex3D, samp, _e29, 2.0); + let _e31 = textureSampleBias(tex3D, samp, _e29, 2f); c_6 = _e31; let _e32 = coord_21; let _e38 = coord_21; - let _e43 = vec4(_e38.x, _e38.y, _e38.z, 6.0); + let _e43 = vec4(_e38.x, _e38.y, _e38.z, 6f); let _e48 = textureSample(tex3D, samp, (_e43.xyz / vec3(_e43.w))); c_6 = _e48; let _e49 = coord_21; let _e56 = coord_21; - let _e61 = vec4(_e56.x, _e56.y, _e56.z, 6.0); - let _e67 = textureSampleBias(tex3D, samp, (_e61.xyz / vec3(_e61.w)), 2.0); + let _e61 = vec4(_e56.x, _e56.y, _e56.z, 6f); + let _e67 = textureSampleBias(tex3D, samp, (_e61.xyz / vec3(_e61.w)), 2f); c_6 = _e67; let _e68 = coord_21; let _e76 = coord_21; - let _e81 = vec4(_e76.x, _e76.y, _e76.z, 6.0); + let _e81 = vec4(_e76.x, _e76.y, _e76.z, 6f); let _e88 = textureSample(tex3D, samp, (_e81.xyz / vec3(_e81.w)), vec3(5i)); c_6 = _e88; let _e89 = coord_21; let _e98 = coord_21; - let _e103 = vec4(_e98.x, _e98.y, _e98.z, 6.0); - let _e111 = textureSampleBias(tex3D, samp, (_e103.xyz / vec3(_e103.w)), 2.0, vec3(5i)); + let _e103 = vec4(_e98.x, _e98.y, _e98.z, 6f); + let _e111 = textureSampleBias(tex3D, samp, (_e103.xyz / vec3(_e103.w)), 2f, vec3(5i)); c_6 = _e111; let _e112 = coord_21; let _e119 = coord_21; - let _e124 = vec4(_e119.x, _e119.y, _e119.z, 6.0); - let _e130 = textureSampleLevel(tex3D, samp, (_e124.xyz / vec3(_e124.w)), 3.0); + let _e124 = vec4(_e119.x, _e119.y, _e119.z, 6f); + let _e130 = textureSampleLevel(tex3D, samp, (_e124.xyz / vec3(_e124.w)), 3f); c_6 = _e130; let _e131 = coord_21; let _e140 = coord_21; - let _e145 = vec4(_e140.x, _e140.y, _e140.z, 6.0); - let _e153 = textureSampleLevel(tex3D, samp, (_e145.xyz / vec3(_e145.w)), 3.0, vec3(5i)); + let _e145 = vec4(_e140.x, _e140.y, _e140.z, 6f); + let _e153 = textureSampleLevel(tex3D, samp, (_e145.xyz / vec3(_e145.w)), 3f, vec3(5i)); c_6 = _e153; let _e154 = coord_21; let _e164 = coord_21; - let _e169 = vec4(_e164.x, _e164.y, _e164.z, 6.0); - let _e178 = textureSampleGrad(tex3D, samp, (_e169.xyz / vec3(_e169.w)), vec3(4.0), vec3(4.0)); + let _e169 = vec4(_e164.x, _e164.y, _e164.z, 6f); + let _e178 = textureSampleGrad(tex3D, samp, (_e169.xyz / vec3(_e169.w)), vec3(4f), vec3(4f)); c_6 = _e178; let _e179 = coord_21; let _e191 = coord_21; - let _e196 = vec4(_e191.x, _e191.y, _e191.z, 6.0); - let _e207 = textureSampleGrad(tex3D, samp, (_e196.xyz / vec3(_e196.w)), vec3(4.0), vec3(4.0), vec3(5i)); + let _e196 = vec4(_e191.x, _e191.y, _e191.z, 6f); + let _e207 = textureSampleGrad(tex3D, samp, (_e196.xyz / vec3(_e196.w)), vec3(4f), vec3(4f), vec3(5i)); c_6 = _e207; let _e213 = coord_21; - let _e218 = textureSampleGrad(tex3D, samp, _e213, vec3(4.0), vec3(4.0)); + let _e218 = textureSampleGrad(tex3D, samp, _e213, vec3(4f), vec3(4f)); c_6 = _e218; let _e226 = coord_21; - let _e233 = textureSampleGrad(tex3D, samp, _e226, vec3(4.0), vec3(4.0), vec3(5i)); + let _e233 = textureSampleGrad(tex3D, samp, _e226, vec3(4f), vec3(4f), vec3(5i)); c_6 = _e233; let _e236 = coord_21; - let _e238 = textureSampleLevel(tex3D, samp, _e236, 3.0); + let _e238 = textureSampleLevel(tex3D, samp, _e236, 3f); c_6 = _e238; let _e243 = coord_21; - let _e247 = textureSampleLevel(tex3D, samp, _e243, 3.0, vec3(5i)); + let _e247 = textureSampleLevel(tex3D, samp, _e243, 3f, vec3(5i)); c_6 = _e247; let _e251 = coord_21; let _e254 = textureSample(tex3D, samp, _e251, vec3(5i)); c_6 = _e254; let _e259 = coord_21; - let _e263 = textureSampleBias(tex3D, samp, _e259, 2.0, vec3(5i)); + let _e263 = textureSampleBias(tex3D, samp, _e259, 2f, vec3(5i)); c_6 = _e263; let _e264 = coord_21; let _e267 = coord_21; diff --git a/naga/tests/out/wgsl/shadow.wgsl b/naga/tests/out/wgsl/shadow.wgsl index b768fab2f1..e9d5bbf1be 100644 --- a/naga/tests/out/wgsl/shadow.wgsl +++ b/naga/tests/out/wgsl/shadow.wgsl @@ -20,7 +20,7 @@ struct Light { color: vec4, } -const c_ambient: vec3 = vec3(0.05, 0.05, 0.05); +const c_ambient: vec3 = vec3(0.05f, 0.05f, 0.05f); const c_max_lights: u32 = 10u; @group(0) @binding(0) @@ -37,12 +37,12 @@ var t_shadow: texture_depth_2d_array; var sampler_shadow: sampler_comparison; fn fetch_shadow(light_id: u32, homogeneous_coords: vec4) -> f32 { - if (homogeneous_coords.w <= 0.0) { - return 1.0; + if (homogeneous_coords.w <= 0f) { + return 1f; } - let flip_correction = vec2(0.5, -0.5); - let proj_correction = (1.0 / homogeneous_coords.w); - let light_local = (((homogeneous_coords.xy * flip_correction) * proj_correction) + vec2(0.5, 0.5)); + let flip_correction = vec2(0.5f, -0.5f); + let proj_correction = (1f / homogeneous_coords.w); + let light_local = (((homogeneous_coords.xy * flip_correction) * proj_correction) + vec2(0.5f, 0.5f)); let _e24 = textureSampleCompareLevel(t_shadow, sampler_shadow, light_local, i32(light_id), (homogeneous_coords.z * proj_correction)); return _e24; } @@ -81,7 +81,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { let _e19 = i; let _e23 = fetch_shadow(_e19, (light.proj * in.world_position)); let light_dir = normalize((light.pos.xyz - in.world_position.xyz)); - let diffuse = max(0.0, dot(normal_1, light_dir)); + let diffuse = max(0f, dot(normal_1, light_dir)); let _e37 = color; color = (_e37 + ((_e23 * diffuse) * light.color.xyz)); } @@ -92,7 +92,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { } let _e42 = color; let _e47 = u_entity.color; - return (vec4(_e42, 1.0) * _e47); + return (vec4(_e42, 1f) * _e47); } @fragment @@ -114,7 +114,7 @@ fn fs_main_without_storage(in_1: VertexOutput) -> @location(0) vec4 { let _e19 = i_1; let _e23 = fetch_shadow(_e19, (light_1.proj * in_1.world_position)); let light_dir_1 = normalize((light_1.pos.xyz - in_1.world_position.xyz)); - let diffuse_1 = max(0.0, dot(normal_2, light_dir_1)); + let diffuse_1 = max(0f, dot(normal_2, light_dir_1)); let _e37 = color_1; color_1 = (_e37 + ((_e23 * diffuse_1) * light_1.color.xyz)); } @@ -125,5 +125,5 @@ fn fs_main_without_storage(in_1: VertexOutput) -> @location(0) vec4 { } let _e42 = color_1; let _e47 = u_entity.color; - return (vec4(_e42, 1.0) * _e47); + return (vec4(_e42, 1f) * _e47); } diff --git a/naga/tests/out/wgsl/skybox.wgsl b/naga/tests/out/wgsl/skybox.wgsl index 0d82fe327f..c10801d0e7 100644 --- a/naga/tests/out/wgsl/skybox.wgsl +++ b/naga/tests/out/wgsl/skybox.wgsl @@ -24,7 +24,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput { tmp2_ = (i32(vertex_index) & 1i); let _e9 = tmp1_; let _e15 = tmp2_; - let pos = vec4(((f32(_e9) * 4.0) - 1.0), ((f32(_e15) * 4.0) - 1.0), 0.0, 1.0); + let pos = vec4(((f32(_e9) * 4f) - 1f), ((f32(_e15) * 4f) - 1f), 0f, 1f); let _e27 = r_data.view[0]; let _e32 = r_data.view[1]; let _e37 = r_data.view[2]; diff --git a/naga/tests/out/wgsl/struct-layout.wgsl b/naga/tests/out/wgsl/struct-layout.wgsl index 1f058384c4..b1569bde3e 100644 --- a/naga/tests/out/wgsl/struct-layout.wgsl +++ b/naga/tests/out/wgsl/struct-layout.wgsl @@ -20,12 +20,12 @@ var needs_padding_storage: NeedsPadding; @fragment fn no_padding_frag(input: NoPadding) -> @location(0) vec4 { - return vec4(0.0); + return vec4(0f); } @vertex fn no_padding_vert(input_1: NoPadding) -> @builtin(position) vec4 { - return vec4(0.0); + return vec4(0f); } @compute @workgroup_size(16, 1, 1) @@ -41,12 +41,12 @@ fn no_padding_comp() { @fragment fn needs_padding_frag(input_2: NeedsPadding) -> @location(0) vec4 { - return vec4(0.0); + return vec4(0f); } @vertex fn needs_padding_vert(input_3: NeedsPadding) -> @builtin(position) vec4 { - return vec4(0.0); + return vec4(0f); } @compute @workgroup_size(16, 1, 1) diff --git a/naga/tests/out/wgsl/texture-arg.wgsl b/naga/tests/out/wgsl/texture-arg.wgsl index 6edf0250e1..0ad02e43f5 100644 --- a/naga/tests/out/wgsl/texture-arg.wgsl +++ b/naga/tests/out/wgsl/texture-arg.wgsl @@ -4,7 +4,7 @@ var Texture: texture_2d; var Sampler: sampler; fn test(Passed_Texture: texture_2d, Passed_Sampler: sampler) -> vec4 { - let _e5 = textureSample(Passed_Texture, Passed_Sampler, vec2(0.0, 0.0)); + let _e5 = textureSample(Passed_Texture, Passed_Sampler, vec2(0f, 0f)); return _e5; } diff --git a/naga/tests/out/wgsl/type-alias.wgsl b/naga/tests/out/wgsl/type-alias.wgsl index fea2dec108..fe3cf79037 100644 --- a/naga/tests/out/wgsl/type-alias.wgsl +++ b/naga/tests/out/wgsl/type-alias.wgsl @@ -1,10 +1,10 @@ fn main() { - let a = vec3(0.0, 0.0, 0.0); - let c = vec3(0.0); - let b = vec3(vec2(0.0), 0.0); - let d = vec3(vec2(0.0), 0.0); + let a = vec3(0f, 0f, 0f); + let c = vec3(0f); + let b = vec3(vec2(0f), 0f); + let d = vec3(vec2(0f), 0f); let e = vec3(d); - let f = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + let f = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); let g = mat3x3(a, a, a); }