From b05a7436e44c57cfe5744947b8e7d348335b7f36 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 24 Nov 2024 09:12:59 -0800 Subject: [PATCH 1/2] [glsl-in] Don't reinterpret function arguments twice in the normal case We already lowered the function expression if it's a normal in argument; no need to do it again. This eliminates an unused variable and expression. With chained function calls, this could lead to a lot of waste. There's still an extra unused expression in the case of an out/inout argument; ideally we'd remove these expressions, but it might be tricky. Fixes #6602 --- CHANGELOG.md | 1 + naga/src/front/glsl/ast.rs | 10 +- naga/src/front/glsl/functions.rs | 8 +- naga/tests/out/wgsl/246-collatz.comp.wgsl | 29 +- naga/tests/out/wgsl/bevy-pbr.frag.wgsl | 836 +++++++--------- naga/tests/out/wgsl/bits_glsl.frag.wgsl | 182 ++-- naga/tests/out/wgsl/bool-select.frag.wgsl | 18 +- naga/tests/out/wgsl/clamp-splat.vert.wgsl | 6 +- .../out/wgsl/double-math-functions.frag.wgsl | 101 +- naga/tests/out/wgsl/images.frag.wgsl | 58 +- .../tests/out/wgsl/inverse-polyfill.frag.wgsl | 12 +- naga/tests/out/wgsl/math-functions.frag.wgsl | 171 ++-- .../out/wgsl/sampler-functions.frag.wgsl | 16 +- naga/tests/out/wgsl/samplers.frag.wgsl | 946 ++++++++---------- .../tests/out/wgsl/vector-functions.frag.wgsl | 134 +-- 15 files changed, 1184 insertions(+), 1344 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f482cc829d..68b29ecbbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -111,6 +111,7 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148] #### Naga - Show types of LHS and RHS in binary operation type mismatch errors. By @ErichDonGubler in [#6450](https://github.com/gfx-rs/wgpu/pull/6450). +- The GLSL parser now uses less expressions for function calls. By @magcius in [#6604](https://github.com/gfx-rs/wgpu/pull/6604). #### General diff --git a/naga/src/front/glsl/ast.rs b/naga/src/front/glsl/ast.rs index ea0bce8661..78f5e2cb09 100644 --- a/naga/src/front/glsl/ast.rs +++ b/naga/src/front/glsl/ast.rs @@ -1,6 +1,6 @@ use std::{borrow::Cow, fmt}; -use super::{builtins::MacroCall, context::ExprPos, Span}; +use super::{builtins::MacroCall, Span}; use crate::{ AddressSpace, BinaryOperator, Binding, Constant, Expression, Function, GlobalVariable, Handle, Interpolation, Literal, Sampling, StorageAccess, Type, UnaryOperator, @@ -376,14 +376,6 @@ impl ParameterQualifier { _ => false, } } - - /// Converts from a parameter qualifier into a [`ExprPos`] - pub const fn as_pos(&self) -> ExprPos { - match *self { - ParameterQualifier::Out | ParameterQualifier::InOut => ExprPos::Lhs, - _ => ExprPos::Rhs, - } - } } /// The GLSL profile used by a shader. diff --git a/naga/src/front/glsl/functions.rs b/naga/src/front/glsl/functions.rs index 6805d6f039..658632e872 100644 --- a/naga/src/front/glsl/functions.rs +++ b/naga/src/front/glsl/functions.rs @@ -785,10 +785,10 @@ impl Frontend { .zip(raw_args) .zip(¶meters) { - let (mut handle, meta) = - ctx.lower_expect_inner(stmt, self, *expr, parameter_info.qualifier.as_pos())?; - if parameter_info.qualifier.is_lhs() { + // Reprocess argument in LHS position + let (handle, meta) = ctx.lower_expect_inner(stmt, self, *expr, ExprPos::Lhs)?; + self.process_lhs_argument( ctx, meta, @@ -803,6 +803,8 @@ impl Frontend { continue; } + let (mut handle, meta) = *call_argument; + let scalar_comps = scalar_components(&ctx.module.types[*parameter].inner); // Apply implicit conversions as needed diff --git a/naga/tests/out/wgsl/246-collatz.comp.wgsl b/naga/tests/out/wgsl/246-collatz.comp.wgsl index 916bb4ae4d..71453bfe1c 100644 --- a/naga/tests/out/wgsl/246-collatz.comp.wgsl +++ b/naga/tests/out/wgsl/246-collatz.comp.wgsl @@ -17,25 +17,25 @@ fn collatz_iterations(n: u32) -> u32 { break; } { - let _e14 = n_1; - let _e15 = f32(_e14); - if ((_e15 - (floor((_e15 / 2f)) * 2f)) == 0f) { + let _e12 = n_1; + let _e14 = f32(_e12); + if ((_e14 - (floor((_e14 / 2f)) * 2f)) == 0f) { { - let _e25 = n_1; - n_1 = (_e25 / 2u); + let _e23 = n_1; + n_1 = (_e23 / 2u); } } else { { - let _e30 = n_1; - n_1 = ((3u * _e30) + 1u); + let _e28 = n_1; + n_1 = ((3u * _e28) + 1u); } } - let _e36 = i; - i = (_e36 + 1u); + let _e34 = i; + i = (_e34 + 1u); } } - let _e39 = i; - return _e39; + let _e37 = i; + return _e37; } fn main_1() { @@ -45,10 +45,9 @@ fn main_1() { index = _e3.x; let _e6 = index; let _e8 = index; - let _e11 = index; - let _e13 = global.indices[_e11]; - let _e14 = collatz_iterations(_e13); - global.indices[_e6] = _e14; + let _e10 = global.indices[_e8]; + let _e11 = collatz_iterations(_e10); + global.indices[_e6] = _e11; return; } diff --git a/naga/tests/out/wgsl/bevy-pbr.frag.wgsl b/naga/tests/out/wgsl/bevy-pbr.frag.wgsl index 012077791e..78d3fbe606 100644 --- a/naga/tests/out/wgsl/bevy-pbr.frag.wgsl +++ b/naga/tests/out/wgsl/bevy-pbr.frag.wgsl @@ -123,15 +123,13 @@ fn getDistanceAttenuation(distanceSquare: f32, inverseRangeSquared: f32) -> f32 factor = (_e44 * _e45); let _e49 = factor; let _e50 = factor; - let _e56 = factor; - let _e57 = factor; - 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 * 1f) / max(_e73, 0.001f)); + smoothFactor = clamp((1f - (_e49 * _e50)), 0f, 1f); + let _e57 = smoothFactor; + let _e58 = smoothFactor; + attenuation = (_e57 * _e58); + let _e61 = attenuation; + let _e64 = distanceSquare_1; + return ((_e61 * 1f) / max(_e64, 0.001f)); } fn D_GGX(roughness: f32, NoH: f32, h: vec3) -> f32 { @@ -183,29 +181,19 @@ fn V_SmithGGXCorrelated(roughness_2: f32, NoV: f32, NoL: f32) -> f32 { let _e53 = NoV_1; let _e56 = NoV_1; let _e58 = a2_; - let _e60 = NoV_1; - let _e61 = a2_; - let _e62 = NoV_1; - let _e65 = NoV_1; - let _e67 = a2_; - lambdaV = (_e50 * sqrt((((_e60 - (_e61 * _e62)) * _e65) + _e67))); - let _e72 = NoV_1; - let _e73 = NoL_1; - let _e74 = a2_; - let _e75 = NoL_1; - let _e78 = NoL_1; - let _e80 = a2_; - let _e82 = NoL_1; - let _e83 = a2_; - let _e84 = NoL_1; - let _e87 = NoL_1; - let _e89 = a2_; - lambdaL = (_e72 * sqrt((((_e82 - (_e83 * _e84)) * _e87) + _e89))); - let _e95 = lambdaV; - let _e96 = lambdaL; - v = (0.5f / (_e95 + _e96)); - let _e100 = v; - return _e100; + lambdaV = (_e50 * sqrt((((_e51 - (_e52 * _e53)) * _e56) + _e58))); + let _e63 = NoV_1; + let _e64 = NoL_1; + let _e65 = a2_; + let _e66 = NoL_1; + let _e69 = NoL_1; + let _e71 = a2_; + lambdaL = (_e63 * sqrt((((_e64 - (_e65 * _e66)) * _e69) + _e71))); + let _e77 = lambdaV; + let _e78 = lambdaL; + v = (0.5f / (_e77 + _e78)); + let _e82 = v; + return _e82; } fn F_Schlick(f0_: vec3, f90_: f32, VoH: f32) -> vec3 { @@ -216,9 +204,8 @@ fn F_Schlick(f0_: vec3, f90_: f32, VoH: f32) -> vec3 { VoH_1 = VoH; let _e45 = f90_1; let _e49 = VoH_1; - let _e52 = VoH_1; - let _e54 = pow5_((1f - _e52)); - return (f0_ + ((vec3(_e45) - f0_) * _e54)); + let _e51 = pow5_((1f - _e49)); + return (f0_ + ((vec3(_e45) - f0_) * _e51)); } fn F_Schlick_1(f0_1: f32, f90_2: f32, VoH_2: f32) -> f32 { @@ -233,9 +220,8 @@ fn F_Schlick_1(f0_1: f32, f90_2: f32, VoH_2: f32) -> f32 { let _e47 = f90_3; let _e48 = f0_2; let _e51 = VoH_3; - let _e54 = VoH_3; - let _e56 = pow5_((1f - _e54)); - return (_e46 + ((_e47 - _e48) * _e56)); + let _e53 = pow5_((1f - _e51)); + return (_e46 + ((_e47 - _e48) * _e53)); } fn fresnel(f0_3: vec3, LoH: f32) -> vec3 { @@ -245,14 +231,13 @@ fn fresnel(f0_3: vec3, LoH: f32) -> vec3 { f0_4 = f0_3; LoH_1 = LoH; - let _e49 = f0_4; - let _e62 = f0_4; - f90_4 = clamp(dot(_e62, vec3(16.5f)), 0f, 1f); - let _e75 = f0_4; - let _e76 = f90_4; - let _e77 = LoH_1; - let _e78 = F_Schlick(_e75, _e76, _e77); - return _e78; + let _e44 = f0_4; + f90_4 = clamp(dot(_e44, vec3(16.5f)), 0f, 1f); + let _e54 = f0_4; + let _e55 = f90_4; + let _e56 = LoH_1; + let _e57 = F_Schlick(_e54, _e55, _e56); + return _e57; } fn specular(f0_5: vec3, roughness_4: f32, h_1: vec3, NoV_2: f32, NoL_2: f32, NoH_2: f32, LoH_2: f32, specularIntensity: f32) -> vec3 { @@ -274,24 +259,24 @@ fn specular(f0_5: vec3, roughness_4: f32, h_1: vec3, NoV_2: f32, NoL_2 NoH_3 = NoH_2; LoH_3 = LoH_2; specularIntensity_1 = specularIntensity; - let _e57 = roughness_5; - let _e58 = NoH_3; - let _e59 = D_GGX(_e57, _e58, h_1); - D = _e59; - let _e64 = roughness_5; - let _e65 = NoV_3; - let _e66 = NoL_3; - let _e67 = V_SmithGGXCorrelated(_e64, _e65, _e66); - V = _e67; - let _e71 = f0_6; - let _e72 = LoH_3; - let _e73 = fresnel(_e71, _e72); - F = _e73; - let _e75 = specularIntensity_1; - let _e76 = D; - let _e78 = V; - let _e80 = F; - return (((_e75 * _e76) * _e78) * _e80); + let _e55 = roughness_5; + let _e56 = NoH_3; + let _e57 = D_GGX(_e55, _e56, h_1); + D = _e57; + let _e59 = roughness_5; + let _e60 = NoV_3; + let _e61 = NoL_3; + let _e62 = V_SmithGGXCorrelated(_e59, _e60, _e61); + V = _e62; + let _e64 = f0_6; + let _e65 = LoH_3; + let _e66 = fresnel(_e64, _e65); + F = _e66; + let _e68 = specularIntensity_1; + let _e69 = D; + let _e71 = V; + let _e73 = F; + return (((_e68 * _e69) * _e71) * _e73); } fn Fd_Burley(roughness_6: f32, NoV_4: f32, NoL_4: f32, LoH_4: f32) -> f32 { @@ -311,17 +296,17 @@ fn Fd_Burley(roughness_6: f32, NoV_4: f32, NoL_4: f32, LoH_4: f32) -> f32 { let _e52 = LoH_5; let _e54 = LoH_5; f90_5 = (0.5f + (((2f * _e50) * _e52) * _e54)); - let _e62 = f90_5; - let _e63 = NoL_5; - let _e64 = F_Schlick_1(1f, _e62, _e63); - lightScatter = _e64; - let _e70 = f90_5; - let _e71 = NoV_5; - let _e72 = F_Schlick_1(1f, _e70, _e71); - viewScatter = _e72; - let _e74 = lightScatter; - let _e75 = viewScatter; - return ((_e74 * _e75) * 0.31830987f); + let _e59 = f90_5; + let _e60 = NoL_5; + let _e61 = F_Schlick_1(1f, _e59, _e60); + lightScatter = _e61; + let _e64 = f90_5; + let _e65 = NoV_5; + let _e66 = F_Schlick_1(1f, _e64, _e65); + viewScatter = _e66; + let _e68 = lightScatter; + let _e69 = viewScatter; + return ((_e68 * _e69) * 0.31830987f); } fn EnvBRDFApprox(f0_7: vec3, perceptual_roughness: f32, NoV_6: f32) -> vec3 { @@ -344,21 +329,16 @@ fn EnvBRDFApprox(f0_7: vec3, perceptual_roughness: f32, NoV_6: f32) -> vec3 let _e69 = r; let _e71 = r; let _e76 = NoV_7; - let _e80 = NoV_7; + let _e80 = r; let _e83 = r; - let _e85 = r; - let _e90 = NoV_7; - let _e94 = NoV_7; - let _e98 = r; - let _e101 = r; - a004_ = ((min((_e83.x * _e85.x), exp2((-9.28f * _e94))) * _e98.x) + _e101.y); - let _e109 = a004_; - let _e112 = r; - AB = ((vec2(-1.04f, 1.04f) * vec2(_e109)) + _e112.zw); - let _e116 = f0_8; - let _e117 = AB; - let _e121 = AB; - return ((_e116 * vec3(_e117.x)) + vec3(_e121.y)); + a004_ = ((min((_e69.x * _e71.x), exp2((-9.28f * _e76))) * _e80.x) + _e83.y); + let _e91 = a004_; + let _e94 = r; + AB = ((vec2(-1.04f, 1.04f) * vec2(_e91)) + _e94.zw); + let _e98 = f0_8; + let _e99 = AB; + let _e103 = AB; + return ((_e98 * vec3(_e99.x)) + vec3(_e103.y)); } fn perceptualRoughnessToRoughness(perceptualRoughness: f32) -> f32 { @@ -366,11 +346,11 @@ fn perceptualRoughnessToRoughness(perceptualRoughness: f32) -> f32 { var clampedPerceptualRoughness: f32; perceptualRoughness_1 = perceptualRoughness; - let _e45 = perceptualRoughness_1; - clampedPerceptualRoughness = clamp(_e45, 0.089f, 1f); - let _e50 = clampedPerceptualRoughness; - let _e51 = clampedPerceptualRoughness; - return (_e50 * _e51); + let _e42 = perceptualRoughness_1; + clampedPerceptualRoughness = clamp(_e42, 0.089f, 1f); + let _e47 = clampedPerceptualRoughness; + let _e48 = clampedPerceptualRoughness; + return (_e47 * _e48); } fn reinhard(color: vec3) -> vec3 { @@ -403,8 +383,8 @@ fn luminance(v_1: vec3) -> f32 { var v_2: vec3; v_2 = v_1; - let _e47 = v_2; - return dot(_e47, vec3(0.2126f, 0.7152f, 0.0722f)); + let _e42 = v_2; + return dot(_e42, vec3(0.2126f, 0.7152f, 0.0722f)); } fn change_luminance(c_in: vec3, l_out: f32) -> vec3 { @@ -414,13 +394,13 @@ fn change_luminance(c_in: vec3, l_out: f32) -> vec3 { c_in_1 = c_in; l_out_1 = l_out; - let _e45 = c_in_1; - let _e46 = luminance(_e45); - l_in = _e46; - let _e48 = c_in_1; - let _e49 = l_out_1; - let _e50 = l_in; - return (_e48 * (_e49 / _e50)); + let _e44 = c_in_1; + let _e45 = luminance(_e44); + l_in = _e45; + let _e47 = c_in_1; + let _e48 = l_out_1; + let _e49 = l_in; + return (_e47 * (_e48 / _e49)); } fn reinhard_luminance(color_4: vec3) -> vec3 { @@ -429,16 +409,16 @@ fn reinhard_luminance(color_4: vec3) -> vec3 { var l_new: f32; color_5 = color_4; - let _e43 = color_5; - let _e44 = luminance(_e43); - l_old = _e44; - let _e46 = l_old; - let _e48 = l_old; - l_new = (_e46 / (1f + _e48)); - let _e54 = color_5; - let _e55 = l_new; - let _e56 = change_luminance(_e54, _e55); - return _e56; + let _e42 = color_5; + let _e43 = luminance(_e42); + l_old = _e43; + let _e45 = l_old; + let _e47 = l_old; + l_new = (_e45 / (1f + _e47)); + let _e51 = color_5; + let _e52 = l_new; + let _e53 = change_luminance(_e51, _e52); + return _e53; } fn reinhard_extended_luminance(color_6: vec3, max_white_l: f32) -> vec3 { @@ -450,21 +430,21 @@ fn reinhard_extended_luminance(color_6: vec3, max_white_l: f32) -> vec3, V_1: vec3, R: vec3, F0_: vec3, diffuseColor: vec3) -> vec3 { @@ -505,120 +485,91 @@ fn point_light(light: PointLight, roughness_8: f32, NdotV: f32, N: vec3, V_ let _e56 = light_1; let _e59 = v_WorldPosition_1; light_to_frag = (_e56.pos.xyz - _e59.xyz); - let _e65 = light_to_frag; - let _e66 = light_to_frag; - distance_square = dot(_e65, _e66); - let _e70 = light_1; - let _e73 = distance_square; - let _e74 = light_1; - let _e77 = getDistanceAttenuation(_e73, _e74.lightParams.x); - rangeAttenuation = _e77; - let _e79 = roughness_9; - a_1 = _e79; - let _e81 = light_1; - radius = _e81.lightParams.y; + let _e63 = light_to_frag; + let _e64 = light_to_frag; + distance_square = dot(_e63, _e64); + let _e67 = distance_square; + let _e68 = light_1; + let _e71 = getDistanceAttenuation(_e67, _e68.lightParams.x); + rangeAttenuation = _e71; + let _e73 = roughness_9; + a_1 = _e73; + let _e75 = light_1; + radius = _e75.lightParams.y; + let _e79 = light_to_frag; + let _e80 = R_1; + let _e82 = R_1; + let _e84 = light_to_frag; + centerToRay = ((dot(_e79, _e80) * _e82) - _e84); let _e87 = light_to_frag; - let _e88 = R_1; - let _e90 = R_1; - let _e92 = light_to_frag; - centerToRay = ((dot(_e87, _e88) * _e90) - _e92); - let _e95 = light_to_frag; - let _e96 = centerToRay; - let _e97 = radius; - let _e100 = centerToRay; - let _e101 = centerToRay; - let _e105 = centerToRay; - let _e106 = centerToRay; - let _e112 = radius; - let _e115 = centerToRay; - let _e116 = centerToRay; - let _e120 = centerToRay; - let _e121 = centerToRay; - closestPoint = (_e95 + (_e96 * clamp((_e112 * inverseSqrt(dot(_e120, _e121))), 0f, 1f))); - let _e133 = closestPoint; - let _e134 = closestPoint; - let _e138 = closestPoint; - let _e139 = closestPoint; - LspecLengthInverse = inverseSqrt(dot(_e138, _e139)); - let _e143 = a_1; - let _e144 = a_1; - let _e145 = radius; - let _e148 = LspecLengthInverse; - let _e153 = a_1; - let _e154 = radius; - let _e157 = LspecLengthInverse; - normalizationFactor = (_e143 / clamp((_e153 + ((_e154 * 0.5f) * _e157)), 0f, 1f)); - let _e165 = normalizationFactor; - let _e166 = normalizationFactor; - specularIntensity_2 = (_e165 * _e166); - let _e169 = closestPoint; - let _e170 = LspecLengthInverse; - L = (_e169 * _e170); - let _e173 = L; - let _e174 = V_2; - let _e176 = L; - let _e177 = V_2; - H = normalize((_e176 + _e177)); - let _e183 = N_1; - let _e184 = L; - let _e190 = N_1; - let _e191 = L; - 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), 0f, 1f); - let _e215 = L; - let _e216 = H; - let _e222 = L; - let _e223 = H; - LoH_6 = clamp(dot(_e222, _e223), 0f, 1f); - let _e237 = F0_1; - let _e238 = roughness_9; - let _e239 = H; - let _e240 = NdotV_1; - let _e241 = NoL_6; - let _e242 = NoH_4; - let _e243 = LoH_6; - let _e244 = specularIntensity_2; - let _e245 = specular(_e237, _e238, _e239, _e240, _e241, _e242, _e243, _e244); - specular_1 = _e245; - let _e248 = light_to_frag; - L = normalize(_e248); - let _e250 = L; - let _e251 = V_2; - let _e253 = L; - let _e254 = V_2; - H = normalize((_e253 + _e254)); - let _e259 = N_1; - let _e260 = L; - let _e266 = N_1; - let _e267 = L; - 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), 0f, 1f); - let _e289 = L; - let _e290 = H; - let _e296 = L; - let _e297 = H; - LoH_6 = clamp(dot(_e296, _e297), 0f, 1f); - let _e302 = diffuseColor_1; - let _e307 = roughness_9; - let _e308 = NdotV_1; - let _e309 = NoL_6; - let _e310 = LoH_6; - let _e311 = Fd_Burley(_e307, _e308, _e309, _e310); - diffuse = (_e302 * _e311); - let _e314 = diffuse; - let _e315 = specular_1; - let _e317 = light_1; - let _e321 = rangeAttenuation; - let _e322 = NoL_6; - return (((_e314 + _e315) * _e317.color.xyz) * (_e321 * _e322)); + let _e88 = centerToRay; + let _e89 = radius; + let _e90 = centerToRay; + let _e91 = centerToRay; + closestPoint = (_e87 + (_e88 * clamp((_e89 * inverseSqrt(dot(_e90, _e91))), 0f, 1f))); + let _e101 = closestPoint; + let _e102 = closestPoint; + LspecLengthInverse = inverseSqrt(dot(_e101, _e102)); + let _e106 = a_1; + let _e107 = a_1; + let _e108 = radius; + let _e111 = LspecLengthInverse; + normalizationFactor = (_e106 / clamp((_e107 + ((_e108 * 0.5f) * _e111)), 0f, 1f)); + let _e119 = normalizationFactor; + let _e120 = normalizationFactor; + specularIntensity_2 = (_e119 * _e120); + let _e123 = closestPoint; + let _e124 = LspecLengthInverse; + L = (_e123 * _e124); + let _e127 = L; + let _e128 = V_2; + H = normalize((_e127 + _e128)); + let _e132 = N_1; + let _e133 = L; + NoL_6 = clamp(dot(_e132, _e133), 0f, 1f); + let _e139 = N_1; + let _e140 = H; + NoH_4 = clamp(dot(_e139, _e140), 0f, 1f); + let _e146 = L; + let _e147 = H; + LoH_6 = clamp(dot(_e146, _e147), 0f, 1f); + let _e153 = F0_1; + let _e154 = roughness_9; + let _e155 = H; + let _e156 = NdotV_1; + let _e157 = NoL_6; + let _e158 = NoH_4; + let _e159 = LoH_6; + let _e160 = specularIntensity_2; + let _e161 = specular(_e153, _e154, _e155, _e156, _e157, _e158, _e159, _e160); + specular_1 = _e161; + let _e163 = light_to_frag; + L = normalize(_e163); + let _e165 = L; + let _e166 = V_2; + H = normalize((_e165 + _e166)); + let _e169 = N_1; + let _e170 = L; + NoL_6 = clamp(dot(_e169, _e170), 0f, 1f); + let _e175 = N_1; + let _e176 = H; + NoH_4 = clamp(dot(_e175, _e176), 0f, 1f); + let _e181 = L; + let _e182 = H; + LoH_6 = clamp(dot(_e181, _e182), 0f, 1f); + let _e187 = diffuseColor_1; + let _e188 = roughness_9; + let _e189 = NdotV_1; + let _e190 = NoL_6; + let _e191 = LoH_6; + let _e192 = Fd_Burley(_e188, _e189, _e190, _e191); + diffuse = (_e187 * _e192); + let _e195 = diffuse; + let _e196 = specular_1; + let _e198 = light_1; + let _e202 = rangeAttenuation; + let _e203 = NoL_6; + return (((_e195 + _e196) * _e198.color.xyz) * (_e202 * _e203)); } fn dir_light(light_2: DirectionalLight, roughness_10: f32, NdotV_2: f32, normal: vec3, view: vec3, R_2: vec3, F0_2: vec3, diffuseColor_2: vec3) -> vec3 { @@ -651,46 +602,38 @@ fn dir_light(light_2: DirectionalLight, roughness_10: f32, NdotV_2: f32, normal: incident_light = _e56.direction.xyz; let _e60 = incident_light; let _e61 = view_1; - let _e63 = incident_light; - let _e64 = view_1; - half_vector = normalize((_e63 + _e64)); - let _e70 = normal_1; - let _e71 = incident_light; - let _e77 = normal_1; - let _e78 = incident_light; - 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), 0f, 1f); - let _e102 = incident_light; - let _e103 = half_vector; - let _e109 = incident_light; - let _e110 = half_vector; - LoH_7 = clamp(dot(_e109, _e110), 0f, 1f); - let _e116 = diffuseColor_3; - let _e121 = roughness_11; - let _e122 = NdotV_3; - let _e123 = NoL_7; - let _e124 = LoH_7; - let _e125 = Fd_Burley(_e121, _e122, _e123, _e124); - diffuse_1 = (_e116 * _e125); - let _e138 = F0_3; - let _e139 = roughness_11; - let _e140 = half_vector; - let _e141 = NdotV_3; - let _e142 = NoL_7; - let _e143 = NoH_5; - let _e144 = LoH_7; - let _e145 = specularIntensity_3; - let _e146 = specular(_e138, _e139, _e140, _e141, _e142, _e143, _e144, _e145); - specular_2 = _e146; - let _e148 = specular_2; - let _e149 = diffuse_1; - let _e151 = light_3; - let _e155 = NoL_7; - return (((_e148 + _e149) * _e151.color.xyz) * _e155); + half_vector = normalize((_e60 + _e61)); + let _e65 = normal_1; + let _e66 = incident_light; + NoL_7 = clamp(dot(_e65, _e66), 0f, 1f); + let _e72 = normal_1; + let _e73 = half_vector; + NoH_5 = clamp(dot(_e72, _e73), 0f, 1f); + let _e79 = incident_light; + let _e80 = half_vector; + LoH_7 = clamp(dot(_e79, _e80), 0f, 1f); + let _e86 = diffuseColor_3; + let _e87 = roughness_11; + let _e88 = NdotV_3; + let _e89 = NoL_7; + let _e90 = LoH_7; + let _e91 = Fd_Burley(_e87, _e88, _e89, _e90); + diffuse_1 = (_e86 * _e91); + let _e96 = F0_3; + let _e97 = roughness_11; + let _e98 = half_vector; + let _e99 = NdotV_3; + let _e100 = NoL_7; + let _e101 = NoH_5; + let _e102 = LoH_7; + let _e103 = specularIntensity_3; + let _e104 = specular(_e96, _e97, _e98, _e99, _e100, _e101, _e102, _e103); + specular_2 = _e104; + let _e106 = specular_2; + let _e107 = diffuse_1; + let _e109 = light_3; + let _e113 = NoL_7; + return (((_e106 + _e107) * _e109.color.xyz) * _e113); } fn main_1() { @@ -722,201 +665,190 @@ fn main_1() { let _e40 = global_3.base_color; output_color = _e40; let _e42 = output_color; - let _e44 = v_Uv_1; - let _e45 = textureSample(StandardMaterial_base_color_texture, StandardMaterial_base_color_texture_sampler, _e44); - output_color = (_e42 * _e45); - let _e48 = v_Uv_1; - let _e49 = textureSample(StandardMaterial_metallic_roughness_texture, StandardMaterial_metallic_roughness_texture_sampler, _e48); - metallic_roughness = _e49; - let _e51 = global_5.metallic; - let _e52 = metallic_roughness; - metallic = (_e51 * _e52.z); - let _e56 = global_4.perceptual_roughness; - let _e57 = metallic_roughness; - perceptual_roughness_2 = (_e56 * _e57.y); - let _e62 = perceptual_roughness_2; - let _e63 = perceptualRoughnessToRoughness(_e62); - roughness_12 = _e63; - let _e66 = v_WorldNormal_1; - N_2 = normalize(_e66); - let _e69 = v_WorldTangent_1; - let _e71 = v_WorldTangent_1; - T = normalize(_e71.xyz); - let _e77 = N_2; - let _e78 = T; - let _e80 = v_WorldTangent_1; - B = (cross(_e77, _e78) * _e80.w); - let _e85 = gl_FrontFacing_1; - if _e85 { - let _e86 = N_2; - local = _e86; + let _e43 = v_Uv_1; + let _e44 = textureSample(StandardMaterial_base_color_texture, StandardMaterial_base_color_texture_sampler, _e43); + output_color = (_e42 * _e44); + let _e46 = v_Uv_1; + let _e47 = textureSample(StandardMaterial_metallic_roughness_texture, StandardMaterial_metallic_roughness_texture_sampler, _e46); + metallic_roughness = _e47; + let _e49 = global_5.metallic; + let _e50 = metallic_roughness; + metallic = (_e49 * _e50.z); + let _e54 = global_4.perceptual_roughness; + let _e55 = metallic_roughness; + perceptual_roughness_2 = (_e54 * _e55.y); + let _e59 = perceptual_roughness_2; + let _e60 = perceptualRoughnessToRoughness(_e59); + roughness_12 = _e60; + let _e62 = v_WorldNormal_1; + N_2 = normalize(_e62); + let _e65 = v_WorldTangent_1; + T = normalize(_e65.xyz); + let _e69 = N_2; + let _e70 = T; + let _e72 = v_WorldTangent_1; + B = (cross(_e69, _e70) * _e72.w); + let _e77 = gl_FrontFacing_1; + if _e77 { + let _e78 = N_2; + local = _e78; } else { - let _e87 = N_2; - local = -(_e87); + let _e79 = N_2; + local = -(_e79); } - let _e90 = local; - N_2 = _e90; - let _e91 = gl_FrontFacing_1; - if _e91 { - let _e92 = T; - local_1 = _e92; + let _e82 = local; + N_2 = _e82; + let _e83 = gl_FrontFacing_1; + if _e83 { + let _e84 = T; + local_1 = _e84; } else { - let _e93 = T; - local_1 = -(_e93); + let _e85 = T; + local_1 = -(_e85); } - let _e96 = local_1; - T = _e96; - let _e97 = gl_FrontFacing_1; - if _e97 { - let _e98 = B; - local_2 = _e98; + let _e88 = local_1; + T = _e88; + let _e89 = gl_FrontFacing_1; + if _e89 { + let _e90 = B; + local_2 = _e90; } else { - let _e99 = B; - local_2 = -(_e99); + let _e91 = B; + local_2 = -(_e91); } - let _e102 = local_2; - B = _e102; - let _e103 = T; - let _e104 = B; - let _e105 = N_2; - TBN = mat3x3(vec3(_e103.x, _e103.y, _e103.z), vec3(_e104.x, _e104.y, _e104.z), vec3(_e105.x, _e105.y, _e105.z)); - let _e120 = TBN; - let _e122 = v_Uv_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 * 2f) - vec3(1f)))); - let _e142 = v_Uv_1; - let _e143 = textureSample(StandardMaterial_occlusion_texture, StandardMaterial_occlusion_texture_sampler, _e142); - occlusion = _e143.x; - let _e146 = global_7.emissive; - emissive = _e146; - let _e148 = emissive; - let _e150 = emissive; - let _e153 = v_Uv_1; - let _e154 = textureSample(StandardMaterial_emissive_texture, StandardMaterial_emissive_texture_sampler, _e153); - let _e156 = (_e150.xyz * _e154.xyz); - emissive.x = _e156.x; - emissive.y = _e156.y; - emissive.z = _e156.z; - let _e163 = global_1.CameraPos; - let _e165 = v_WorldPosition_1; - let _e168 = global_1.CameraPos; - let _e170 = v_WorldPosition_1; - V_3 = normalize((_e168.xyz - _e170.xyz)); - let _e177 = N_2; - let _e178 = V_3; + let _e94 = local_2; + B = _e94; + let _e95 = T; + let _e96 = B; + let _e97 = N_2; + TBN = mat3x3(vec3(_e95.x, _e95.y, _e95.z), vec3(_e96.x, _e96.y, _e96.z), vec3(_e97.x, _e97.y, _e97.z)); + let _e112 = TBN; + let _e113 = v_Uv_1; + let _e114 = textureSample(StandardMaterial_normal_map, StandardMaterial_normal_map_sampler, _e113); + N_2 = (_e112 * normalize(((_e114.xyz * 2f) - vec3(1f)))); + let _e123 = v_Uv_1; + let _e124 = textureSample(StandardMaterial_occlusion_texture, StandardMaterial_occlusion_texture_sampler, _e123); + occlusion = _e124.x; + let _e127 = global_7.emissive; + emissive = _e127; + let _e129 = emissive; + let _e131 = emissive; + let _e133 = v_Uv_1; + let _e134 = textureSample(StandardMaterial_emissive_texture, StandardMaterial_emissive_texture_sampler, _e133); + let _e136 = (_e131.xyz * _e134.xyz); + emissive.x = _e136.x; + emissive.y = _e136.y; + emissive.z = _e136.z; + let _e143 = global_1.CameraPos; + let _e145 = v_WorldPosition_1; + V_3 = normalize((_e143.xyz - _e145.xyz)); + let _e150 = N_2; + let _e151 = V_3; + NdotV_4 = max(dot(_e150, _e151), 0.001f); + let _e157 = global_6.reflectance; + let _e159 = global_6.reflectance; + let _e162 = metallic; + let _e166 = output_color; + let _e168 = metallic; + F0_4 = (vec3((((0.16f * _e157) * _e159) * (1f - _e162))) + (_e166.xyz * vec3(_e168))); + let _e173 = output_color; + let _e176 = metallic; + diffuseColor_4 = (_e173.xyz * vec3((1f - _e176))); + let _e181 = V_3; let _e183 = N_2; - let _e184 = V_3; - 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.16f * _e190) * _e192) * (1f - _e195))) + (_e199.xyz * vec3(_e201))); - let _e206 = output_color; - let _e209 = metallic; - diffuseColor_4 = (_e206.xyz * vec3((1f - _e209))); - let _e214 = V_3; - let _e217 = V_3; - let _e219 = N_2; - R_4 = reflect(-(_e217), _e219); + R_4 = reflect(-(_e181), _e183); loop { - let _e227 = i; - let _e228 = global_2.NumLights; - let _e232 = i; - if !(((_e227 < i32(_e228.x)) && (_e232 < MAX_POINT_LIGHTS))) { + let _e191 = i; + let _e192 = global_2.NumLights; + let _e196 = i; + if !(((_e191 < i32(_e192.x)) && (_e196 < MAX_POINT_LIGHTS))) { break; } { - let _e239 = light_accum; - let _e240 = i; - let _e250 = i; - let _e252 = global_2.PointLights[_e250]; - let _e253 = roughness_12; - let _e254 = NdotV_4; - let _e255 = N_2; - let _e256 = V_3; - let _e257 = R_4; - let _e258 = F0_4; - let _e259 = diffuseColor_4; - let _e260 = point_light(_e252, _e253, _e254, _e255, _e256, _e257, _e258, _e259); - light_accum = (_e239 + _e260); + let _e203 = light_accum; + let _e204 = i; + let _e206 = global_2.PointLights[_e204]; + let _e207 = roughness_12; + let _e208 = NdotV_4; + let _e209 = N_2; + let _e210 = V_3; + let _e211 = R_4; + let _e212 = F0_4; + let _e213 = diffuseColor_4; + let _e214 = point_light(_e206, _e207, _e208, _e209, _e210, _e211, _e212, _e213); + light_accum = (_e203 + _e214); } continuing { - let _e236 = i; - i = (_e236 + 1i); + let _e200 = i; + i = (_e200 + 1i); } } loop { - let _e264 = i_1; - let _e265 = global_2.NumLights; - let _e269 = i_1; - if !(((_e264 < i32(_e265.y)) && (_e269 < MAX_DIRECTIONAL_LIGHTS))) { + let _e218 = i_1; + let _e219 = global_2.NumLights; + let _e223 = i_1; + if !(((_e218 < i32(_e219.y)) && (_e223 < MAX_DIRECTIONAL_LIGHTS))) { break; } { - let _e276 = light_accum; - let _e277 = i_1; - let _e287 = i_1; - let _e289 = global_2.DirectionalLights[_e287]; - let _e290 = roughness_12; - let _e291 = NdotV_4; - let _e292 = N_2; - let _e293 = V_3; - let _e294 = R_4; - let _e295 = F0_4; - let _e296 = diffuseColor_4; - let _e297 = dir_light(_e289, _e290, _e291, _e292, _e293, _e294, _e295, _e296); - light_accum = (_e276 + _e297); + let _e230 = light_accum; + let _e231 = i_1; + let _e233 = global_2.DirectionalLights[_e231]; + let _e234 = roughness_12; + let _e235 = NdotV_4; + let _e236 = N_2; + let _e237 = V_3; + let _e238 = R_4; + let _e239 = F0_4; + let _e240 = diffuseColor_4; + let _e241 = dir_light(_e233, _e234, _e235, _e236, _e237, _e238, _e239, _e240); + light_accum = (_e230 + _e241); } continuing { - let _e273 = i_1; - i_1 = (_e273 + 1i); + let _e227 = i_1; + i_1 = (_e227 + 1i); } } - let _e302 = diffuseColor_4; - let _e304 = NdotV_4; - let _e305 = EnvBRDFApprox(_e302, 1f, _e304); - diffuse_ambient = _e305; - let _e310 = F0_4; - let _e311 = perceptual_roughness_2; - let _e312 = NdotV_4; - let _e313 = EnvBRDFApprox(_e310, _e311, _e312); - specular_ambient = _e313; - let _e315 = output_color; - let _e317 = light_accum; - output_color.x = _e317.x; - output_color.y = _e317.y; - output_color.z = _e317.z; - let _e324 = output_color; - let _e326 = output_color; - let _e328 = diffuse_ambient; - let _e329 = specular_ambient; - let _e331 = global_2.AmbientColor; - let _e334 = occlusion; - let _e336 = (_e326.xyz + (((_e328 + _e329) * _e331.xyz) * _e334)); - output_color.x = _e336.x; - output_color.y = _e336.y; - output_color.z = _e336.z; - let _e343 = output_color; - let _e345 = output_color; - let _e347 = emissive; - let _e349 = output_color; - let _e352 = (_e345.xyz + (_e347.xyz * _e349.w)); - output_color.x = _e352.x; - output_color.y = _e352.y; - output_color.z = _e352.z; - let _e359 = output_color; - let _e361 = output_color; - let _e363 = output_color; - let _e365 = reinhard_luminance(_e363.xyz); - output_color.x = _e365.x; - output_color.y = _e365.y; - output_color.z = _e365.z; - let _e372 = output_color; - o_Target = _e372; + let _e243 = diffuseColor_4; + let _e245 = NdotV_4; + let _e246 = EnvBRDFApprox(_e243, 1f, _e245); + diffuse_ambient = _e246; + let _e248 = F0_4; + let _e249 = perceptual_roughness_2; + let _e250 = NdotV_4; + let _e251 = EnvBRDFApprox(_e248, _e249, _e250); + specular_ambient = _e251; + let _e253 = output_color; + let _e255 = light_accum; + output_color.x = _e255.x; + output_color.y = _e255.y; + output_color.z = _e255.z; + let _e262 = output_color; + let _e264 = output_color; + let _e266 = diffuse_ambient; + let _e267 = specular_ambient; + let _e269 = global_2.AmbientColor; + let _e272 = occlusion; + let _e274 = (_e264.xyz + (((_e266 + _e267) * _e269.xyz) * _e272)); + output_color.x = _e274.x; + output_color.y = _e274.y; + output_color.z = _e274.z; + let _e281 = output_color; + let _e283 = output_color; + let _e285 = emissive; + let _e287 = output_color; + let _e290 = (_e283.xyz + (_e285.xyz * _e287.w)); + output_color.x = _e290.x; + output_color.y = _e290.y; + output_color.z = _e290.z; + let _e297 = output_color; + let _e299 = output_color; + let _e301 = reinhard_luminance(_e299.xyz); + output_color.x = _e301.x; + output_color.y = _e301.y; + output_color.z = _e301.z; + let _e308 = output_color; + o_Target = _e308; return; } diff --git a/naga/tests/out/wgsl/bits_glsl.frag.wgsl b/naga/tests/out/wgsl/bits_glsl.frag.wgsl index e8365dd1ee..3513d1ba25 100644 --- a/naga/tests/out/wgsl/bits_glsl.frag.wgsl +++ b/naga/tests/out/wgsl/bits_glsl.frag.wgsl @@ -10,98 +10,98 @@ fn main_1() { var f2_: vec2 = vec2(0f); var f4_: vec4 = vec4(0f); - let _e33 = f4_; - u = pack4x8snorm(_e33); - let _e36 = f4_; - u = pack4x8unorm(_e36); - let _e39 = f2_; - u = pack2x16unorm(_e39); - let _e42 = f2_; - u = pack2x16snorm(_e42); - let _e45 = f2_; - u = pack2x16float(_e45); + let _e32 = f4_; + u = pack4x8snorm(_e32); + let _e34 = f4_; + u = pack4x8unorm(_e34); + let _e36 = f2_; + u = pack2x16unorm(_e36); + let _e38 = f2_; + u = pack2x16snorm(_e38); + let _e40 = f2_; + u = pack2x16float(_e40); + let _e42 = u; + f4_ = unpack4x8snorm(_e42); + let _e44 = u; + f4_ = unpack4x8unorm(_e44); + let _e46 = u; + f2_ = unpack2x16snorm(_e46); let _e48 = u; - f4_ = unpack4x8snorm(_e48); - let _e51 = u; - f4_ = unpack4x8unorm(_e51); - let _e54 = u; - f2_ = unpack2x16snorm(_e54); - let _e57 = u; - f2_ = unpack2x16unorm(_e57); - let _e60 = u; - f2_ = unpack2x16float(_e60); - let _e66 = i; - let _e67 = i; - i = insertBits(_e66, _e67, 5u, 10u); - let _e77 = i2_; - let _e78 = i2_; - i2_ = insertBits(_e77, _e78, 5u, 10u); - let _e88 = i3_; - let _e89 = i3_; - i3_ = insertBits(_e88, _e89, 5u, 10u); - let _e99 = i4_; - let _e100 = i4_; - i4_ = insertBits(_e99, _e100, 5u, 10u); - let _e110 = u; - let _e111 = u; - u = insertBits(_e110, _e111, 5u, 10u); - let _e121 = u2_; - let _e122 = u2_; - u2_ = insertBits(_e121, _e122, 5u, 10u); - let _e132 = u3_; - let _e133 = u3_; - u3_ = insertBits(_e132, _e133, 5u, 10u); - let _e143 = u4_; - let _e144 = u4_; - u4_ = insertBits(_e143, _e144, 5u, 10u); - let _e153 = i; - i = extractBits(_e153, 5u, 10u); - let _e162 = i2_; - i2_ = extractBits(_e162, 5u, 10u); - let _e171 = i3_; - i3_ = extractBits(_e171, 5u, 10u); - let _e180 = i4_; - i4_ = extractBits(_e180, 5u, 10u); - let _e189 = u; - u = extractBits(_e189, 5u, 10u); - let _e198 = u2_; - u2_ = extractBits(_e198, 5u, 10u); - let _e207 = u3_; - u3_ = extractBits(_e207, 5u, 10u); - let _e216 = u4_; - u4_ = extractBits(_e216, 5u, 10u); - let _e223 = i; - i = firstTrailingBit(_e223); - let _e226 = i2_; - i2_ = firstTrailingBit(_e226); - let _e229 = i3_; - i3_ = firstTrailingBit(_e229); - let _e232 = i4_; - i4_ = firstTrailingBit(_e232); - let _e235 = u; - i = i32(firstTrailingBit(_e235)); - let _e239 = u2_; - i2_ = vec2(firstTrailingBit(_e239)); - let _e243 = u3_; - i3_ = vec3(firstTrailingBit(_e243)); - let _e247 = u4_; - i4_ = vec4(firstTrailingBit(_e247)); - let _e251 = i; - i = firstLeadingBit(_e251); - let _e254 = i2_; - i2_ = firstLeadingBit(_e254); - let _e257 = i3_; - i3_ = firstLeadingBit(_e257); - let _e260 = i4_; - i4_ = firstLeadingBit(_e260); - let _e263 = u; - i = i32(firstLeadingBit(_e263)); - let _e267 = u2_; - i2_ = vec2(firstLeadingBit(_e267)); - let _e271 = u3_; - i3_ = vec3(firstLeadingBit(_e271)); - let _e275 = u4_; - i4_ = vec4(firstLeadingBit(_e275)); + f2_ = unpack2x16unorm(_e48); + let _e50 = u; + f2_ = unpack2x16float(_e50); + let _e52 = i; + let _e53 = i; + i = insertBits(_e52, _e53, 5u, 10u); + let _e59 = i2_; + let _e60 = i2_; + i2_ = insertBits(_e59, _e60, 5u, 10u); + let _e66 = i3_; + let _e67 = i3_; + i3_ = insertBits(_e66, _e67, 5u, 10u); + let _e73 = i4_; + let _e74 = i4_; + i4_ = insertBits(_e73, _e74, 5u, 10u); + let _e80 = u; + let _e81 = u; + u = insertBits(_e80, _e81, 5u, 10u); + let _e87 = u2_; + let _e88 = u2_; + u2_ = insertBits(_e87, _e88, 5u, 10u); + let _e94 = u3_; + let _e95 = u3_; + u3_ = insertBits(_e94, _e95, 5u, 10u); + let _e101 = u4_; + let _e102 = u4_; + u4_ = insertBits(_e101, _e102, 5u, 10u); + let _e108 = i; + i = extractBits(_e108, 5u, 10u); + let _e114 = i2_; + i2_ = extractBits(_e114, 5u, 10u); + let _e120 = i3_; + i3_ = extractBits(_e120, 5u, 10u); + let _e126 = i4_; + i4_ = extractBits(_e126, 5u, 10u); + let _e132 = u; + u = extractBits(_e132, 5u, 10u); + let _e138 = u2_; + u2_ = extractBits(_e138, 5u, 10u); + let _e144 = u3_; + u3_ = extractBits(_e144, 5u, 10u); + let _e150 = u4_; + u4_ = extractBits(_e150, 5u, 10u); + let _e156 = i; + i = firstTrailingBit(_e156); + let _e158 = i2_; + i2_ = firstTrailingBit(_e158); + let _e160 = i3_; + i3_ = firstTrailingBit(_e160); + let _e162 = i4_; + i4_ = firstTrailingBit(_e162); + let _e164 = u; + i = i32(firstTrailingBit(_e164)); + let _e167 = u2_; + i2_ = vec2(firstTrailingBit(_e167)); + let _e170 = u3_; + i3_ = vec3(firstTrailingBit(_e170)); + let _e173 = u4_; + i4_ = vec4(firstTrailingBit(_e173)); + let _e176 = i; + i = firstLeadingBit(_e176); + let _e178 = i2_; + i2_ = firstLeadingBit(_e178); + let _e180 = i3_; + i3_ = firstLeadingBit(_e180); + let _e182 = i4_; + i4_ = firstLeadingBit(_e182); + let _e184 = u; + i = i32(firstLeadingBit(_e184)); + let _e187 = u2_; + i2_ = vec2(firstLeadingBit(_e187)); + let _e190 = u3_; + i3_ = vec3(firstLeadingBit(_e190)); + let _e193 = u4_; + i4_ = vec4(firstLeadingBit(_e193)); return; } diff --git a/naga/tests/out/wgsl/bool-select.frag.wgsl b/naga/tests/out/wgsl/bool-select.frag.wgsl index 747ff677a2..4045a3de45 100644 --- a/naga/tests/out/wgsl/bool-select.frag.wgsl +++ b/naga/tests/out/wgsl/bool-select.frag.wgsl @@ -21,19 +21,19 @@ fn TevPerCompGT_1(a_2: vec3, b_2: vec3) -> vec3 { a_3 = a_2; b_3 = b_2; - let _e7 = a_3; - let _e8 = b_3; - return select(vec3(0f), vec3(1f), (_e7 > _e8)); + let _e5 = a_3; + let _e6 = b_3; + return select(vec3(0f), vec3(1f), (_e5 > _e6)); } fn main_1() { let _e1 = o_color; - 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(3f, 5f); - o_color.w = _e23; + let _e7 = TevPerCompGT_1(vec3(3f), vec3(5f)); + o_color.x = _e7.x; + o_color.y = _e7.y; + o_color.z = _e7.z; + let _e17 = TevPerCompGT(3f, 5f); + o_color.w = _e17; return; } diff --git a/naga/tests/out/wgsl/clamp-splat.vert.wgsl b/naga/tests/out/wgsl/clamp-splat.vert.wgsl index 3425e57588..909ff07209 100644 --- a/naga/tests/out/wgsl/clamp-splat.vert.wgsl +++ b/naga/tests/out/wgsl/clamp-splat.vert.wgsl @@ -6,9 +6,9 @@ var a_pos_1: vec2; var gl_Position: vec4; fn main_1() { - let _e5 = a_pos_1; - let _e10 = clamp(_e5, vec2(0f), vec2(1f)); - gl_Position = vec4(_e10.x, _e10.y, 0f, 1f); + let _e2 = a_pos_1; + let _e7 = clamp(_e2, vec2(0f), vec2(1f)); + gl_Position = vec4(_e7.x, _e7.y, 0f, 1f); return; } diff --git a/naga/tests/out/wgsl/double-math-functions.frag.wgsl b/naga/tests/out/wgsl/double-math-functions.frag.wgsl index 914af92d24..01c798586a 100644 --- a/naga/tests/out/wgsl/double-math-functions.frag.wgsl +++ b/naga/tests/out/wgsl/double-math-functions.frag.wgsl @@ -34,64 +34,59 @@ fn main_1() { let _e10 = a; let _e11 = b; m = mat4x4(vec4(_e8.x, _e8.y, _e8.z, _e8.w), vec4(_e9.x, _e9.y, _e9.z, _e9.w), vec4(_e10.x, _e10.y, _e10.z, _e10.w), vec4(_e11.x, _e11.y, _e11.z, _e11.w)); - let _e37 = a; - ceilOut = ceil(_e37); - let _e41 = a; - roundOut = round(_e41); + let _e36 = a; + ceilOut = ceil(_e36); + let _e39 = a; + roundOut = round(_e39); + let _e42 = a; + floorOut = floor(_e42); let _e45 = a; - floorOut = floor(_e45); - let _e49 = a; - fractOut = fract(_e49); - let _e53 = a; - truncOut = trunc(_e53); + fractOut = fract(_e45); + let _e48 = a; + truncOut = trunc(_e48); + let _e51 = a; + absOut = abs(_e51); + let _e54 = a; + sqrtOut = sqrt(_e54); let _e57 = a; - absOut = abs(_e57); - let _e61 = a; - sqrtOut = sqrt(_e61); - let _e65 = a; - inversesqrtOut = inverseSqrt(_e65); + inversesqrtOut = inverseSqrt(_e57); + let _e60 = a; + signOut = sign(_e60); + let _e63 = m; + transposeOut = transpose(_e63); + let _e66 = a; + normalizeOut = normalize(_e66); let _e69 = a; - signOut = sign(_e69); - let _e73 = m; - transposeOut = transpose(_e73); - let _e77 = a; - normalizeOut = normalize(_e77); - let _e81 = a; - lengthOut = length(_e81); - let _e85 = m; - determinantOut = determinant(_e85); + lengthOut = length(_e69); + let _e72 = m; + determinantOut = determinant(_e72); + let _e75 = a; + let _e77 = b; + modOut = (_e75.x - (floor((_e75.x / _e77.x)) * _e77.x)); + let _e84 = a; + let _e85 = b; + dotOut = dot(_e84, _e85); let _e88 = a; - let _e90 = b; + let _e89 = b; + maxOut = max(_e88, _e89); let _e92 = a; - let _e94 = b; - modOut = (_e92.x - (floor((_e92.x / _e94.x)) * _e94.x)); - let _e103 = a; - let _e104 = b; - dotOut = dot(_e103, _e104); - let _e109 = a; - let _e110 = b; - maxOut = max(_e109, _e110); - let _e115 = a; - let _e116 = b; - minOut = min(_e115, _e116); - let _e121 = a; - let _e122 = b; - reflectOut = reflect(_e121, _e122); - let _e125 = a; - let _e127 = b; - let _e129 = a; - let _e131 = b; - crossOut = cross(_e129.xyz, _e131.xyz); - let _e137 = a; - let _e138 = b; - distanceOut = distance(_e137, _e138); - let _e143 = a; - let _e144 = b; - stepOut = step(_e143, _e144); - let _e147 = a; - let _e150 = a; - let _e152 = i; - ldexpOut = ldexp(_e150.x, _e152); + let _e93 = b; + minOut = min(_e92, _e93); + let _e96 = a; + let _e97 = b; + reflectOut = reflect(_e96, _e97); + let _e100 = a; + let _e102 = b; + crossOut = cross(_e100.xyz, _e102.xyz); + let _e106 = a; + let _e107 = b; + distanceOut = distance(_e106, _e107); + let _e110 = a; + let _e111 = b; + stepOut = step(_e110, _e111); + let _e114 = a; + let _e116 = i; + ldexpOut = ldexp(_e114.x, _e116); 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)); diff --git a/naga/tests/out/wgsl/images.frag.wgsl b/naga/tests/out/wgsl/images.frag.wgsl index e7eada96e8..6b57b52aeb 100644 --- a/naga/tests/out/wgsl/images.frag.wgsl +++ b/naga/tests/out/wgsl/images.frag.wgsl @@ -23,11 +23,11 @@ fn testImg1D(coord: i32) { coord_1 = coord; let _e10 = textureDimensions(img1D); size = i32(_e10); + let _e13 = coord_1; + textureStore(img1D, _e13, vec4(2f)); let _e17 = coord_1; - textureStore(img1D, _e17, vec4(2f)); - let _e22 = coord_1; - let _e23 = textureLoad(img1D, _e22); - c = _e23; + let _e18 = textureLoad(img1D, _e17); + c = _e18; return; } @@ -40,11 +40,11 @@ fn testImg1DArray(coord_2: vec2) { let _e10 = textureDimensions(img1DArray); let _e11 = textureNumLayers(img1DArray); size_1 = vec2(vec2(vec2(_e10, _e11))); - let _e17 = coord_3; - let _e20 = textureLoad(img1DArray, _e17.x, _e17.y); - c_1 = _e20; - let _e26 = coord_3; - textureStore(img1DArray, _e26.x, _e26.y, vec4(2f)); + let _e16 = coord_3; + let _e19 = textureLoad(img1DArray, _e16.x, _e16.y); + c_1 = _e19; + let _e21 = coord_3; + textureStore(img1DArray, _e21.x, _e21.y, vec4(2f)); return; } @@ -56,11 +56,11 @@ fn testImg2D(coord_4: vec2) { coord_5 = coord_4; let _e10 = textureDimensions(img2D); size_2 = vec2(vec2(_e10)); - let _e15 = coord_5; - let _e16 = textureLoad(img2D, _e15); - c_2 = _e16; - let _e22 = coord_5; - textureStore(img2D, _e22, vec4(2f)); + let _e14 = coord_5; + let _e15 = textureLoad(img2D, _e14); + c_2 = _e15; + let _e17 = coord_5; + textureStore(img2D, _e17, vec4(2f)); return; } @@ -73,11 +73,11 @@ fn testImg2DArray(coord_6: vec3) { let _e10 = textureDimensions(img2DArray); let _e13 = textureNumLayers(img2DArray); size_3 = vec3(vec3(vec3(_e10.x, _e10.y, _e13))); - let _e19 = coord_7; - let _e22 = textureLoad(img2DArray, _e19.xy, _e19.z); - c_3 = _e22; - let _e28 = coord_7; - textureStore(img2DArray, _e28.xy, _e28.z, vec4(2f)); + let _e18 = coord_7; + let _e21 = textureLoad(img2DArray, _e18.xy, _e18.z); + c_3 = _e21; + let _e23 = coord_7; + textureStore(img2DArray, _e23.xy, _e23.z, vec4(2f)); return; } @@ -89,11 +89,11 @@ fn testImg3D(coord_8: vec3) { coord_9 = coord_8; let _e10 = textureDimensions(img3D); size_4 = vec3(vec3(_e10)); - let _e15 = coord_9; - let _e16 = textureLoad(img3D, _e15); - c_4 = _e16; - let _e22 = coord_9; - textureStore(img3D, _e22, vec4(2f)); + let _e14 = coord_9; + let _e15 = textureLoad(img3D, _e14); + c_4 = _e15; + let _e17 = coord_9; + textureStore(img3D, _e17, vec4(2f)); return; } @@ -105,9 +105,9 @@ fn testImgReadOnly(coord_10: vec2) { coord_11 = coord_10; let _e10 = textureDimensions(img2D); size_5 = vec2(vec2(_e10)); - let _e15 = coord_11; - let _e16 = textureLoad(imgReadOnly, _e15); - c_5 = _e16; + let _e14 = coord_11; + let _e15 = textureLoad(imgReadOnly, _e14); + c_5 = _e15; return; } @@ -118,8 +118,8 @@ fn testImgWriteOnly(coord_12: vec2) { coord_13 = coord_12; let _e10 = textureDimensions(img2D); size_6 = vec2(vec2(_e10)); - let _e18 = coord_13; - textureStore(imgWriteOnly, _e18, vec4(2f)); + let _e14 = coord_13; + textureStore(imgWriteOnly, _e14, vec4(2f)); return; } diff --git a/naga/tests/out/wgsl/inverse-polyfill.frag.wgsl b/naga/tests/out/wgsl/inverse-polyfill.frag.wgsl index d22847c975..1efea1d9f6 100644 --- a/naga/tests/out/wgsl/inverse-polyfill.frag.wgsl +++ b/naga/tests/out/wgsl/inverse-polyfill.frag.wgsl @@ -19,12 +19,12 @@ fn main_1() { let _e39 = b3_; let _e40 = a3_; m3_ = mat3x3(vec3(_e38.x, _e38.y, _e38.z), vec3(_e39.x, _e39.y, _e39.z), vec3(_e40.x, _e40.y, _e40.z)); - let _e64 = m4_; - m4_inverse = _naga_inverse_4x4_f32(_e64); - let _e68 = m3_; - m3_inverse = _naga_inverse_3x3_f32(_e68); - let _e72 = m2_; - m2_inverse = _naga_inverse_2x2_f32(_e72); + let _e63 = m4_; + m4_inverse = _naga_inverse_4x4_f32(_e63); + let _e66 = m3_; + m3_inverse = _naga_inverse_3x3_f32(_e66); + let _e69 = m2_; + m2_inverse = _naga_inverse_2x2_f32(_e69); return; } diff --git a/naga/tests/out/wgsl/math-functions.frag.wgsl b/naga/tests/out/wgsl/math-functions.frag.wgsl index b01c3322ae..10dc84c9a5 100644 --- a/naga/tests/out/wgsl/math-functions.frag.wgsl +++ b/naga/tests/out/wgsl/math-functions.frag.wgsl @@ -53,108 +53,99 @@ fn main_1() { let _e8 = a; let _e9 = b; m = mat4x4(vec4(_e6.x, _e6.y, _e6.z, _e6.w), vec4(_e7.x, _e7.y, _e7.z, _e7.w), vec4(_e8.x, _e8.y, _e8.z, _e8.w), vec4(_e9.x, _e9.y, _e9.z, _e9.w)); - let _e35 = a; - ceilOut = ceil(_e35); - let _e39 = a; - roundOut = round(_e39); + let _e34 = a; + ceilOut = ceil(_e34); + let _e37 = a; + roundOut = round(_e37); + let _e40 = a; + floorOut = floor(_e40); let _e43 = a; - floorOut = floor(_e43); - let _e47 = a; - fractOut = fract(_e47); - let _e51 = a; - truncOut = trunc(_e51); + fractOut = fract(_e43); + let _e46 = a; + truncOut = trunc(_e46); + let _e49 = a; + sinOut = sin(_e49); + let _e52 = a; + absOut = abs(_e52); let _e55 = a; - sinOut = sin(_e55); - let _e59 = a; - absOut = abs(_e59); - let _e63 = a; - sqrtOut = sqrt(_e63); + sqrtOut = sqrt(_e55); + let _e58 = a; + inversesqrtOut = inverseSqrt(_e58); + let _e61 = a; + expOut = exp(_e61); + let _e64 = a; + exp2Out = exp2(_e64); let _e67 = a; - inversesqrtOut = inverseSqrt(_e67); - let _e71 = a; - expOut = exp(_e71); - let _e75 = a; - exp2Out = exp2(_e75); + signOut = sign(_e67); + let _e70 = m; + transposeOut = transpose(_e70); + let _e73 = a; + normalizeOut = normalize(_e73); + let _e76 = a; + sinhOut = sinh(_e76); let _e79 = a; - signOut = sign(_e79); - let _e83 = m; - transposeOut = transpose(_e83); - let _e87 = a; - normalizeOut = normalize(_e87); + cosOut = cos(_e79); + let _e82 = a; + coshOut = cosh(_e82); + let _e85 = a; + tanOut = tan(_e85); + let _e88 = a; + tanhOut = tanh(_e88); let _e91 = a; - sinhOut = sinh(_e91); - let _e95 = a; - cosOut = cos(_e95); - let _e99 = a; - coshOut = cosh(_e99); + acosOut = acos(_e91); + let _e94 = a; + asinOut = asin(_e94); + let _e97 = a; + logOut = log(_e97); + let _e100 = a; + log2Out = log2(_e100); let _e103 = a; - tanOut = tan(_e103); - let _e107 = a; - tanhOut = tanh(_e107); - let _e111 = a; - acosOut = acos(_e111); + lengthOut = length(_e103); + let _e106 = m; + determinantOut = determinant(_e106); + let _e109 = i; + bitCountOut = countOneBits(_e109); + let _e112 = i; + bitfieldReverseOut = reverseBits(_e112); let _e115 = a; - asinOut = asin(_e115); + atanOut = atan(_e115.x); let _e119 = a; - logOut = log(_e119); - let _e123 = a; - log2Out = log2(_e123); - let _e127 = a; - lengthOut = length(_e127); - let _e131 = m; - determinantOut = determinant(_e131); - let _e135 = i; - bitCountOut = countOneBits(_e135); - let _e139 = i; - bitfieldReverseOut = reverseBits(_e139); + let _e121 = a; + atan2Out = atan2(_e119.x, _e121.y); + let _e125 = a; + let _e127 = b; + modOut = (_e125.x - (floor((_e125.x / _e127.x)) * _e127.x)); + let _e134 = a; + let _e135 = b; + powOut = pow(_e134, _e135); + let _e138 = a; + let _e139 = b; + dotOut = dot(_e138, _e139); let _e142 = a; - let _e144 = a; - atanOut = atan(_e144.x); - let _e148 = a; + let _e143 = b; + maxOut = max(_e142, _e143); + let _e146 = a; + let _e147 = b; + minOut = min(_e146, _e147); let _e150 = a; - let _e152 = a; + let _e151 = b; + reflectOut = reflect(_e150, _e151); let _e154 = a; - atan2Out = atan2(_e152.x, _e154.y); - let _e158 = a; - let _e160 = b; - let _e162 = a; - let _e164 = b; - modOut = (_e162.x - (floor((_e162.x / _e164.x)) * _e164.x)); + let _e156 = b; + crossOut = cross(_e154.xyz, _e156.xyz); + let _e160 = a; + let _e161 = b; + distanceOut = distance(_e160, _e161); + let _e164 = a; + let _e165 = b; + stepOut = step(_e164, _e165); + let _e168 = a; + let _e170 = i; + ldexpOut = ldexp(_e168.x, _e170); let _e173 = a; - let _e174 = b; - powOut = pow(_e173, _e174); - let _e179 = a; - let _e180 = b; - dotOut = dot(_e179, _e180); - let _e185 = a; - let _e186 = b; - maxOut = max(_e185, _e186); - let _e191 = a; - let _e192 = b; - minOut = min(_e191, _e192); - let _e197 = a; - let _e198 = b; - reflectOut = reflect(_e197, _e198); - let _e201 = a; - let _e203 = b; - let _e205 = a; - let _e207 = b; - crossOut = cross(_e205.xyz, _e207.xyz); - let _e213 = a; - let _e214 = b; - distanceOut = distance(_e213, _e214); - let _e219 = a; - let _e220 = b; - stepOut = step(_e219, _e220); - let _e223 = a; - let _e226 = a; - let _e228 = i; - ldexpOut = ldexp(_e226.x, _e228); - let _e232 = a; - rad = radians(_e232); - let _e235 = a; - let _e237 = a; - deg = degrees(_e237.x); + rad = radians(_e173); + let _e176 = a; + deg = degrees(_e176.x); smoothStepScalar = smoothstep(0f, 1f, 0.5f); smoothStepVector = smoothstep(vec4(0f), vec4(1f), vec4(0.5f)); smoothStepMixed = smoothstep(vec4(0f), vec4(1f), vec4(0.5f)); diff --git a/naga/tests/out/wgsl/sampler-functions.frag.wgsl b/naga/tests/out/wgsl/sampler-functions.frag.wgsl index 3530629088..0f79bd9693 100644 --- a/naga/tests/out/wgsl/sampler-functions.frag.wgsl +++ b/naga/tests/out/wgsl/sampler-functions.frag.wgsl @@ -5,12 +5,11 @@ fn CalcShadowPCF1_(T_P_t_TextureDepth: texture_depth_2d, S_P_t_TextureDepth: sam t_ProjCoord_1 = t_ProjCoord; let _e6 = t_Res; let _e7 = t_ProjCoord_1; - 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.2f)); - let _e19 = t_Res; - return _e19; + let _e8 = _e7.xyz; + let _e11 = textureSampleCompare(T_P_t_TextureDepth, S_P_t_TextureDepth, _e8.xy, _e8.z); + t_Res = (_e6 + (_e11 * 0.2f)); + let _e17 = t_Res; + return _e17; } fn CalcShadowPCF(T_P_t_TextureDepth_1: texture_depth_2d, S_P_t_TextureDepth_1: sampler_comparison, t_ProjCoord_2: vec3, t_Bias: f32) -> f32 { @@ -23,9 +22,8 @@ fn CalcShadowPCF(T_P_t_TextureDepth_1: texture_depth_2d, S_P_t_TextureDepth_1: s let _e9 = t_Bias_1; t_ProjCoord_3.z = (_e7.z + _e9); let _e11 = t_ProjCoord_3; - let _e13 = t_ProjCoord_3; - let _e15 = CalcShadowPCF1_(T_P_t_TextureDepth_1, S_P_t_TextureDepth_1, _e13.xyz); - return _e15; + let _e13 = CalcShadowPCF1_(T_P_t_TextureDepth_1, S_P_t_TextureDepth_1, _e11.xyz); + return _e13; } fn main_1() { diff --git a/naga/tests/out/wgsl/samplers.frag.wgsl b/naga/tests/out/wgsl/samplers.frag.wgsl index c51f05305d..170b0491b3 100644 --- a/naga/tests/out/wgsl/samplers.frag.wgsl +++ b/naga/tests/out/wgsl/samplers.frag.wgsl @@ -42,96 +42,82 @@ fn testTex1D(coord: f32) { var c: vec4; coord_1 = coord; - let _e22 = textureDimensions(tex1D, 0i); - size1D = i32(_e22); - let _e25 = textureNumLevels(tex1D); - levels = i32(_e25); + let _e21 = textureDimensions(tex1D, 0i); + size1D = i32(_e21); + let _e24 = textureNumLevels(tex1D); + levels = i32(_e24); + let _e28 = coord_1; + let _e29 = textureSample(tex1D, samp, _e28); + c = _e29; let _e30 = coord_1; - let _e31 = textureSample(tex1D, samp, _e30); - c = _e31; - let _e35 = coord_1; - let _e38 = textureSampleGrad(tex1D, samp, _e35, 4f, 4f); + let _e33 = textureSampleGrad(tex1D, samp, _e30, 4f, 4f); + c = _e33; + let _e34 = coord_1; + let _e38 = textureSampleGrad(tex1D, samp, _e34, 4f, 4f, 5i); c = _e38; - let _e43 = coord_1; - let _e47 = textureSampleGrad(tex1D, samp, _e43, 4f, 4f, 5i); - c = _e47; - let _e50 = coord_1; - let _e52 = textureSampleLevel(tex1D, samp, _e50, 3f); - c = _e52; + let _e39 = coord_1; + let _e41 = textureSampleLevel(tex1D, samp, _e39, 3f); + c = _e41; + let _e42 = coord_1; + let _e45 = textureSampleLevel(tex1D, samp, _e42, 3f, 5i); + c = _e45; + let _e46 = coord_1; + let _e48 = textureSample(tex1D, samp, _e46, 5i); + c = _e48; + let _e49 = coord_1; + let _e51 = vec2(_e49, 6f); + let _e55 = textureSample(tex1D, samp, (_e51.x / _e51.y)); + c = _e55; let _e56 = coord_1; - let _e59 = textureSampleLevel(tex1D, samp, _e56, 3f, 5i); - c = _e59; - let _e62 = coord_1; - let _e64 = textureSample(tex1D, samp, _e62, 5i); - c = _e64; - let _e65 = coord_1; - let _e68 = coord_1; - let _e70 = vec2(_e68, 6f); - let _e74 = textureSample(tex1D, samp, (_e70.x / _e70.y)); - c = _e74; - let _e75 = coord_1; - let _e80 = coord_1; - let _e84 = vec4(_e80, 0f, 0f, 6f); - let _e90 = textureSample(tex1D, samp, (_e84.xyz / vec3(_e84.w)).x); - c = _e90; - let _e91 = coord_1; - let _e96 = coord_1; - let _e98 = vec2(_e96, 6f); - let _e104 = textureSampleGrad(tex1D, samp, (_e98.x / _e98.y), 4f, 4f); - c = _e104; - let _e105 = coord_1; - let _e112 = coord_1; - let _e116 = vec4(_e112, 0f, 0f, 6f); - let _e124 = textureSampleGrad(tex1D, samp, (_e116.xyz / vec3(_e116.w)).x, 4f, 4f); - c = _e124; - let _e125 = coord_1; - let _e131 = coord_1; - let _e133 = vec2(_e131, 6f); - let _e140 = textureSampleGrad(tex1D, samp, (_e133.x / _e133.y), 4f, 4f, 5i); - c = _e140; - let _e141 = coord_1; - let _e149 = coord_1; - let _e153 = vec4(_e149, 0f, 0f, 6f); - let _e162 = textureSampleGrad(tex1D, samp, (_e153.xyz / vec3(_e153.w)).x, 4f, 4f, 5i); + let _e60 = vec4(_e56, 0f, 0f, 6f); + let _e66 = textureSample(tex1D, samp, (_e60.xyz / vec3(_e60.w)).x); + c = _e66; + let _e67 = coord_1; + let _e69 = vec2(_e67, 6f); + let _e75 = textureSampleGrad(tex1D, samp, (_e69.x / _e69.y), 4f, 4f); + c = _e75; + let _e76 = coord_1; + let _e80 = vec4(_e76, 0f, 0f, 6f); + let _e88 = textureSampleGrad(tex1D, samp, (_e80.xyz / vec3(_e80.w)).x, 4f, 4f); + c = _e88; + let _e89 = coord_1; + let _e91 = vec2(_e89, 6f); + let _e98 = textureSampleGrad(tex1D, samp, (_e91.x / _e91.y), 4f, 4f, 5i); + c = _e98; + let _e99 = coord_1; + let _e103 = vec4(_e99, 0f, 0f, 6f); + let _e112 = textureSampleGrad(tex1D, samp, (_e103.xyz / vec3(_e103.w)).x, 4f, 4f, 5i); + c = _e112; + let _e113 = coord_1; + let _e115 = vec2(_e113, 6f); + let _e120 = textureSampleLevel(tex1D, samp, (_e115.x / _e115.y), 3f); + c = _e120; + let _e121 = coord_1; + let _e125 = vec4(_e121, 0f, 0f, 6f); + let _e132 = textureSampleLevel(tex1D, samp, (_e125.xyz / vec3(_e125.w)).x, 3f); + c = _e132; + let _e133 = coord_1; + let _e135 = vec2(_e133, 6f); + let _e141 = textureSampleLevel(tex1D, samp, (_e135.x / _e135.y), 3f, 5i); + c = _e141; + let _e142 = coord_1; + let _e146 = vec4(_e142, 0f, 0f, 6f); + let _e154 = textureSampleLevel(tex1D, samp, (_e146.xyz / vec3(_e146.w)).x, 3f, 5i); + c = _e154; + let _e155 = coord_1; + let _e157 = vec2(_e155, 6f); + let _e162 = textureSample(tex1D, samp, (_e157.x / _e157.y), 5i); c = _e162; let _e163 = coord_1; - let _e167 = coord_1; - let _e169 = vec2(_e167, 6f); - let _e174 = textureSampleLevel(tex1D, samp, (_e169.x / _e169.y), 3f); + let _e167 = vec4(_e163, 0f, 0f, 6f); + let _e174 = textureSample(tex1D, samp, (_e167.xyz / vec3(_e167.w)).x, 5i); c = _e174; let _e175 = coord_1; - let _e181 = coord_1; - let _e185 = vec4(_e181, 0f, 0f, 6f); - let _e192 = textureSampleLevel(tex1D, samp, (_e185.xyz / vec3(_e185.w)).x, 3f); - c = _e192; - let _e193 = coord_1; - let _e198 = coord_1; - let _e200 = vec2(_e198, 6f); - let _e206 = textureSampleLevel(tex1D, samp, (_e200.x / _e200.y), 3f, 5i); - c = _e206; - let _e207 = coord_1; - let _e214 = coord_1; - let _e218 = vec4(_e214, 0f, 0f, 6f); - let _e226 = textureSampleLevel(tex1D, samp, (_e218.xyz / vec3(_e218.w)).x, 3f, 5i); - c = _e226; - let _e227 = coord_1; - let _e231 = coord_1; - let _e233 = vec2(_e231, 6f); - let _e238 = textureSample(tex1D, samp, (_e233.x / _e233.y), 5i); - c = _e238; - let _e239 = coord_1; - let _e245 = coord_1; - let _e249 = vec4(_e245, 0f, 0f, 6f); - let _e256 = textureSample(tex1D, samp, (_e249.xyz / vec3(_e249.w)).x, 5i); - c = _e256; - let _e257 = coord_1; - let _e260 = coord_1; - let _e263 = textureLoad(tex1D, i32(_e260), 3i); - c = _e263; - let _e264 = coord_1; - let _e268 = coord_1; - let _e272 = textureLoad(tex1D, i32(_e268), 3i); - c = _e272; + let _e178 = textureLoad(tex1D, i32(_e175), 3i); + c = _e178; + let _e179 = coord_1; + let _e183 = textureLoad(tex1D, i32(_e179), 3i); + c = _e183; return; } @@ -142,39 +128,37 @@ fn testTex1DArray(coord_2: vec2) { var c_1: vec4; coord_3 = coord_2; - let _e22 = textureDimensions(tex1DArray, 0i); - let _e23 = textureNumLayers(tex1DArray); - size1DArray = vec2(vec2(_e22, _e23)); - let _e27 = textureNumLevels(tex1DArray); - levels_1 = i32(_e27); - let _e32 = coord_3; - let _e36 = textureSample(tex1DArray, samp, _e32.x, i32(_e32.y)); - c_1 = _e36; - let _e40 = coord_3; - let _e46 = textureSampleGrad(tex1DArray, samp, _e40.x, i32(_e40.y), 4f, 4f); - c_1 = _e46; - let _e51 = coord_3; - let _e58 = textureSampleGrad(tex1DArray, samp, _e51.x, i32(_e51.y), 4f, 4f, 5i); - c_1 = _e58; - let _e61 = coord_3; - let _e66 = textureSampleLevel(tex1DArray, samp, _e61.x, i32(_e61.y), 3f); - c_1 = _e66; - let _e70 = coord_3; - let _e76 = textureSampleLevel(tex1DArray, samp, _e70.x, i32(_e70.y), 3f, 5i); - c_1 = _e76; - let _e79 = coord_3; - let _e84 = textureSample(tex1DArray, samp, _e79.x, i32(_e79.y), 5i); - c_1 = _e84; - let _e85 = coord_3; - let _e88 = coord_3; - let _e89 = vec2(_e88); - let _e93 = textureLoad(tex1DArray, _e89.x, _e89.y, 3i); - c_1 = _e93; - let _e94 = coord_3; - let _e98 = coord_3; - let _e99 = vec2(_e98); - let _e104 = textureLoad(tex1DArray, _e99.x, _e99.y, 3i); - c_1 = _e104; + let _e21 = textureDimensions(tex1DArray, 0i); + let _e22 = textureNumLayers(tex1DArray); + size1DArray = vec2(vec2(_e21, _e22)); + let _e26 = textureNumLevels(tex1DArray); + levels_1 = i32(_e26); + let _e30 = coord_3; + let _e34 = textureSample(tex1DArray, samp, _e30.x, i32(_e30.y)); + c_1 = _e34; + let _e35 = coord_3; + let _e41 = textureSampleGrad(tex1DArray, samp, _e35.x, i32(_e35.y), 4f, 4f); + c_1 = _e41; + let _e42 = coord_3; + let _e49 = textureSampleGrad(tex1DArray, samp, _e42.x, i32(_e42.y), 4f, 4f, 5i); + c_1 = _e49; + let _e50 = coord_3; + let _e55 = textureSampleLevel(tex1DArray, samp, _e50.x, i32(_e50.y), 3f); + c_1 = _e55; + let _e56 = coord_3; + let _e62 = textureSampleLevel(tex1DArray, samp, _e56.x, i32(_e56.y), 3f, 5i); + c_1 = _e62; + let _e63 = coord_3; + let _e68 = textureSample(tex1DArray, samp, _e63.x, i32(_e63.y), 5i); + c_1 = _e68; + let _e69 = coord_3; + let _e70 = vec2(_e69); + let _e74 = textureLoad(tex1DArray, _e70.x, _e70.y, 3i); + c_1 = _e74; + let _e75 = coord_3; + let _e76 = vec2(_e75); + let _e81 = textureLoad(tex1DArray, _e76.x, _e76.y, 3i); + c_1 = _e81; return; } @@ -185,138 +169,116 @@ fn testTex2D(coord_4: vec2) { var c_2: vec4; coord_5 = coord_4; - let _e22 = textureDimensions(tex2D, 0i); - size2D = vec2(_e22); - let _e25 = textureNumLevels(tex2D); - levels_2 = i32(_e25); + let _e21 = textureDimensions(tex2D, 0i); + size2D = vec2(_e21); + let _e24 = textureNumLevels(tex2D); + levels_2 = i32(_e24); + let _e28 = coord_5; + let _e29 = textureSample(tex2D, samp, _e28); + c_2 = _e29; let _e30 = coord_5; - let _e31 = textureSample(tex2D, samp, _e30); - c_2 = _e31; - let _e34 = coord_5; - let _e36 = textureSampleBias(tex2D, samp, _e34, 2f); - c_2 = _e36; - let _e42 = coord_5; - let _e47 = textureSampleGrad(tex2D, samp, _e42, vec2(4f), vec2(4f)); - c_2 = _e47; + let _e32 = textureSampleBias(tex2D, samp, _e30, 2f); + c_2 = _e32; + let _e33 = coord_5; + let _e38 = textureSampleGrad(tex2D, samp, _e33, vec2(4f), vec2(4f)); + c_2 = _e38; + let _e39 = coord_5; + let _e46 = textureSampleGrad(tex2D, samp, _e39, vec2(4f), vec2(4f), vec2(5i)); + c_2 = _e46; + let _e47 = coord_5; + let _e49 = textureSampleLevel(tex2D, samp, _e47, 3f); + c_2 = _e49; + let _e50 = coord_5; + let _e54 = textureSampleLevel(tex2D, samp, _e50, 3f, vec2(5i)); + c_2 = _e54; let _e55 = coord_5; - let _e62 = textureSampleGrad(tex2D, samp, _e55, vec2(4f), vec2(4f), vec2(5i)); - c_2 = _e62; - let _e65 = coord_5; - let _e67 = textureSampleLevel(tex2D, samp, _e65, 3f); - c_2 = _e67; - let _e72 = coord_5; - let _e76 = textureSampleLevel(tex2D, samp, _e72, 3f, vec2(5i)); - c_2 = _e76; - let _e80 = coord_5; - let _e83 = textureSample(tex2D, samp, _e80, vec2(5i)); - c_2 = _e83; - let _e88 = coord_5; - let _e92 = textureSampleBias(tex2D, samp, _e88, 2f, vec2(5i)); - c_2 = _e92; - let _e93 = coord_5; - let _e98 = coord_5; - let _e102 = vec3(_e98.x, _e98.y, 6f); - let _e107 = textureSample(tex2D, samp, (_e102.xy / vec2(_e102.z))); - c_2 = _e107; - let _e108 = coord_5; - let _e114 = coord_5; - let _e119 = vec4(_e114.x, _e114.y, 0f, 6f); - let _e125 = textureSample(tex2D, samp, (_e119.xyz / vec3(_e119.w)).xy); - c_2 = _e125; - let _e126 = coord_5; - let _e132 = coord_5; - let _e136 = vec3(_e132.x, _e132.y, 6f); - let _e142 = textureSampleBias(tex2D, samp, (_e136.xy / vec2(_e136.z)), 2f); - c_2 = _e142; - let _e143 = coord_5; - let _e150 = coord_5; - let _e155 = vec4(_e150.x, _e150.y, 0f, 6f); - let _e162 = textureSampleBias(tex2D, samp, (_e155.xyz / vec3(_e155.w)).xy, 2f); - c_2 = _e162; - let _e163 = coord_5; - let _e172 = coord_5; - let _e176 = vec3(_e172.x, _e172.y, 6f); - let _e185 = textureSampleGrad(tex2D, samp, (_e176.xy / vec2(_e176.z)), vec2(4f), vec2(4f)); - c_2 = _e185; - let _e186 = coord_5; - let _e196 = coord_5; - let _e201 = vec4(_e196.x, _e196.y, 0f, 6f); - let _e211 = textureSampleGrad(tex2D, samp, (_e201.xyz / vec3(_e201.w)).xy, vec2(4f), vec2(4f)); - c_2 = _e211; - let _e212 = coord_5; - let _e223 = coord_5; - let _e227 = vec3(_e223.x, _e223.y, 6f); - let _e238 = textureSampleGrad(tex2D, samp, (_e227.xy / vec2(_e227.z)), vec2(4f), vec2(4f), vec2(5i)); - c_2 = _e238; - let _e239 = coord_5; - let _e251 = coord_5; - let _e256 = vec4(_e251.x, _e251.y, 0f, 6f); - let _e268 = textureSampleGrad(tex2D, samp, (_e256.xyz / vec3(_e256.w)).xy, vec2(4f), vec2(4f), vec2(5i)); - c_2 = _e268; - let _e269 = coord_5; - let _e275 = coord_5; - let _e279 = vec3(_e275.x, _e275.y, 6f); - let _e285 = textureSampleLevel(tex2D, samp, (_e279.xy / vec2(_e279.z)), 3f); - c_2 = _e285; - let _e286 = coord_5; - let _e293 = coord_5; - let _e298 = vec4(_e293.x, _e293.y, 0f, 6f); - let _e305 = textureSampleLevel(tex2D, samp, (_e298.xyz / vec3(_e298.w)).xy, 3f); - c_2 = _e305; - let _e306 = coord_5; - let _e314 = coord_5; - let _e318 = vec3(_e314.x, _e314.y, 6f); - let _e326 = textureSampleLevel(tex2D, samp, (_e318.xy / vec2(_e318.z)), 3f, vec2(5i)); - c_2 = _e326; - let _e327 = coord_5; - let _e336 = coord_5; - let _e341 = vec4(_e336.x, _e336.y, 0f, 6f); - let _e350 = textureSampleLevel(tex2D, samp, (_e341.xyz / vec3(_e341.w)).xy, 3f, vec2(5i)); - c_2 = _e350; - let _e351 = coord_5; - let _e358 = coord_5; - let _e362 = vec3(_e358.x, _e358.y, 6f); - let _e369 = textureSample(tex2D, samp, (_e362.xy / vec2(_e362.z)), vec2(5i)); - c_2 = _e369; - let _e370 = coord_5; - let _e378 = coord_5; - let _e383 = vec4(_e378.x, _e378.y, 0f, 6f); - let _e391 = textureSample(tex2D, samp, (_e383.xyz / vec3(_e383.w)).xy, vec2(5i)); - c_2 = _e391; - let _e392 = coord_5; - let _e400 = coord_5; - let _e404 = vec3(_e400.x, _e400.y, 6f); - let _e412 = textureSampleBias(tex2D, samp, (_e404.xy / vec2(_e404.z)), 2f, vec2(5i)); - c_2 = _e412; - let _e413 = coord_5; - let _e422 = coord_5; - let _e427 = vec4(_e422.x, _e422.y, 0f, 6f); - let _e436 = textureSampleBias(tex2D, samp, (_e427.xyz / vec3(_e427.w)).xy, 2f, vec2(5i)); - c_2 = _e436; - let _e437 = coord_5; - let _e440 = coord_5; - let _e443 = textureLoad(tex2D, vec2(_e440), 3i); - c_2 = _e443; - let _e444 = coord_5; - let _e447 = coord_5; - let _e450 = textureLoad(utex2D, vec2(_e447), 3i); - c_2 = vec4(_e450); - let _e452 = coord_5; - let _e455 = coord_5; - let _e458 = textureLoad(itex2D, vec2(_e455), 3i); - c_2 = vec4(_e458); - let _e460 = coord_5; - let _e465 = coord_5; - let _e470 = textureLoad(tex2D, vec2(_e465), 3i); - c_2 = _e470; - let _e471 = coord_5; - let _e476 = coord_5; - let _e481 = textureLoad(utex2D, vec2(_e476), 3i); - c_2 = vec4(_e481); - let _e483 = coord_5; - let _e488 = coord_5; - let _e493 = textureLoad(itex2D, vec2(_e488), 3i); - c_2 = vec4(_e493); + let _e58 = textureSample(tex2D, samp, _e55, vec2(5i)); + c_2 = _e58; + let _e59 = coord_5; + let _e63 = textureSampleBias(tex2D, samp, _e59, 2f, vec2(5i)); + c_2 = _e63; + let _e64 = coord_5; + let _e68 = vec3(_e64.x, _e64.y, 6f); + let _e73 = textureSample(tex2D, samp, (_e68.xy / vec2(_e68.z))); + c_2 = _e73; + let _e74 = coord_5; + let _e79 = vec4(_e74.x, _e74.y, 0f, 6f); + let _e85 = textureSample(tex2D, samp, (_e79.xyz / vec3(_e79.w)).xy); + c_2 = _e85; + let _e86 = coord_5; + let _e90 = vec3(_e86.x, _e86.y, 6f); + let _e96 = textureSampleBias(tex2D, samp, (_e90.xy / vec2(_e90.z)), 2f); + c_2 = _e96; + let _e97 = coord_5; + let _e102 = vec4(_e97.x, _e97.y, 0f, 6f); + let _e109 = textureSampleBias(tex2D, samp, (_e102.xyz / vec3(_e102.w)).xy, 2f); + c_2 = _e109; + let _e110 = coord_5; + let _e114 = vec3(_e110.x, _e110.y, 6f); + let _e123 = textureSampleGrad(tex2D, samp, (_e114.xy / vec2(_e114.z)), vec2(4f), vec2(4f)); + c_2 = _e123; + let _e124 = coord_5; + let _e129 = vec4(_e124.x, _e124.y, 0f, 6f); + let _e139 = textureSampleGrad(tex2D, samp, (_e129.xyz / vec3(_e129.w)).xy, vec2(4f), vec2(4f)); + c_2 = _e139; + let _e140 = coord_5; + let _e144 = vec3(_e140.x, _e140.y, 6f); + let _e155 = textureSampleGrad(tex2D, samp, (_e144.xy / vec2(_e144.z)), vec2(4f), vec2(4f), vec2(5i)); + c_2 = _e155; + let _e156 = coord_5; + let _e161 = vec4(_e156.x, _e156.y, 0f, 6f); + let _e173 = textureSampleGrad(tex2D, samp, (_e161.xyz / vec3(_e161.w)).xy, vec2(4f), vec2(4f), vec2(5i)); + c_2 = _e173; + let _e174 = coord_5; + let _e178 = vec3(_e174.x, _e174.y, 6f); + let _e184 = textureSampleLevel(tex2D, samp, (_e178.xy / vec2(_e178.z)), 3f); + c_2 = _e184; + let _e185 = coord_5; + let _e190 = vec4(_e185.x, _e185.y, 0f, 6f); + let _e197 = textureSampleLevel(tex2D, samp, (_e190.xyz / vec3(_e190.w)).xy, 3f); + c_2 = _e197; + let _e198 = coord_5; + let _e202 = vec3(_e198.x, _e198.y, 6f); + let _e210 = textureSampleLevel(tex2D, samp, (_e202.xy / vec2(_e202.z)), 3f, vec2(5i)); + c_2 = _e210; + let _e211 = coord_5; + let _e216 = vec4(_e211.x, _e211.y, 0f, 6f); + let _e225 = textureSampleLevel(tex2D, samp, (_e216.xyz / vec3(_e216.w)).xy, 3f, vec2(5i)); + c_2 = _e225; + let _e226 = coord_5; + let _e230 = vec3(_e226.x, _e226.y, 6f); + let _e237 = textureSample(tex2D, samp, (_e230.xy / vec2(_e230.z)), vec2(5i)); + c_2 = _e237; + let _e238 = coord_5; + let _e243 = vec4(_e238.x, _e238.y, 0f, 6f); + let _e251 = textureSample(tex2D, samp, (_e243.xyz / vec3(_e243.w)).xy, vec2(5i)); + c_2 = _e251; + let _e252 = coord_5; + let _e256 = vec3(_e252.x, _e252.y, 6f); + let _e264 = textureSampleBias(tex2D, samp, (_e256.xy / vec2(_e256.z)), 2f, vec2(5i)); + c_2 = _e264; + let _e265 = coord_5; + let _e270 = vec4(_e265.x, _e265.y, 0f, 6f); + let _e279 = textureSampleBias(tex2D, samp, (_e270.xyz / vec3(_e270.w)).xy, 2f, vec2(5i)); + c_2 = _e279; + let _e280 = coord_5; + let _e283 = textureLoad(tex2D, vec2(_e280), 3i); + c_2 = _e283; + let _e284 = coord_5; + let _e287 = textureLoad(utex2D, vec2(_e284), 3i); + c_2 = vec4(_e287); + let _e289 = coord_5; + let _e292 = textureLoad(itex2D, vec2(_e289), 3i); + c_2 = vec4(_e292); + let _e294 = coord_5; + let _e299 = textureLoad(tex2D, vec2(_e294), 3i); + c_2 = _e299; + let _e300 = coord_5; + let _e305 = textureLoad(utex2D, vec2(_e300), 3i); + c_2 = vec4(_e305); + let _e307 = coord_5; + let _e312 = textureLoad(itex2D, vec2(_e307), 3i); + c_2 = vec4(_e312); return; } @@ -327,76 +289,64 @@ fn testTex2DShadow(coord_6: vec2) { var d: f32; coord_7 = coord_6; - let _e22 = textureDimensions(tex2DShadow, 0i); - size2DShadow = vec2(_e22); - let _e25 = textureNumLevels(tex2DShadow); - levels_3 = i32(_e25); - let _e29 = coord_7; - let _e34 = coord_7; - let _e38 = vec3(_e34.x, _e34.y, 1f); - let _e41 = textureSampleCompare(tex2DShadow, sampShadow, _e38.xy, _e38.z); - d = _e41; - let _e42 = coord_7; - let _e51 = coord_7; - let _e55 = vec3(_e51.x, _e51.y, 1f); - let _e62 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e55.xy, _e55.z); - d = _e62; - let _e63 = coord_7; - let _e74 = coord_7; - let _e78 = vec3(_e74.x, _e74.y, 1f); - let _e87 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e78.xy, _e78.z, vec2(5i)); - d = _e87; - let _e88 = coord_7; - let _e94 = coord_7; - let _e98 = vec3(_e94.x, _e94.y, 1f); - let _e102 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e98.xy, _e98.z); - d = _e102; - let _e103 = coord_7; - let _e111 = coord_7; - let _e115 = vec3(_e111.x, _e111.y, 1f); - let _e121 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e115.xy, _e115.z, vec2(5i)); + let _e21 = textureDimensions(tex2DShadow, 0i); + size2DShadow = vec2(_e21); + let _e24 = textureNumLevels(tex2DShadow); + levels_3 = i32(_e24); + let _e28 = coord_7; + let _e32 = vec3(_e28.x, _e28.y, 1f); + let _e35 = textureSampleCompare(tex2DShadow, sampShadow, _e32.xy, _e32.z); + d = _e35; + let _e36 = coord_7; + let _e40 = vec3(_e36.x, _e36.y, 1f); + let _e47 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e40.xy, _e40.z); + d = _e47; + let _e48 = coord_7; + let _e52 = vec3(_e48.x, _e48.y, 1f); + let _e61 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e52.xy, _e52.z, vec2(5i)); + d = _e61; + let _e62 = coord_7; + let _e66 = vec3(_e62.x, _e62.y, 1f); + let _e70 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e66.xy, _e66.z); + d = _e70; + let _e71 = coord_7; + let _e75 = vec3(_e71.x, _e71.y, 1f); + let _e81 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e75.xy, _e75.z, vec2(5i)); + d = _e81; + let _e82 = coord_7; + let _e86 = vec3(_e82.x, _e82.y, 1f); + let _e91 = textureSampleCompare(tex2DShadow, sampShadow, _e86.xy, _e86.z, vec2(5i)); + d = _e91; + let _e92 = coord_7; + let _e97 = vec4(_e92.x, _e92.y, 1f, 6f); + let _e101 = (_e97.xyz / vec3(_e97.w)); + let _e104 = textureSampleCompare(tex2DShadow, sampShadow, _e101.xy, _e101.z); + d = _e104; + let _e105 = coord_7; + let _e110 = vec4(_e105.x, _e105.y, 1f, 6f); + let _e118 = (_e110.xyz / vec3(_e110.w)); + let _e121 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e118.xy, _e118.z); d = _e121; let _e122 = coord_7; - let _e129 = coord_7; - let _e133 = vec3(_e129.x, _e129.y, 1f); - let _e138 = textureSampleCompare(tex2DShadow, sampShadow, _e133.xy, _e133.z, vec2(5i)); - d = _e138; - let _e139 = coord_7; - let _e145 = coord_7; - let _e150 = vec4(_e145.x, _e145.y, 1f, 6f); - let _e154 = (_e150.xyz / vec3(_e150.w)); - let _e157 = textureSampleCompare(tex2DShadow, sampShadow, _e154.xy, _e154.z); - d = _e157; - let _e158 = coord_7; - let _e168 = coord_7; - let _e173 = vec4(_e168.x, _e168.y, 1f, 6f); - let _e181 = (_e173.xyz / vec3(_e173.w)); - let _e184 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e181.xy, _e181.z); - d = _e184; - let _e185 = coord_7; - let _e197 = coord_7; - let _e202 = vec4(_e197.x, _e197.y, 1f, 6f); - let _e212 = (_e202.xyz / vec3(_e202.w)); - let _e215 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e212.xy, _e212.z, vec2(5i)); - d = _e215; - let _e216 = coord_7; - let _e223 = coord_7; - let _e228 = vec4(_e223.x, _e223.y, 1f, 6f); - let _e233 = (_e228.xyz / vec3(_e228.w)); - let _e236 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e233.xy, _e233.z); - d = _e236; - let _e237 = coord_7; - let _e246 = coord_7; - let _e251 = vec4(_e246.x, _e246.y, 1f, 6f); - let _e258 = (_e251.xyz / vec3(_e251.w)); - let _e261 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e258.xy, _e258.z, vec2(5i)); - d = _e261; - let _e262 = coord_7; - let _e270 = coord_7; - let _e275 = vec4(_e270.x, _e270.y, 1f, 6f); - let _e281 = (_e275.xyz / vec3(_e275.w)); - let _e284 = textureSampleCompare(tex2DShadow, sampShadow, _e281.xy, _e281.z, vec2(5i)); - d = _e284; + let _e127 = vec4(_e122.x, _e122.y, 1f, 6f); + let _e137 = (_e127.xyz / vec3(_e127.w)); + let _e140 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e137.xy, _e137.z, vec2(5i)); + d = _e140; + let _e141 = coord_7; + let _e146 = vec4(_e141.x, _e141.y, 1f, 6f); + let _e151 = (_e146.xyz / vec3(_e146.w)); + let _e154 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e151.xy, _e151.z); + d = _e154; + let _e155 = coord_7; + let _e160 = vec4(_e155.x, _e155.y, 1f, 6f); + let _e167 = (_e160.xyz / vec3(_e160.w)); + let _e170 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e167.xy, _e167.z, vec2(5i)); + d = _e170; + let _e171 = coord_7; + let _e176 = vec4(_e171.x, _e171.y, 1f, 6f); + let _e182 = (_e176.xyz / vec3(_e176.w)); + let _e185 = textureSampleCompare(tex2DShadow, sampShadow, _e182.xy, _e182.z, vec2(5i)); + d = _e185; return; } @@ -407,45 +357,43 @@ fn testTex2DArray(coord_8: vec3) { var c_3: vec4; coord_9 = coord_8; - let _e22 = textureDimensions(tex2DArray, 0i); - let _e25 = textureNumLayers(tex2DArray); - size2DArray = vec3(vec3(_e22.x, _e22.y, _e25)); - let _e29 = textureNumLevels(tex2DArray); - levels_4 = i32(_e29); - let _e34 = coord_9; - let _e38 = textureSample(tex2DArray, samp, _e34.xy, i32(_e34.z)); - c_3 = _e38; - let _e41 = coord_9; - let _e46 = textureSampleBias(tex2DArray, samp, _e41.xy, i32(_e41.z), 2f); - c_3 = _e46; + let _e21 = textureDimensions(tex2DArray, 0i); + let _e24 = textureNumLayers(tex2DArray); + size2DArray = vec3(vec3(_e21.x, _e21.y, _e24)); + let _e28 = textureNumLevels(tex2DArray); + levels_4 = i32(_e28); + let _e32 = coord_9; + let _e36 = textureSample(tex2DArray, samp, _e32.xy, i32(_e32.z)); + c_3 = _e36; + let _e37 = coord_9; + let _e42 = textureSampleBias(tex2DArray, samp, _e37.xy, i32(_e37.z), 2f); + c_3 = _e42; + let _e43 = coord_9; + let _e51 = textureSampleGrad(tex2DArray, samp, _e43.xy, i32(_e43.z), vec2(4f), vec2(4f)); + c_3 = _e51; let _e52 = coord_9; - let _e60 = textureSampleGrad(tex2DArray, samp, _e52.xy, i32(_e52.z), vec2(4f), vec2(4f)); - c_3 = _e60; - let _e68 = coord_9; - let _e78 = textureSampleGrad(tex2DArray, samp, _e68.xy, i32(_e68.z), vec2(4f), vec2(4f), vec2(5i)); - c_3 = _e78; - let _e81 = coord_9; - let _e86 = textureSampleLevel(tex2DArray, samp, _e81.xy, i32(_e81.z), 3f); - c_3 = _e86; - let _e91 = coord_9; - let _e98 = textureSampleLevel(tex2DArray, samp, _e91.xy, i32(_e91.z), 3f, vec2(5i)); - c_3 = _e98; - let _e102 = coord_9; - let _e108 = textureSample(tex2DArray, samp, _e102.xy, i32(_e102.z), vec2(5i)); - c_3 = _e108; - let _e113 = coord_9; - let _e120 = textureSampleBias(tex2DArray, samp, _e113.xy, i32(_e113.z), 2f, vec2(5i)); - c_3 = _e120; - let _e121 = coord_9; - let _e124 = coord_9; - let _e125 = vec3(_e124); - let _e129 = textureLoad(tex2DArray, _e125.xy, _e125.z, 3i); - c_3 = _e129; - let _e130 = coord_9; - let _e135 = coord_9; - let _e136 = vec3(_e135); - let _e142 = textureLoad(tex2DArray, _e136.xy, _e136.z, 3i); - c_3 = _e142; + let _e62 = textureSampleGrad(tex2DArray, samp, _e52.xy, i32(_e52.z), vec2(4f), vec2(4f), vec2(5i)); + c_3 = _e62; + let _e63 = coord_9; + let _e68 = textureSampleLevel(tex2DArray, samp, _e63.xy, i32(_e63.z), 3f); + c_3 = _e68; + let _e69 = coord_9; + let _e76 = textureSampleLevel(tex2DArray, samp, _e69.xy, i32(_e69.z), 3f, vec2(5i)); + c_3 = _e76; + let _e77 = coord_9; + let _e83 = textureSample(tex2DArray, samp, _e77.xy, i32(_e77.z), vec2(5i)); + c_3 = _e83; + let _e84 = coord_9; + let _e91 = textureSampleBias(tex2DArray, samp, _e84.xy, i32(_e84.z), 2f, vec2(5i)); + c_3 = _e91; + let _e92 = coord_9; + let _e93 = vec3(_e92); + let _e97 = textureLoad(tex2DArray, _e93.xy, _e93.z, 3i); + c_3 = _e97; + let _e98 = coord_9; + let _e99 = vec3(_e98); + let _e105 = textureLoad(tex2DArray, _e99.xy, _e99.z, 3i); + c_3 = _e105; return; } @@ -456,31 +404,27 @@ fn testTex2DArrayShadow(coord_10: vec3) { var d_1: f32; coord_11 = coord_10; - let _e22 = textureDimensions(tex2DArrayShadow, 0i); - let _e25 = textureNumLayers(tex2DArrayShadow); - size2DArrayShadow = vec3(vec3(_e22.x, _e22.y, _e25)); - let _e29 = textureNumLevels(tex2DArrayShadow); - levels_5 = i32(_e29); - let _e33 = coord_11; - let _e39 = coord_11; - let _e44 = vec4(_e39.x, _e39.y, _e39.z, 1f); - let _e49 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e44.xy, i32(_e44.z), _e44.w); - d_1 = _e49; - let _e50 = coord_11; - let _e60 = coord_11; - let _e65 = vec4(_e60.x, _e60.y, _e60.z, 1f); - let _e74 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e65.xy, i32(_e65.z), _e65.w); + let _e21 = textureDimensions(tex2DArrayShadow, 0i); + let _e24 = textureNumLayers(tex2DArrayShadow); + size2DArrayShadow = vec3(vec3(_e21.x, _e21.y, _e24)); + let _e28 = textureNumLevels(tex2DArrayShadow); + levels_5 = i32(_e28); + let _e32 = coord_11; + let _e37 = vec4(_e32.x, _e32.y, _e32.z, 1f); + let _e42 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e37.xy, i32(_e37.z), _e37.w); + d_1 = _e42; + let _e43 = coord_11; + let _e48 = vec4(_e43.x, _e43.y, _e43.z, 1f); + let _e57 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e48.xy, i32(_e48.z), _e48.w); + d_1 = _e57; + let _e58 = coord_11; + let _e63 = vec4(_e58.x, _e58.y, _e58.z, 1f); + let _e74 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e63.xy, i32(_e63.z), _e63.w, vec2(5i)); d_1 = _e74; let _e75 = coord_11; - let _e87 = coord_11; - let _e92 = vec4(_e87.x, _e87.y, _e87.z, 1f); - let _e103 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e92.xy, i32(_e92.z), _e92.w, vec2(5i)); - d_1 = _e103; - let _e104 = coord_11; - let _e112 = coord_11; - let _e117 = vec4(_e112.x, _e112.y, _e112.z, 1f); - let _e124 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e117.xy, i32(_e117.z), _e117.w, vec2(5i)); - d_1 = _e124; + let _e80 = vec4(_e75.x, _e75.y, _e75.z, 1f); + let _e87 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e80.xy, i32(_e80.z), _e80.w, vec2(5i)); + d_1 = _e87; return; } @@ -491,22 +435,22 @@ fn testTexCube(coord_12: vec3) { var c_4: vec4; coord_13 = coord_12; - let _e22 = textureDimensions(texCube, 0i); - sizeCube = vec2(_e22); - let _e25 = textureNumLevels(texCube); - levels_6 = i32(_e25); + let _e21 = textureDimensions(texCube, 0i); + sizeCube = vec2(_e21); + let _e24 = textureNumLevels(texCube); + levels_6 = i32(_e24); + let _e28 = coord_13; + let _e29 = textureSample(texCube, samp, _e28); + c_4 = _e29; let _e30 = coord_13; - let _e31 = textureSample(texCube, samp, _e30); - c_4 = _e31; - let _e34 = coord_13; - let _e36 = textureSampleBias(texCube, samp, _e34, 2f); - c_4 = _e36; - let _e42 = coord_13; - let _e47 = textureSampleGrad(texCube, samp, _e42, vec3(4f), vec3(4f)); - c_4 = _e47; - let _e50 = coord_13; - let _e52 = textureSampleLevel(texCube, samp, _e50, 3f); - c_4 = _e52; + let _e32 = textureSampleBias(texCube, samp, _e30, 2f); + c_4 = _e32; + let _e33 = coord_13; + let _e38 = textureSampleGrad(texCube, samp, _e33, vec3(4f), vec3(4f)); + c_4 = _e38; + let _e39 = coord_13; + let _e41 = textureSampleLevel(texCube, samp, _e39, 3f); + c_4 = _e41; return; } @@ -517,20 +461,18 @@ fn testTexCubeShadow(coord_14: vec3) { var d_2: f32; coord_15 = coord_14; - let _e22 = textureDimensions(texCubeShadow, 0i); - sizeCubeShadow = vec2(_e22); - let _e25 = textureNumLevels(texCubeShadow); - levels_7 = i32(_e25); - let _e29 = coord_15; - let _e35 = coord_15; - let _e40 = vec4(_e35.x, _e35.y, _e35.z, 1f); - let _e43 = textureSampleCompare(texCubeShadow, sampShadow, _e40.xyz, _e40.w); - d_2 = _e43; - let _e44 = coord_15; - let _e54 = coord_15; - let _e59 = vec4(_e54.x, _e54.y, _e54.z, 1f); - let _e66 = textureSampleCompareLevel(texCubeShadow, sampShadow, _e59.xyz, _e59.w); - d_2 = _e66; + let _e21 = textureDimensions(texCubeShadow, 0i); + sizeCubeShadow = vec2(_e21); + let _e24 = textureNumLevels(texCubeShadow); + levels_7 = i32(_e24); + let _e28 = coord_15; + let _e33 = vec4(_e28.x, _e28.y, _e28.z, 1f); + let _e36 = textureSampleCompare(texCubeShadow, sampShadow, _e33.xyz, _e33.w); + d_2 = _e36; + let _e37 = coord_15; + let _e42 = vec4(_e37.x, _e37.y, _e37.z, 1f); + let _e49 = textureSampleCompareLevel(texCubeShadow, sampShadow, _e42.xyz, _e42.w); + d_2 = _e49; return; } @@ -541,23 +483,23 @@ fn testTexCubeArray(coord_16: vec4) { var c_5: vec4; coord_17 = coord_16; - let _e22 = textureDimensions(texCubeArray, 0i); - let _e25 = textureNumLayers(texCubeArray); - sizeCubeArray = vec3(vec3(_e22.x, _e22.y, _e25)); - let _e29 = textureNumLevels(texCubeArray); - levels_8 = i32(_e29); - let _e34 = coord_17; - let _e38 = textureSample(texCubeArray, samp, _e34.xyz, i32(_e34.w)); - c_5 = _e38; - let _e41 = coord_17; - let _e46 = textureSampleBias(texCubeArray, samp, _e41.xyz, i32(_e41.w), 2f); - c_5 = _e46; + let _e21 = textureDimensions(texCubeArray, 0i); + let _e24 = textureNumLayers(texCubeArray); + sizeCubeArray = vec3(vec3(_e21.x, _e21.y, _e24)); + let _e28 = textureNumLevels(texCubeArray); + levels_8 = i32(_e28); + let _e32 = coord_17; + let _e36 = textureSample(texCubeArray, samp, _e32.xyz, i32(_e32.w)); + c_5 = _e36; + let _e37 = coord_17; + let _e42 = textureSampleBias(texCubeArray, samp, _e37.xyz, i32(_e37.w), 2f); + c_5 = _e42; + let _e43 = coord_17; + let _e51 = textureSampleGrad(texCubeArray, samp, _e43.xyz, i32(_e43.w), vec3(4f), vec3(4f)); + c_5 = _e51; let _e52 = coord_17; - let _e60 = textureSampleGrad(texCubeArray, samp, _e52.xyz, i32(_e52.w), vec3(4f), vec3(4f)); - c_5 = _e60; - let _e63 = coord_17; - let _e68 = textureSampleLevel(texCubeArray, samp, _e63.xyz, i32(_e63.w), 3f); - c_5 = _e68; + let _e57 = textureSampleLevel(texCubeArray, samp, _e52.xyz, i32(_e52.w), 3f); + c_5 = _e57; return; } @@ -568,14 +510,14 @@ fn testTexCubeArrayShadow(coord_18: vec4) { var d_3: f32; coord_19 = coord_18; - let _e22 = textureDimensions(texCubeArrayShadow, 0i); - let _e25 = textureNumLayers(texCubeArrayShadow); - sizeCubeArrayShadow = vec3(vec3(_e22.x, _e22.y, _e25)); - let _e29 = textureNumLevels(texCubeArrayShadow); - levels_9 = i32(_e29); - let _e35 = coord_19; - let _e40 = textureSampleCompare(texCubeArrayShadow, sampShadow, _e35.xyz, i32(_e35.w), 1f); - d_3 = _e40; + let _e21 = textureDimensions(texCubeArrayShadow, 0i); + let _e24 = textureNumLayers(texCubeArrayShadow); + sizeCubeArrayShadow = vec3(vec3(_e21.x, _e21.y, _e24)); + let _e28 = textureNumLevels(texCubeArrayShadow); + levels_9 = i32(_e28); + let _e32 = coord_19; + let _e37 = textureSampleCompare(texCubeArrayShadow, sampShadow, _e32.xyz, i32(_e32.w), 1f); + d_3 = _e37; return; } @@ -586,82 +528,72 @@ fn testTex3D(coord_20: vec3) { var c_6: vec4; coord_21 = coord_20; - let _e22 = textureDimensions(tex3D, 0i); - size3D = vec3(_e22); - let _e25 = textureNumLevels(tex3D); - levels_10 = i32(_e25); + let _e21 = textureDimensions(tex3D, 0i); + size3D = vec3(_e21); + let _e24 = textureNumLevels(tex3D); + levels_10 = i32(_e24); + let _e28 = coord_21; + let _e29 = textureSample(tex3D, samp, _e28); + c_6 = _e29; let _e30 = coord_21; - let _e31 = textureSample(tex3D, samp, _e30); - c_6 = _e31; - let _e34 = coord_21; - let _e36 = textureSampleBias(tex3D, samp, _e34, 2f); - c_6 = _e36; - let _e37 = coord_21; - let _e43 = coord_21; - let _e48 = vec4(_e43.x, _e43.y, _e43.z, 6f); - let _e53 = textureSample(tex3D, samp, (_e48.xyz / vec3(_e48.w))); - c_6 = _e53; - let _e54 = coord_21; - let _e61 = coord_21; - let _e66 = vec4(_e61.x, _e61.y, _e61.z, 6f); - let _e72 = textureSampleBias(tex3D, samp, (_e66.xyz / vec3(_e66.w)), 2f); - c_6 = _e72; - let _e73 = coord_21; - let _e81 = coord_21; - let _e86 = vec4(_e81.x, _e81.y, _e81.z, 6f); - let _e93 = textureSample(tex3D, samp, (_e86.xyz / vec3(_e86.w)), vec3(5i)); - c_6 = _e93; - let _e94 = coord_21; - let _e103 = coord_21; - let _e108 = vec4(_e103.x, _e103.y, _e103.z, 6f); - let _e116 = textureSampleBias(tex3D, samp, (_e108.xyz / vec3(_e108.w)), 2f, vec3(5i)); - c_6 = _e116; - let _e117 = coord_21; + let _e32 = textureSampleBias(tex3D, samp, _e30, 2f); + c_6 = _e32; + let _e33 = coord_21; + let _e38 = vec4(_e33.x, _e33.y, _e33.z, 6f); + let _e43 = textureSample(tex3D, samp, (_e38.xyz / vec3(_e38.w))); + c_6 = _e43; + let _e44 = coord_21; + let _e49 = vec4(_e44.x, _e44.y, _e44.z, 6f); + let _e55 = textureSampleBias(tex3D, samp, (_e49.xyz / vec3(_e49.w)), 2f); + c_6 = _e55; + let _e56 = coord_21; + let _e61 = vec4(_e56.x, _e56.y, _e56.z, 6f); + let _e68 = textureSample(tex3D, samp, (_e61.xyz / vec3(_e61.w)), vec3(5i)); + c_6 = _e68; + let _e69 = coord_21; + let _e74 = vec4(_e69.x, _e69.y, _e69.z, 6f); + let _e82 = textureSampleBias(tex3D, samp, (_e74.xyz / vec3(_e74.w)), 2f, vec3(5i)); + c_6 = _e82; + let _e83 = coord_21; + let _e88 = vec4(_e83.x, _e83.y, _e83.z, 6f); + let _e94 = textureSampleLevel(tex3D, samp, (_e88.xyz / vec3(_e88.w)), 3f); + c_6 = _e94; + let _e95 = coord_21; + let _e100 = vec4(_e95.x, _e95.y, _e95.z, 6f); + let _e108 = textureSampleLevel(tex3D, samp, (_e100.xyz / vec3(_e100.w)), 3f, vec3(5i)); + c_6 = _e108; + let _e109 = coord_21; + let _e114 = vec4(_e109.x, _e109.y, _e109.z, 6f); + let _e123 = textureSampleGrad(tex3D, samp, (_e114.xyz / vec3(_e114.w)), vec3(4f), vec3(4f)); + c_6 = _e123; let _e124 = coord_21; let _e129 = vec4(_e124.x, _e124.y, _e124.z, 6f); - let _e135 = textureSampleLevel(tex3D, samp, (_e129.xyz / vec3(_e129.w)), 3f); - c_6 = _e135; - let _e136 = coord_21; - let _e145 = coord_21; - let _e150 = vec4(_e145.x, _e145.y, _e145.z, 6f); - let _e158 = textureSampleLevel(tex3D, samp, (_e150.xyz / vec3(_e150.w)), 3f, vec3(5i)); - c_6 = _e158; - let _e159 = coord_21; - let _e169 = coord_21; - let _e174 = vec4(_e169.x, _e169.y, _e169.z, 6f); - let _e183 = textureSampleGrad(tex3D, samp, (_e174.xyz / vec3(_e174.w)), vec3(4f), vec3(4f)); - c_6 = _e183; - let _e184 = coord_21; - let _e196 = coord_21; - let _e201 = vec4(_e196.x, _e196.y, _e196.z, 6f); - let _e212 = textureSampleGrad(tex3D, samp, (_e201.xyz / vec3(_e201.w)), vec3(4f), vec3(4f), vec3(5i)); - c_6 = _e212; - let _e218 = coord_21; - let _e223 = textureSampleGrad(tex3D, samp, _e218, vec3(4f), vec3(4f)); - c_6 = _e223; - let _e231 = coord_21; - let _e238 = textureSampleGrad(tex3D, samp, _e231, vec3(4f), vec3(4f), vec3(5i)); - c_6 = _e238; - let _e241 = coord_21; - let _e243 = textureSampleLevel(tex3D, samp, _e241, 3f); - c_6 = _e243; - let _e248 = coord_21; - let _e252 = textureSampleLevel(tex3D, samp, _e248, 3f, vec3(5i)); - c_6 = _e252; - let _e256 = coord_21; - let _e259 = textureSample(tex3D, samp, _e256, vec3(5i)); - c_6 = _e259; - let _e264 = coord_21; - let _e268 = textureSampleBias(tex3D, samp, _e264, 2f, vec3(5i)); - c_6 = _e268; - let _e269 = coord_21; - let _e272 = coord_21; - let _e275 = textureLoad(tex3D, vec3(_e272), 3i); - c_6 = _e275; - let _e276 = coord_21; - let _e281 = coord_21; - let _e286 = textureLoad(tex3D, vec3(_e281), 3i); - c_6 = _e286; + let _e140 = textureSampleGrad(tex3D, samp, (_e129.xyz / vec3(_e129.w)), vec3(4f), vec3(4f), vec3(5i)); + c_6 = _e140; + let _e141 = coord_21; + let _e146 = textureSampleGrad(tex3D, samp, _e141, vec3(4f), vec3(4f)); + c_6 = _e146; + let _e147 = coord_21; + let _e154 = textureSampleGrad(tex3D, samp, _e147, vec3(4f), vec3(4f), vec3(5i)); + c_6 = _e154; + let _e155 = coord_21; + let _e157 = textureSampleLevel(tex3D, samp, _e155, 3f); + c_6 = _e157; + let _e158 = coord_21; + let _e162 = textureSampleLevel(tex3D, samp, _e158, 3f, vec3(5i)); + c_6 = _e162; + let _e163 = coord_21; + let _e166 = textureSample(tex3D, samp, _e163, vec3(5i)); + c_6 = _e166; + let _e167 = coord_21; + let _e171 = textureSampleBias(tex3D, samp, _e167, 2f, vec3(5i)); + c_6 = _e171; + let _e172 = coord_21; + let _e175 = textureLoad(tex3D, vec3(_e172), 3i); + c_6 = _e175; + let _e176 = coord_21; + let _e181 = textureLoad(tex3D, vec3(_e176), 3i); + c_6 = _e181; return; } @@ -674,9 +606,8 @@ fn testTex2DMS(coord_22: vec2) { let _e20 = textureDimensions(tex2DMS); size2DMS = vec2(_e20); let _e24 = coord_23; - let _e27 = coord_23; - let _e30 = textureLoad(tex2DMS, vec2(_e27), 3i); - c_7 = _e30; + let _e27 = textureLoad(tex2DMS, vec2(_e24), 3i); + c_7 = _e27; return; } @@ -690,10 +621,9 @@ fn testTex2DMSArray(coord_24: vec3) { let _e23 = textureNumLayers(tex2DMSArray); size2DMSArray = vec3(vec3(_e20.x, _e20.y, _e23)); let _e28 = coord_25; - let _e31 = coord_25; - let _e32 = vec3(_e31); - let _e36 = textureLoad(tex2DMSArray, _e32.xy, _e32.z, 3i); - c_8 = _e36; + let _e29 = vec3(_e28); + let _e33 = textureLoad(tex2DMSArray, _e29.xy, _e29.z, 3i); + c_8 = _e33; return; } diff --git a/naga/tests/out/wgsl/vector-functions.frag.wgsl b/naga/tests/out/wgsl/vector-functions.frag.wgsl index 90b35f3837..0f28a40c87 100644 --- a/naga/tests/out/wgsl/vector-functions.frag.wgsl +++ b/naga/tests/out/wgsl/vector-functions.frag.wgsl @@ -10,24 +10,24 @@ fn ftest(a: vec4, b: vec4) { a_1 = a; b_1 = b; - let _e6 = a_1; - let _e7 = b_1; - c = (_e6 < _e7); + let _e4 = a_1; + let _e5 = b_1; + c = (_e4 < _e5); + let _e8 = a_1; + let _e9 = b_1; + d = (_e8 <= _e9); let _e12 = a_1; let _e13 = b_1; - d = (_e12 <= _e13); - let _e18 = a_1; - let _e19 = b_1; - e = (_e18 > _e19); + e = (_e12 > _e13); + let _e16 = a_1; + let _e17 = b_1; + f = (_e16 >= _e17); + let _e20 = a_1; + let _e21 = b_1; + g = (_e20 == _e21); let _e24 = a_1; let _e25 = b_1; - f = (_e24 >= _e25); - let _e30 = a_1; - let _e31 = b_1; - g = (_e30 == _e31); - let _e36 = a_1; - let _e37 = b_1; - h = (_e36 != _e37); + h = (_e24 != _e25); return; } @@ -43,24 +43,24 @@ fn dtest(a_2: vec4, b_2: vec4) { a_3 = a_2; b_3 = b_2; - let _e6 = a_3; - let _e7 = b_3; - c_1 = (_e6 < _e7); + let _e4 = a_3; + let _e5 = b_3; + c_1 = (_e4 < _e5); + let _e8 = a_3; + let _e9 = b_3; + d_1 = (_e8 <= _e9); let _e12 = a_3; let _e13 = b_3; - d_1 = (_e12 <= _e13); - let _e18 = a_3; - let _e19 = b_3; - e_1 = (_e18 > _e19); + e_1 = (_e12 > _e13); + let _e16 = a_3; + let _e17 = b_3; + f_1 = (_e16 >= _e17); + let _e20 = a_3; + let _e21 = b_3; + g_1 = (_e20 == _e21); let _e24 = a_3; let _e25 = b_3; - f_1 = (_e24 >= _e25); - let _e30 = a_3; - let _e31 = b_3; - g_1 = (_e30 == _e31); - let _e36 = a_3; - let _e37 = b_3; - h_1 = (_e36 != _e37); + h_1 = (_e24 != _e25); return; } @@ -76,24 +76,24 @@ fn itest(a_4: vec4, b_4: vec4) { a_5 = a_4; b_5 = b_4; - let _e6 = a_5; - let _e7 = b_5; - c_2 = (_e6 < _e7); + let _e4 = a_5; + let _e5 = b_5; + c_2 = (_e4 < _e5); + let _e8 = a_5; + let _e9 = b_5; + d_2 = (_e8 <= _e9); let _e12 = a_5; let _e13 = b_5; - d_2 = (_e12 <= _e13); - let _e18 = a_5; - let _e19 = b_5; - e_2 = (_e18 > _e19); + e_2 = (_e12 > _e13); + let _e16 = a_5; + let _e17 = b_5; + f_2 = (_e16 >= _e17); + let _e20 = a_5; + let _e21 = b_5; + g_2 = (_e20 == _e21); let _e24 = a_5; let _e25 = b_5; - f_2 = (_e24 >= _e25); - let _e30 = a_5; - let _e31 = b_5; - g_2 = (_e30 == _e31); - let _e36 = a_5; - let _e37 = b_5; - h_2 = (_e36 != _e37); + h_2 = (_e24 != _e25); return; } @@ -109,24 +109,24 @@ fn utest(a_6: vec4, b_6: vec4) { a_7 = a_6; b_7 = b_6; - let _e6 = a_7; - let _e7 = b_7; - c_3 = (_e6 < _e7); + let _e4 = a_7; + let _e5 = b_7; + c_3 = (_e4 < _e5); + let _e8 = a_7; + let _e9 = b_7; + d_3 = (_e8 <= _e9); let _e12 = a_7; let _e13 = b_7; - d_3 = (_e12 <= _e13); - let _e18 = a_7; - let _e19 = b_7; - e_3 = (_e18 > _e19); + e_3 = (_e12 > _e13); + let _e16 = a_7; + let _e17 = b_7; + f_3 = (_e16 >= _e17); + let _e20 = a_7; + let _e21 = b_7; + g_3 = (_e20 == _e21); let _e24 = a_7; let _e25 = b_7; - f_3 = (_e24 >= _e25); - let _e30 = a_7; - let _e31 = b_7; - g_3 = (_e30 == _e31); - let _e36 = a_7; - let _e37 = b_7; - h_3 = (_e36 != _e37); + h_3 = (_e24 != _e25); return; } @@ -141,18 +141,18 @@ fn btest(a_8: vec4, b_8: vec4) { a_9 = a_8; b_9 = b_8; - let _e6 = a_9; - let _e7 = b_9; - c_4 = (_e6 == _e7); + let _e4 = a_9; + let _e5 = b_9; + c_4 = (_e4 == _e5); + let _e8 = a_9; + let _e9 = b_9; + d_4 = (_e8 != _e9); let _e12 = a_9; - let _e13 = b_9; - d_4 = (_e12 != _e13); - let _e17 = a_9; - e_4 = any(_e17); - let _e21 = a_9; - f_4 = all(_e21); - let _e25 = a_9; - g_4 = !(_e25); + e_4 = any(_e12); + let _e15 = a_9; + f_4 = all(_e15); + let _e18 = a_9; + g_4 = !(_e18); return; } From ba6e67f9d72cbf09d51602d2f49f4322fc07baf5 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 24 Nov 2024 09:53:38 -0800 Subject: [PATCH 2/2] Set the bake count for loads back to 2 This effectively reverts https://github.com/gfx-rs/naga/pull/925. In the time since that PR was filed, WGSL's semantics of var and let were changed, and naga was updated as well. It seems this workaround is no longer necessary to fix the original reordering bug experienced. Fixes #4349. This is still a bit scary, so I've left it as a draft. --- CHANGELOG.md | 1 + naga/src/back/mod.rs | 4 - .../6438-conflicting-idents.vs.Vertex.glsl | 5 +- .../access.assign_through_ptr.Compute.glsl | 9 +- ...cess.assign_to_ptr_components.Compute.glsl | 9 +- .../out/glsl/access.foo_frag.Fragment.glsl | 9 +- .../out/glsl/access.foo_vert.Vertex.glsl | 73 +-- naga/tests/out/glsl/bitcast.main.Compute.glsl | 27 +- naga/tests/out/glsl/bits.main.Compute.glsl | 152 ++--- naga/tests/out/glsl/boids.main.Compute.glsl | 108 +--- .../tests/out/glsl/break-if.main.Compute.glsl | 18 +- .../out/glsl/const-exprs.main.Compute.glsl | 12 +- .../out/glsl/control-flow.main.Compute.glsl | 6 +- .../out/glsl/do-while.main.Fragment.glsl | 3 +- .../out/glsl/dualsource.main.Fragment.glsl | 4 +- ...gment-output.main_vec2scalar.Fragment.glsl | 13 +- ...ragment-output.main_vec4vec3.Fragment.glsl | 13 +- naga/tests/out/glsl/globals.main.Compute.glsl | 23 +- .../glsl/image.texture_sample.Fragment.glsl | 69 +-- ...ge.texture_sample_comparison.Fragment.glsl | 27 +- .../interpolate_compat.vert_main.Vertex.glsl | 23 +- .../out/glsl/operators.main.Compute.glsl | 56 +- .../out/glsl/overrides.main.Compute.glsl | 3 +- .../tests/out/glsl/padding.vertex.Vertex.glsl | 5 +- .../glsl/push-constants.main.Fragment.glsl | 3 +- .../glsl/push-constants.vert_main.Vertex.glsl | 3 +- .../tests/out/glsl/quad-vert.main.Vertex.glsl | 7 +- .../out/glsl/shadow.fs_main.Fragment.glsl | 20 +- ...adow.fs_main_without_storage.Fragment.glsl | 20 +- .../tests/out/glsl/shadow.vs_main.Vertex.glsl | 13 +- .../tests/out/glsl/skybox.vs_main.Vertex.glsl | 12 +- ...onstants-issue-5598.fragment.Fragment.glsl | 3 +- ...ec-constants-issue-5598.vertex.Vertex.glsl | 9 +- .../glsl/standard.derivatives.Fragment.glsl | 5 +- ...uct-layout.needs_padding_comp.Compute.glsl | 6 +- ...struct-layout.no_padding_comp.Compute.glsl | 6 +- .../unnamed-gl-per-vertex.main.Vertex.glsl | 6 +- .../glsl/workgroup-var-init.main.Compute.glsl | 3 +- .../out/hlsl/6438-conflicting-idents.hlsl | 3 +- naga/tests/out/hlsl/access.hlsl | 73 +-- .../out/hlsl/atomicOps-int64-min-max.hlsl | 12 +- naga/tests/out/hlsl/binding-arrays.hlsl | 134 ++--- naga/tests/out/hlsl/bitcast.hlsl | 27 +- naga/tests/out/hlsl/bits.hlsl | 122 ++-- naga/tests/out/hlsl/boids.hlsl | 108 +--- naga/tests/out/hlsl/break-if.hlsl | 18 +- naga/tests/out/hlsl/collatz.hlsl | 21 +- naga/tests/out/hlsl/const-exprs.hlsl | 12 +- naga/tests/out/hlsl/control-flow.hlsl | 6 +- naga/tests/out/hlsl/do-while.hlsl | 3 +- naga/tests/out/hlsl/dualsource.hlsl | 4 +- naga/tests/out/hlsl/empty-global-name.hlsl | 3 +- naga/tests/out/hlsl/fetch_depth.hlsl | 3 +- naga/tests/out/hlsl/fragment-output.hlsl | 6 +- naga/tests/out/hlsl/globals.hlsl | 23 +- naga/tests/out/hlsl/hlsl-keyword.hlsl | 3 +- naga/tests/out/hlsl/image.hlsl | 96 +-- naga/tests/out/hlsl/int64.hlsl | 182 ++---- naga/tests/out/hlsl/interface.hlsl | 3 +- naga/tests/out/hlsl/interpolate.hlsl | 3 +- naga/tests/out/hlsl/interpolate_compat.hlsl | 3 +- naga/tests/out/hlsl/operators.hlsl | 56 +- naga/tests/out/hlsl/overrides.hlsl | 3 +- naga/tests/out/hlsl/padding.hlsl | 5 +- naga/tests/out/hlsl/push-constants.hlsl | 6 +- naga/tests/out/hlsl/quad-vert.hlsl | 7 +- naga/tests/out/hlsl/shadow.hlsl | 49 +- naga/tests/out/hlsl/skybox.hlsl | 12 +- naga/tests/out/hlsl/standard.hlsl | 5 +- naga/tests/out/hlsl/struct-layout.hlsl | 12 +- .../tests/out/hlsl/unnamed-gl-per-vertex.hlsl | 6 +- naga/tests/out/hlsl/workgroup-var-init.hlsl | 3 +- .../tests/out/msl/6438-conflicting-idents.msl | 3 +- .../out/msl/abstract-types-operators.msl | 36 +- naga/tests/out/msl/abstract-types-var.msl | 60 +- naga/tests/out/msl/access.msl | 73 +-- naga/tests/out/msl/atomicCompareExchange.msl | 40 +- .../tests/out/msl/atomicOps-int64-min-max.msl | 12 +- naga/tests/out/msl/binding-arrays.msl | 134 ++--- naga/tests/out/msl/bitcast.msl | 27 +- naga/tests/out/msl/bits.msl | 140 ++--- naga/tests/out/msl/boids.msl | 108 +--- naga/tests/out/msl/bounds-check-restrict.msl | 26 +- naga/tests/out/msl/bounds-check-zero.msl | 26 +- naga/tests/out/msl/break-if.msl | 12 +- naga/tests/out/msl/collatz.msl | 21 +- naga/tests/out/msl/const-exprs.msl | 12 +- naga/tests/out/msl/control-flow.msl | 6 +- naga/tests/out/msl/do-while.msl | 1 - naga/tests/out/msl/dualsource.msl | 4 +- naga/tests/out/msl/empty-global-name.msl | 3 +- naga/tests/out/msl/extra.msl | 3 +- naga/tests/out/msl/fetch_depth.msl | 3 +- naga/tests/out/msl/fragment-output.msl | 6 +- naga/tests/out/msl/globals.msl | 23 +- naga/tests/out/msl/image.msl | 96 +-- naga/tests/out/msl/int64.msl | 189 ++---- naga/tests/out/msl/interface.msl | 3 +- naga/tests/out/msl/interpolate.msl | 3 +- naga/tests/out/msl/interpolate_compat.msl | 3 +- naga/tests/out/msl/msl-varyings.msl | 3 +- naga/tests/out/msl/operators.msl | 56 +- naga/tests/out/msl/overrides.msl | 3 +- naga/tests/out/msl/padding.msl | 5 +- naga/tests/out/msl/policy-mix.msl | 7 +- naga/tests/out/msl/quad-vert.msl | 7 +- naga/tests/out/msl/resource-binding-map.msl | 10 +- naga/tests/out/msl/shadow.msl | 49 +- naga/tests/out/msl/skybox.msl | 12 +- naga/tests/out/msl/standard.msl | 5 +- naga/tests/out/msl/struct-layout.msl | 12 +- naga/tests/out/msl/unnamed-gl-per-vertex.msl | 6 +- .../out/msl/vertex-pulling-transform.msl | 6 +- naga/tests/out/msl/workgroup-var-init.msl | 3 +- .../out/wgsl/210-bevy-2d-shader.frag.wgsl | 9 +- .../out/wgsl/210-bevy-2d-shader.vert.wgsl | 14 +- naga/tests/out/wgsl/210-bevy-shader.vert.wgsl | 21 +- naga/tests/out/wgsl/246-collatz.comp.wgsl | 28 +- .../out/wgsl/5246-dual-iteration.frag.wgsl | 18 +- .../out/wgsl/6438-conflicting-idents.wgsl | 3 +- .../wgsl/800-out-of-bounds-panic.vert.wgsl | 15 +- naga/tests/out/wgsl/932-for-loop-if.frag.wgsl | 6 +- .../out/wgsl/abstract-types-operators.wgsl | 36 +- naga/tests/out/wgsl/abstract-types-var.wgsl | 60 +- naga/tests/out/wgsl/access.wgsl | 73 +-- .../out/wgsl/atomicCompareExchange-int64.wgsl | 40 +- .../tests/out/wgsl/atomicCompareExchange.wgsl | 40 +- .../out/wgsl/atomicOps-int64-min-max.wgsl | 12 +- naga/tests/out/wgsl/bevy-pbr.frag.wgsl | 556 ++++-------------- naga/tests/out/wgsl/bevy-pbr.vert.wgsl | 29 +- .../out/wgsl/binding-arrays.dynamic.wgsl | 3 +- .../tests/out/wgsl/binding-arrays.static.wgsl | 3 +- naga/tests/out/wgsl/binding-arrays.wgsl | 134 ++--- .../tests/out/wgsl/binding-buffer-arrays.wgsl | 24 +- naga/tests/out/wgsl/bitcast.wgsl | 27 +- naga/tests/out/wgsl/bits.wgsl | 164 ++---- naga/tests/out/wgsl/bits_glsl.frag.wgsl | 134 ++--- naga/tests/out/wgsl/boids.wgsl | 108 +--- naga/tests/out/wgsl/bool-select.frag.wgsl | 12 +- naga/tests/out/wgsl/break-if.wgsl | 18 +- naga/tests/out/wgsl/buffer.frag.wgsl | 6 +- .../builtin-accessed-outside-entrypoint.wgsl | 10 +- naga/tests/out/wgsl/clamp-splat.vert.wgsl | 6 +- naga/tests/out/wgsl/collatz.wgsl | 21 +- naga/tests/out/wgsl/const-exprs.wgsl | 12 +- .../out/wgsl/const-global-swizzle.frag.wgsl | 6 +- .../out/wgsl/constant-array-size.frag.wgsl | 14 +- naga/tests/out/wgsl/control-flow.wgsl | 6 +- naga/tests/out/wgsl/declarations.frag.wgsl | 15 +- naga/tests/out/wgsl/do-while.wgsl | 3 +- .../out/wgsl/double-math-functions.frag.wgsl | 75 +-- naga/tests/out/wgsl/dualsource.wgsl | 4 +- naga/tests/out/wgsl/empty-global-name.wgsl | 3 +- naga/tests/out/wgsl/expressions.frag.wgsl | 250 +++----- naga/tests/out/wgsl/extra.wgsl | 3 +- naga/tests/out/wgsl/fetch_depth.wgsl | 3 +- naga/tests/out/wgsl/fma.frag.wgsl | 19 +- naga/tests/out/wgsl/fragment-output.wgsl | 6 +- naga/tests/out/wgsl/functions_call.frag.wgsl | 21 +- .../out/wgsl/global-constant-array.frag.wgsl | 1 - naga/tests/out/wgsl/globals.wgsl | 23 +- naga/tests/out/wgsl/image.wgsl | 96 +-- naga/tests/out/wgsl/images.frag.wgsl | 24 +- naga/tests/out/wgsl/int64.wgsl | 182 ++---- naga/tests/out/wgsl/interface.wgsl | 3 +- naga/tests/out/wgsl/interpolate.wgsl | 3 +- naga/tests/out/wgsl/interpolate_compat.wgsl | 3 +- .../wgsl/inv-hyperbolic-trig-functions.wgsl | 9 +- .../tests/out/wgsl/inverse-polyfill.frag.wgsl | 9 +- naga/tests/out/wgsl/lexical-scopes.wgsl | 6 +- .../out/wgsl/local-var-init-in-loop.comp.wgsl | 10 +- naga/tests/out/wgsl/math-functions.frag.wgsl | 134 ++--- naga/tests/out/wgsl/operators.wgsl | 56 +- naga/tests/out/wgsl/padding.wgsl | 5 +- naga/tests/out/wgsl/prepostfix.frag.wgsl | 9 +- naga/tests/out/wgsl/quad-vert.wgsl | 7 +- naga/tests/out/wgsl/quad_glsl.frag.wgsl | 3 +- naga/tests/out/wgsl/quad_glsl.vert.wgsl | 10 +- .../out/wgsl/sampler-functions.frag.wgsl | 16 +- naga/tests/out/wgsl/samplers.frag.wgsl | 162 ++--- naga/tests/out/wgsl/shadow.wgsl | 49 +- naga/tests/out/wgsl/skybox.wgsl | 12 +- naga/tests/out/wgsl/standard.wgsl | 5 +- naga/tests/out/wgsl/statements.frag.wgsl | 15 +- naga/tests/out/wgsl/struct-layout.wgsl | 12 +- .../tests/out/wgsl/unnamed-gl-per-vertex.wgsl | 6 +- .../tests/out/wgsl/vector-functions.frag.wgsl | 113 +--- naga/tests/out/wgsl/workgroup-var-init.wgsl | 3 +- 188 files changed, 1812 insertions(+), 4321 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b29ecbbf..b90426313b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -112,6 +112,7 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148] - Show types of LHS and RHS in binary operation type mismatch errors. By @ErichDonGubler in [#6450](https://github.com/gfx-rs/wgpu/pull/6450). - The GLSL parser now uses less expressions for function calls. By @magcius in [#6604](https://github.com/gfx-rs/wgpu/pull/6604). +- Sets the bake count for loads back to 2, which really helps improve the readability of generated WGSL code. By @magcius in [#6605](https://github.com/gfx-rs/wgpu/pull/6605). #### General diff --git a/naga/src/back/mod.rs b/naga/src/back/mod.rs index 58c7fa02cb..7777a8c65a 100644 --- a/naga/src/back/mod.rs +++ b/naga/src/back/mod.rs @@ -213,10 +213,6 @@ impl crate::Expression { crate::Expression::ImageSample { .. } | crate::Expression::ImageLoad { .. } => 1, // derivatives use the control flow crate::Expression::Derivative { .. } => 1, - // TODO: We need a better fix for named `Load` expressions - // More info - https://github.com/gfx-rs/naga/pull/914 - // And https://github.com/gfx-rs/naga/issues/910 - crate::Expression::Load { .. } => 1, // cache expressions that are referenced multiple times _ => 2, } diff --git a/naga/tests/out/glsl/6438-conflicting-idents.vs.Vertex.glsl b/naga/tests/out/glsl/6438-conflicting-idents.vs.Vertex.glsl index 7937cba42d..e357042e30 100644 --- a/naga/tests/out/glsl/6438-conflicting-idents.vs.Vertex.glsl +++ b/naga/tests/out/glsl/6438-conflicting-idents.vs.Vertex.glsl @@ -14,9 +14,8 @@ void main() { vec2 xy = _p2vs_location0; OurVertexShaderOutput vsOutput = OurVertexShaderOutput(vec4(0.0), vec2(0.0)); vsOutput.position = vec4(xy, 0.0, 1.0); - OurVertexShaderOutput _e6 = vsOutput; - gl_Position = _e6.position; - _vs2fs_location0 = _e6.texcoord; + gl_Position = vsOutput.position; + _vs2fs_location0 = vsOutput.texcoord; gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w); return; } diff --git a/naga/tests/out/glsl/access.assign_through_ptr.Compute.glsl b/naga/tests/out/glsl/access.assign_through_ptr.Compute.glsl index d8b4f8fc16..96fc3f10f6 100644 --- a/naga/tests/out/glsl/access.assign_through_ptr.Compute.glsl +++ b/naga/tests/out/glsl/access.assign_through_ptr.Compute.glsl @@ -24,8 +24,7 @@ struct AssignToMember { }; float read_from_private(inout float foo_1) { - float _e1 = foo_1; - return _e1; + return foo_1; } float test_arr_as_arg(float a[5][10]) { @@ -43,8 +42,7 @@ void assign_array_through_ptr_fn(inout vec4 foo_2[2]) { } uint fetch_arg_ptr_member(inout AssignToMember p_1) { - uint _e2 = p_1.x; - return _e2; + return p_1.x; } void assign_to_arg_ptr_member(inout AssignToMember p_2) { @@ -53,8 +51,7 @@ void assign_to_arg_ptr_member(inout AssignToMember p_2) { } uint fetch_arg_ptr_array_element(inout uint p_3[4]) { - uint _e2 = p_3[1]; - return _e2; + return p_3[1]; } void assign_to_arg_ptr_array_element(inout uint p_4[4]) { diff --git a/naga/tests/out/glsl/access.assign_to_ptr_components.Compute.glsl b/naga/tests/out/glsl/access.assign_to_ptr_components.Compute.glsl index ec83c8a2ee..867e5820cf 100644 --- a/naga/tests/out/glsl/access.assign_to_ptr_components.Compute.glsl +++ b/naga/tests/out/glsl/access.assign_to_ptr_components.Compute.glsl @@ -24,8 +24,7 @@ struct AssignToMember { }; float read_from_private(inout float foo_1) { - float _e1 = foo_1; - return _e1; + return foo_1; } float test_arr_as_arg(float a[5][10]) { @@ -43,8 +42,7 @@ void assign_array_through_ptr_fn(inout vec4 foo_2[2]) { } uint fetch_arg_ptr_member(inout AssignToMember p_1) { - uint _e2 = p_1.x; - return _e2; + return p_1.x; } void assign_to_arg_ptr_member(inout AssignToMember p_2) { @@ -53,8 +51,7 @@ void assign_to_arg_ptr_member(inout AssignToMember p_2) { } uint fetch_arg_ptr_array_element(inout uint p_3[4]) { - uint _e2 = p_3[1]; - return _e2; + return p_3[1]; } void assign_to_arg_ptr_array_element(inout uint p_4[4]) { diff --git a/naga/tests/out/glsl/access.foo_frag.Fragment.glsl b/naga/tests/out/glsl/access.foo_frag.Fragment.glsl index 90092e535e..3338cea92b 100644 --- a/naga/tests/out/glsl/access.foo_frag.Fragment.glsl +++ b/naga/tests/out/glsl/access.foo_frag.Fragment.glsl @@ -34,8 +34,7 @@ layout(std430) buffer type_13_block_1Fragment { ivec2 _group_0_binding_2_fs; }; layout(location = 0) out vec4 _fs2p_location0; float read_from_private(inout float foo_1) { - float _e1 = foo_1; - return _e1; + return foo_1; } float test_arr_as_arg(float a[5][10]) { @@ -53,8 +52,7 @@ void assign_array_through_ptr_fn(inout vec4 foo_2[2]) { } uint fetch_arg_ptr_member(inout AssignToMember p_1) { - uint _e2 = p_1.x; - return _e2; + return p_1.x; } void assign_to_arg_ptr_member(inout AssignToMember p_2) { @@ -63,8 +61,7 @@ void assign_to_arg_ptr_member(inout AssignToMember p_2) { } uint fetch_arg_ptr_array_element(inout uint p_3[4]) { - uint _e2 = p_3[1]; - return _e2; + return p_3[1]; } void assign_to_arg_ptr_array_element(inout uint p_4[4]) { diff --git a/naga/tests/out/glsl/access.foo_vert.Vertex.glsl b/naga/tests/out/glsl/access.foo_vert.Vertex.glsl index 8e09a39c6a..8c3b1eaadc 100644 --- a/naga/tests/out/glsl/access.foo_vert.Vertex.glsl +++ b/naga/tests/out/glsl/access.foo_vert.Vertex.glsl @@ -39,76 +39,51 @@ uniform MatCx2InArray_block_3Vertex { MatCx2InArray _group_0_binding_3_vs; }; void test_matrix_within_struct_accesses() { int idx = 1; Baz t = Baz(mat3x2(vec2(1.0), vec2(2.0), vec2(3.0))); - int _e3 = idx; - idx = (_e3 - 1); + idx = (idx - 1); mat3x2 l0_ = _group_0_binding_1_vs.m; vec2 l1_ = _group_0_binding_1_vs.m[0]; - int _e14 = idx; - vec2 l2_ = _group_0_binding_1_vs.m[_e14]; + vec2 l2_ = _group_0_binding_1_vs.m[idx]; float l3_ = _group_0_binding_1_vs.m[0][1]; - int _e25 = idx; - float l4_ = _group_0_binding_1_vs.m[0][_e25]; - int _e30 = idx; - float l5_ = _group_0_binding_1_vs.m[_e30][1]; - int _e36 = idx; - int _e38 = idx; - float l6_ = _group_0_binding_1_vs.m[_e36][_e38]; - int _e51 = idx; - idx = (_e51 + 1); + float l4_ = _group_0_binding_1_vs.m[0][idx]; + float l5_ = _group_0_binding_1_vs.m[idx][1]; + float l6_ = _group_0_binding_1_vs.m[idx][idx]; + idx = (idx + 1); t.m = mat3x2(vec2(6.0), vec2(5.0), vec2(4.0)); t.m[0] = vec2(9.0); - int _e66 = idx; - t.m[_e66] = vec2(90.0); + t.m[idx] = vec2(90.0); t.m[0][1] = 10.0; - int _e76 = idx; - t.m[0][_e76] = 20.0; - int _e80 = idx; - t.m[_e80][1] = 30.0; - int _e85 = idx; - int _e87 = idx; - t.m[_e85][_e87] = 40.0; + t.m[0][idx] = 20.0; + t.m[idx][1] = 30.0; + t.m[idx][idx] = 40.0; return; } void test_matrix_within_array_within_struct_accesses() { int idx_1 = 1; MatCx2InArray t_1 = MatCx2InArray(mat4x2[2](mat4x2(0.0), mat4x2(0.0))); - int _e3 = idx_1; - idx_1 = (_e3 - 1); + idx_1 = (idx_1 - 1); mat4x2 l0_1[2] = _group_0_binding_3_vs.am; mat4x2 l1_1 = _group_0_binding_3_vs.am[0]; vec2 l2_1 = _group_0_binding_3_vs.am[0][0]; - int _e20 = idx_1; - vec2 l3_1 = _group_0_binding_3_vs.am[0][_e20]; + vec2 l3_1 = _group_0_binding_3_vs.am[0][idx_1]; float l4_1 = _group_0_binding_3_vs.am[0][0][1]; - int _e33 = idx_1; - float l5_1 = _group_0_binding_3_vs.am[0][0][_e33]; - int _e39 = idx_1; - float l6_1 = _group_0_binding_3_vs.am[0][_e39][1]; - int _e46 = idx_1; - int _e48 = idx_1; - float l7_ = _group_0_binding_3_vs.am[0][_e46][_e48]; - int _e55 = idx_1; - idx_1 = (_e55 + 1); + float l5_1 = _group_0_binding_3_vs.am[0][0][idx_1]; + float l6_1 = _group_0_binding_3_vs.am[0][idx_1][1]; + float l7_ = _group_0_binding_3_vs.am[0][idx_1][idx_1]; + idx_1 = (idx_1 + 1); t_1.am = mat4x2[2](mat4x2(0.0), mat4x2(0.0)); 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); - int _e77 = idx_1; - t_1.am[0][_e77] = vec2(90.0); + t_1.am[0][idx_1] = vec2(90.0); t_1.am[0][0][1] = 10.0; - int _e89 = idx_1; - t_1.am[0][0][_e89] = 20.0; - int _e94 = idx_1; - t_1.am[0][_e94][1] = 30.0; - int _e100 = idx_1; - int _e102 = idx_1; - t_1.am[0][_e100][_e102] = 40.0; + t_1.am[0][0][idx_1] = 20.0; + t_1.am[0][idx_1][1] = 30.0; + t_1.am[0][idx_1][idx_1] = 40.0; return; } float read_from_private(inout float foo_1) { - float _e1 = foo_1; - return _e1; + return foo_1; } float test_arr_as_arg(float a[5][10]) { @@ -126,8 +101,7 @@ void assign_array_through_ptr_fn(inout vec4 foo_2[2]) { } uint fetch_arg_ptr_member(inout AssignToMember p_1) { - uint _e2 = p_1.x; - return _e2; + return p_1.x; } void assign_to_arg_ptr_member(inout AssignToMember p_2) { @@ -136,8 +110,7 @@ void assign_to_arg_ptr_member(inout AssignToMember p_2) { } uint fetch_arg_ptr_array_element(inout uint p_3[4]) { - uint _e2 = p_3[1]; - return _e2; + return p_3[1]; } void assign_to_arg_ptr_array_element(inout uint p_4[4]) { diff --git a/naga/tests/out/glsl/bitcast.main.Compute.glsl b/naga/tests/out/glsl/bitcast.main.Compute.glsl index 57e7e221b7..4849c42d4a 100644 --- a/naga/tests/out/glsl/bitcast.main.Compute.glsl +++ b/naga/tests/out/glsl/bitcast.main.Compute.glsl @@ -16,24 +16,15 @@ void main() { vec2 f2_ = vec2(0.0); vec3 f3_ = vec3(0.0); vec4 f4_ = vec4(0.0); - ivec2 _e27 = i2_; - u2_ = uvec2(_e27); - ivec3 _e29 = i3_; - u3_ = uvec3(_e29); - ivec4 _e31 = i4_; - u4_ = uvec4(_e31); - uvec2 _e33 = u2_; - i2_ = ivec2(_e33); - uvec3 _e35 = u3_; - i3_ = ivec3(_e35); - uvec4 _e37 = u4_; - i4_ = ivec4(_e37); - ivec2 _e39 = i2_; - f2_ = intBitsToFloat(_e39); - ivec3 _e41 = i3_; - f3_ = intBitsToFloat(_e41); - ivec4 _e43 = i4_; - f4_ = intBitsToFloat(_e43); + u2_ = uvec2(i2_); + u3_ = uvec3(i3_); + u4_ = uvec4(i4_); + i2_ = ivec2(u2_); + i3_ = ivec3(u3_); + i4_ = ivec4(u4_); + f2_ = intBitsToFloat(i2_); + f3_ = intBitsToFloat(i3_); + f4_ = intBitsToFloat(i4_); return; } diff --git a/naga/tests/out/glsl/bits.main.Compute.glsl b/naga/tests/out/glsl/bits.main.Compute.glsl index f4b5c0f481..837cd45798 100644 --- a/naga/tests/out/glsl/bits.main.Compute.glsl +++ b/naga/tests/out/glsl/bits.main.Compute.glsl @@ -17,118 +17,62 @@ void main() { uvec4 u4_ = uvec4(0u); vec2 f2_ = vec2(0.0); vec4 f4_ = vec4(0.0); - vec4 _e28 = f4_; - u = packSnorm4x8(_e28); - vec4 _e30 = f4_; - u = packUnorm4x8(_e30); - vec2 _e32 = f2_; - u = packSnorm2x16(_e32); - vec2 _e34 = f2_; - u = packUnorm2x16(_e34); - vec2 _e36 = f2_; - u = packHalf2x16(_e36); + u = packSnorm4x8(f4_); + u = packUnorm4x8(f4_); + u = packSnorm2x16(f2_); + u = packUnorm2x16(f2_); + u = packHalf2x16(f2_); ivec4 _e38 = i4_; u = uint((_e38[0] & 0xFF) | ((_e38[1] & 0xFF) << 8) | ((_e38[2] & 0xFF) << 16) | ((_e38[3] & 0xFF) << 24)); uvec4 _e40 = u4_; u = (_e40[0] & 0xFFu) | ((_e40[1] & 0xFFu) << 8) | ((_e40[2] & 0xFFu) << 16) | ((_e40[3] & 0xFFu) << 24); - uint _e42 = u; - f4_ = unpackSnorm4x8(_e42); - uint _e44 = u; - f4_ = unpackUnorm4x8(_e44); - uint _e46 = u; - f2_ = unpackSnorm2x16(_e46); - uint _e48 = u; - f2_ = unpackUnorm2x16(_e48); - uint _e50 = u; - f2_ = unpackHalf2x16(_e50); + f4_ = unpackSnorm4x8(u); + f4_ = unpackUnorm4x8(u); + f2_ = unpackSnorm2x16(u); + f2_ = unpackUnorm2x16(u); + f2_ = unpackHalf2x16(u); uint _e52 = u; i4_ = ivec4(bitfieldExtract(int(_e52), 0, 8), bitfieldExtract(int(_e52), 8, 8), bitfieldExtract(int(_e52), 16, 8), bitfieldExtract(int(_e52), 24, 8)); uint _e54 = u; u4_ = uvec4(bitfieldExtract(_e54, 0, 8), bitfieldExtract(_e54, 8, 8), bitfieldExtract(_e54, 16, 8), bitfieldExtract(_e54, 24, 8)); - int _e56 = i; - int _e57 = i; - i = bitfieldInsert(_e56, _e57, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - ivec2 _e61 = i2_; - ivec2 _e62 = i2_; - i2_ = bitfieldInsert(_e61, _e62, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - ivec3 _e66 = i3_; - ivec3 _e67 = i3_; - i3_ = bitfieldInsert(_e66, _e67, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - ivec4 _e71 = i4_; - ivec4 _e72 = i4_; - i4_ = bitfieldInsert(_e71, _e72, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - uint _e76 = u; - uint _e77 = u; - u = bitfieldInsert(_e76, _e77, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - uvec2 _e81 = u2_; - uvec2 _e82 = u2_; - u2_ = bitfieldInsert(_e81, _e82, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - uvec3 _e86 = u3_; - uvec3 _e87 = u3_; - u3_ = bitfieldInsert(_e86, _e87, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - uvec4 _e91 = u4_; - uvec4 _e92 = u4_; - u4_ = bitfieldInsert(_e91, _e92, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - int _e96 = i; - i = bitfieldExtract(_e96, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - ivec2 _e100 = i2_; - i2_ = bitfieldExtract(_e100, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - ivec3 _e104 = i3_; - i3_ = bitfieldExtract(_e104, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - ivec4 _e108 = i4_; - i4_ = bitfieldExtract(_e108, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - uint _e112 = u; - u = bitfieldExtract(_e112, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - uvec2 _e116 = u2_; - u2_ = bitfieldExtract(_e116, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - uvec3 _e120 = u3_; - u3_ = bitfieldExtract(_e120, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - uvec4 _e124 = u4_; - u4_ = bitfieldExtract(_e124, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); - int _e128 = i; - i = findLSB(_e128); - uvec2 _e130 = u2_; - u2_ = uvec2(findLSB(_e130)); - ivec3 _e132 = i3_; - i3_ = findMSB(_e132); - uvec3 _e134 = u3_; - u3_ = uvec3(findMSB(_e134)); - int _e136 = i; - i = findMSB(_e136); - uint _e138 = u; - u = uint(findMSB(_e138)); - int _e140 = i; - i = bitCount(_e140); - ivec2 _e142 = i2_; - i2_ = bitCount(_e142); - ivec3 _e144 = i3_; - i3_ = bitCount(_e144); - ivec4 _e146 = i4_; - i4_ = bitCount(_e146); - uint _e148 = u; - u = uint(bitCount(_e148)); - uvec2 _e150 = u2_; - u2_ = uvec2(bitCount(_e150)); - uvec3 _e152 = u3_; - u3_ = uvec3(bitCount(_e152)); - uvec4 _e154 = u4_; - u4_ = uvec4(bitCount(_e154)); - int _e156 = i; - i = bitfieldReverse(_e156); - ivec2 _e158 = i2_; - i2_ = bitfieldReverse(_e158); - ivec3 _e160 = i3_; - i3_ = bitfieldReverse(_e160); - ivec4 _e162 = i4_; - i4_ = bitfieldReverse(_e162); - uint _e164 = u; - u = bitfieldReverse(_e164); - uvec2 _e166 = u2_; - u2_ = bitfieldReverse(_e166); - uvec3 _e168 = u3_; - u3_ = bitfieldReverse(_e168); - uvec4 _e170 = u4_; - u4_ = bitfieldReverse(_e170); + i = bitfieldInsert(i, i, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + i2_ = bitfieldInsert(i2_, i2_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + i3_ = bitfieldInsert(i3_, i3_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + i4_ = bitfieldInsert(i4_, i4_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + u = bitfieldInsert(u, u, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + u2_ = bitfieldInsert(u2_, u2_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + u3_ = bitfieldInsert(u3_, u3_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + u4_ = bitfieldInsert(u4_, u4_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + i = bitfieldExtract(i, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + i2_ = bitfieldExtract(i2_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + i3_ = bitfieldExtract(i3_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + i4_ = bitfieldExtract(i4_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + u = bitfieldExtract(u, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + u2_ = bitfieldExtract(u2_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + u3_ = bitfieldExtract(u3_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + u4_ = bitfieldExtract(u4_, int(min(5u, 32u)), int(min(10u, 32u - min(5u, 32u)))); + i = findLSB(i); + u2_ = uvec2(findLSB(u2_)); + i3_ = findMSB(i3_); + u3_ = uvec3(findMSB(u3_)); + i = findMSB(i); + u = uint(findMSB(u)); + i = bitCount(i); + i2_ = bitCount(i2_); + i3_ = bitCount(i3_); + i4_ = bitCount(i4_); + u = uint(bitCount(u)); + u2_ = uvec2(bitCount(u2_)); + u3_ = uvec3(bitCount(u3_)); + u4_ = uvec4(bitCount(u4_)); + i = bitfieldReverse(i); + i2_ = bitfieldReverse(i2_); + i3_ = bitfieldReverse(i3_); + i4_ = bitfieldReverse(i4_); + u = bitfieldReverse(u); + u2_ = bitfieldReverse(u2_); + u3_ = bitfieldReverse(u3_); + u4_ = bitfieldReverse(u4_); return; } diff --git a/naga/tests/out/glsl/boids.main.Compute.glsl b/naga/tests/out/glsl/boids.main.Compute.glsl index c42358bfef..49b13d5327 100644 --- a/naga/tests/out/glsl/boids.main.Compute.glsl +++ b/naga/tests/out/glsl/boids.main.Compute.glsl @@ -47,109 +47,57 @@ void main() { if ((index >= NUM_PARTICLES)) { return; } - vec2 _e8 = _group_0_binding_1_cs.particles[index].pos; - vPos = _e8; - vec2 _e14 = _group_0_binding_1_cs.particles[index].vel; - vVel = _e14; + vPos = _group_0_binding_1_cs.particles[index].pos; + vVel = _group_0_binding_1_cs.particles[index].vel; bool loop_init = true; while(true) { if (!loop_init) { - uint _e91 = i; - i = (_e91 + 1u); + i = (i + 1u); } loop_init = false; - uint _e36 = i; - if ((_e36 >= NUM_PARTICLES)) { + if ((i >= NUM_PARTICLES)) { break; } - uint _e39 = i; - if ((_e39 == index)) { + if ((i == index)) { continue; } - uint _e43 = i; - vec2 _e46 = _group_0_binding_1_cs.particles[_e43].pos; - pos = _e46; - uint _e49 = i; - vec2 _e52 = _group_0_binding_1_cs.particles[_e49].vel; - vel = _e52; - vec2 _e53 = pos; - vec2 _e54 = vPos; - float _e58 = _group_0_binding_0_cs.rule1Distance; - if ((distance(_e53, _e54) < _e58)) { - vec2 _e60 = cMass; - vec2 _e61 = pos; - cMass = (_e60 + _e61); - int _e63 = cMassCount; - cMassCount = (_e63 + 1); + pos = _group_0_binding_1_cs.particles[i].pos; + vel = _group_0_binding_1_cs.particles[i].vel; + if ((distance(pos, vPos) < _group_0_binding_0_cs.rule1Distance)) { + cMass = (cMass + pos); + cMassCount = (cMassCount + 1); } - vec2 _e66 = pos; - vec2 _e67 = vPos; - float _e71 = _group_0_binding_0_cs.rule2Distance; - if ((distance(_e66, _e67) < _e71)) { - vec2 _e73 = colVel; - vec2 _e74 = pos; - vec2 _e75 = vPos; - colVel = (_e73 - (_e74 - _e75)); + if ((distance(pos, vPos) < _group_0_binding_0_cs.rule2Distance)) { + colVel = (colVel - (pos - vPos)); } - vec2 _e78 = pos; - vec2 _e79 = vPos; - float _e83 = _group_0_binding_0_cs.rule3Distance; - if ((distance(_e78, _e79) < _e83)) { - vec2 _e85 = cVel; - vec2 _e86 = vel; - cVel = (_e85 + _e86); - int _e88 = cVelCount; - cVelCount = (_e88 + 1); + if ((distance(pos, vPos) < _group_0_binding_0_cs.rule3Distance)) { + cVel = (cVel + vel); + cVelCount = (cVelCount + 1); } } - int _e94 = cMassCount; - if ((_e94 > 0)) { - vec2 _e97 = cMass; - int _e98 = cMassCount; - vec2 _e102 = vPos; - cMass = ((_e97 / vec2(float(_e98))) - _e102); + if ((cMassCount > 0)) { + cMass = ((cMass / vec2(float(cMassCount))) - vPos); } - int _e104 = cVelCount; - if ((_e104 > 0)) { - vec2 _e107 = cVel; - int _e108 = cVelCount; - cVel = (_e107 / vec2(float(_e108))); + if ((cVelCount > 0)) { + cVel = (cVel / vec2(float(cVelCount))); } - vec2 _e112 = vVel; - vec2 _e113 = cMass; - float _e116 = _group_0_binding_0_cs.rule1Scale; - vec2 _e119 = colVel; - float _e122 = _group_0_binding_0_cs.rule2Scale; - vec2 _e125 = cVel; - float _e128 = _group_0_binding_0_cs.rule3Scale; - vVel = (((_e112 + (_e113 * _e116)) + (_e119 * _e122)) + (_e125 * _e128)); - vec2 _e131 = vVel; - vec2 _e133 = vVel; - vVel = (normalize(_e131) * clamp(length(_e133), 0.0, 0.1)); - vec2 _e139 = vPos; - vec2 _e140 = vVel; - float _e143 = _group_0_binding_0_cs.deltaT; - vPos = (_e139 + (_e140 * _e143)); - float _e147 = vPos.x; - if ((_e147 < -1.0)) { + vVel = (((vVel + (cMass * _group_0_binding_0_cs.rule1Scale)) + (colVel * _group_0_binding_0_cs.rule2Scale)) + (cVel * _group_0_binding_0_cs.rule3Scale)); + vVel = (normalize(vVel) * clamp(length(vVel), 0.0, 0.1)); + vPos = (vPos + (vVel * _group_0_binding_0_cs.deltaT)); + if ((vPos.x < -1.0)) { vPos.x = 1.0; } - float _e153 = vPos.x; - if ((_e153 > 1.0)) { + if ((vPos.x > 1.0)) { vPos.x = -1.0; } - float _e159 = vPos.y; - if ((_e159 < -1.0)) { + if ((vPos.y < -1.0)) { vPos.y = 1.0; } - float _e165 = vPos.y; - if ((_e165 > 1.0)) { + if ((vPos.y > 1.0)) { vPos.y = -1.0; } - vec2 _e174 = vPos; - _group_0_binding_2_cs.particles[index].pos = _e174; - vec2 _e179 = vVel; - _group_0_binding_2_cs.particles[index].vel = _e179; + _group_0_binding_2_cs.particles[index].pos = vPos; + _group_0_binding_2_cs.particles[index].vel = vVel; return; } diff --git a/naga/tests/out/glsl/break-if.main.Compute.glsl b/naga/tests/out/glsl/break-if.main.Compute.glsl index ba96de4879..23c91911d1 100644 --- a/naga/tests/out/glsl/break-if.main.Compute.glsl +++ b/naga/tests/out/glsl/break-if.main.Compute.glsl @@ -26,10 +26,8 @@ void breakIfEmptyBody(bool a) { while(true) { if (!loop_init_1) { b = a; - bool _e2 = b; - c = (a != _e2); - bool _e5 = c; - if ((a == _e5)) { + c = (a != b); + if ((a == c)) { break; } } @@ -44,15 +42,13 @@ void breakIf(bool a_1) { bool loop_init_2 = true; while(true) { if (!loop_init_2) { - bool _e5 = e; - if ((a_1 == _e5)) { + if ((a_1 == e)) { break; } } loop_init_2 = false; d = a_1; - bool _e2 = d; - e = (a_1 != _e2); + e = (a_1 != d); } return; } @@ -62,14 +58,12 @@ void breakIfSeparateVariable() { bool loop_init_3 = true; while(true) { if (!loop_init_3) { - uint _e5 = counter; - if ((_e5 == 5u)) { + if ((counter == 5u)) { break; } } loop_init_3 = false; - uint _e3 = counter; - counter = (_e3 + 1u); + counter = (counter + 1u); } return; } diff --git a/naga/tests/out/glsl/const-exprs.main.Compute.glsl b/naga/tests/out/glsl/const-exprs.main.Compute.glsl index b095345de9..5d52e0ed73 100644 --- a/naga/tests/out/glsl/const-exprs.main.Compute.glsl +++ b/naga/tests/out/glsl/const-exprs.main.Compute.glsl @@ -39,15 +39,9 @@ void non_constant_initializers() { int y = 0; int z = 70; ivec4 out_3 = ivec4(0); - int _e2 = w; - x = _e2; - int _e4 = x; - y = _e4; - int _e8 = w; - int _e9 = x; - int _e10 = y; - int _e11 = z; - out_3 = ivec4(_e8, _e9, _e10, _e11); + x = w; + y = x; + out_3 = ivec4(w, x, y, z); return; } diff --git a/naga/tests/out/glsl/control-flow.main.Compute.glsl b/naga/tests/out/glsl/control-flow.main.Compute.glsl index 391fca84f4..591851cd06 100644 --- a/naga/tests/out/glsl/control-flow.main.Compute.glsl +++ b/naga/tests/out/glsl/control-flow.main.Compute.glsl @@ -152,8 +152,7 @@ void main() { do { pos = 1; } while(false); - int _e4 = pos; - switch(_e4) { + switch(pos) { case 1: { pos = 0; break; @@ -185,8 +184,7 @@ void main() { break; } } - int _e11 = pos; - switch(_e11) { + switch(pos) { case 1: { pos = 0; break; diff --git a/naga/tests/out/glsl/do-while.main.Fragment.glsl b/naga/tests/out/glsl/do-while.main.Fragment.glsl index fb8f6e1efa..ea377f0209 100644 --- a/naga/tests/out/glsl/do-while.main.Fragment.glsl +++ b/naga/tests/out/glsl/do-while.main.Fragment.glsl @@ -8,8 +8,7 @@ void fb1_(inout bool cond) { bool loop_init = true; while(true) { if (!loop_init) { - bool _e1 = cond; - if (!(_e1)) { + if (!(cond)) { break; } } diff --git a/naga/tests/out/glsl/dualsource.main.Fragment.glsl b/naga/tests/out/glsl/dualsource.main.Fragment.glsl index ef57922798..8ca0f8a7dc 100644 --- a/naga/tests/out/glsl/dualsource.main.Fragment.glsl +++ b/naga/tests/out/glsl/dualsource.main.Fragment.glsl @@ -15,9 +15,7 @@ void main() { vec4 position = gl_FragCoord; vec4 color = vec4(0.4, 0.3, 0.2, 0.1); vec4 mask = vec4(0.9, 0.8, 0.7, 0.6); - vec4 _e13 = color; - vec4 _e14 = mask; - FragmentOutput _tmp_return = FragmentOutput(_e13, _e14); + FragmentOutput _tmp_return = FragmentOutput(color, mask); _fs2p_location0 = _tmp_return.color; _fs2p_location1 = _tmp_return.mask; return; diff --git a/naga/tests/out/glsl/fragment-output.main_vec2scalar.Fragment.glsl b/naga/tests/out/glsl/fragment-output.main_vec2scalar.Fragment.glsl index c68a89f162..29c6073f0b 100644 --- a/naga/tests/out/glsl/fragment-output.main_vec2scalar.Fragment.glsl +++ b/naga/tests/out/glsl/fragment-output.main_vec2scalar.Fragment.glsl @@ -34,13 +34,12 @@ void main() { output_1.scalarf = 0.0; output_1.scalari = 0; output_1.scalaru = 0u; - FragmentOutputVec2Scalar _e16 = output_1; - _fs2p_location0 = _e16.vec2f; - _fs2p_location1 = _e16.vec2i; - _fs2p_location2 = _e16.vec2u; - _fs2p_location3 = _e16.scalarf; - _fs2p_location4 = _e16.scalari; - _fs2p_location5 = _e16.scalaru; + _fs2p_location0 = output_1.vec2f; + _fs2p_location1 = output_1.vec2i; + _fs2p_location2 = output_1.vec2u; + _fs2p_location3 = output_1.scalarf; + _fs2p_location4 = output_1.scalari; + _fs2p_location5 = output_1.scalaru; return; } diff --git a/naga/tests/out/glsl/fragment-output.main_vec4vec3.Fragment.glsl b/naga/tests/out/glsl/fragment-output.main_vec4vec3.Fragment.glsl index c0398f399a..af0aaa2438 100644 --- a/naga/tests/out/glsl/fragment-output.main_vec4vec3.Fragment.glsl +++ b/naga/tests/out/glsl/fragment-output.main_vec4vec3.Fragment.glsl @@ -34,13 +34,12 @@ void main() { output_.vec3f = vec3(0.0); output_.vec3i = ivec3(0); output_.vec3u = uvec3(0u); - FragmentOutputVec4Vec3_ _e19 = output_; - _fs2p_location0 = _e19.vec4f; - _fs2p_location1 = _e19.vec4i; - _fs2p_location2 = _e19.vec4u; - _fs2p_location3 = _e19.vec3f; - _fs2p_location4 = _e19.vec3i; - _fs2p_location5 = _e19.vec3u; + _fs2p_location0 = output_.vec4f; + _fs2p_location1 = output_.vec4i; + _fs2p_location2 = output_.vec4u; + _fs2p_location3 = output_.vec3f; + _fs2p_location4 = output_.vec3i; + _fs2p_location5 = output_.vec3u; return; } diff --git a/naga/tests/out/glsl/globals.main.Compute.glsl b/naga/tests/out/glsl/globals.main.Compute.glsl index b7ef8bd295..966283cf08 100644 --- a/naga/tests/out/glsl/globals.main.Compute.glsl +++ b/naga/tests/out/glsl/globals.main.Compute.glsl @@ -39,8 +39,7 @@ void test_msl_packed_vec3_() { _group_0_binding_1_cs.v3_ = vec3(1.0); _group_0_binding_1_cs.v3_.x = 1.0; _group_0_binding_1_cs.v3_.x = 2.0; - int _e16 = idx; - _group_0_binding_1_cs.v3_[_e16] = 3.0; + _group_0_binding_1_cs.v3_[idx] = 3.0; FooStruct data = _group_0_binding_1_cs; vec3 l0_ = data.v3_; vec2 l1_ = data.v3_.zx; @@ -61,20 +60,12 @@ void main() { float Foo = 1.0; bool at = true; test_msl_packed_vec3_(); - mat4x2 _e5 = _group_0_binding_7_cs[0][0]; - vec4 _e10 = _group_0_binding_6_cs[0][0][0]; - wg[7] = (_e5 * _e10).x; - mat3x2 _e16 = _group_0_binding_5_cs; - vec3 _e18 = _group_0_binding_4_cs; - wg[6] = (_e16 * _e18).x; - float _e26 = _group_0_binding_2_cs[1].y; - wg[5] = _e26; - float _e32 = _group_0_binding_3_cs[0].w; - wg[4] = _e32; - float _e37 = _group_0_binding_1_cs.v1_; - wg[3] = _e37; - float _e43 = _group_0_binding_1_cs.v3_.x; - wg[2] = _e43; + wg[7] = (_group_0_binding_7_cs[0][0] * _group_0_binding_6_cs[0][0][0]).x; + wg[6] = (_group_0_binding_5_cs * _group_0_binding_4_cs).x; + wg[5] = _group_0_binding_2_cs[1].y; + wg[4] = _group_0_binding_3_cs[0].w; + wg[3] = _group_0_binding_1_cs.v1_; + wg[2] = _group_0_binding_1_cs.v3_.x; _group_0_binding_1_cs.v1_ = 4.0; wg[1] = float(uint(_group_0_binding_2_cs.length())); at_1 = 2u; diff --git a/naga/tests/out/glsl/image.texture_sample.Fragment.glsl b/naga/tests/out/glsl/image.texture_sample.Fragment.glsl index 3657b2ea13..04835919c9 100644 --- a/naga/tests/out/glsl/image.texture_sample.Fragment.glsl +++ b/naga/tests/out/glsl/image.texture_sample.Fragment.glsl @@ -14,73 +14,50 @@ void main() { vec2 tc = vec2(0.5); vec3 tc3_ = vec3(0.5); vec4 _e9 = texture(_group_0_binding_0_fs, tc.x); - vec4 _e10 = a; - a = (_e10 + _e9); + a = (a + _e9); vec4 _e14 = texture(_group_0_binding_1_fs, vec2(tc)); - vec4 _e15 = a; - a = (_e15 + _e14); + a = (a + _e14); vec4 _e19 = textureOffset(_group_0_binding_1_fs, vec2(tc), ivec2(3, 1)); - vec4 _e20 = a; - a = (_e20 + _e19); + a = (a + _e19); vec4 _e24 = textureLod(_group_0_binding_1_fs, vec2(tc), 2.3); - vec4 _e25 = a; - a = (_e25 + _e24); + a = (a + _e24); vec4 _e29 = textureLodOffset(_group_0_binding_1_fs, vec2(tc), 2.3, ivec2(3, 1)); - vec4 _e30 = a; - a = (_e30 + _e29); + a = (a + _e29); vec4 _e35 = textureOffset(_group_0_binding_1_fs, vec2(tc), ivec2(3, 1), 2.0); - vec4 _e36 = a; - a = (_e36 + _e35); + a = (a + _e35); vec4 _e41 = texture(_group_0_binding_4_fs, vec3(tc, 0u)); - vec4 _e42 = a; - a = (_e42 + _e41); + a = (a + _e41); vec4 _e47 = textureOffset(_group_0_binding_4_fs, vec3(tc, 0u), ivec2(3, 1)); - vec4 _e48 = a; - a = (_e48 + _e47); + a = (a + _e47); vec4 _e53 = textureLod(_group_0_binding_4_fs, vec3(tc, 0u), 2.3); - vec4 _e54 = a; - a = (_e54 + _e53); + a = (a + _e53); vec4 _e59 = textureLodOffset(_group_0_binding_4_fs, vec3(tc, 0u), 2.3, ivec2(3, 1)); - vec4 _e60 = a; - a = (_e60 + _e59); + a = (a + _e59); vec4 _e66 = textureOffset(_group_0_binding_4_fs, vec3(tc, 0u), ivec2(3, 1), 2.0); - vec4 _e67 = a; - a = (_e67 + _e66); + a = (a + _e66); vec4 _e72 = texture(_group_0_binding_4_fs, vec3(tc, 0)); - vec4 _e73 = a; - a = (_e73 + _e72); + a = (a + _e72); vec4 _e78 = textureOffset(_group_0_binding_4_fs, vec3(tc, 0), ivec2(3, 1)); - vec4 _e79 = a; - a = (_e79 + _e78); + a = (a + _e78); vec4 _e84 = textureLod(_group_0_binding_4_fs, vec3(tc, 0), 2.3); - vec4 _e85 = a; - a = (_e85 + _e84); + a = (a + _e84); vec4 _e90 = textureLodOffset(_group_0_binding_4_fs, vec3(tc, 0), 2.3, ivec2(3, 1)); - vec4 _e91 = a; - a = (_e91 + _e90); + a = (a + _e90); vec4 _e97 = textureOffset(_group_0_binding_4_fs, vec3(tc, 0), ivec2(3, 1), 2.0); - vec4 _e98 = a; - a = (_e98 + _e97); + a = (a + _e97); vec4 _e103 = texture(_group_0_binding_6_fs, vec4(tc3_, 0u)); - vec4 _e104 = a; - a = (_e104 + _e103); + a = (a + _e103); vec4 _e109 = textureLod(_group_0_binding_6_fs, vec4(tc3_, 0u), 2.3); - vec4 _e110 = a; - a = (_e110 + _e109); + a = (a + _e109); vec4 _e116 = texture(_group_0_binding_6_fs, vec4(tc3_, 0u), 2.0); - vec4 _e117 = a; - a = (_e117 + _e116); + a = (a + _e116); vec4 _e122 = texture(_group_0_binding_6_fs, vec4(tc3_, 0)); - vec4 _e123 = a; - a = (_e123 + _e122); + a = (a + _e122); vec4 _e128 = textureLod(_group_0_binding_6_fs, vec4(tc3_, 0), 2.3); - vec4 _e129 = a; - a = (_e129 + _e128); + a = (a + _e128); vec4 _e135 = texture(_group_0_binding_6_fs, vec4(tc3_, 0), 2.0); - vec4 _e136 = a; - a = (_e136 + _e135); - vec4 _e138 = a; - _fs2p_location0 = _e138; + a = (a + _e135); + _fs2p_location0 = a; return; } diff --git a/naga/tests/out/glsl/image.texture_sample_comparison.Fragment.glsl b/naga/tests/out/glsl/image.texture_sample_comparison.Fragment.glsl index b1c198b0c3..3f0675a432 100644 --- a/naga/tests/out/glsl/image.texture_sample_comparison.Fragment.glsl +++ b/naga/tests/out/glsl/image.texture_sample_comparison.Fragment.glsl @@ -12,31 +12,22 @@ void main() { vec2 tc = vec2(0.5); vec3 tc3_ = vec3(0.5); float _e8 = texture(_group_1_binding_2_fs, vec3(tc, 0.5)); - float _e9 = a_1; - a_1 = (_e9 + _e8); + a_1 = (a_1 + _e8); float _e14 = texture(_group_1_binding_3_fs, vec4(tc, 0u, 0.5)); - float _e15 = a_1; - a_1 = (_e15 + _e14); + a_1 = (a_1 + _e14); float _e20 = texture(_group_1_binding_3_fs, vec4(tc, 0, 0.5)); - float _e21 = a_1; - a_1 = (_e21 + _e20); + a_1 = (a_1 + _e20); float _e25 = texture(_group_1_binding_4_fs, vec4(tc3_, 0.5)); - float _e26 = a_1; - a_1 = (_e26 + _e25); + a_1 = (a_1 + _e25); float _e30 = textureLod(_group_1_binding_2_fs, vec3(tc, 0.5), 0.0); - float _e31 = a_1; - a_1 = (_e31 + _e30); + a_1 = (a_1 + _e30); float _e36 = textureGrad(_group_1_binding_3_fs, vec4(tc, 0u, 0.5), vec2(0.0), vec2(0.0)); - float _e37 = a_1; - a_1 = (_e37 + _e36); + a_1 = (a_1 + _e36); float _e42 = textureGrad(_group_1_binding_3_fs, vec4(tc, 0, 0.5), vec2(0.0), vec2(0.0)); - float _e43 = a_1; - a_1 = (_e43 + _e42); + a_1 = (a_1 + _e42); float _e47 = textureGrad(_group_1_binding_4_fs, vec4(tc3_, 0.5), vec3(0.0), vec3(0.0)); - float _e48 = a_1; - a_1 = (_e48 + _e47); - float _e50 = a_1; - _fs2p_location0 = _e50; + a_1 = (a_1 + _e47); + _fs2p_location0 = a_1; return; } diff --git a/naga/tests/out/glsl/interpolate_compat.vert_main.Vertex.glsl b/naga/tests/out/glsl/interpolate_compat.vert_main.Vertex.glsl index 5b85026d79..6dc806d07e 100644 --- a/naga/tests/out/glsl/interpolate_compat.vert_main.Vertex.glsl +++ b/naga/tests/out/glsl/interpolate_compat.vert_main.Vertex.glsl @@ -36,18 +36,17 @@ void main() { out_.perspective_centroid = 2197.0; out_.perspective_sample = 2744.0; out_.perspective_center = 2812.0; - FragmentInput _e39 = out_; - gl_Position = _e39.position; - _vs2fs_location0 = _e39._flat; - _vs2fs_location2 = _e39.flat_either; - _vs2fs_location3 = _e39._linear; - _vs2fs_location4 = _e39.linear_centroid; - _vs2fs_location6 = _e39.linear_sample; - _vs2fs_location7 = _e39.linear_center; - _vs2fs_location8 = _e39.perspective; - _vs2fs_location9 = _e39.perspective_centroid; - _vs2fs_location10 = _e39.perspective_sample; - _vs2fs_location11 = _e39.perspective_center; + gl_Position = out_.position; + _vs2fs_location0 = out_._flat; + _vs2fs_location2 = out_.flat_either; + _vs2fs_location3 = out_._linear; + _vs2fs_location4 = out_.linear_centroid; + _vs2fs_location6 = out_.linear_sample; + _vs2fs_location7 = out_.linear_center; + _vs2fs_location8 = out_.perspective; + _vs2fs_location9 = out_.perspective_centroid; + _vs2fs_location10 = out_.perspective_sample; + _vs2fs_location11 = out_.perspective_center; return; } diff --git a/naga/tests/out/glsl/operators.main.Compute.glsl b/naga/tests/out/glsl/operators.main.Compute.glsl index 006bce205e..f29bd993a3 100644 --- a/naga/tests/out/glsl/operators.main.Compute.glsl +++ b/naga/tests/out/glsl/operators.main.Compute.glsl @@ -31,14 +31,10 @@ vec4 splat(float m, int n) { vec2 splat_assignment() { vec2 a = vec2(2.0); - vec2 _e4 = a; - a = (_e4 + vec2(1.0)); - vec2 _e8 = a; - a = (_e8 - vec2(3.0)); - vec2 _e12 = a; - a = (_e12 / vec2(4.0)); - vec2 _e15 = a; - return _e15; + a = (a + vec2(1.0)); + a = (a - vec2(3.0)); + a = (a / vec2(4.0)); + return a; } vec3 bool_cast(vec3 x) { @@ -202,36 +198,20 @@ void assignment() { int a_1 = 0; ivec3 vec0_ = ivec3(0); a_1 = 1; - int _e5 = a_1; - a_1 = (_e5 + 1); - int _e7 = a_1; - a_1 = (_e7 - 1); - int _e9 = a_1; - int _e10 = a_1; - a_1 = (_e10 * _e9); - int _e12 = a_1; - int _e13 = a_1; - a_1 = (_e13 / _e12); - int _e15 = a_1; - a_1 = (_e15 % 1); - int _e17 = a_1; - a_1 = (_e17 & 0); - int _e19 = a_1; - a_1 = (_e19 | 0); - int _e21 = a_1; - a_1 = (_e21 ^ 0); - int _e23 = a_1; - a_1 = (_e23 << 2u); - int _e25 = a_1; - a_1 = (_e25 >> 1u); - int _e28 = a_1; - a_1 = (_e28 + 1); - int _e31 = a_1; - a_1 = (_e31 - 1); - int _e37 = vec0_[1]; - vec0_[1] = (_e37 + 1); - int _e41 = vec0_[1]; - vec0_[1] = (_e41 - 1); + a_1 = (a_1 + 1); + a_1 = (a_1 - 1); + a_1 = (a_1 * a_1); + a_1 = (a_1 / a_1); + a_1 = (a_1 % 1); + a_1 = (a_1 & 0); + a_1 = (a_1 | 0); + a_1 = (a_1 ^ 0); + a_1 = (a_1 << 2u); + a_1 = (a_1 >> 1u); + a_1 = (a_1 + 1); + a_1 = (a_1 - 1); + vec0_[1] = (vec0_[1] + 1); + vec0_[1] = (vec0_[1] - 1); return; } diff --git a/naga/tests/out/glsl/overrides.main.Compute.glsl b/naga/tests/out/glsl/overrides.main.Compute.glsl index d1170df962..801e24f75e 100644 --- a/naga/tests/out/glsl/overrides.main.Compute.glsl +++ b/naga/tests/out/glsl/overrides.main.Compute.glsl @@ -23,8 +23,7 @@ void main() { bool x = false; float gain_x_100_ = 0.0; x = true; - float _e9 = gain_x_10_; - gain_x_100_ = (_e9 * 10.0); + gain_x_100_ = (gain_x_10_ * 10.0); store_override = gain; return; } diff --git a/naga/tests/out/glsl/padding.vertex.Vertex.glsl b/naga/tests/out/glsl/padding.vertex.Vertex.glsl index 82d8d31fa9..2c86e247b5 100644 --- a/naga/tests/out/glsl/padding.vertex.Vertex.glsl +++ b/naga/tests/out/glsl/padding.vertex.Vertex.glsl @@ -26,10 +26,7 @@ uniform Test3_block_2Vertex { Test3_ _group_0_binding_2_vs; }; void main() { - float _e4 = _group_0_binding_0_vs.b; - float _e8 = _group_0_binding_1_vs.b; - float _e12 = _group_0_binding_2_vs.b; - gl_Position = (((vec4(1.0) * _e4) * _e8) * _e12); + gl_Position = (((vec4(1.0) * _group_0_binding_0_vs.b) * _group_0_binding_1_vs.b) * _group_0_binding_2_vs.b); gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w); return; } diff --git a/naga/tests/out/glsl/push-constants.main.Fragment.glsl b/naga/tests/out/glsl/push-constants.main.Fragment.glsl index 8131e9e897..cc17730503 100644 --- a/naga/tests/out/glsl/push-constants.main.Fragment.glsl +++ b/naga/tests/out/glsl/push-constants.main.Fragment.glsl @@ -16,8 +16,7 @@ layout(location = 0) out vec4 _fs2p_location0; void main() { FragmentIn in_ = FragmentIn(_vs2fs_location0); - float _e4 = _push_constant_binding_fs.multiplier; - _fs2p_location0 = (in_.color * _e4); + _fs2p_location0 = (in_.color * _push_constant_binding_fs.multiplier); return; } diff --git a/naga/tests/out/glsl/push-constants.vert_main.Vertex.glsl b/naga/tests/out/glsl/push-constants.vert_main.Vertex.glsl index 53b218a946..ce054bca41 100644 --- a/naga/tests/out/glsl/push-constants.vert_main.Vertex.glsl +++ b/naga/tests/out/glsl/push-constants.vert_main.Vertex.glsl @@ -19,8 +19,7 @@ void main() { vec2 pos = _p2vs_location0; uint ii = (uint(gl_InstanceID) + naga_vs_first_instance); uint vi = uint(gl_VertexID); - float _e8 = _push_constant_binding_vs.multiplier; - gl_Position = vec4((((float(ii) * float(vi)) * _e8) * pos), 0.0, 1.0); + gl_Position = vec4((((float(ii) * float(vi)) * _push_constant_binding_vs.multiplier) * pos), 0.0, 1.0); return; } diff --git a/naga/tests/out/glsl/quad-vert.main.Vertex.glsl b/naga/tests/out/glsl/quad-vert.main.Vertex.glsl index 4a48679668..44b6c3ed2e 100644 --- a/naga/tests/out/glsl/quad-vert.main.Vertex.glsl +++ b/naga/tests/out/glsl/quad-vert.main.Vertex.glsl @@ -26,8 +26,7 @@ layout(location = 0) in vec2 _p2vs_location0; layout(location = 0) smooth out vec2 _vs2fs_location0; void main_1() { - vec2 _e6 = a_uv_1; - v_uv = _e6; + v_uv = a_uv_1; vec2 _e7 = a_pos_1; unnamed.gen_gl_Position = vec4(_e7.x, _e7.y, 0.0, 1.0); return; @@ -39,9 +38,7 @@ void main() { a_uv_1 = a_uv; a_pos_1 = a_pos; main_1(); - vec2 _e7 = v_uv; - vec4 _e8 = unnamed.gen_gl_Position; - type_4 _tmp_return = type_4(_e7, _e8); + type_4 _tmp_return = type_4(v_uv, unnamed.gen_gl_Position); _vs2fs_location0 = _tmp_return.member; gl_Position = _tmp_return.gen_gl_Position; gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w); diff --git a/naga/tests/out/glsl/shadow.fs_main.Fragment.glsl b/naga/tests/out/glsl/shadow.fs_main.Fragment.glsl index ab7214380f..117c49945a 100644 --- a/naga/tests/out/glsl/shadow.fs_main.Fragment.glsl +++ b/naga/tests/out/glsl/shadow.fs_main.Fragment.glsl @@ -55,30 +55,22 @@ void main() { bool loop_init = true; while(true) { if (!loop_init) { - uint _e40 = i; - i = (_e40 + 1u); + i = (i + 1u); } loop_init = false; - uint _e7 = i; - uint _e11 = _group_0_binding_0_fs.num_lights.x; - if ((_e7 < min(_e11, c_max_lights))) { + if ((i < min(_group_0_binding_0_fs.num_lights.x, c_max_lights))) { } else { break; } { - uint _e16 = i; - Light light = _group_0_binding_1_fs[_e16]; - uint _e19 = i; - float _e23 = fetch_shadow(_e19, (light.proj * in_.world_position)); + Light light = _group_0_binding_1_fs[i]; + float _e23 = fetch_shadow(i, (light.proj * in_.world_position)); vec3 light_dir = normalize((light.pos.xyz - in_.world_position.xyz)); float diffuse = max(0.0, dot(normal_1, light_dir)); - vec3 _e37 = color; - color = (_e37 + ((_e23 * diffuse) * light.color.xyz)); + color = (color + ((_e23 * diffuse) * light.color.xyz)); } } - vec3 _e42 = color; - vec4 _e47 = _group_1_binding_0_fs.color; - _fs2p_location0 = (vec4(_e42, 1.0) * _e47); + _fs2p_location0 = (vec4(color, 1.0) * _group_1_binding_0_fs.color); return; } diff --git a/naga/tests/out/glsl/shadow.fs_main_without_storage.Fragment.glsl b/naga/tests/out/glsl/shadow.fs_main_without_storage.Fragment.glsl index a9fcf31d56..01eedfa9e2 100644 --- a/naga/tests/out/glsl/shadow.fs_main_without_storage.Fragment.glsl +++ b/naga/tests/out/glsl/shadow.fs_main_without_storage.Fragment.glsl @@ -55,30 +55,22 @@ void main() { bool loop_init = true; while(true) { if (!loop_init) { - uint _e40 = i_1; - i_1 = (_e40 + 1u); + i_1 = (i_1 + 1u); } loop_init = false; - uint _e7 = i_1; - uint _e11 = _group_0_binding_0_fs.num_lights.x; - if ((_e7 < min(_e11, c_max_lights))) { + if ((i_1 < min(_group_0_binding_0_fs.num_lights.x, c_max_lights))) { } else { break; } { - uint _e16 = i_1; - Light light = _group_0_binding_1_fs[_e16]; - uint _e19 = i_1; - float _e23 = fetch_shadow(_e19, (light.proj * in_1.world_position)); + Light light = _group_0_binding_1_fs[i_1]; + float _e23 = fetch_shadow(i_1, (light.proj * in_1.world_position)); vec3 light_dir = normalize((light.pos.xyz - in_1.world_position.xyz)); float diffuse = max(0.0, dot(normal_1, light_dir)); - vec3 _e37 = color_1; - color_1 = (_e37 + ((_e23 * diffuse) * light.color.xyz)); + color_1 = (color_1 + ((_e23 * diffuse) * light.color.xyz)); } } - vec3 _e42 = color_1; - vec4 _e47 = _group_1_binding_0_fs.color; - _fs2p_location0 = (vec4(_e42, 1.0) * _e47); + _fs2p_location0 = (vec4(color_1, 1.0) * _group_1_binding_0_fs.color); return; } diff --git a/naga/tests/out/glsl/shadow.vs_main.Vertex.glsl b/naga/tests/out/glsl/shadow.vs_main.Vertex.glsl index 631c412f2a..8d90e4f263 100644 --- a/naga/tests/out/glsl/shadow.vs_main.Vertex.glsl +++ b/naga/tests/out/glsl/shadow.vs_main.Vertex.glsl @@ -38,16 +38,13 @@ void main() { ivec4 normal = _p2vs_location1; VertexOutput out_ = VertexOutput(vec4(0.0), vec3(0.0), vec4(0.0)); mat4x4 w = _group_1_binding_0_vs.world; - mat4x4 _e7 = _group_1_binding_0_vs.world; - vec4 world_pos = (_e7 * vec4(position)); + vec4 world_pos = (_group_1_binding_0_vs.world * vec4(position)); out_.world_normal = (mat3x3(w[0].xyz, w[1].xyz, w[2].xyz) * vec3(normal.xyz)); out_.world_position = world_pos; - mat4x4 _e26 = _group_0_binding_0_vs.view_proj; - out_.proj_position = (_e26 * world_pos); - VertexOutput _e28 = out_; - gl_Position = _e28.proj_position; - _vs2fs_location0 = _e28.world_normal; - _vs2fs_location1 = _e28.world_position; + out_.proj_position = (_group_0_binding_0_vs.view_proj * world_pos); + gl_Position = out_.proj_position; + _vs2fs_location0 = out_.world_normal; + _vs2fs_location1 = out_.world_position; gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w); return; } diff --git a/naga/tests/out/glsl/skybox.vs_main.Vertex.glsl b/naga/tests/out/glsl/skybox.vs_main.Vertex.glsl index e40addaa2f..14554f97f5 100644 --- a/naga/tests/out/glsl/skybox.vs_main.Vertex.glsl +++ b/naga/tests/out/glsl/skybox.vs_main.Vertex.glsl @@ -21,15 +21,9 @@ void main() { int tmp2_ = 0; tmp1_ = (int(vertex_index) / 2); tmp2_ = (int(vertex_index) & 1); - int _e9 = tmp1_; - int _e15 = tmp2_; - vec4 pos = vec4(((float(_e9) * 4.0) - 1.0), ((float(_e15) * 4.0) - 1.0), 0.0, 1.0); - vec4 _e27 = _group_0_binding_0_vs.view[0]; - vec4 _e32 = _group_0_binding_0_vs.view[1]; - vec4 _e37 = _group_0_binding_0_vs.view[2]; - mat3x3 inv_model_view = transpose(mat3x3(_e27.xyz, _e32.xyz, _e37.xyz)); - mat4x4 _e43 = _group_0_binding_0_vs.proj_inv; - vec4 unprojected = (_e43 * pos); + vec4 pos = vec4(((float(tmp1_) * 4.0) - 1.0), ((float(tmp2_) * 4.0) - 1.0), 0.0, 1.0); + mat3x3 inv_model_view = transpose(mat3x3(_group_0_binding_0_vs.view[0].xyz, _group_0_binding_0_vs.view[1].xyz, _group_0_binding_0_vs.view[2].xyz)); + vec4 unprojected = (_group_0_binding_0_vs.proj_inv * pos); VertexOutput _tmp_return = VertexOutput(pos, (inv_model_view * unprojected.xyz)); gl_Position = _tmp_return.position; _vs2fs_location0 = _tmp_return.uv; diff --git a/naga/tests/out/glsl/spec-constants-issue-5598.fragment.Fragment.glsl b/naga/tests/out/glsl/spec-constants-issue-5598.fragment.Fragment.glsl index e81d8fa1b1..436a409d82 100644 --- a/naga/tests/out/glsl/spec-constants-issue-5598.fragment.Fragment.glsl +++ b/naga/tests/out/glsl/spec-constants-issue-5598.fragment.Fragment.glsl @@ -27,8 +27,7 @@ void main() { vec4 param = gl_FragCoord; global = param; function(); - vec4 _e3 = global_1; - _fs2p_location0 = _e3; + _fs2p_location0 = global_1; return; } diff --git a/naga/tests/out/glsl/spec-constants-issue-5598.vertex.Vertex.glsl b/naga/tests/out/glsl/spec-constants-issue-5598.vertex.Vertex.glsl index 256e9380ac..a5e65dd75b 100644 --- a/naga/tests/out/glsl/spec-constants-issue-5598.vertex.Vertex.glsl +++ b/naga/tests/out/glsl/spec-constants-issue-5598.vertex.Vertex.glsl @@ -14,8 +14,7 @@ void function_1() { uint _e5 = global_2; local = vec4[6](vec4(-1.0, -1.0, 0.0, 1.0), vec4(1.0, -1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), vec4(-1.0, 1.0, 0.0, 1.0), vec4(-1.0, -1.0, 0.0, 1.0)); if ((_e5 < 6u)) { - vec4 _e8 = local[_e5]; - global_3 = _e8; + global_3 = local[_e5]; } return; } @@ -24,10 +23,8 @@ void main() { uint param_1 = uint(gl_VertexID); global_2 = param_1; function_1(); - float _e4 = global_3.y; - global_3.y = -(_e4); - vec4 _e6 = global_3; - gl_Position = _e6; + global_3.y = -(global_3.y); + gl_Position = global_3; gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w); return; } diff --git a/naga/tests/out/glsl/standard.derivatives.Fragment.glsl b/naga/tests/out/glsl/standard.derivatives.Fragment.glsl index 18e150a3fe..d75c894280 100644 --- a/naga/tests/out/glsl/standard.derivatives.Fragment.glsl +++ b/naga/tests/out/glsl/standard.derivatives.Fragment.glsl @@ -33,10 +33,7 @@ void main() { vec4 _e12 = fwidth(foo); z = _e12; bool _e13 = test_any_and_all_for_bool(); - vec4 _e14 = x; - vec4 _e15 = y; - vec4 _e17 = z; - _fs2p_location0 = ((_e14 + _e15) * _e17); + _fs2p_location0 = ((x + y) * z); return; } diff --git a/naga/tests/out/glsl/struct-layout.needs_padding_comp.Compute.glsl b/naga/tests/out/glsl/struct-layout.needs_padding_comp.Compute.glsl index 7fe97f2982..2c910559c1 100644 --- a/naga/tests/out/glsl/struct-layout.needs_padding_comp.Compute.glsl +++ b/naga/tests/out/glsl/struct-layout.needs_padding_comp.Compute.glsl @@ -21,10 +21,8 @@ layout(std430) buffer NeedsPadding_block_1Compute { NeedsPadding _group_0_bindin void main() { NeedsPadding x_1 = NeedsPadding(0.0, vec3(0.0), 0.0); - NeedsPadding _e2 = _group_0_binding_2_cs; - x_1 = _e2; - NeedsPadding _e4 = _group_0_binding_3_cs; - x_1 = _e4; + x_1 = _group_0_binding_2_cs; + x_1 = _group_0_binding_3_cs; return; } diff --git a/naga/tests/out/glsl/struct-layout.no_padding_comp.Compute.glsl b/naga/tests/out/glsl/struct-layout.no_padding_comp.Compute.glsl index c7bbcf7b70..144c18ab92 100644 --- a/naga/tests/out/glsl/struct-layout.no_padding_comp.Compute.glsl +++ b/naga/tests/out/glsl/struct-layout.no_padding_comp.Compute.glsl @@ -21,10 +21,8 @@ layout(std430) buffer NoPadding_block_1Compute { NoPadding _group_0_binding_1_cs void main() { NoPadding x = NoPadding(vec3(0.0), 0.0); - NoPadding _e2 = _group_0_binding_0_cs; - x = _e2; - NoPadding _e4 = _group_0_binding_1_cs; - x = _e4; + x = _group_0_binding_0_cs; + x = _group_0_binding_1_cs; return; } diff --git a/naga/tests/out/glsl/unnamed-gl-per-vertex.main.Vertex.glsl b/naga/tests/out/glsl/unnamed-gl-per-vertex.main.Vertex.glsl index e44bef49aa..d62dfc55b2 100644 --- a/naga/tests/out/glsl/unnamed-gl-per-vertex.main.Vertex.glsl +++ b/naga/tests/out/glsl/unnamed-gl-per-vertex.main.Vertex.glsl @@ -24,10 +24,8 @@ void main() { uint param = uint(gl_VertexID); global_1 = int(param); function(); - float _e6 = global.member.y; - global.member.y = -(_e6); - vec4 _e8 = global.member; - gl_Position = _e8; + global.member.y = -(global.member.y); + gl_Position = global.member; gl_Position.yz = vec2(-gl_Position.y, gl_Position.z * 2.0 - gl_Position.w); return; } diff --git a/naga/tests/out/glsl/workgroup-var-init.main.Compute.glsl b/naga/tests/out/glsl/workgroup-var-init.main.Compute.glsl index de136c1109..a9c1706f2e 100644 --- a/naga/tests/out/glsl/workgroup-var-init.main.Compute.glsl +++ b/naga/tests/out/glsl/workgroup-var-init.main.Compute.glsl @@ -21,8 +21,7 @@ void main() { } memoryBarrierShared(); barrier(); - uint _e3[512] = w_mem.arr; - _group_0_binding_0_cs = _e3; + _group_0_binding_0_cs = w_mem.arr; return; } diff --git a/naga/tests/out/hlsl/6438-conflicting-idents.hlsl b/naga/tests/out/hlsl/6438-conflicting-idents.hlsl index 179ac8ec8d..a9983f6719 100644 --- a/naga/tests/out/hlsl/6438-conflicting-idents.hlsl +++ b/naga/tests/out/hlsl/6438-conflicting-idents.hlsl @@ -13,8 +13,7 @@ VertexOutput_vs vs(float2 xy : LOC0) OurVertexShaderOutput vsOutput = (OurVertexShaderOutput)0; vsOutput.position = float4(xy, 0.0, 1.0); - OurVertexShaderOutput _e6 = vsOutput; - const OurVertexShaderOutput ourvertexshaderoutput = _e6; + const OurVertexShaderOutput ourvertexshaderoutput = vsOutput; const VertexOutput_vs ourvertexshaderoutput_1 = { ourvertexshaderoutput.texcoord, ourvertexshaderoutput.position }; return ourvertexshaderoutput_1; } diff --git a/naga/tests/out/hlsl/access.hlsl b/naga/tests/out/hlsl/access.hlsl index a6fbf368b3..da454d3878 100644 --- a/naga/tests/out/hlsl/access.hlsl +++ b/naga/tests/out/hlsl/access.hlsl @@ -125,34 +125,22 @@ void test_matrix_within_struct_accesses() int idx = 1; Baz t = ConstructBaz(float3x2((1.0).xx, (2.0).xx, (3.0).xx)); - int _e3 = idx; - idx = (_e3 - 1); + idx = (idx - 1); float3x2 l0_ = GetMatmOnBaz(baz); float2 l1_ = GetMatmOnBaz(baz)[0]; - int _e14 = idx; - float2 l2_ = GetMatmOnBaz(baz)[_e14]; + float2 l2_ = GetMatmOnBaz(baz)[idx]; float l3_ = GetMatmOnBaz(baz)[0].y; - int _e25 = idx; - float l4_ = GetMatmOnBaz(baz)[0][_e25]; - int _e30 = idx; - float l5_ = GetMatmOnBaz(baz)[_e30].y; - int _e36 = idx; - int _e38 = idx; - float l6_ = GetMatmOnBaz(baz)[_e36][_e38]; - int _e51 = idx; - idx = (_e51 + 1); + float l4_ = GetMatmOnBaz(baz)[0][idx]; + float l5_ = GetMatmOnBaz(baz)[idx].y; + float l6_ = GetMatmOnBaz(baz)[idx][idx]; + idx = (idx + 1); SetMatmOnBaz(t, float3x2((6.0).xx, (5.0).xx, (4.0).xx)); t.m_0 = (9.0).xx; - int _e66 = idx; - SetMatVecmOnBaz(t, (90.0).xx, _e66); + SetMatVecmOnBaz(t, (90.0).xx, idx); t.m_0[1] = 10.0; - int _e76 = idx; - t.m_0[_e76] = 20.0; - int _e80 = idx; - SetMatScalarmOnBaz(t, 30.0, _e80, 1); - int _e85 = idx; - int _e87 = idx; - SetMatScalarmOnBaz(t, 40.0, _e85, _e87); + t.m_0[idx] = 20.0; + SetMatScalarmOnBaz(t, 30.0, idx, 1); + SetMatScalarmOnBaz(t, 40.0, idx, idx); return; } @@ -172,43 +160,30 @@ void test_matrix_within_array_within_struct_accesses() int idx_1 = 1; MatCx2InArray t_1 = ConstructMatCx2InArray(ZeroValuearray2_float4x2_()); - int _e3 = idx_1; - idx_1 = (_e3 - 1); + idx_1 = (idx_1 - 1); float4x2 l0_1[2] = ((float4x2[2])nested_mat_cx2_.am); float4x2 l1_1 = ((float4x2)nested_mat_cx2_.am[0]); float2 l2_1 = nested_mat_cx2_.am[0]._0; - int _e20 = idx_1; - float2 l3_1 = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _e20); + float2 l3_1 = __get_col_of_mat4x2(nested_mat_cx2_.am[0], idx_1); float l4_1 = nested_mat_cx2_.am[0]._0.y; - int _e33 = idx_1; - float l5_1 = nested_mat_cx2_.am[0]._0[_e33]; - int _e39 = idx_1; - float l6_1 = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _e39).y; - int _e46 = idx_1; - int _e48 = idx_1; - float l7_ = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _e46)[_e48]; - int _e55 = idx_1; - idx_1 = (_e55 + 1); + float l5_1 = nested_mat_cx2_.am[0]._0[idx_1]; + float l6_1 = __get_col_of_mat4x2(nested_mat_cx2_.am[0], idx_1).y; + float l7_ = __get_col_of_mat4x2(nested_mat_cx2_.am[0], idx_1)[idx_1]; + idx_1 = (idx_1 + 1); t_1.am = (__mat4x2[2])ZeroValuearray2_float4x2_(); t_1.am[0] = (__mat4x2)float4x2((8.0).xx, (7.0).xx, (6.0).xx, (5.0).xx); t_1.am[0]._0 = (9.0).xx; - int _e77 = idx_1; - __set_col_of_mat4x2(t_1.am[0], _e77, (90.0).xx); + __set_col_of_mat4x2(t_1.am[0], idx_1, (90.0).xx); t_1.am[0]._0.y = 10.0; - int _e89 = idx_1; - t_1.am[0]._0[min(uint(_e89), 1u)] = 20.0; - int _e94 = idx_1; - __set_el_of_mat4x2(t_1.am[0], _e94, 1, 30.0); - int _e100 = idx_1; - int _e102 = idx_1; - __set_el_of_mat4x2(t_1.am[0], _e100, _e102, 40.0); + t_1.am[0]._0[min(uint(idx_1), 1u)] = 20.0; + __set_el_of_mat4x2(t_1.am[0], idx_1, 1, 30.0); + __set_el_of_mat4x2(t_1.am[0], idx_1, idx_1, 40.0); return; } float read_from_private(inout float foo_1) { - float _e1 = foo_1; - return _e1; + return foo_1; } float test_arr_as_arg(float a[5][10]) @@ -236,8 +211,7 @@ void assign_array_through_ptr_fn(inout float4 foo_2[2]) uint fetch_arg_ptr_member(inout AssignToMember p_1) { - uint _e2 = p_1.x; - return _e2; + return p_1.x; } void assign_to_arg_ptr_member(inout AssignToMember p_2) @@ -248,8 +222,7 @@ void assign_to_arg_ptr_member(inout AssignToMember p_2) uint fetch_arg_ptr_array_element(inout uint p_3[4]) { - uint _e2 = p_3[1]; - return _e2; + return p_3[1]; } void assign_to_arg_ptr_array_element(inout uint p_4[4]) diff --git a/naga/tests/out/hlsl/atomicOps-int64-min-max.hlsl b/naga/tests/out/hlsl/atomicOps-int64-min-max.hlsl index 989a52b78b..a7f72cd925 100644 --- a/naga/tests/out/hlsl/atomicOps-int64-min-max.hlsl +++ b/naga/tests/out/hlsl/atomicOps-int64-min-max.hlsl @@ -18,17 +18,13 @@ cbuffer input : register(b3) { uint64_t input; } [numthreads(2, 1, 1)] void cs_main(uint3 id : SV_GroupThreadID) { - uint64_t _e3 = input; - storage_atomic_scalar.InterlockedMax64(0, _e3); - uint64_t _e7 = input; - storage_atomic_arr.InterlockedMax64(8, (1uL + _e7)); + storage_atomic_scalar.InterlockedMax64(0, input); + storage_atomic_arr.InterlockedMax64(8, (1uL + input)); storage_struct.InterlockedMax64(0, 1uL); storage_struct.InterlockedMax64(8+8, uint64_t(id.x)); GroupMemoryBarrierWithGroupSync(); - uint64_t _e20 = input; - storage_atomic_scalar.InterlockedMin64(0, _e20); - uint64_t _e24 = input; - storage_atomic_arr.InterlockedMin64(8, (1uL + _e24)); + storage_atomic_scalar.InterlockedMin64(0, input); + storage_atomic_arr.InterlockedMin64(8, (1uL + input)); storage_struct.InterlockedMin64(0, 1uL); storage_struct.InterlockedMin64(8+8, uint64_t(id.x)); return; diff --git a/naga/tests/out/hlsl/binding-arrays.hlsl b/naga/tests/out/hlsl/binding-arrays.hlsl index d6719c1fa6..c6620258a0 100644 --- a/naga/tests/out/hlsl/binding-arrays.hlsl +++ b/naga/tests/out/hlsl/binding-arrays.hlsl @@ -60,121 +60,75 @@ float4 main(FragmentInput_main fragmentinput_main) : SV_Target0 uint non_uniform_index = fragment_in.index; float2 uv = (0.0).xx; int2 pix = (0).xx; - uint2 _e22 = u2_; - u2_ = (_e22 + NagaDimensions2D(texture_array_unbounded[0])); - uint2 _e27 = u2_; - u2_ = (_e27 + NagaDimensions2D(texture_array_unbounded[uniform_index])); - uint2 _e32 = u2_; - u2_ = (_e32 + NagaDimensions2D(texture_array_unbounded[NonUniformResourceIndex(non_uniform_index)])); + u2_ = (u2_ + NagaDimensions2D(texture_array_unbounded[0])); + u2_ = (u2_ + NagaDimensions2D(texture_array_unbounded[uniform_index])); + u2_ = (u2_ + NagaDimensions2D(texture_array_unbounded[NonUniformResourceIndex(non_uniform_index)])); float4 _e38 = texture_array_bounded[0].Gather(samp[0], uv); - float4 _e39 = v4_; - v4_ = (_e39 + _e38); + v4_ = (v4_ + _e38); float4 _e45 = texture_array_bounded[uniform_index].Gather(samp[uniform_index], uv); - float4 _e46 = v4_; - v4_ = (_e46 + _e45); + v4_ = (v4_ + _e45); float4 _e52 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].Gather(samp[NonUniformResourceIndex(non_uniform_index)], uv); - float4 _e53 = v4_; - v4_ = (_e53 + _e52); + v4_ = (v4_ + _e52); float4 _e60 = texture_array_depth[0].GatherCmp(samp_comp[0], uv, 0.0); - float4 _e61 = v4_; - v4_ = (_e61 + _e60); + v4_ = (v4_ + _e60); float4 _e68 = texture_array_depth[uniform_index].GatherCmp(samp_comp[uniform_index], uv, 0.0); - float4 _e69 = v4_; - v4_ = (_e69 + _e68); + v4_ = (v4_ + _e68); float4 _e76 = texture_array_depth[NonUniformResourceIndex(non_uniform_index)].GatherCmp(samp_comp[NonUniformResourceIndex(non_uniform_index)], uv, 0.0); - float4 _e77 = v4_; - v4_ = (_e77 + _e76); + v4_ = (v4_ + _e76); float4 _e82 = texture_array_unbounded[0].Load(int3(pix, 0)); - float4 _e83 = v4_; - v4_ = (_e83 + _e82); + v4_ = (v4_ + _e82); float4 _e88 = texture_array_unbounded[uniform_index].Load(int3(pix, 0)); - float4 _e89 = v4_; - v4_ = (_e89 + _e88); + v4_ = (v4_ + _e88); float4 _e94 = texture_array_unbounded[NonUniformResourceIndex(non_uniform_index)].Load(int3(pix, 0)); - float4 _e95 = v4_; - v4_ = (_e95 + _e94); - uint _e100 = u1_; - u1_ = (_e100 + NagaNumLayers2DArray(texture_array_2darray[0])); - uint _e105 = u1_; - u1_ = (_e105 + NagaNumLayers2DArray(texture_array_2darray[uniform_index])); - uint _e110 = u1_; - u1_ = (_e110 + NagaNumLayers2DArray(texture_array_2darray[NonUniformResourceIndex(non_uniform_index)])); - uint _e115 = u1_; - u1_ = (_e115 + NagaNumLevels2D(texture_array_bounded[0])); - uint _e120 = u1_; - u1_ = (_e120 + NagaNumLevels2D(texture_array_bounded[uniform_index])); - uint _e125 = u1_; - u1_ = (_e125 + NagaNumLevels2D(texture_array_bounded[NonUniformResourceIndex(non_uniform_index)])); - uint _e130 = u1_; - u1_ = (_e130 + NagaMSNumSamples2D(texture_array_multisampled[0])); - uint _e135 = u1_; - u1_ = (_e135 + NagaMSNumSamples2D(texture_array_multisampled[uniform_index])); - uint _e140 = u1_; - u1_ = (_e140 + NagaMSNumSamples2D(texture_array_multisampled[NonUniformResourceIndex(non_uniform_index)])); + v4_ = (v4_ + _e94); + u1_ = (u1_ + NagaNumLayers2DArray(texture_array_2darray[0])); + u1_ = (u1_ + NagaNumLayers2DArray(texture_array_2darray[uniform_index])); + u1_ = (u1_ + NagaNumLayers2DArray(texture_array_2darray[NonUniformResourceIndex(non_uniform_index)])); + u1_ = (u1_ + NagaNumLevels2D(texture_array_bounded[0])); + u1_ = (u1_ + NagaNumLevels2D(texture_array_bounded[uniform_index])); + u1_ = (u1_ + NagaNumLevels2D(texture_array_bounded[NonUniformResourceIndex(non_uniform_index)])); + u1_ = (u1_ + NagaMSNumSamples2D(texture_array_multisampled[0])); + u1_ = (u1_ + NagaMSNumSamples2D(texture_array_multisampled[uniform_index])); + u1_ = (u1_ + NagaMSNumSamples2D(texture_array_multisampled[NonUniformResourceIndex(non_uniform_index)])); float4 _e146 = texture_array_bounded[0].Sample(samp[0], uv); - float4 _e147 = v4_; - v4_ = (_e147 + _e146); + v4_ = (v4_ + _e146); float4 _e153 = texture_array_bounded[uniform_index].Sample(samp[uniform_index], uv); - float4 _e154 = v4_; - v4_ = (_e154 + _e153); + v4_ = (v4_ + _e153); float4 _e160 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].Sample(samp[NonUniformResourceIndex(non_uniform_index)], uv); - float4 _e161 = v4_; - v4_ = (_e161 + _e160); + v4_ = (v4_ + _e160); float4 _e168 = texture_array_bounded[0].SampleBias(samp[0], uv, 0.0); - float4 _e169 = v4_; - v4_ = (_e169 + _e168); + v4_ = (v4_ + _e168); float4 _e176 = texture_array_bounded[uniform_index].SampleBias(samp[uniform_index], uv, 0.0); - float4 _e177 = v4_; - v4_ = (_e177 + _e176); + v4_ = (v4_ + _e176); float4 _e184 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].SampleBias(samp[NonUniformResourceIndex(non_uniform_index)], uv, 0.0); - float4 _e185 = v4_; - v4_ = (_e185 + _e184); + v4_ = (v4_ + _e184); float _e192 = texture_array_depth[0].SampleCmp(samp_comp[0], uv, 0.0); - float _e193 = v1_; - v1_ = (_e193 + _e192); + v1_ = (v1_ + _e192); float _e200 = texture_array_depth[uniform_index].SampleCmp(samp_comp[uniform_index], uv, 0.0); - float _e201 = v1_; - v1_ = (_e201 + _e200); + v1_ = (v1_ + _e200); float _e208 = texture_array_depth[NonUniformResourceIndex(non_uniform_index)].SampleCmp(samp_comp[NonUniformResourceIndex(non_uniform_index)], uv, 0.0); - float _e209 = v1_; - v1_ = (_e209 + _e208); + v1_ = (v1_ + _e208); float _e216 = texture_array_depth[0].SampleCmpLevelZero(samp_comp[0], uv, 0.0); - float _e217 = v1_; - v1_ = (_e217 + _e216); + v1_ = (v1_ + _e216); float _e224 = texture_array_depth[uniform_index].SampleCmpLevelZero(samp_comp[uniform_index], uv, 0.0); - float _e225 = v1_; - v1_ = (_e225 + _e224); + v1_ = (v1_ + _e224); float _e232 = texture_array_depth[NonUniformResourceIndex(non_uniform_index)].SampleCmpLevelZero(samp_comp[NonUniformResourceIndex(non_uniform_index)], uv, 0.0); - float _e233 = v1_; - v1_ = (_e233 + _e232); + v1_ = (v1_ + _e232); float4 _e239 = texture_array_bounded[0].SampleGrad(samp[0], uv, uv, uv); - float4 _e240 = v4_; - v4_ = (_e240 + _e239); + v4_ = (v4_ + _e239); float4 _e246 = texture_array_bounded[uniform_index].SampleGrad(samp[uniform_index], uv, uv, uv); - float4 _e247 = v4_; - v4_ = (_e247 + _e246); + v4_ = (v4_ + _e246); float4 _e253 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].SampleGrad(samp[NonUniformResourceIndex(non_uniform_index)], uv, uv, uv); - float4 _e254 = v4_; - v4_ = (_e254 + _e253); + v4_ = (v4_ + _e253); float4 _e261 = texture_array_bounded[0].SampleLevel(samp[0], uv, 0.0); - float4 _e262 = v4_; - v4_ = (_e262 + _e261); + v4_ = (v4_ + _e261); float4 _e269 = texture_array_bounded[uniform_index].SampleLevel(samp[uniform_index], uv, 0.0); - float4 _e270 = v4_; - v4_ = (_e270 + _e269); + v4_ = (v4_ + _e269); float4 _e277 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].SampleLevel(samp[NonUniformResourceIndex(non_uniform_index)], uv, 0.0); - float4 _e278 = v4_; - v4_ = (_e278 + _e277); - float4 _e282 = v4_; - texture_array_storage[0][pix] = _e282; - float4 _e285 = v4_; - texture_array_storage[uniform_index][pix] = _e285; - float4 _e288 = v4_; - texture_array_storage[NonUniformResourceIndex(non_uniform_index)][pix] = _e288; - uint2 _e289 = u2_; - uint _e290 = u1_; - float2 v2_ = float2((_e289 + (_e290).xx)); - float4 _e294 = v4_; - float _e301 = v1_; - return ((_e294 + float4(v2_.x, v2_.y, v2_.x, v2_.y)) + (_e301).xxxx); + v4_ = (v4_ + _e277); + texture_array_storage[0][pix] = v4_; + texture_array_storage[uniform_index][pix] = v4_; + texture_array_storage[NonUniformResourceIndex(non_uniform_index)][pix] = v4_; + float2 v2_ = float2((u2_ + (u1_).xx)); + return ((v4_ + float4(v2_.x, v2_.y, v2_.x, v2_.y)) + (v1_).xxxx); } diff --git a/naga/tests/out/hlsl/bitcast.hlsl b/naga/tests/out/hlsl/bitcast.hlsl index b21408dda5..1ea981ccc3 100644 --- a/naga/tests/out/hlsl/bitcast.hlsl +++ b/naga/tests/out/hlsl/bitcast.hlsl @@ -11,23 +11,14 @@ void main() float3 f3_ = (0.0).xxx; float4 f4_ = (0.0).xxxx; - int2 _e27 = i2_; - u2_ = asuint(_e27); - int3 _e29 = i3_; - u3_ = asuint(_e29); - int4 _e31 = i4_; - u4_ = asuint(_e31); - uint2 _e33 = u2_; - i2_ = asint(_e33); - uint3 _e35 = u3_; - i3_ = asint(_e35); - uint4 _e37 = u4_; - i4_ = asint(_e37); - int2 _e39 = i2_; - f2_ = asfloat(_e39); - int3 _e41 = i3_; - f3_ = asfloat(_e41); - int4 _e43 = i4_; - f4_ = asfloat(_e43); + u2_ = asuint(i2_); + u3_ = asuint(i3_); + u4_ = asuint(i4_); + i2_ = asint(u2_); + i3_ = asint(u3_); + i4_ = asint(u4_); + f2_ = asfloat(i2_); + f3_ = asfloat(i3_); + f4_ = asfloat(i4_); return; } diff --git a/naga/tests/out/hlsl/bits.hlsl b/naga/tests/out/hlsl/bits.hlsl index c89eb19efe..d65abd798b 100644 --- a/naga/tests/out/hlsl/bits.hlsl +++ b/naga/tests/out/hlsl/bits.hlsl @@ -216,89 +216,43 @@ void main() i4_ = int4(_e52, _e52 >> 8, _e52 >> 16, _e52 >> 24) << 24 >> 24; uint _e54 = u; u4_ = uint4(_e54, _e54 >> 8, _e54 >> 16, _e54 >> 24) << 24 >> 24; - int _e56 = i; - int _e57 = i; - i = naga_insertBits(_e56, _e57, 5u, 10u); - int2 _e61 = i2_; - int2 _e62 = i2_; - i2_ = naga_insertBits(_e61, _e62, 5u, 10u); - int3 _e66 = i3_; - int3 _e67 = i3_; - i3_ = naga_insertBits(_e66, _e67, 5u, 10u); - int4 _e71 = i4_; - int4 _e72 = i4_; - i4_ = naga_insertBits(_e71, _e72, 5u, 10u); - uint _e76 = u; - uint _e77 = u; - u = naga_insertBits(_e76, _e77, 5u, 10u); - uint2 _e81 = u2_; - uint2 _e82 = u2_; - u2_ = naga_insertBits(_e81, _e82, 5u, 10u); - uint3 _e86 = u3_; - uint3 _e87 = u3_; - u3_ = naga_insertBits(_e86, _e87, 5u, 10u); - uint4 _e91 = u4_; - uint4 _e92 = u4_; - u4_ = naga_insertBits(_e91, _e92, 5u, 10u); - int _e96 = i; - i = naga_extractBits(_e96, 5u, 10u); - int2 _e100 = i2_; - i2_ = naga_extractBits(_e100, 5u, 10u); - int3 _e104 = i3_; - i3_ = naga_extractBits(_e104, 5u, 10u); - int4 _e108 = i4_; - i4_ = naga_extractBits(_e108, 5u, 10u); - uint _e112 = u; - u = naga_extractBits(_e112, 5u, 10u); - uint2 _e116 = u2_; - u2_ = naga_extractBits(_e116, 5u, 10u); - uint3 _e120 = u3_; - u3_ = naga_extractBits(_e120, 5u, 10u); - uint4 _e124 = u4_; - u4_ = naga_extractBits(_e124, 5u, 10u); - int _e128 = i; - i = asint(firstbitlow(_e128)); - uint2 _e130 = u2_; - u2_ = firstbitlow(_e130); - int3 _e132 = i3_; - i3_ = asint(firstbithigh(_e132)); - uint3 _e134 = u3_; - u3_ = firstbithigh(_e134); - int _e136 = i; - i = asint(firstbithigh(_e136)); - uint _e138 = u; - u = firstbithigh(_e138); - int _e140 = i; - i = asint(countbits(asuint(_e140))); - int2 _e142 = i2_; - i2_ = asint(countbits(asuint(_e142))); - int3 _e144 = i3_; - i3_ = asint(countbits(asuint(_e144))); - int4 _e146 = i4_; - i4_ = asint(countbits(asuint(_e146))); - uint _e148 = u; - u = countbits(_e148); - uint2 _e150 = u2_; - u2_ = countbits(_e150); - uint3 _e152 = u3_; - u3_ = countbits(_e152); - uint4 _e154 = u4_; - u4_ = countbits(_e154); - int _e156 = i; - i = asint(reversebits(asuint(_e156))); - int2 _e158 = i2_; - i2_ = asint(reversebits(asuint(_e158))); - int3 _e160 = i3_; - i3_ = asint(reversebits(asuint(_e160))); - int4 _e162 = i4_; - i4_ = asint(reversebits(asuint(_e162))); - uint _e164 = u; - u = reversebits(_e164); - uint2 _e166 = u2_; - u2_ = reversebits(_e166); - uint3 _e168 = u3_; - u3_ = reversebits(_e168); - uint4 _e170 = u4_; - u4_ = reversebits(_e170); + i = naga_insertBits(i, i, 5u, 10u); + i2_ = naga_insertBits(i2_, i2_, 5u, 10u); + i3_ = naga_insertBits(i3_, i3_, 5u, 10u); + i4_ = naga_insertBits(i4_, i4_, 5u, 10u); + u = naga_insertBits(u, u, 5u, 10u); + u2_ = naga_insertBits(u2_, u2_, 5u, 10u); + u3_ = naga_insertBits(u3_, u3_, 5u, 10u); + u4_ = naga_insertBits(u4_, u4_, 5u, 10u); + i = naga_extractBits(i, 5u, 10u); + i2_ = naga_extractBits(i2_, 5u, 10u); + i3_ = naga_extractBits(i3_, 5u, 10u); + i4_ = naga_extractBits(i4_, 5u, 10u); + u = naga_extractBits(u, 5u, 10u); + u2_ = naga_extractBits(u2_, 5u, 10u); + u3_ = naga_extractBits(u3_, 5u, 10u); + u4_ = naga_extractBits(u4_, 5u, 10u); + i = asint(firstbitlow(i)); + u2_ = firstbitlow(u2_); + i3_ = asint(firstbithigh(i3_)); + u3_ = firstbithigh(u3_); + i = asint(firstbithigh(i)); + u = firstbithigh(u); + i = asint(countbits(asuint(i))); + i2_ = asint(countbits(asuint(i2_))); + i3_ = asint(countbits(asuint(i3_))); + i4_ = asint(countbits(asuint(i4_))); + u = countbits(u); + u2_ = countbits(u2_); + u3_ = countbits(u3_); + u4_ = countbits(u4_); + i = asint(reversebits(asuint(i))); + i2_ = asint(reversebits(asuint(i2_))); + i3_ = asint(reversebits(asuint(i3_))); + i4_ = asint(reversebits(asuint(i4_))); + u = reversebits(u); + u2_ = reversebits(u2_); + u3_ = reversebits(u3_); + u4_ = reversebits(u4_); return; } diff --git a/naga/tests/out/hlsl/boids.hlsl b/naga/tests/out/hlsl/boids.hlsl index 22e9c6cefd..58c1557aa0 100644 --- a/naga/tests/out/hlsl/boids.hlsl +++ b/naga/tests/out/hlsl/boids.hlsl @@ -37,108 +37,56 @@ void main(uint3 global_invocation_id : SV_DispatchThreadID) if ((index >= NUM_PARTICLES)) { return; } - float2 _e8 = asfloat(particlesSrc.Load2(0+index*16+0)); - vPos = _e8; - float2 _e14 = asfloat(particlesSrc.Load2(8+index*16+0)); - vVel = _e14; + vPos = asfloat(particlesSrc.Load2(0+index*16+0)); + vVel = asfloat(particlesSrc.Load2(8+index*16+0)); bool loop_init = true; while(true) { if (!loop_init) { - uint _e91 = i; - i = (_e91 + 1u); + i = (i + 1u); } loop_init = false; - uint _e36 = i; - if ((_e36 >= NUM_PARTICLES)) { + if ((i >= NUM_PARTICLES)) { break; } - uint _e39 = i; - if ((_e39 == index)) { + if ((i == index)) { continue; } - uint _e43 = i; - float2 _e46 = asfloat(particlesSrc.Load2(0+_e43*16+0)); - pos = _e46; - uint _e49 = i; - float2 _e52 = asfloat(particlesSrc.Load2(8+_e49*16+0)); - vel = _e52; - float2 _e53 = pos; - float2 _e54 = vPos; - float _e58 = params.rule1Distance; - if ((distance(_e53, _e54) < _e58)) { - float2 _e60 = cMass; - float2 _e61 = pos; - cMass = (_e60 + _e61); - int _e63 = cMassCount; - cMassCount = (_e63 + 1); + pos = asfloat(particlesSrc.Load2(0+i*16+0)); + vel = asfloat(particlesSrc.Load2(8+i*16+0)); + if ((distance(pos, vPos) < params.rule1Distance)) { + cMass = (cMass + pos); + cMassCount = (cMassCount + 1); } - float2 _e66 = pos; - float2 _e67 = vPos; - float _e71 = params.rule2Distance; - if ((distance(_e66, _e67) < _e71)) { - float2 _e73 = colVel; - float2 _e74 = pos; - float2 _e75 = vPos; - colVel = (_e73 - (_e74 - _e75)); + if ((distance(pos, vPos) < params.rule2Distance)) { + colVel = (colVel - (pos - vPos)); } - float2 _e78 = pos; - float2 _e79 = vPos; - float _e83 = params.rule3Distance; - if ((distance(_e78, _e79) < _e83)) { - float2 _e85 = cVel; - float2 _e86 = vel; - cVel = (_e85 + _e86); - int _e88 = cVelCount; - cVelCount = (_e88 + 1); + if ((distance(pos, vPos) < params.rule3Distance)) { + cVel = (cVel + vel); + cVelCount = (cVelCount + 1); } } - int _e94 = cMassCount; - if ((_e94 > 0)) { - float2 _e97 = cMass; - int _e98 = cMassCount; - float2 _e102 = vPos; - cMass = ((_e97 / (float(_e98)).xx) - _e102); + if ((cMassCount > 0)) { + cMass = ((cMass / (float(cMassCount)).xx) - vPos); } - int _e104 = cVelCount; - if ((_e104 > 0)) { - float2 _e107 = cVel; - int _e108 = cVelCount; - cVel = (_e107 / (float(_e108)).xx); + if ((cVelCount > 0)) { + cVel = (cVel / (float(cVelCount)).xx); } - float2 _e112 = vVel; - float2 _e113 = cMass; - float _e116 = params.rule1Scale; - float2 _e119 = colVel; - float _e122 = params.rule2Scale; - float2 _e125 = cVel; - float _e128 = params.rule3Scale; - vVel = (((_e112 + (_e113 * _e116)) + (_e119 * _e122)) + (_e125 * _e128)); - float2 _e131 = vVel; - float2 _e133 = vVel; - vVel = (normalize(_e131) * clamp(length(_e133), 0.0, 0.1)); - float2 _e139 = vPos; - float2 _e140 = vVel; - float _e143 = params.deltaT; - vPos = (_e139 + (_e140 * _e143)); - float _e147 = vPos.x; - if ((_e147 < -1.0)) { + vVel = (((vVel + (cMass * params.rule1Scale)) + (colVel * params.rule2Scale)) + (cVel * params.rule3Scale)); + vVel = (normalize(vVel) * clamp(length(vVel), 0.0, 0.1)); + vPos = (vPos + (vVel * params.deltaT)); + if ((vPos.x < -1.0)) { vPos.x = 1.0; } - float _e153 = vPos.x; - if ((_e153 > 1.0)) { + if ((vPos.x > 1.0)) { vPos.x = -1.0; } - float _e159 = vPos.y; - if ((_e159 < -1.0)) { + if ((vPos.y < -1.0)) { vPos.y = 1.0; } - float _e165 = vPos.y; - if ((_e165 > 1.0)) { + if ((vPos.y > 1.0)) { vPos.y = -1.0; } - float2 _e174 = vPos; - particlesDst.Store2(0+index*16+0, asuint(_e174)); - float2 _e179 = vVel; - particlesDst.Store2(8+index*16+0, asuint(_e179)); + particlesDst.Store2(0+index*16+0, asuint(vPos)); + particlesDst.Store2(8+index*16+0, asuint(vVel)); return; } diff --git a/naga/tests/out/hlsl/break-if.hlsl b/naga/tests/out/hlsl/break-if.hlsl index 63a0185583..52fb9cb5e6 100644 --- a/naga/tests/out/hlsl/break-if.hlsl +++ b/naga/tests/out/hlsl/break-if.hlsl @@ -21,10 +21,8 @@ void breakIfEmptyBody(bool a) while(true) { if (!loop_init_1) { b = a; - bool _e2 = b; - c = (a != _e2); - bool _e5 = c; - if ((a == _e5)) { + c = (a != b); + if ((a == c)) { break; } } @@ -41,15 +39,13 @@ void breakIf(bool a_1) bool loop_init_2 = true; while(true) { if (!loop_init_2) { - bool _e5 = e; - if ((a_1 == _e5)) { + if ((a_1 == e)) { break; } } loop_init_2 = false; d = a_1; - bool _e2 = d; - e = (a_1 != _e2); + e = (a_1 != d); } return; } @@ -61,14 +57,12 @@ void breakIfSeparateVariable() bool loop_init_3 = true; while(true) { if (!loop_init_3) { - uint _e5 = counter; - if ((_e5 == 5u)) { + if ((counter == 5u)) { break; } } loop_init_3 = false; - uint _e3 = counter; - counter = (_e3 + 1u); + counter = (counter + 1u); } return; } diff --git a/naga/tests/out/hlsl/collatz.hlsl b/naga/tests/out/hlsl/collatz.hlsl index b00586aa4c..4536256975 100644 --- a/naga/tests/out/hlsl/collatz.hlsl +++ b/naga/tests/out/hlsl/collatz.hlsl @@ -7,33 +7,26 @@ uint collatz_iterations(uint n_base) n = n_base; while(true) { - uint _e4 = n; - if ((_e4 > 1u)) { + if ((n > 1u)) { } else { break; } { - uint _e7 = n; - if (((_e7 % 2u) == 0u)) { - uint _e12 = n; - n = (_e12 / 2u); + if (((n % 2u) == 0u)) { + n = (n / 2u); } else { - uint _e16 = n; - n = ((3u * _e16) + 1u); + n = ((3u * n) + 1u); } - uint _e20 = i; - i = (_e20 + 1u); + i = (i + 1u); } } - uint _e23 = i; - return _e23; + return i; } [numthreads(1, 1, 1)] void main(uint3 global_id : SV_DispatchThreadID) { - uint _e9 = asuint(v_indices.Load(global_id.x*4+0)); - const uint _e10 = collatz_iterations(_e9); + const uint _e10 = collatz_iterations(asuint(v_indices.Load(global_id.x*4+0))); v_indices.Store(global_id.x*4+0, asuint(_e10)); return; } diff --git a/naga/tests/out/hlsl/const-exprs.hlsl b/naga/tests/out/hlsl/const-exprs.hlsl index 29bec5f17a..65bdeaf4d5 100644 --- a/naga/tests/out/hlsl/const-exprs.hlsl +++ b/naga/tests/out/hlsl/const-exprs.hlsl @@ -39,15 +39,9 @@ void non_constant_initializers() int z = 70; int4 out_3 = (int4)0; - int _e2 = w; - x = _e2; - int _e4 = x; - y = _e4; - int _e8 = w; - int _e9 = x; - int _e10 = y; - int _e11 = z; - out_3 = int4(_e8, _e9, _e10, _e11); + x = w; + y = x; + out_3 = int4(w, x, y, z); return; } diff --git a/naga/tests/out/hlsl/control-flow.hlsl b/naga/tests/out/hlsl/control-flow.hlsl index 2438858a8a..f76a19a0b0 100644 --- a/naga/tests/out/hlsl/control-flow.hlsl +++ b/naga/tests/out/hlsl/control-flow.hlsl @@ -178,8 +178,7 @@ void main(uint3 global_id : SV_DispatchThreadID) do { pos = 1; } while(false); - int _e4 = pos; - switch(_e4) { + switch(pos) { case 1: { pos = 0; break; @@ -211,8 +210,7 @@ void main(uint3 global_id : SV_DispatchThreadID) break; } } - int _e11 = pos; - switch(_e11) { + switch(pos) { case 1: { pos = 0; break; diff --git a/naga/tests/out/hlsl/do-while.hlsl b/naga/tests/out/hlsl/do-while.hlsl index ca7d42e1e7..4aafc12608 100644 --- a/naga/tests/out/hlsl/do-while.hlsl +++ b/naga/tests/out/hlsl/do-while.hlsl @@ -3,8 +3,7 @@ void fb1_(inout bool cond) bool loop_init = true; while(true) { if (!loop_init) { - bool _e1 = cond; - if (!(_e1)) { + if (!(cond)) { break; } } diff --git a/naga/tests/out/hlsl/dualsource.hlsl b/naga/tests/out/hlsl/dualsource.hlsl index 6fbf8fa5c4..dd3ddfefa5 100644 --- a/naga/tests/out/hlsl/dualsource.hlsl +++ b/naga/tests/out/hlsl/dualsource.hlsl @@ -20,8 +20,6 @@ FragmentOutput main(FragmentInput_main fragmentinput_main) float4 color = float4(0.4, 0.3, 0.2, 0.1); float4 mask = float4(0.9, 0.8, 0.7, 0.6); - float4 _e13 = color; - float4 _e14 = mask; - const FragmentOutput fragmentoutput = ConstructFragmentOutput(_e13, _e14); + const FragmentOutput fragmentoutput = ConstructFragmentOutput(color, mask); return fragmentoutput; } diff --git a/naga/tests/out/hlsl/empty-global-name.hlsl b/naga/tests/out/hlsl/empty-global-name.hlsl index 64227b0bc7..1c449a94ae 100644 --- a/naga/tests/out/hlsl/empty-global-name.hlsl +++ b/naga/tests/out/hlsl/empty-global-name.hlsl @@ -6,8 +6,7 @@ RWByteAddressBuffer unnamed : register(u0); void function() { - int _e3 = asint(unnamed.Load(0)); - unnamed.Store(0, asuint((_e3 + 1))); + unnamed.Store(0, asuint((asint(unnamed.Load(0)) + 1))); return; } diff --git a/naga/tests/out/hlsl/fetch_depth.hlsl b/naga/tests/out/hlsl/fetch_depth.hlsl index 04a1f51353..3fdfb7a588 100644 --- a/naga/tests/out/hlsl/fetch_depth.hlsl +++ b/naga/tests/out/hlsl/fetch_depth.hlsl @@ -12,8 +12,7 @@ Texture2D global_2 : register(t2); void function() { - uint2 _e6 = asuint(global_1.Load2(0)); - float _e7 = global_2.Load(int3(_e6, 0)).x; + float _e7 = global_2.Load(int3(asuint(global_1.Load2(0)), 0)).x; global.Store(0, asuint((_e7).xxxx.x)); return; } diff --git a/naga/tests/out/hlsl/fragment-output.hlsl b/naga/tests/out/hlsl/fragment-output.hlsl index f1f0a82ae8..cf9ee8b289 100644 --- a/naga/tests/out/hlsl/fragment-output.hlsl +++ b/naga/tests/out/hlsl/fragment-output.hlsl @@ -26,8 +26,7 @@ FragmentOutputVec4Vec3_ main_vec4vec3_() output.vec3f = (0.0).xxx; output.vec3i = (0).xxx; output.vec3u = (0u).xxx; - FragmentOutputVec4Vec3_ _e19 = output; - const FragmentOutputVec4Vec3_ fragmentoutputvec4vec3_ = _e19; + const FragmentOutputVec4Vec3_ fragmentoutputvec4vec3_ = output; return fragmentoutputvec4vec3_; } @@ -41,7 +40,6 @@ FragmentOutputVec2Scalar main_vec2scalar() output_1.scalarf = 0.0; output_1.scalari = 0; output_1.scalaru = 0u; - FragmentOutputVec2Scalar _e16 = output_1; - const FragmentOutputVec2Scalar fragmentoutputvec2scalar = _e16; + const FragmentOutputVec2Scalar fragmentoutputvec2scalar = output_1; return fragmentoutputvec2scalar; } diff --git a/naga/tests/out/hlsl/globals.hlsl b/naga/tests/out/hlsl/globals.hlsl index d6d8eb4107..0569dc3d66 100644 --- a/naga/tests/out/hlsl/globals.hlsl +++ b/naga/tests/out/hlsl/globals.hlsl @@ -89,8 +89,7 @@ void test_msl_packed_vec3_() alignment.Store3(0, asuint((1.0).xxx)); alignment.Store(0+0, asuint(1.0)); alignment.Store(0+0, asuint(2.0)); - int _e16 = idx; - alignment.Store(_e16*4+0, asuint(3.0)); + alignment.Store(idx*4+0, asuint(3.0)); FooStruct data = ConstructFooStruct(asfloat(alignment.Load3(0)), asfloat(alignment.Load(12))); float3 l0_ = data.v3_; float2 l1_ = data.v3_.zx; @@ -120,20 +119,12 @@ void main(uint3 __local_invocation_id : SV_GroupThreadID) bool at = true; test_msl_packed_vec3_(); - float4x2 _e5 = ((float4x2)global_nested_arrays_of_matrices_4x2_[0][0]); - float4 _e10 = global_nested_arrays_of_matrices_2x4_[0][0][0]; - wg[7] = mul(_e10, _e5).x; - float3x2 _e16 = ((float3x2)global_mat); - float3 _e18 = global_vec; - wg[6] = mul(_e18, _e16).x; - float _e26 = asfloat(dummy.Load(4+8)); - wg[5] = _e26; - float _e32 = float_vecs[0].w; - wg[4] = _e32; - float _e37 = asfloat(alignment.Load(12)); - wg[3] = _e37; - float _e43 = asfloat(alignment.Load(0+0)); - wg[2] = _e43; + wg[7] = mul(global_nested_arrays_of_matrices_2x4_[0][0][0], ((float4x2)global_nested_arrays_of_matrices_4x2_[0][0])).x; + wg[6] = mul(global_vec, ((float3x2)global_mat)).x; + wg[5] = asfloat(dummy.Load(4+8)); + wg[4] = float_vecs[0].w; + wg[3] = asfloat(alignment.Load(12)); + wg[2] = asfloat(alignment.Load(0+0)); alignment.Store(12, asuint(4.0)); wg[1] = float(((NagaBufferLength(dummy) - 0) / 8)); at_1 = 2u; diff --git a/naga/tests/out/hlsl/hlsl-keyword.hlsl b/naga/tests/out/hlsl/hlsl-keyword.hlsl index 7c5f769e4d..6dcd02cf4c 100644 --- a/naga/tests/out/hlsl/hlsl-keyword.hlsl +++ b/naga/tests/out/hlsl/hlsl-keyword.hlsl @@ -2,6 +2,5 @@ float4 fs_main() : SV_Target0 { float4 Pass_ = float4(1.0, 1.0, 1.0, 1.0); - float4 _e6 = Pass_; - return _e6; + return Pass_; } diff --git a/naga/tests/out/hlsl/image.hlsl b/naga/tests/out/hlsl/image.hlsl index 84e9f6d706..0acbf737fd 100644 --- a/naga/tests/out/hlsl/image.hlsl +++ b/naga/tests/out/hlsl/image.hlsl @@ -248,73 +248,50 @@ float4 texture_sample() : SV_Target0 float2 tc = (0.5).xx; float3 tc3_ = (0.5).xxx; float4 _e9 = image_1d.Sample(sampler_reg, tc.x); - float4 _e10 = a; - a = (_e10 + _e9); + a = (a + _e9); float4 _e14 = image_2d.Sample(sampler_reg, tc); - float4 _e15 = a; - a = (_e15 + _e14); + a = (a + _e14); float4 _e19 = image_2d.Sample(sampler_reg, tc, int2(int2(3, 1))); - float4 _e20 = a; - a = (_e20 + _e19); + a = (a + _e19); float4 _e24 = image_2d.SampleLevel(sampler_reg, tc, 2.3); - float4 _e25 = a; - a = (_e25 + _e24); + a = (a + _e24); float4 _e29 = image_2d.SampleLevel(sampler_reg, tc, 2.3, int2(int2(3, 1))); - float4 _e30 = a; - a = (_e30 + _e29); + a = (a + _e29); float4 _e35 = image_2d.SampleBias(sampler_reg, tc, 2.0, int2(int2(3, 1))); - float4 _e36 = a; - a = (_e36 + _e35); + a = (a + _e35); float4 _e41 = image_2d_array.Sample(sampler_reg, float3(tc, 0u)); - float4 _e42 = a; - a = (_e42 + _e41); + a = (a + _e41); float4 _e47 = image_2d_array.Sample(sampler_reg, float3(tc, 0u), int2(int2(3, 1))); - float4 _e48 = a; - a = (_e48 + _e47); + a = (a + _e47); float4 _e53 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0u), 2.3); - float4 _e54 = a; - a = (_e54 + _e53); + a = (a + _e53); float4 _e59 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0u), 2.3, int2(int2(3, 1))); - float4 _e60 = a; - a = (_e60 + _e59); + a = (a + _e59); float4 _e66 = image_2d_array.SampleBias(sampler_reg, float3(tc, 0u), 2.0, int2(int2(3, 1))); - float4 _e67 = a; - a = (_e67 + _e66); + a = (a + _e66); float4 _e72 = image_2d_array.Sample(sampler_reg, float3(tc, 0)); - float4 _e73 = a; - a = (_e73 + _e72); + a = (a + _e72); float4 _e78 = image_2d_array.Sample(sampler_reg, float3(tc, 0), int2(int2(3, 1))); - float4 _e79 = a; - a = (_e79 + _e78); + a = (a + _e78); float4 _e84 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0), 2.3); - float4 _e85 = a; - a = (_e85 + _e84); + a = (a + _e84); float4 _e90 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0), 2.3, int2(int2(3, 1))); - float4 _e91 = a; - a = (_e91 + _e90); + a = (a + _e90); float4 _e97 = image_2d_array.SampleBias(sampler_reg, float3(tc, 0), 2.0, int2(int2(3, 1))); - float4 _e98 = a; - a = (_e98 + _e97); + a = (a + _e97); float4 _e103 = image_cube_array.Sample(sampler_reg, float4(tc3_, 0u)); - float4 _e104 = a; - a = (_e104 + _e103); + a = (a + _e103); float4 _e109 = image_cube_array.SampleLevel(sampler_reg, float4(tc3_, 0u), 2.3); - float4 _e110 = a; - a = (_e110 + _e109); + a = (a + _e109); float4 _e116 = image_cube_array.SampleBias(sampler_reg, float4(tc3_, 0u), 2.0); - float4 _e117 = a; - a = (_e117 + _e116); + a = (a + _e116); float4 _e122 = image_cube_array.Sample(sampler_reg, float4(tc3_, 0)); - float4 _e123 = a; - a = (_e123 + _e122); + a = (a + _e122); float4 _e128 = image_cube_array.SampleLevel(sampler_reg, float4(tc3_, 0), 2.3); - float4 _e129 = a; - a = (_e129 + _e128); + a = (a + _e128); float4 _e135 = image_cube_array.SampleBias(sampler_reg, float4(tc3_, 0), 2.0); - float4 _e136 = a; - a = (_e136 + _e135); - float4 _e138 = a; - return _e138; + a = (a + _e135); + return a; } float texture_sample_comparison() : SV_Target0 @@ -324,31 +301,22 @@ float texture_sample_comparison() : SV_Target0 float2 tc_1 = (0.5).xx; float3 tc3_1 = (0.5).xxx; float _e8 = image_2d_depth.SampleCmp(sampler_cmp, tc_1, 0.5); - float _e9 = a_1; - a_1 = (_e9 + _e8); + a_1 = (a_1 + _e8); float _e14 = image_2d_array_depth.SampleCmp(sampler_cmp, float3(tc_1, 0u), 0.5); - float _e15 = a_1; - a_1 = (_e15 + _e14); + a_1 = (a_1 + _e14); float _e20 = image_2d_array_depth.SampleCmp(sampler_cmp, float3(tc_1, 0), 0.5); - float _e21 = a_1; - a_1 = (_e21 + _e20); + a_1 = (a_1 + _e20); float _e25 = image_cube_depth.SampleCmp(sampler_cmp, tc3_1, 0.5); - float _e26 = a_1; - a_1 = (_e26 + _e25); + a_1 = (a_1 + _e25); float _e30 = image_2d_depth.SampleCmpLevelZero(sampler_cmp, tc_1, 0.5); - float _e31 = a_1; - a_1 = (_e31 + _e30); + a_1 = (a_1 + _e30); float _e36 = image_2d_array_depth.SampleCmpLevelZero(sampler_cmp, float3(tc_1, 0u), 0.5); - float _e37 = a_1; - a_1 = (_e37 + _e36); + a_1 = (a_1 + _e36); float _e42 = image_2d_array_depth.SampleCmpLevelZero(sampler_cmp, float3(tc_1, 0), 0.5); - float _e43 = a_1; - a_1 = (_e43 + _e42); + a_1 = (a_1 + _e42); float _e47 = image_cube_depth.SampleCmpLevelZero(sampler_cmp, tc3_1, 0.5); - float _e48 = a_1; - a_1 = (_e48 + _e47); - float _e50 = a_1; - return _e50; + a_1 = (a_1 + _e47); + return a_1; } float4 gather() : SV_Target0 diff --git a/naga/tests/out/hlsl/int64.hlsl b/naga/tests/out/hlsl/int64.hlsl index ccce279baa..c952422620 100644 --- a/naga/tests/out/hlsl/int64.hlsl +++ b/naga/tests/out/hlsl/int64.hlsl @@ -63,81 +63,32 @@ int64_t int64_function(int64_t x) { int64_t val = 20L; - int64_t _e6 = val; - val = (_e6 + (31L - 1002003004005006L)); - int64_t _e8 = val; - int64_t _e11 = val; - val = (_e11 + (_e8 + 5L)); - uint _e15 = input_uniform.val_u32_; - int64_t _e16 = val; - int64_t _e20 = val; - val = (_e20 + int64_t((_e15 + uint(_e16)))); - int _e24 = input_uniform.val_i32_; - int64_t _e25 = val; - int64_t _e29 = val; - val = (_e29 + int64_t((_e24 + int(_e25)))); - float _e33 = input_uniform.val_f32_; - int64_t _e34 = val; - int64_t _e38 = val; - val = (_e38 + int64_t((_e33 + float(_e34)))); - int64_t _e42 = input_uniform.val_i64_; - int64_t _e45 = val; - val = (_e45 + (_e42).xxx.z); - uint64_t _e49 = input_uniform.val_u64_; - int64_t _e51 = val; - val = (_e51 + _e49); - uint64_t2 _e55 = input_uniform.val_u64_2_; - int64_t _e58 = val; - val = (_e58 + _e55.y); - uint64_t3 _e62 = input_uniform.val_u64_3_; - int64_t _e65 = val; - val = (_e65 + _e62.z); - uint64_t4 _e69 = input_uniform.val_u64_4_; - int64_t _e72 = val; - val = (_e72 + _e69.w); - int64_t _e78 = input_uniform.val_i64_; - int64_t _e81 = input_storage.Load(128); - output.Store(128, (_e78 + _e81)); - int64_t2 _e87 = input_uniform.val_i64_2_; - int64_t2 _e90 = input_storage.Load(144); - output.Store(144, (_e87 + _e90)); - int64_t3 _e96 = input_uniform.val_i64_3_; - int64_t3 _e99 = input_storage.Load(160); - output.Store(160, (_e96 + _e99)); - int64_t4 _e105 = input_uniform.val_i64_4_; - int64_t4 _e108 = input_storage.Load(192); - output.Store(192, (_e105 + _e108)); - int64_t _e114[2] = Constructarray2_int64_t_(input_arrays.Load(16+0), input_arrays.Load(16+8)); + val = (val + (31L - 1002003004005006L)); + val = (val + (val + 5L)); + val = (val + int64_t((input_uniform.val_u32_ + uint(val)))); + val = (val + int64_t((input_uniform.val_i32_ + int(val)))); + val = (val + int64_t((input_uniform.val_f32_ + float(val)))); + val = (val + (input_uniform.val_i64_).xxx.z); + val = (val + input_uniform.val_u64_); + val = (val + input_uniform.val_u64_2_.y); + val = (val + input_uniform.val_u64_3_.z); + val = (val + input_uniform.val_u64_4_.w); + output.Store(128, (input_uniform.val_i64_ + input_storage.Load(128))); + output.Store(144, (input_uniform.val_i64_2_ + input_storage.Load(144))); + output.Store(160, (input_uniform.val_i64_3_ + input_storage.Load(160))); + output.Store(192, (input_uniform.val_i64_4_ + input_storage.Load(192))); { - int64_t _value2[2] = _e114; + int64_t _value2[2] = Constructarray2_int64_t_(input_arrays.Load(16+0), input_arrays.Load(16+8)); output_arrays.Store(16+0, _value2[0]); output_arrays.Store(16+8, _value2[1]); } - int64_t _e115 = val; - int64_t _e117 = val; - val = (_e117 + abs(_e115)); - int64_t _e119 = val; - int64_t _e120 = val; - int64_t _e121 = val; - int64_t _e123 = val; - val = (_e123 + clamp(_e119, _e120, _e121)); - int64_t _e125 = val; - int64_t _e127 = val; - int64_t _e130 = val; - val = (_e130 + dot((_e125).xx, (_e127).xx)); - int64_t _e132 = val; - int64_t _e133 = val; - int64_t _e135 = val; - val = (_e135 + max(_e132, _e133)); - int64_t _e137 = val; - int64_t _e138 = val; - int64_t _e140 = val; - val = (_e140 + min(_e137, _e138)); - int64_t _e142 = val; - int64_t _e144 = val; - val = (_e144 + sign(_e142)); - int64_t _e146 = val; - return _e146; + val = (val + abs(val)); + val = (val + clamp(val, val, val)); + val = (val + dot((val).xx, (val).xx)); + val = (val + max(val, val)); + val = (val + min(val, val)); + val = (val + sign(val)); + return val; } typedef uint64_t ret_Constructarray2_uint64_t_[2]; @@ -150,78 +101,31 @@ uint64_t uint64_function(uint64_t x_1) { uint64_t val_1 = 20uL; - uint64_t _e6 = val_1; - val_1 = (_e6 + (31uL + 1002003004005006uL)); - uint64_t _e8 = val_1; - uint64_t _e11 = val_1; - val_1 = (_e11 + (_e8 + 5uL)); - uint _e15 = input_uniform.val_u32_; - uint64_t _e16 = val_1; - uint64_t _e20 = val_1; - val_1 = (_e20 + uint64_t((_e15 + uint(_e16)))); - int _e24 = input_uniform.val_i32_; - uint64_t _e25 = val_1; - uint64_t _e29 = val_1; - val_1 = (_e29 + uint64_t((_e24 + int(_e25)))); - float _e33 = input_uniform.val_f32_; - uint64_t _e34 = val_1; - uint64_t _e38 = val_1; - val_1 = (_e38 + uint64_t((_e33 + float(_e34)))); - uint64_t _e42 = input_uniform.val_u64_; - uint64_t _e45 = val_1; - val_1 = (_e45 + (_e42).xxx.z); - int64_t _e49 = input_uniform.val_i64_; - uint64_t _e51 = val_1; - val_1 = (_e51 + _e49); - int64_t2 _e55 = input_uniform.val_i64_2_; - uint64_t _e58 = val_1; - val_1 = (_e58 + _e55.y); - int64_t3 _e62 = input_uniform.val_i64_3_; - uint64_t _e65 = val_1; - val_1 = (_e65 + _e62.z); - int64_t4 _e69 = input_uniform.val_i64_4_; - uint64_t _e72 = val_1; - val_1 = (_e72 + _e69.w); - uint64_t _e78 = input_uniform.val_u64_; - uint64_t _e81 = input_storage.Load(16); - output.Store(16, (_e78 + _e81)); - uint64_t2 _e87 = input_uniform.val_u64_2_; - uint64_t2 _e90 = input_storage.Load(32); - output.Store(32, (_e87 + _e90)); - uint64_t3 _e96 = input_uniform.val_u64_3_; - uint64_t3 _e99 = input_storage.Load(64); - output.Store(64, (_e96 + _e99)); - uint64_t4 _e105 = input_uniform.val_u64_4_; - uint64_t4 _e108 = input_storage.Load(96); - output.Store(96, (_e105 + _e108)); - uint64_t _e114[2] = Constructarray2_uint64_t_(input_arrays.Load(0+0), input_arrays.Load(0+8)); + val_1 = (val_1 + (31uL + 1002003004005006uL)); + val_1 = (val_1 + (val_1 + 5uL)); + val_1 = (val_1 + uint64_t((input_uniform.val_u32_ + uint(val_1)))); + val_1 = (val_1 + uint64_t((input_uniform.val_i32_ + int(val_1)))); + val_1 = (val_1 + uint64_t((input_uniform.val_f32_ + float(val_1)))); + val_1 = (val_1 + (input_uniform.val_u64_).xxx.z); + val_1 = (val_1 + input_uniform.val_i64_); + val_1 = (val_1 + input_uniform.val_i64_2_.y); + val_1 = (val_1 + input_uniform.val_i64_3_.z); + val_1 = (val_1 + input_uniform.val_i64_4_.w); + output.Store(16, (input_uniform.val_u64_ + input_storage.Load(16))); + output.Store(32, (input_uniform.val_u64_2_ + input_storage.Load(32))); + output.Store(64, (input_uniform.val_u64_3_ + input_storage.Load(64))); + output.Store(96, (input_uniform.val_u64_4_ + input_storage.Load(96))); { - uint64_t _value2[2] = _e114; + uint64_t _value2[2] = Constructarray2_uint64_t_(input_arrays.Load(0+0), input_arrays.Load(0+8)); output_arrays.Store(0+0, _value2[0]); output_arrays.Store(0+8, _value2[1]); } - uint64_t _e115 = val_1; - uint64_t _e117 = val_1; - val_1 = (_e117 + abs(_e115)); - uint64_t _e119 = val_1; - uint64_t _e120 = val_1; - uint64_t _e121 = val_1; - uint64_t _e123 = val_1; - val_1 = (_e123 + clamp(_e119, _e120, _e121)); - uint64_t _e125 = val_1; - uint64_t _e127 = val_1; - uint64_t _e130 = val_1; - val_1 = (_e130 + dot((_e125).xx, (_e127).xx)); - uint64_t _e132 = val_1; - uint64_t _e133 = val_1; - uint64_t _e135 = val_1; - val_1 = (_e135 + max(_e132, _e133)); - uint64_t _e137 = val_1; - uint64_t _e138 = val_1; - uint64_t _e140 = val_1; - val_1 = (_e140 + min(_e137, _e138)); - uint64_t _e142 = val_1; - return _e142; + val_1 = (val_1 + abs(val_1)); + val_1 = (val_1 + clamp(val_1, val_1, val_1)); + val_1 = (val_1 + dot((val_1).xx, (val_1).xx)); + val_1 = (val_1 + max(val_1, val_1)); + val_1 = (val_1 + min(val_1, val_1)); + return val_1; } [numthreads(1, 1, 1)] diff --git a/naga/tests/out/hlsl/interface.hlsl b/naga/tests/out/hlsl/interface.hlsl index 6187ca0974..36694ac402 100644 --- a/naga/tests/out/hlsl/interface.hlsl +++ b/naga/tests/out/hlsl/interface.hlsl @@ -89,6 +89,5 @@ precise float4 vertex_two_structs(Input1_ in1_, Input2_ in2_) : SV_Position { uint index = 2u; - uint _e8 = index; - return float4(float((_NagaConstants.first_vertex + in1_.index)), float((_NagaConstants.first_instance + in2_.index)), float(_e8), 0.0); + return float4(float((_NagaConstants.first_vertex + in1_.index)), float((_NagaConstants.first_instance + in2_.index)), float(index), 0.0); } diff --git a/naga/tests/out/hlsl/interpolate.hlsl b/naga/tests/out/hlsl/interpolate.hlsl index ebb6e83477..9bac5e185a 100644 --- a/naga/tests/out/hlsl/interpolate.hlsl +++ b/naga/tests/out/hlsl/interpolate.hlsl @@ -59,8 +59,7 @@ VertexOutput_vert_main vert_main() out_.perspective_centroid = 2197.0; out_.perspective_sample = 2744.0; out_.perspective_center = 2812.0; - FragmentInput _e41 = out_; - const FragmentInput fragmentinput = _e41; + const FragmentInput fragmentinput = out_; const VertexOutput_vert_main fragmentinput_1 = { fragmentinput._flat, fragmentinput.flat_first, fragmentinput.flat_either, fragmentinput._linear, fragmentinput.linear_centroid, fragmentinput.linear_sample, fragmentinput.linear_center, fragmentinput.perspective, fragmentinput.perspective_centroid, fragmentinput.perspective_sample, fragmentinput.perspective_center, fragmentinput.position }; return fragmentinput_1; } diff --git a/naga/tests/out/hlsl/interpolate_compat.hlsl b/naga/tests/out/hlsl/interpolate_compat.hlsl index 85f1bb001c..2477a9d741 100644 --- a/naga/tests/out/hlsl/interpolate_compat.hlsl +++ b/naga/tests/out/hlsl/interpolate_compat.hlsl @@ -55,8 +55,7 @@ VertexOutput_vert_main vert_main() out_.perspective_centroid = 2197.0; out_.perspective_sample = 2744.0; out_.perspective_center = 2812.0; - FragmentInput _e39 = out_; - const FragmentInput fragmentinput = _e39; + const FragmentInput fragmentinput = out_; const VertexOutput_vert_main fragmentinput_1 = { fragmentinput._flat, fragmentinput.flat_either, fragmentinput._linear, fragmentinput.linear_centroid, fragmentinput.linear_sample, fragmentinput.linear_center, fragmentinput.perspective, fragmentinput.perspective_centroid, fragmentinput.perspective_sample, fragmentinput.perspective_center, fragmentinput.position }; return fragmentinput_1; } diff --git a/naga/tests/out/hlsl/operators.hlsl b/naga/tests/out/hlsl/operators.hlsl index 7d9dc8f401..5f9b0ebe76 100644 --- a/naga/tests/out/hlsl/operators.hlsl +++ b/naga/tests/out/hlsl/operators.hlsl @@ -27,14 +27,10 @@ float2 splat_assignment() { float2 a = (2.0).xx; - float2 _e4 = a; - a = (_e4 + (1.0).xx); - float2 _e8 = a; - a = (_e8 - (3.0).xx); - float2 _e12 = a; - a = (_e12 / (4.0).xx); - float2 _e15 = a; - return _e15; + a = (a + (1.0).xx); + a = (a - (3.0).xx); + a = (a / (4.0).xx); + return a; } float3 bool_cast(float3 x) @@ -221,36 +217,20 @@ void assignment() int3 vec0_ = ZeroValueint3(); a_1 = 1; - int _e5 = a_1; - a_1 = (_e5 + 1); - int _e7 = a_1; - a_1 = (_e7 - 1); - int _e9 = a_1; - int _e10 = a_1; - a_1 = (_e10 * _e9); - int _e12 = a_1; - int _e13 = a_1; - a_1 = (_e13 / _e12); - int _e15 = a_1; - a_1 = (_e15 % 1); - int _e17 = a_1; - a_1 = (_e17 & 0); - int _e19 = a_1; - a_1 = (_e19 | 0); - int _e21 = a_1; - a_1 = (_e21 ^ 0); - int _e23 = a_1; - a_1 = (_e23 << 2u); - int _e25 = a_1; - a_1 = (_e25 >> 1u); - int _e28 = a_1; - a_1 = (_e28 + 1); - int _e31 = a_1; - a_1 = (_e31 - 1); - int _e37 = vec0_[1]; - vec0_[1] = (_e37 + 1); - int _e41 = vec0_[1]; - vec0_[1] = (_e41 - 1); + a_1 = (a_1 + 1); + a_1 = (a_1 - 1); + a_1 = (a_1 * a_1); + a_1 = (a_1 / a_1); + a_1 = (a_1 % 1); + a_1 = (a_1 & 0); + a_1 = (a_1 | 0); + a_1 = (a_1 ^ 0); + a_1 = (a_1 << 2u); + a_1 = (a_1 >> 1u); + a_1 = (a_1 + 1); + a_1 = (a_1 - 1); + vec0_[1] = (vec0_[1] + 1); + vec0_[1] = (vec0_[1] - 1); return; } diff --git a/naga/tests/out/hlsl/overrides.hlsl b/naga/tests/out/hlsl/overrides.hlsl index aae0b491bf..d54d6e6e44 100644 --- a/naga/tests/out/hlsl/overrides.hlsl +++ b/naga/tests/out/hlsl/overrides.hlsl @@ -17,8 +17,7 @@ void main() float gain_x_100_ = (float)0; x = true; - float _e9 = gain_x_10_; - gain_x_100_ = (_e9 * 10.0); + gain_x_100_ = (gain_x_10_ * 10.0); store_override = gain; return; } diff --git a/naga/tests/out/hlsl/padding.hlsl b/naga/tests/out/hlsl/padding.hlsl index 9408cb2f93..4f48baee5a 100644 --- a/naga/tests/out/hlsl/padding.hlsl +++ b/naga/tests/out/hlsl/padding.hlsl @@ -35,8 +35,5 @@ cbuffer input3_ : register(b2) { Test3_ input3_; } float4 vertex() : SV_Position { - float _e4 = input1_.b; - float _e8 = input2_.b; - float _e12 = input3_.b; - return ((((1.0).xxxx * _e4) * _e8) * _e12); + return ((((1.0).xxxx * input1_.b) * input2_.b) * input3_.b); } diff --git a/naga/tests/out/hlsl/push-constants.hlsl b/naga/tests/out/hlsl/push-constants.hlsl index 188e9e1b5f..3f0a5dce2a 100644 --- a/naga/tests/out/hlsl/push-constants.hlsl +++ b/naga/tests/out/hlsl/push-constants.hlsl @@ -21,13 +21,11 @@ struct FragmentInput_main { float4 vert_main(float2 pos : LOC0, uint ii : SV_InstanceID, uint vi : SV_VertexID) : SV_Position { - float _e8 = pc.multiplier; - return float4((((float((_NagaConstants.first_instance + ii)) * float((_NagaConstants.first_vertex + vi))) * _e8) * pos), 0.0, 1.0); + return float4((((float((_NagaConstants.first_instance + ii)) * float((_NagaConstants.first_vertex + vi))) * pc.multiplier) * pos), 0.0, 1.0); } float4 main(FragmentInput_main fragmentinput_main) : SV_Target0 { FragmentIn in_ = { fragmentinput_main.color }; - float _e4 = pc.multiplier; - return (in_.color * _e4); + return (in_.color * pc.multiplier); } diff --git a/naga/tests/out/hlsl/quad-vert.hlsl b/naga/tests/out/hlsl/quad-vert.hlsl index 20834db423..d62fddf030 100644 --- a/naga/tests/out/hlsl/quad-vert.hlsl +++ b/naga/tests/out/hlsl/quad-vert.hlsl @@ -37,8 +37,7 @@ struct VertexOutput_main { void main_1() { - float2 _e6 = a_uv_1; - v_uv = _e6; + v_uv = a_uv_1; float2 _e7 = a_pos_1; unnamed.gl_Position = float4(_e7.x, _e7.y, 0.0, 1.0); return; @@ -56,9 +55,7 @@ VertexOutput_main main(float2 a_uv : LOC1, float2 a_pos : LOC0) a_uv_1 = a_uv; a_pos_1 = a_pos; main_1(); - float2 _e7 = v_uv; - float4 _e8 = unnamed.gl_Position; - const type_4 type_4_ = Constructtype_4(_e7, _e8); + const type_4 type_4_ = Constructtype_4(v_uv, unnamed.gl_Position); const VertexOutput_main type_4_1 = { type_4_.member, type_4_.gl_Position }; return type_4_1; } diff --git a/naga/tests/out/hlsl/shadow.hlsl b/naga/tests/out/hlsl/shadow.hlsl index c0431bfef9..0672143a21 100644 --- a/naga/tests/out/hlsl/shadow.hlsl +++ b/naga/tests/out/hlsl/shadow.hlsl @@ -65,14 +65,11 @@ VertexOutput_vs_main vs_main(int4 position : LOC0, int4 normal : LOC1) VertexOutput out_ = (VertexOutput)0; float4x4 w = u_entity.world; - float4x4 _e7 = u_entity.world; - float4 world_pos = mul(float4(position), _e7); + float4 world_pos = mul(float4(position), u_entity.world); out_.world_normal = mul(float3(normal.xyz), float3x3(w[0].xyz, w[1].xyz, w[2].xyz)); out_.world_position = world_pos; - float4x4 _e26 = u_globals.view_proj; - out_.proj_position = mul(world_pos, _e26); - VertexOutput _e28 = out_; - const VertexOutput vertexoutput = _e28; + out_.proj_position = mul(world_pos, u_globals.view_proj); + const VertexOutput vertexoutput = out_; const VertexOutput_vs_main vertexoutput_1 = { vertexoutput.world_normal, vertexoutput.world_position, vertexoutput.proj_position }; return vertexoutput_1; } @@ -95,30 +92,22 @@ float4 fs_main(FragmentInput_fs_main fragmentinput_fs_main) : SV_Target0 bool loop_init = true; while(true) { if (!loop_init) { - uint _e40 = i; - i = (_e40 + 1u); + i = (i + 1u); } loop_init = false; - uint _e7 = i; - uint _e11 = u_globals.num_lights.x; - if ((_e7 < min(_e11, c_max_lights))) { + if ((i < min(u_globals.num_lights.x, c_max_lights))) { } else { break; } { - uint _e16 = i; - Light light = ConstructLight(float4x4(asfloat(s_lights.Load4(_e16*96+0+0)), asfloat(s_lights.Load4(_e16*96+0+16)), asfloat(s_lights.Load4(_e16*96+0+32)), asfloat(s_lights.Load4(_e16*96+0+48))), asfloat(s_lights.Load4(_e16*96+64)), asfloat(s_lights.Load4(_e16*96+80))); - uint _e19 = i; - const float _e23 = fetch_shadow(_e19, mul(in_.world_position, light.proj)); + Light light = ConstructLight(float4x4(asfloat(s_lights.Load4(i*96+0+0)), asfloat(s_lights.Load4(i*96+0+16)), asfloat(s_lights.Load4(i*96+0+32)), asfloat(s_lights.Load4(i*96+0+48))), asfloat(s_lights.Load4(i*96+64)), asfloat(s_lights.Load4(i*96+80))); + const float _e23 = fetch_shadow(i, mul(in_.world_position, light.proj)); float3 light_dir = normalize((light.pos.xyz - in_.world_position.xyz)); float diffuse = max(0.0, dot(normal_1, light_dir)); - float3 _e37 = color; - color = (_e37 + ((_e23 * diffuse) * light.color.xyz)); + color = (color + ((_e23 * diffuse) * light.color.xyz)); } } - float3 _e42 = color; - float4 _e47 = u_entity.color; - return (float4(_e42, 1.0) * _e47); + return (float4(color, 1.0) * u_entity.color); } float4 fs_main_without_storage(FragmentInput_fs_main_without_storage fragmentinput_fs_main_without_storage) : SV_Target0 @@ -131,28 +120,20 @@ float4 fs_main_without_storage(FragmentInput_fs_main_without_storage fragmentinp bool loop_init_1 = true; while(true) { if (!loop_init_1) { - uint _e40 = i_1; - i_1 = (_e40 + 1u); + i_1 = (i_1 + 1u); } loop_init_1 = false; - uint _e7 = i_1; - uint _e11 = u_globals.num_lights.x; - if ((_e7 < min(_e11, c_max_lights))) { + if ((i_1 < min(u_globals.num_lights.x, c_max_lights))) { } else { break; } { - uint _e16 = i_1; - Light light_1 = u_lights[_e16]; - uint _e19 = i_1; - const float _e23 = fetch_shadow(_e19, mul(in_1.world_position, light_1.proj)); + Light light_1 = u_lights[i_1]; + const float _e23 = fetch_shadow(i_1, mul(in_1.world_position, light_1.proj)); float3 light_dir_1 = normalize((light_1.pos.xyz - in_1.world_position.xyz)); float diffuse_1 = max(0.0, dot(normal_2, light_dir_1)); - float3 _e37 = color_1; - color_1 = (_e37 + ((_e23 * diffuse_1) * light_1.color.xyz)); + color_1 = (color_1 + ((_e23 * diffuse_1) * light_1.color.xyz)); } } - float3 _e42 = color_1; - float4 _e47 = u_entity.color; - return (float4(_e42, 1.0) * _e47); + return (float4(color_1, 1.0) * u_entity.color); } diff --git a/naga/tests/out/hlsl/skybox.hlsl b/naga/tests/out/hlsl/skybox.hlsl index f33cc461a2..5c812e4390 100644 --- a/naga/tests/out/hlsl/skybox.hlsl +++ b/naga/tests/out/hlsl/skybox.hlsl @@ -43,15 +43,9 @@ VertexOutput_vs_main vs_main(uint vertex_index : SV_VertexID) tmp1_ = (int((_NagaConstants.first_vertex + vertex_index)) / 2); tmp2_ = (int((_NagaConstants.first_vertex + vertex_index)) & 1); - int _e9 = tmp1_; - int _e15 = tmp2_; - float4 pos = float4(((float(_e9) * 4.0) - 1.0), ((float(_e15) * 4.0) - 1.0), 0.0, 1.0); - float4 _e27 = r_data.view[0]; - float4 _e32 = r_data.view[1]; - float4 _e37 = r_data.view[2]; - float3x3 inv_model_view = transpose(float3x3(_e27.xyz, _e32.xyz, _e37.xyz)); - float4x4 _e43 = r_data.proj_inv; - float4 unprojected = mul(pos, _e43); + float4 pos = float4(((float(tmp1_) * 4.0) - 1.0), ((float(tmp2_) * 4.0) - 1.0), 0.0, 1.0); + float3x3 inv_model_view = transpose(float3x3(r_data.view[0].xyz, r_data.view[1].xyz, r_data.view[2].xyz)); + float4 unprojected = mul(pos, r_data.proj_inv); const VertexOutput vertexoutput = ConstructVertexOutput(pos, mul(unprojected.xyz, inv_model_view)); const VertexOutput_vs_main vertexoutput_1 = { vertexoutput.uv, vertexoutput.position }; return vertexoutput_1; diff --git a/naga/tests/out/hlsl/standard.hlsl b/naga/tests/out/hlsl/standard.hlsl index 88ba1d14b0..87ddf2b9c3 100644 --- a/naga/tests/out/hlsl/standard.hlsl +++ b/naga/tests/out/hlsl/standard.hlsl @@ -33,8 +33,5 @@ float4 derivatives(FragmentInput_derivatives fragmentinput_derivatives) : SV_Tar float4 _e12 = fwidth(foo); z = _e12; const bool _e13 = test_any_and_all_for_bool(); - float4 _e14 = x; - float4 _e15 = y; - float4 _e17 = z; - return ((_e14 + _e15) * _e17); + return ((x + y) * z); } diff --git a/naga/tests/out/hlsl/struct-layout.hlsl b/naga/tests/out/hlsl/struct-layout.hlsl index 59f046ded6..7d9cb6cf11 100644 --- a/naga/tests/out/hlsl/struct-layout.hlsl +++ b/naga/tests/out/hlsl/struct-layout.hlsl @@ -48,10 +48,8 @@ void no_padding_comp() { NoPadding x = (NoPadding)0; - NoPadding _e2 = no_padding_uniform; - x = _e2; - NoPadding _e4 = ConstructNoPadding(asfloat(no_padding_storage.Load3(0)), asfloat(no_padding_storage.Load(12))); - x = _e4; + x = no_padding_uniform; + x = ConstructNoPadding(asfloat(no_padding_storage.Load3(0)), asfloat(no_padding_storage.Load(12))); return; } @@ -79,9 +77,7 @@ void needs_padding_comp() { NeedsPadding x_1 = (NeedsPadding)0; - NeedsPadding _e2 = needs_padding_uniform; - x_1 = _e2; - NeedsPadding _e4 = ConstructNeedsPadding(asfloat(needs_padding_storage.Load(0)), asfloat(needs_padding_storage.Load3(16)), asfloat(needs_padding_storage.Load(28))); - x_1 = _e4; + x_1 = needs_padding_uniform; + x_1 = ConstructNeedsPadding(asfloat(needs_padding_storage.Load(0)), asfloat(needs_padding_storage.Load3(16)), asfloat(needs_padding_storage.Load(28))); return; } diff --git a/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl b/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl index 6564f71f72..78262841c6 100644 --- a/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl +++ b/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl @@ -34,8 +34,6 @@ float4 main(uint param : SV_VertexID) : SV_Position { global_1 = int(param); function(); - float _e6 = global.member.y; - global.member.y = -(_e6); - float4 _e8 = global.member; - return _e8; + global.member.y = -(global.member.y); + return global.member; } diff --git a/naga/tests/out/hlsl/workgroup-var-init.hlsl b/naga/tests/out/hlsl/workgroup-var-init.hlsl index 49b4fe621a..5dbabc4581 100644 --- a/naga/tests/out/hlsl/workgroup-var-init.hlsl +++ b/naga/tests/out/hlsl/workgroup-var-init.hlsl @@ -14,9 +14,8 @@ void main(uint3 __local_invocation_id : SV_GroupThreadID) w_mem = (WStruct)0; } GroupMemoryBarrierWithGroupSync(); - uint _e3[512] = w_mem.arr; { - uint _value2[512] = _e3; + uint _value2[512] = w_mem.arr; output.Store(0, asuint(_value2[0])); output.Store(4, asuint(_value2[1])); output.Store(8, asuint(_value2[2])); diff --git a/naga/tests/out/msl/6438-conflicting-idents.msl b/naga/tests/out/msl/6438-conflicting-idents.msl index 596ebad402..c6bbf1e0e0 100644 --- a/naga/tests/out/msl/6438-conflicting-idents.msl +++ b/naga/tests/out/msl/6438-conflicting-idents.msl @@ -22,8 +22,7 @@ vertex vsOutput_1 vs( const auto xy = varyings.xy; OurVertexShaderOutput vsOutput = {}; vsOutput.position = metal::float4(xy, 0.0, 1.0); - OurVertexShaderOutput _e6 = vsOutput; - const auto _tmp = _e6; + const auto _tmp = vsOutput; return vsOutput_1 { _tmp.position, _tmp.texcoord }; } diff --git a/naga/tests/out/msl/abstract-types-operators.msl b/naga/tests/out/msl/abstract-types-operators.msl index f273b06610..df157a5873 100644 --- a/naga/tests/out/msl/abstract-types-operators.msl +++ b/naga/tests/out/msl/abstract-types-operators.msl @@ -53,31 +53,17 @@ void runtime_values( uint plus_uai_u = {}; uint plus_u_uai = {}; uint plus_u_u_u = {}; - float _e8 = f; - plus_faf_f = 1.0 + _e8; - float _e14 = f; - plus_fai_f = 1.0 + _e14; - float _e18 = f; - plus_f_faf = _e18 + 2.0; - float _e22 = f; - plus_f_fai = _e22 + 2.0; - float _e26 = f; - float _e27 = f; - plus_f_f_f = _e26 + _e27; - int _e31 = i; - plus_iai_i = 1 + _e31; - int _e35 = i; - plus_i_iai = _e35 + 2; - int _e39 = i; - int _e40 = i; - plus_i_i_i = _e39 + _e40; - uint _e44 = u; - plus_uai_u = 1u + _e44; - uint _e48 = u; - plus_u_uai = _e48 + 2u; - uint _e52 = u; - uint _e53 = u; - plus_u_u_u = _e52 + _e53; + plus_faf_f = 1.0 + f; + plus_fai_f = 1.0 + f; + plus_f_faf = f + 2.0; + plus_f_fai = f + 2.0; + plus_f_f_f = f + f; + plus_iai_i = 1 + i; + plus_i_iai = i + 2; + plus_i_i_i = i + i; + plus_uai_u = 1u + u; + plus_u_uai = u + 2u; + plus_u_u_u = u + u; return; } diff --git a/naga/tests/out/msl/abstract-types-var.msl b/naga/tests/out/msl/abstract-types-var.msl index 7d5623469b..915d8d3e65 100644 --- a/naga/tests/out/msl/abstract-types-var.msl +++ b/naga/tests/out/msl/abstract-types-var.msl @@ -73,45 +73,25 @@ void mixed_constant_and_runtime_arguments( type_7 xafpai_f = {}; type_8 xaip_iai = {}; type_8 xaipai_i = {}; - uint _e3 = u; - xvupuai_1 = metal::uint2(_e3, 43u); - uint _e7 = u; - xvupaiu_1 = metal::uint2(42u, _e7); - uint _e11 = u; - xvuuai_1 = metal::uint2(_e11, 43u); - uint _e15 = u; - xvuaiu_1 = metal::uint2(42u, _e15); - float _e19 = f; - xmfp_faiaiai_1 = metal::float2x2(metal::float2(_e19, 2.0), metal::float2(3.0, 4.0)); - float _e27 = f; - xmfpai_faiai_1 = metal::float2x2(metal::float2(1.0, _e27), metal::float2(3.0, 4.0)); - float _e35 = f; - xmfpaiai_fai_1 = metal::float2x2(metal::float2(1.0, 2.0), metal::float2(_e35, 4.0)); - float _e43 = f; - xmfpaiaiai_f_1 = metal::float2x2(metal::float2(1.0, 2.0), metal::float2(3.0, _e43)); - float _e51 = f; - xaf_faf_1 = type_7 {_e51, 2.0}; - float _e55 = f; - xafaf_f_1 = type_7 {1.0, _e55}; - float _e59 = f; - xaf_fai = type_7 {_e59, 2.0}; - float _e63 = f; - xafai_f = type_7 {1.0, _e63}; - int _e67 = i; - xai_iai_1 = type_8 {_e67, 2}; - int _e71 = i; - xaiai_i_1 = type_8 {1, _e71}; - float _e75 = f; - xafp_faf = type_7 {_e75, 2.0}; - float _e79 = f; - xafpaf_f = type_7 {1.0, _e79}; - float _e83 = f; - xafp_fai = type_7 {_e83, 2.0}; - float _e87 = f; - xafpai_f = type_7 {1.0, _e87}; - int _e91 = i; - xaip_iai = type_8 {_e91, 2}; - int _e95 = i; - xaipai_i = type_8 {1, _e95}; + xvupuai_1 = metal::uint2(u, 43u); + xvupaiu_1 = metal::uint2(42u, u); + xvuuai_1 = metal::uint2(u, 43u); + xvuaiu_1 = metal::uint2(42u, u); + xmfp_faiaiai_1 = metal::float2x2(metal::float2(f, 2.0), metal::float2(3.0, 4.0)); + xmfpai_faiai_1 = metal::float2x2(metal::float2(1.0, f), metal::float2(3.0, 4.0)); + xmfpaiai_fai_1 = metal::float2x2(metal::float2(1.0, 2.0), metal::float2(f, 4.0)); + xmfpaiaiai_f_1 = metal::float2x2(metal::float2(1.0, 2.0), metal::float2(3.0, f)); + xaf_faf_1 = type_7 {f, 2.0}; + xafaf_f_1 = type_7 {1.0, f}; + xaf_fai = type_7 {f, 2.0}; + xafai_f = type_7 {1.0, f}; + xai_iai_1 = type_8 {i, 2}; + xaiai_i_1 = type_8 {1, i}; + xafp_faf = type_7 {f, 2.0}; + xafpaf_f = type_7 {1.0, f}; + xafp_fai = type_7 {f, 2.0}; + xafpai_f = type_7 {1.0, f}; + xaip_iai = type_8 {i, 2}; + xaipai_i = type_8 {1, i}; return; } diff --git a/naga/tests/out/msl/access.msl b/naga/tests/out/msl/access.msl index 2103a8d099..9f0b6ecb7e 100644 --- a/naga/tests/out/msl/access.msl +++ b/naga/tests/out/msl/access.msl @@ -69,34 +69,22 @@ void test_matrix_within_struct_accesses( ) { int idx = 1; Baz t = Baz {metal::float3x2(metal::float2(1.0), metal::float2(2.0), metal::float2(3.0))}; - int _e3 = idx; - idx = _e3 - 1; + idx = idx - 1; metal::float3x2 l0_ = baz.m; metal::float2 l1_ = baz.m[0]; - int _e14 = idx; - metal::float2 l2_ = baz.m[_e14]; + metal::float2 l2_ = baz.m[idx]; float l3_ = baz.m[0].y; - int _e25 = idx; - float l4_ = baz.m[0][_e25]; - int _e30 = idx; - float l5_ = baz.m[_e30].y; - int _e36 = idx; - int _e38 = idx; - float l6_ = baz.m[_e36][_e38]; - int _e51 = idx; - idx = _e51 + 1; + float l4_ = baz.m[0][idx]; + float l5_ = baz.m[idx].y; + float l6_ = baz.m[idx][idx]; + idx = idx + 1; t.m = metal::float3x2(metal::float2(6.0), metal::float2(5.0), metal::float2(4.0)); t.m[0] = metal::float2(9.0); - int _e66 = idx; - t.m[_e66] = metal::float2(90.0); + t.m[idx] = metal::float2(90.0); t.m[0].y = 10.0; - int _e76 = idx; - t.m[0][_e76] = 20.0; - int _e80 = idx; - t.m[_e80].y = 30.0; - int _e85 = idx; - int _e87 = idx; - t.m[_e85][_e87] = 40.0; + t.m[0][idx] = 20.0; + t.m[idx].y = 30.0; + t.m[idx][idx] = 40.0; return; } @@ -105,44 +93,31 @@ void test_matrix_within_array_within_struct_accesses( ) { int idx_1 = 1; MatCx2InArray t_1 = MatCx2InArray {type_15 {}}; - int _e3 = idx_1; - idx_1 = _e3 - 1; + idx_1 = idx_1 - 1; type_15 l0_1 = nested_mat_cx2_.am; metal::float4x2 l1_1 = nested_mat_cx2_.am.inner[0]; metal::float2 l2_1 = nested_mat_cx2_.am.inner[0][0]; - int _e20 = idx_1; - metal::float2 l3_1 = nested_mat_cx2_.am.inner[0][_e20]; + metal::float2 l3_1 = nested_mat_cx2_.am.inner[0][idx_1]; float l4_1 = nested_mat_cx2_.am.inner[0][0].y; - int _e33 = idx_1; - float l5_1 = nested_mat_cx2_.am.inner[0][0][_e33]; - int _e39 = idx_1; - float l6_1 = nested_mat_cx2_.am.inner[0][_e39].y; - int _e46 = idx_1; - int _e48 = idx_1; - float l7_ = nested_mat_cx2_.am.inner[0][_e46][_e48]; - int _e55 = idx_1; - idx_1 = _e55 + 1; + float l5_1 = nested_mat_cx2_.am.inner[0][0][idx_1]; + float l6_1 = nested_mat_cx2_.am.inner[0][idx_1].y; + float l7_ = nested_mat_cx2_.am.inner[0][idx_1][idx_1]; + idx_1 = idx_1 + 1; t_1.am = type_15 {}; t_1.am.inner[0] = metal::float4x2(metal::float2(8.0), metal::float2(7.0), metal::float2(6.0), metal::float2(5.0)); t_1.am.inner[0][0] = metal::float2(9.0); - int _e77 = idx_1; - t_1.am.inner[0][_e77] = metal::float2(90.0); + t_1.am.inner[0][idx_1] = metal::float2(90.0); t_1.am.inner[0][0].y = 10.0; - int _e89 = idx_1; - t_1.am.inner[0][0][_e89] = 20.0; - int _e94 = idx_1; - t_1.am.inner[0][_e94].y = 30.0; - int _e100 = idx_1; - int _e102 = idx_1; - t_1.am.inner[0][_e100][_e102] = 40.0; + t_1.am.inner[0][0][idx_1] = 20.0; + t_1.am.inner[0][idx_1].y = 30.0; + t_1.am.inner[0][idx_1][idx_1] = 40.0; return; } float read_from_private( thread float& foo_1 ) { - float _e1 = foo_1; - return _e1; + return foo_1; } float test_arr_as_arg( @@ -168,8 +143,7 @@ void assign_array_through_ptr_fn( uint fetch_arg_ptr_member( thread AssignToMember& p_1 ) { - uint _e2 = p_1.x; - return _e2; + return p_1.x; } void assign_to_arg_ptr_member( @@ -182,8 +156,7 @@ void assign_to_arg_ptr_member( uint fetch_arg_ptr_array_element( thread type_25& p_3 ) { - uint _e2 = p_3.inner[1]; - return _e2; + return p_3.inner[1]; } void assign_to_arg_ptr_array_element( diff --git a/naga/tests/out/msl/atomicCompareExchange.msl b/naga/tests/out/msl/atomicCompareExchange.msl index 6655fad7e2..0ffa0d2755 100644 --- a/naga/tests/out/msl/atomicCompareExchange.msl +++ b/naga/tests/out/msl/atomicCompareExchange.msl @@ -79,32 +79,24 @@ kernel void test_atomic_compare_exchange_i32_( bool loop_init = true; while(true) { if (!loop_init) { - uint _e27 = i; - i = _e27 + 1u; + i = i + 1u; } loop_init = false; - uint _e2 = i; - if (_e2 < SIZE) { + if (i < SIZE) { } else { break; } { - uint _e6 = i; - int _e8 = metal::atomic_load_explicit(&arr_i32_.inner[_e6], metal::memory_order_relaxed); - old = _e8; + old = metal::atomic_load_explicit(&arr_i32_.inner[i], metal::memory_order_relaxed); exchanged = false; while(true) { - bool _e12 = exchanged; - if (!(_e12)) { + if (!(exchanged)) { } else { break; } { - int _e14 = old; - int new_ = as_type(as_type(_e14) + 1.0); - uint _e20 = i; - int _e22 = old; - _atomic_compare_exchange_resultSint4_ _e23 = naga_atomic_compare_exchange_weak_explicit(&arr_i32_.inner[_e20], _e22, new_); + int new_ = as_type(as_type(old) + 1.0); + _atomic_compare_exchange_resultSint4_ _e23 = naga_atomic_compare_exchange_weak_explicit(&arr_i32_.inner[i], old, new_); old = _e23.old_value; exchanged = _e23.exchanged; } @@ -127,32 +119,24 @@ kernel void test_atomic_compare_exchange_u32_( bool loop_init_1 = true; while(true) { if (!loop_init_1) { - uint _e27 = i_1; - i_1 = _e27 + 1u; + i_1 = i_1 + 1u; } loop_init_1 = false; - uint _e2 = i_1; - if (_e2 < SIZE) { + if (i_1 < SIZE) { } else { break; } { - uint _e6 = i_1; - uint _e8 = metal::atomic_load_explicit(&arr_u32_.inner[_e6], metal::memory_order_relaxed); - old_1 = _e8; + old_1 = metal::atomic_load_explicit(&arr_u32_.inner[i_1], metal::memory_order_relaxed); exchanged_1 = false; while(true) { - bool _e12 = exchanged_1; - if (!(_e12)) { + if (!(exchanged_1)) { } else { break; } { - uint _e14 = old_1; - uint new_1 = as_type(as_type(_e14) + 1.0); - uint _e20 = i_1; - uint _e22 = old_1; - _atomic_compare_exchange_resultUint4_ _e23 = naga_atomic_compare_exchange_weak_explicit(&arr_u32_.inner[_e20], _e22, new_1); + uint new_1 = as_type(as_type(old_1) + 1.0); + _atomic_compare_exchange_resultUint4_ _e23 = naga_atomic_compare_exchange_weak_explicit(&arr_u32_.inner[i_1], old_1, new_1); old_1 = _e23.old_value; exchanged_1 = _e23.exchanged; } diff --git a/naga/tests/out/msl/atomicOps-int64-min-max.msl b/naga/tests/out/msl/atomicOps-int64-min-max.msl index f69a2a49bd..32092962ee 100644 --- a/naga/tests/out/msl/atomicOps-int64-min-max.msl +++ b/naga/tests/out/msl/atomicOps-int64-min-max.msl @@ -21,17 +21,13 @@ kernel void cs_main( , device Struct& storage_struct [[user(fake0)]] , constant ulong& input [[user(fake0)]] ) { - ulong _e3 = input; - metal::atomic_max_explicit(&storage_atomic_scalar, _e3, metal::memory_order_relaxed); - ulong _e7 = input; - metal::atomic_max_explicit(&storage_atomic_arr.inner[1], 1uL + _e7, metal::memory_order_relaxed); + metal::atomic_max_explicit(&storage_atomic_scalar, input, metal::memory_order_relaxed); + metal::atomic_max_explicit(&storage_atomic_arr.inner[1], 1uL + input, metal::memory_order_relaxed); metal::atomic_max_explicit(&storage_struct.atomic_scalar, 1uL, metal::memory_order_relaxed); metal::atomic_max_explicit(&storage_struct.atomic_arr.inner[1], static_cast(id.x), metal::memory_order_relaxed); metal::threadgroup_barrier(metal::mem_flags::mem_threadgroup); - ulong _e20 = input; - metal::atomic_min_explicit(&storage_atomic_scalar, _e20, metal::memory_order_relaxed); - ulong _e24 = input; - metal::atomic_min_explicit(&storage_atomic_arr.inner[1], 1uL + _e24, metal::memory_order_relaxed); + metal::atomic_min_explicit(&storage_atomic_scalar, input, metal::memory_order_relaxed); + metal::atomic_min_explicit(&storage_atomic_arr.inner[1], 1uL + input, metal::memory_order_relaxed); metal::atomic_min_explicit(&storage_struct.atomic_scalar, 1uL, metal::memory_order_relaxed); metal::atomic_min_explicit(&storage_struct.atomic_arr.inner[1], static_cast(id.x), metal::memory_order_relaxed); return; diff --git a/naga/tests/out/msl/binding-arrays.msl b/naga/tests/out/msl/binding-arrays.msl index 75f787a9f2..09f050a59c 100644 --- a/naga/tests/out/msl/binding-arrays.msl +++ b/naga/tests/out/msl/binding-arrays.msl @@ -44,121 +44,75 @@ fragment main_Output main_( uint non_uniform_index = fragment_in.index; metal::float2 uv = metal::float2(0.0); metal::int2 pix = metal::int2(0); - metal::uint2 _e22 = u2_; - u2_ = _e22 + metal::uint2(texture_array_unbounded[0].get_width(), texture_array_unbounded[0].get_height()); - metal::uint2 _e27 = u2_; - u2_ = _e27 + metal::uint2(texture_array_unbounded[uniform_index].get_width(), texture_array_unbounded[uniform_index].get_height()); - metal::uint2 _e32 = u2_; - u2_ = _e32 + metal::uint2(texture_array_unbounded[non_uniform_index].get_width(), texture_array_unbounded[non_uniform_index].get_height()); + u2_ = u2_ + metal::uint2(texture_array_unbounded[0].get_width(), texture_array_unbounded[0].get_height()); + u2_ = u2_ + metal::uint2(texture_array_unbounded[uniform_index].get_width(), texture_array_unbounded[uniform_index].get_height()); + u2_ = u2_ + metal::uint2(texture_array_unbounded[non_uniform_index].get_width(), texture_array_unbounded[non_uniform_index].get_height()); metal::float4 _e38 = texture_array_bounded[0].gather(samp[0], uv); - metal::float4 _e39 = v4_; - v4_ = _e39 + _e38; + v4_ = v4_ + _e38; metal::float4 _e45 = texture_array_bounded[uniform_index].gather(samp[uniform_index], uv); - metal::float4 _e46 = v4_; - v4_ = _e46 + _e45; + v4_ = v4_ + _e45; metal::float4 _e52 = texture_array_bounded[non_uniform_index].gather(samp[non_uniform_index], uv); - metal::float4 _e53 = v4_; - v4_ = _e53 + _e52; + v4_ = v4_ + _e52; metal::float4 _e60 = texture_array_depth[0].gather_compare(samp_comp[0], uv, 0.0); - metal::float4 _e61 = v4_; - v4_ = _e61 + _e60; + v4_ = v4_ + _e60; metal::float4 _e68 = texture_array_depth[uniform_index].gather_compare(samp_comp[uniform_index], uv, 0.0); - metal::float4 _e69 = v4_; - v4_ = _e69 + _e68; + v4_ = v4_ + _e68; metal::float4 _e76 = texture_array_depth[non_uniform_index].gather_compare(samp_comp[non_uniform_index], uv, 0.0); - metal::float4 _e77 = v4_; - v4_ = _e77 + _e76; + v4_ = v4_ + _e76; metal::float4 _e82 = (uint(0) < texture_array_unbounded[0].get_num_mip_levels() && metal::all(metal::uint2(pix) < metal::uint2(texture_array_unbounded[0].get_width(0), texture_array_unbounded[0].get_height(0))) ? texture_array_unbounded[0].read(metal::uint2(pix), 0): DefaultConstructible()); - metal::float4 _e83 = v4_; - v4_ = _e83 + _e82; + v4_ = v4_ + _e82; metal::float4 _e88 = (uint(0) < texture_array_unbounded[uniform_index].get_num_mip_levels() && metal::all(metal::uint2(pix) < metal::uint2(texture_array_unbounded[uniform_index].get_width(0), texture_array_unbounded[uniform_index].get_height(0))) ? texture_array_unbounded[uniform_index].read(metal::uint2(pix), 0): DefaultConstructible()); - metal::float4 _e89 = v4_; - v4_ = _e89 + _e88; + v4_ = v4_ + _e88; metal::float4 _e94 = (uint(0) < texture_array_unbounded[non_uniform_index].get_num_mip_levels() && metal::all(metal::uint2(pix) < metal::uint2(texture_array_unbounded[non_uniform_index].get_width(0), texture_array_unbounded[non_uniform_index].get_height(0))) ? texture_array_unbounded[non_uniform_index].read(metal::uint2(pix), 0): DefaultConstructible()); - metal::float4 _e95 = v4_; - v4_ = _e95 + _e94; - uint _e100 = u1_; - u1_ = _e100 + texture_array_2darray[0].get_array_size(); - uint _e105 = u1_; - u1_ = _e105 + texture_array_2darray[uniform_index].get_array_size(); - uint _e110 = u1_; - u1_ = _e110 + texture_array_2darray[non_uniform_index].get_array_size(); - uint _e115 = u1_; - u1_ = _e115 + texture_array_bounded[0].get_num_mip_levels(); - uint _e120 = u1_; - u1_ = _e120 + texture_array_bounded[uniform_index].get_num_mip_levels(); - uint _e125 = u1_; - u1_ = _e125 + texture_array_bounded[non_uniform_index].get_num_mip_levels(); - uint _e130 = u1_; - u1_ = _e130 + texture_array_multisampled[0].get_num_samples(); - uint _e135 = u1_; - u1_ = _e135 + texture_array_multisampled[uniform_index].get_num_samples(); - uint _e140 = u1_; - u1_ = _e140 + texture_array_multisampled[non_uniform_index].get_num_samples(); + v4_ = v4_ + _e94; + u1_ = u1_ + texture_array_2darray[0].get_array_size(); + u1_ = u1_ + texture_array_2darray[uniform_index].get_array_size(); + u1_ = u1_ + texture_array_2darray[non_uniform_index].get_array_size(); + u1_ = u1_ + texture_array_bounded[0].get_num_mip_levels(); + u1_ = u1_ + texture_array_bounded[uniform_index].get_num_mip_levels(); + u1_ = u1_ + texture_array_bounded[non_uniform_index].get_num_mip_levels(); + u1_ = u1_ + texture_array_multisampled[0].get_num_samples(); + u1_ = u1_ + texture_array_multisampled[uniform_index].get_num_samples(); + u1_ = u1_ + texture_array_multisampled[non_uniform_index].get_num_samples(); metal::float4 _e146 = texture_array_bounded[0].sample(samp[0], uv); - metal::float4 _e147 = v4_; - v4_ = _e147 + _e146; + v4_ = v4_ + _e146; metal::float4 _e153 = texture_array_bounded[uniform_index].sample(samp[uniform_index], uv); - metal::float4 _e154 = v4_; - v4_ = _e154 + _e153; + v4_ = v4_ + _e153; metal::float4 _e160 = texture_array_bounded[non_uniform_index].sample(samp[non_uniform_index], uv); - metal::float4 _e161 = v4_; - v4_ = _e161 + _e160; + v4_ = v4_ + _e160; metal::float4 _e168 = texture_array_bounded[0].sample(samp[0], uv, metal::bias(0.0)); - metal::float4 _e169 = v4_; - v4_ = _e169 + _e168; + v4_ = v4_ + _e168; metal::float4 _e176 = texture_array_bounded[uniform_index].sample(samp[uniform_index], uv, metal::bias(0.0)); - metal::float4 _e177 = v4_; - v4_ = _e177 + _e176; + v4_ = v4_ + _e176; metal::float4 _e184 = texture_array_bounded[non_uniform_index].sample(samp[non_uniform_index], uv, metal::bias(0.0)); - metal::float4 _e185 = v4_; - v4_ = _e185 + _e184; + v4_ = v4_ + _e184; float _e192 = texture_array_depth[0].sample_compare(samp_comp[0], uv, 0.0); - float _e193 = v1_; - v1_ = _e193 + _e192; + v1_ = v1_ + _e192; float _e200 = texture_array_depth[uniform_index].sample_compare(samp_comp[uniform_index], uv, 0.0); - float _e201 = v1_; - v1_ = _e201 + _e200; + v1_ = v1_ + _e200; float _e208 = texture_array_depth[non_uniform_index].sample_compare(samp_comp[non_uniform_index], uv, 0.0); - float _e209 = v1_; - v1_ = _e209 + _e208; + v1_ = v1_ + _e208; float _e216 = texture_array_depth[0].sample_compare(samp_comp[0], uv, 0.0); - float _e217 = v1_; - v1_ = _e217 + _e216; + v1_ = v1_ + _e216; float _e224 = texture_array_depth[uniform_index].sample_compare(samp_comp[uniform_index], uv, 0.0); - float _e225 = v1_; - v1_ = _e225 + _e224; + v1_ = v1_ + _e224; float _e232 = texture_array_depth[non_uniform_index].sample_compare(samp_comp[non_uniform_index], uv, 0.0); - float _e233 = v1_; - v1_ = _e233 + _e232; + v1_ = v1_ + _e232; metal::float4 _e239 = texture_array_bounded[0].sample(samp[0], uv, metal::gradient2d(uv, uv)); - metal::float4 _e240 = v4_; - v4_ = _e240 + _e239; + v4_ = v4_ + _e239; metal::float4 _e246 = texture_array_bounded[uniform_index].sample(samp[uniform_index], uv, metal::gradient2d(uv, uv)); - metal::float4 _e247 = v4_; - v4_ = _e247 + _e246; + v4_ = v4_ + _e246; metal::float4 _e253 = texture_array_bounded[non_uniform_index].sample(samp[non_uniform_index], uv, metal::gradient2d(uv, uv)); - metal::float4 _e254 = v4_; - v4_ = _e254 + _e253; + v4_ = v4_ + _e253; metal::float4 _e261 = texture_array_bounded[0].sample(samp[0], uv, metal::level(0.0)); - metal::float4 _e262 = v4_; - v4_ = _e262 + _e261; + v4_ = v4_ + _e261; metal::float4 _e269 = texture_array_bounded[uniform_index].sample(samp[uniform_index], uv, metal::level(0.0)); - metal::float4 _e270 = v4_; - v4_ = _e270 + _e269; + v4_ = v4_ + _e269; metal::float4 _e277 = texture_array_bounded[non_uniform_index].sample(samp[non_uniform_index], uv, metal::level(0.0)); - metal::float4 _e278 = v4_; - v4_ = _e278 + _e277; - metal::float4 _e282 = v4_; - texture_array_storage[0].write(_e282, metal::uint2(pix)); - metal::float4 _e285 = v4_; - texture_array_storage[uniform_index].write(_e285, metal::uint2(pix)); - metal::float4 _e288 = v4_; - texture_array_storage[non_uniform_index].write(_e288, metal::uint2(pix)); - metal::uint2 _e289 = u2_; - uint _e290 = u1_; - metal::float2 v2_ = static_cast(_e289 + metal::uint2(_e290)); - metal::float4 _e294 = v4_; - float _e301 = v1_; - return main_Output { (_e294 + metal::float4(v2_.x, v2_.y, v2_.x, v2_.y)) + metal::float4(_e301) }; + v4_ = v4_ + _e277; + texture_array_storage[0].write(v4_, metal::uint2(pix)); + texture_array_storage[uniform_index].write(v4_, metal::uint2(pix)); + texture_array_storage[non_uniform_index].write(v4_, metal::uint2(pix)); + metal::float2 v2_ = static_cast(u2_ + metal::uint2(u1_)); + return main_Output { (v4_ + metal::float4(v2_.x, v2_.y, v2_.x, v2_.y)) + metal::float4(v1_) }; } diff --git a/naga/tests/out/msl/bitcast.msl b/naga/tests/out/msl/bitcast.msl index 20f4b850e3..a14229c890 100644 --- a/naga/tests/out/msl/bitcast.msl +++ b/naga/tests/out/msl/bitcast.msl @@ -16,23 +16,14 @@ kernel void main_( metal::float2 f2_ = metal::float2(0.0); metal::float3 f3_ = metal::float3(0.0); metal::float4 f4_ = metal::float4(0.0); - metal::int2 _e27 = i2_; - u2_ = as_type(_e27); - metal::int3 _e29 = i3_; - u3_ = as_type(_e29); - metal::int4 _e31 = i4_; - u4_ = as_type(_e31); - metal::uint2 _e33 = u2_; - i2_ = as_type(_e33); - metal::uint3 _e35 = u3_; - i3_ = as_type(_e35); - metal::uint4 _e37 = u4_; - i4_ = as_type(_e37); - metal::int2 _e39 = i2_; - f2_ = as_type(_e39); - metal::int3 _e41 = i3_; - f3_ = as_type(_e41); - metal::int4 _e43 = i4_; - f4_ = as_type(_e43); + u2_ = as_type(i2_); + u3_ = as_type(i3_); + u4_ = as_type(i4_); + i2_ = as_type(u2_); + i3_ = as_type(u3_); + i4_ = as_type(u4_); + f2_ = as_type(i2_); + f3_ = as_type(i3_); + f4_ = as_type(i4_); return; } diff --git a/naga/tests/out/msl/bits.msl b/naga/tests/out/msl/bits.msl index 02613fcc04..6828b616e8 100644 --- a/naga/tests/out/msl/bits.msl +++ b/naga/tests/out/msl/bits.msl @@ -17,78 +17,42 @@ kernel void main_( metal::uint4 u4_ = metal::uint4(0u); metal::float2 f2_ = metal::float2(0.0); metal::float4 f4_ = metal::float4(0.0); - metal::float4 _e28 = f4_; - u = metal::pack_float_to_snorm4x8(_e28); - metal::float4 _e30 = f4_; - u = metal::pack_float_to_unorm4x8(_e30); - metal::float2 _e32 = f2_; - u = metal::pack_float_to_snorm2x16(_e32); - metal::float2 _e34 = f2_; - u = metal::pack_float_to_unorm2x16(_e34); - metal::float2 _e36 = f2_; - u = as_type(half2(_e36)); + u = metal::pack_float_to_snorm4x8(f4_); + u = metal::pack_float_to_unorm4x8(f4_); + u = metal::pack_float_to_snorm2x16(f2_); + u = metal::pack_float_to_unorm2x16(f2_); + u = as_type(half2(f2_)); metal::int4 _e38 = i4_; u = uint((_e38[0] & 0xFF) | ((_e38[1] & 0xFF) << 8) | ((_e38[2] & 0xFF) << 16) | ((_e38[3] & 0xFF) << 24)); metal::uint4 _e40 = u4_; u = (_e40[0] & 0xFF) | ((_e40[1] & 0xFF) << 8) | ((_e40[2] & 0xFF) << 16) | ((_e40[3] & 0xFF) << 24); - uint _e42 = u; - f4_ = metal::unpack_snorm4x8_to_float(_e42); - uint _e44 = u; - f4_ = metal::unpack_unorm4x8_to_float(_e44); - uint _e46 = u; - f2_ = metal::unpack_snorm2x16_to_float(_e46); - uint _e48 = u; - f2_ = metal::unpack_unorm2x16_to_float(_e48); - uint _e50 = u; - f2_ = float2(as_type(_e50)); + f4_ = metal::unpack_snorm4x8_to_float(u); + f4_ = metal::unpack_unorm4x8_to_float(u); + f2_ = metal::unpack_snorm2x16_to_float(u); + f2_ = metal::unpack_unorm2x16_to_float(u); + f2_ = float2(as_type(u)); uint _e52 = u; i4_ = int4(_e52, _e52 >> 8, _e52 >> 16, _e52 >> 24) << 24 >> 24; uint _e54 = u; u4_ = uint4(_e54, _e54 >> 8, _e54 >> 16, _e54 >> 24) << 24 >> 24; - int _e56 = i; - int _e57 = i; - i = metal::insert_bits(_e56, _e57, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::int2 _e61 = i2_; - metal::int2 _e62 = i2_; - i2_ = metal::insert_bits(_e61, _e62, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::int3 _e66 = i3_; - metal::int3 _e67 = i3_; - i3_ = metal::insert_bits(_e66, _e67, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::int4 _e71 = i4_; - metal::int4 _e72 = i4_; - i4_ = metal::insert_bits(_e71, _e72, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - uint _e76 = u; - uint _e77 = u; - u = metal::insert_bits(_e76, _e77, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::uint2 _e81 = u2_; - metal::uint2 _e82 = u2_; - u2_ = metal::insert_bits(_e81, _e82, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::uint3 _e86 = u3_; - metal::uint3 _e87 = u3_; - u3_ = metal::insert_bits(_e86, _e87, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::uint4 _e91 = u4_; - metal::uint4 _e92 = u4_; - u4_ = metal::insert_bits(_e91, _e92, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - int _e96 = i; - i = metal::extract_bits(_e96, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::int2 _e100 = i2_; - i2_ = metal::extract_bits(_e100, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::int3 _e104 = i3_; - i3_ = metal::extract_bits(_e104, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::int4 _e108 = i4_; - i4_ = metal::extract_bits(_e108, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - uint _e112 = u; - u = metal::extract_bits(_e112, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::uint2 _e116 = u2_; - u2_ = metal::extract_bits(_e116, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::uint3 _e120 = u3_; - u3_ = metal::extract_bits(_e120, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - metal::uint4 _e124 = u4_; - u4_ = metal::extract_bits(_e124, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); - int _e128 = i; - i = (((metal::ctz(_e128) + 1) % 33) - 1); - metal::uint2 _e130 = u2_; - u2_ = (((metal::ctz(_e130) + 1) % 33) - 1); + i = metal::insert_bits(i, i, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + i2_ = metal::insert_bits(i2_, i2_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + i3_ = metal::insert_bits(i3_, i3_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + i4_ = metal::insert_bits(i4_, i4_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + u = metal::insert_bits(u, u, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + u2_ = metal::insert_bits(u2_, u2_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + u3_ = metal::insert_bits(u3_, u3_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + u4_ = metal::insert_bits(u4_, u4_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + i = metal::extract_bits(i, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + i2_ = metal::extract_bits(i2_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + i3_ = metal::extract_bits(i3_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + i4_ = metal::extract_bits(i4_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + u = metal::extract_bits(u, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + u2_ = metal::extract_bits(u2_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + u3_ = metal::extract_bits(u3_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + u4_ = metal::extract_bits(u4_, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u))); + i = (((metal::ctz(i) + 1) % 33) - 1); + u2_ = (((metal::ctz(u2_) + 1) % 33) - 1); metal::int3 _e132 = i3_; i3_ = metal::select(31 - metal::clz(metal::select(_e132, ~_e132, _e132 < 0)), int3(-1), _e132 == 0 || _e132 == -1); metal::uint3 _e134 = u3_; @@ -97,37 +61,21 @@ kernel void main_( i = metal::select(31 - metal::clz(metal::select(_e136, ~_e136, _e136 < 0)), int(-1), _e136 == 0 || _e136 == -1); uint _e138 = u; u = metal::select(31 - metal::clz(_e138), uint(-1), _e138 == 0 || _e138 == -1); - int _e140 = i; - i = metal::popcount(_e140); - metal::int2 _e142 = i2_; - i2_ = metal::popcount(_e142); - metal::int3 _e144 = i3_; - i3_ = metal::popcount(_e144); - metal::int4 _e146 = i4_; - i4_ = metal::popcount(_e146); - uint _e148 = u; - u = metal::popcount(_e148); - metal::uint2 _e150 = u2_; - u2_ = metal::popcount(_e150); - metal::uint3 _e152 = u3_; - u3_ = metal::popcount(_e152); - metal::uint4 _e154 = u4_; - u4_ = metal::popcount(_e154); - int _e156 = i; - i = metal::reverse_bits(_e156); - metal::int2 _e158 = i2_; - i2_ = metal::reverse_bits(_e158); - metal::int3 _e160 = i3_; - i3_ = metal::reverse_bits(_e160); - metal::int4 _e162 = i4_; - i4_ = metal::reverse_bits(_e162); - uint _e164 = u; - u = metal::reverse_bits(_e164); - metal::uint2 _e166 = u2_; - u2_ = metal::reverse_bits(_e166); - metal::uint3 _e168 = u3_; - u3_ = metal::reverse_bits(_e168); - metal::uint4 _e170 = u4_; - u4_ = metal::reverse_bits(_e170); + i = metal::popcount(i); + i2_ = metal::popcount(i2_); + i3_ = metal::popcount(i3_); + i4_ = metal::popcount(i4_); + u = metal::popcount(u); + u2_ = metal::popcount(u2_); + u3_ = metal::popcount(u3_); + u4_ = metal::popcount(u4_); + i = metal::reverse_bits(i); + i2_ = metal::reverse_bits(i2_); + i3_ = metal::reverse_bits(i3_); + i4_ = metal::reverse_bits(i4_); + u = metal::reverse_bits(u); + u2_ = metal::reverse_bits(u2_); + u3_ = metal::reverse_bits(u3_); + u4_ = metal::reverse_bits(u4_); return; } diff --git a/naga/tests/out/msl/boids.msl b/naga/tests/out/msl/boids.msl index 07acd7cf62..15305daff4 100644 --- a/naga/tests/out/msl/boids.msl +++ b/naga/tests/out/msl/boids.msl @@ -51,110 +51,58 @@ kernel void main_( if (index >= NUM_PARTICLES) { return; } - metal::float2 _e8 = particlesSrc.particles[index].pos; - vPos = _e8; - metal::float2 _e14 = particlesSrc.particles[index].vel; - vVel = _e14; + vPos = particlesSrc.particles[index].pos; + vVel = particlesSrc.particles[index].vel; bool loop_init = true; while(true) { if (!loop_init) { - uint _e91 = i; - i = _e91 + 1u; + i = i + 1u; } loop_init = false; - uint _e36 = i; - if (_e36 >= NUM_PARTICLES) { + if (i >= NUM_PARTICLES) { break; } - uint _e39 = i; - if (_e39 == index) { + if (i == index) { continue; } - uint _e43 = i; - metal::float2 _e46 = particlesSrc.particles[_e43].pos; - pos = _e46; - uint _e49 = i; - metal::float2 _e52 = particlesSrc.particles[_e49].vel; - vel = _e52; - metal::float2 _e53 = pos; - metal::float2 _e54 = vPos; - float _e58 = params.rule1Distance; - if (metal::distance(_e53, _e54) < _e58) { - metal::float2 _e60 = cMass; - metal::float2 _e61 = pos; - cMass = _e60 + _e61; - int _e63 = cMassCount; - cMassCount = _e63 + 1; + pos = particlesSrc.particles[i].pos; + vel = particlesSrc.particles[i].vel; + if (metal::distance(pos, vPos) < params.rule1Distance) { + cMass = cMass + pos; + cMassCount = cMassCount + 1; } - metal::float2 _e66 = pos; - metal::float2 _e67 = vPos; - float _e71 = params.rule2Distance; - if (metal::distance(_e66, _e67) < _e71) { - metal::float2 _e73 = colVel; - metal::float2 _e74 = pos; - metal::float2 _e75 = vPos; - colVel = _e73 - (_e74 - _e75); + if (metal::distance(pos, vPos) < params.rule2Distance) { + colVel = colVel - (pos - vPos); } - metal::float2 _e78 = pos; - metal::float2 _e79 = vPos; - float _e83 = params.rule3Distance; - if (metal::distance(_e78, _e79) < _e83) { - metal::float2 _e85 = cVel; - metal::float2 _e86 = vel; - cVel = _e85 + _e86; - int _e88 = cVelCount; - cVelCount = _e88 + 1; + if (metal::distance(pos, vPos) < params.rule3Distance) { + cVel = cVel + vel; + cVelCount = cVelCount + 1; } #define LOOP_IS_BOUNDED { volatile bool unpredictable_break_from_loop = false; if (unpredictable_break_from_loop) break; } LOOP_IS_BOUNDED } - int _e94 = cMassCount; - if (_e94 > 0) { - metal::float2 _e97 = cMass; - int _e98 = cMassCount; - metal::float2 _e102 = vPos; - cMass = (_e97 / metal::float2(static_cast(_e98))) - _e102; + if (cMassCount > 0) { + cMass = (cMass / metal::float2(static_cast(cMassCount))) - vPos; } - int _e104 = cVelCount; - if (_e104 > 0) { - metal::float2 _e107 = cVel; - int _e108 = cVelCount; - cVel = _e107 / metal::float2(static_cast(_e108)); + if (cVelCount > 0) { + cVel = cVel / metal::float2(static_cast(cVelCount)); } - metal::float2 _e112 = vVel; - metal::float2 _e113 = cMass; - float _e116 = params.rule1Scale; - metal::float2 _e119 = colVel; - float _e122 = params.rule2Scale; - metal::float2 _e125 = cVel; - float _e128 = params.rule3Scale; - vVel = ((_e112 + (_e113 * _e116)) + (_e119 * _e122)) + (_e125 * _e128); - metal::float2 _e131 = vVel; - metal::float2 _e133 = vVel; - vVel = metal::normalize(_e131) * metal::clamp(metal::length(_e133), 0.0, 0.1); - metal::float2 _e139 = vPos; - metal::float2 _e140 = vVel; - float _e143 = params.deltaT; - vPos = _e139 + (_e140 * _e143); - float _e147 = vPos.x; - if (_e147 < -1.0) { + vVel = ((vVel + (cMass * params.rule1Scale)) + (colVel * params.rule2Scale)) + (cVel * params.rule3Scale); + vVel = metal::normalize(vVel) * metal::clamp(metal::length(vVel), 0.0, 0.1); + vPos = vPos + (vVel * params.deltaT); + if (vPos.x < -1.0) { vPos.x = 1.0; } - float _e153 = vPos.x; - if (_e153 > 1.0) { + if (vPos.x > 1.0) { vPos.x = -1.0; } - float _e159 = vPos.y; - if (_e159 < -1.0) { + if (vPos.y < -1.0) { vPos.y = 1.0; } - float _e165 = vPos.y; - if (_e165 > 1.0) { + if (vPos.y > 1.0) { vPos.y = -1.0; } - metal::float2 _e174 = vPos; - particlesDst.particles[index].pos = _e174; - metal::float2 _e179 = vVel; - particlesDst.particles[index].vel = _e179; + particlesDst.particles[index].pos = vPos; + particlesDst.particles[index].vel = vVel; return; } diff --git a/naga/tests/out/msl/bounds-check-restrict.msl b/naga/tests/out/msl/bounds-check-restrict.msl index a8bf371555..a6f7b5ecf1 100644 --- a/naga/tests/out/msl/bounds-check-restrict.msl +++ b/naga/tests/out/msl/bounds-check-restrict.msl @@ -25,8 +25,7 @@ float index_array( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e4 = globals.a.inner[metal::min(unsigned(i), 9u)]; - return _e4; + return globals.a.inner[metal::min(unsigned(i), 9u)]; } float index_dynamic_array( @@ -34,8 +33,7 @@ float index_dynamic_array( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e4 = globals.d[metal::min(unsigned(i_1), (_buffer_sizes.size0 - 112 - 4) / 4)]; - return _e4; + return globals.d[metal::min(unsigned(i_1), (_buffer_sizes.size0 - 112 - 4) / 4)]; } float index_vector( @@ -43,8 +41,7 @@ float index_vector( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e4 = globals.v[metal::min(unsigned(i_2), 3u)]; - return _e4; + return globals.v[metal::min(unsigned(i_2), 3u)]; } float index_vector_by_value( @@ -59,8 +56,7 @@ metal::float4 index_matrix( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - metal::float4 _e4 = globals.m[metal::min(unsigned(i_4), 2u)]; - return _e4; + return globals.m[metal::min(unsigned(i_4), 2u)]; } float index_twice( @@ -69,8 +65,7 @@ float index_twice( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e6 = globals.m[metal::min(unsigned(i_5), 2u)][metal::min(unsigned(j), 3u)]; - return _e6; + return globals.m[metal::min(unsigned(i_5), 2u)][metal::min(unsigned(j), 3u)]; } float index_expensive( @@ -78,18 +73,14 @@ float index_expensive( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e11 = globals.a.inner[metal::min(unsigned(static_cast(metal::sin(static_cast(i_6) / 100.0) * 100.0)), 9u)]; - return _e11; + return globals.a.inner[metal::min(unsigned(static_cast(metal::sin(static_cast(i_6) / 100.0) * 100.0)), 9u)]; } float index_in_bounds( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e3 = globals.a.inner[9]; - float _e7 = globals.v.w; - float _e13 = globals.m[2].w; - return (_e3 + _e7) + _e13; + return (globals.a.inner[9] + globals.v.w) + globals.m[2].w; } void set_array( @@ -168,8 +159,7 @@ float index_dynamic_array_constant_index( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e3 = globals.d[metal::min(unsigned(1000), (_buffer_sizes.size0 - 112 - 4) / 4)]; - return _e3; + return globals.d[metal::min(unsigned(1000), (_buffer_sizes.size0 - 112 - 4) / 4)]; } void set_dynamic_array_constant_index( diff --git a/naga/tests/out/msl/bounds-check-zero.msl b/naga/tests/out/msl/bounds-check-zero.msl index 8269d4bf70..d0fc252b73 100644 --- a/naga/tests/out/msl/bounds-check-zero.msl +++ b/naga/tests/out/msl/bounds-check-zero.msl @@ -31,8 +31,7 @@ float index_array( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e4 = uint(i) < 10 ? globals.a.inner[i] : DefaultConstructible(); - return _e4; + return uint(i) < 10 ? globals.a.inner[i] : DefaultConstructible(); } float index_dynamic_array( @@ -40,8 +39,7 @@ float index_dynamic_array( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e4 = uint(i_1) < 1 + (_buffer_sizes.size0 - 112 - 4) / 4 ? globals.d[i_1] : DefaultConstructible(); - return _e4; + return uint(i_1) < 1 + (_buffer_sizes.size0 - 112 - 4) / 4 ? globals.d[i_1] : DefaultConstructible(); } float index_vector( @@ -49,8 +47,7 @@ float index_vector( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e4 = uint(i_2) < 4 ? globals.v[i_2] : DefaultConstructible(); - return _e4; + return uint(i_2) < 4 ? globals.v[i_2] : DefaultConstructible(); } float index_vector_by_value( @@ -65,8 +62,7 @@ metal::float4 index_matrix( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - metal::float4 _e4 = uint(i_4) < 3 ? globals.m[i_4] : DefaultConstructible(); - return _e4; + return uint(i_4) < 3 ? globals.m[i_4] : DefaultConstructible(); } float index_twice( @@ -75,8 +71,7 @@ float index_twice( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e6 = uint(j) < 4 && uint(i_5) < 3 ? globals.m[i_5][j] : DefaultConstructible(); - return _e6; + return uint(j) < 4 && uint(i_5) < 3 ? globals.m[i_5][j] : DefaultConstructible(); } float index_expensive( @@ -85,18 +80,14 @@ float index_expensive( constant _mslBufferSizes& _buffer_sizes ) { int _e9 = static_cast(metal::sin(static_cast(i_6) / 100.0) * 100.0); - float _e11 = uint(_e9) < 10 ? globals.a.inner[_e9] : DefaultConstructible(); - return _e11; + return uint(_e9) < 10 ? globals.a.inner[_e9] : DefaultConstructible(); } float index_in_bounds( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e3 = globals.a.inner[9]; - float _e7 = globals.v.w; - float _e13 = globals.m[2].w; - return (_e3 + _e7) + _e13; + return (globals.a.inner[9] + globals.v.w) + globals.m[2].w; } void set_array( @@ -188,8 +179,7 @@ float index_dynamic_array_constant_index( device Globals const& globals, constant _mslBufferSizes& _buffer_sizes ) { - float _e3 = uint(1000) < 1 + (_buffer_sizes.size0 - 112 - 4) / 4 ? globals.d[1000] : DefaultConstructible(); - return _e3; + return uint(1000) < 1 + (_buffer_sizes.size0 - 112 - 4) / 4 ? globals.d[1000] : DefaultConstructible(); } void set_dynamic_array_constant_index( diff --git a/naga/tests/out/msl/break-if.msl b/naga/tests/out/msl/break-if.msl index 4d3397234b..86e8e37f99 100644 --- a/naga/tests/out/msl/break-if.msl +++ b/naga/tests/out/msl/break-if.msl @@ -30,9 +30,7 @@ void breakIfEmptyBody( while(true) { if (!loop_init_1) { b = a; - bool _e2 = b; - c = a != _e2; - bool _e5 = c; + c = a != b; if (a == c) { break; } @@ -51,15 +49,13 @@ void breakIf( bool loop_init_2 = true; while(true) { if (!loop_init_2) { - bool _e5 = e; if (a_1 == e) { break; } } loop_init_2 = false; d = a_1; - bool _e2 = d; - e = a_1 != _e2; + e = a_1 != d; LOOP_IS_BOUNDED } return; @@ -71,14 +67,12 @@ void breakIfSeparateVariable( bool loop_init_3 = true; while(true) { if (!loop_init_3) { - uint _e5 = counter; if (counter == 5u) { break; } } loop_init_3 = false; - uint _e3 = counter; - counter = _e3 + 1u; + counter = counter + 1u; LOOP_IS_BOUNDED } return; diff --git a/naga/tests/out/msl/collatz.msl b/naga/tests/out/msl/collatz.msl index e282d13abb..d2f38decb2 100644 --- a/naga/tests/out/msl/collatz.msl +++ b/naga/tests/out/msl/collatz.msl @@ -20,28 +20,22 @@ uint collatz_iterations( uint i = 0u; n = n_base; while(true) { - uint _e4 = n; - if (_e4 > 1u) { + if (n > 1u) { } else { break; } { - uint _e7 = n; - if ((_e7 % 2u) == 0u) { - uint _e12 = n; - n = _e12 / 2u; + if ((n % 2u) == 0u) { + n = n / 2u; } else { - uint _e16 = n; - n = (3u * _e16) + 1u; + n = (3u * n) + 1u; } - uint _e20 = i; - i = _e20 + 1u; + i = i + 1u; } #define LOOP_IS_BOUNDED { volatile bool unpredictable_break_from_loop = false; if (unpredictable_break_from_loop) break; } LOOP_IS_BOUNDED } - uint _e23 = i; - return _e23; + return i; } struct main_Input { @@ -51,8 +45,7 @@ kernel void main_( , device PrimeIndices& v_indices [[user(fake0)]] , constant _mslBufferSizes& _buffer_sizes [[user(fake0)]] ) { - uint _e9 = v_indices.data[global_id.x]; - uint _e10 = collatz_iterations(_e9); + uint _e10 = collatz_iterations(v_indices.data[global_id.x]); v_indices.data[global_id.x] = _e10; return; } diff --git a/naga/tests/out/msl/const-exprs.msl b/naga/tests/out/msl/const-exprs.msl index 7798ae62b3..d1925503d4 100644 --- a/naga/tests/out/msl/const-exprs.msl +++ b/naga/tests/out/msl/const-exprs.msl @@ -41,15 +41,9 @@ void non_constant_initializers( int y = {}; int z = 70; metal::int4 out_3 = {}; - int _e2 = w; - x = _e2; - int _e4 = x; - y = _e4; - int _e8 = w; - int _e9 = x; - int _e10 = y; - int _e11 = z; - out_3 = metal::int4(_e8, _e9, _e10, _e11); + x = w; + y = x; + out_3 = metal::int4(w, x, y, z); return; } diff --git a/naga/tests/out/msl/control-flow.msl b/naga/tests/out/msl/control-flow.msl index 1b35249f36..cdaf55c3e9 100644 --- a/naga/tests/out/msl/control-flow.msl +++ b/naga/tests/out/msl/control-flow.msl @@ -173,8 +173,7 @@ kernel void main_( break; } } - int _e4 = pos; - switch(_e4) { + switch(pos) { case 1: { pos = 0; break; @@ -206,8 +205,7 @@ kernel void main_( break; } } - int _e11 = pos; - switch(_e11) { + switch(pos) { case 1: { pos = 0; break; diff --git a/naga/tests/out/msl/do-while.msl b/naga/tests/out/msl/do-while.msl index 2a883304d1..b04fdee946 100644 --- a/naga/tests/out/msl/do-while.msl +++ b/naga/tests/out/msl/do-while.msl @@ -11,7 +11,6 @@ void fb1_( bool loop_init = true; while(true) { if (!loop_init) { - bool _e1 = cond; if (!(cond)) { break; } diff --git a/naga/tests/out/msl/dualsource.msl b/naga/tests/out/msl/dualsource.msl index 439e3c0d8c..1b35d05f08 100644 --- a/naga/tests/out/msl/dualsource.msl +++ b/naga/tests/out/msl/dualsource.msl @@ -20,8 +20,6 @@ fragment main_Output main_( ) { metal::float4 color = metal::float4(0.4, 0.3, 0.2, 0.1); metal::float4 mask = metal::float4(0.9, 0.8, 0.7, 0.6); - metal::float4 _e13 = color; - metal::float4 _e14 = mask; - const auto _tmp = FragmentOutput {_e13, _e14}; + const auto _tmp = FragmentOutput {color, mask}; return main_Output { _tmp.color, _tmp.mask }; } diff --git a/naga/tests/out/msl/empty-global-name.msl b/naga/tests/out/msl/empty-global-name.msl index 01cac3f6e0..4add395e43 100644 --- a/naga/tests/out/msl/empty-global-name.msl +++ b/naga/tests/out/msl/empty-global-name.msl @@ -11,8 +11,7 @@ struct type_1 { void function( device type_1& unnamed ) { - int _e3 = unnamed.member; - unnamed.member = _e3 + 1; + unnamed.member = unnamed.member + 1; return; } diff --git a/naga/tests/out/msl/extra.msl b/naga/tests/out/msl/extra.msl index 8288dfad92..f77048d3e6 100644 --- a/naga/tests/out/msl/extra.msl +++ b/naga/tests/out/msl/extra.msl @@ -26,8 +26,7 @@ fragment main_Output main_( , constant PushConstants& pc [[buffer(1)]] ) { const FragmentIn in = { varyings.color, primitive_index }; - uint _e4 = pc.index; - if (in.primitive_index == _e4) { + if (in.primitive_index == pc.index) { return main_Output { in.color }; } else { return main_Output { metal::float4(metal::float3(1.0) - in.color.xyz, in.color.w) }; diff --git a/naga/tests/out/msl/fetch_depth.msl b/naga/tests/out/msl/fetch_depth.msl index 867a284372..ac29f8d33d 100644 --- a/naga/tests/out/msl/fetch_depth.msl +++ b/naga/tests/out/msl/fetch_depth.msl @@ -16,8 +16,7 @@ void function( device type_4 const& global_1, metal::depth2d global_2 ) { - metal::uint2 _e6 = global_1.member; - float _e7 = global_2.read(metal::uint2(_e6), 0); + float _e7 = global_2.read(metal::uint2(global_1.member), 0); global.member = metal::float4(_e7).x; return; } diff --git a/naga/tests/out/msl/fragment-output.msl b/naga/tests/out/msl/fragment-output.msl index c886fc885e..1c32c28392 100644 --- a/naga/tests/out/msl/fragment-output.msl +++ b/naga/tests/out/msl/fragment-output.msl @@ -38,8 +38,7 @@ fragment main_vec4vec3_Output main_vec4vec3_( output.vec3f = metal::float3(0.0); output.vec3i = metal::int3(0); output.vec3u = metal::uint3(0u); - FragmentOutputVec4Vec3_ _e19 = output; - const auto _tmp = _e19; + const auto _tmp = output; return main_vec4vec3_Output { _tmp.vec4f, _tmp.vec4i, _tmp.vec4u, _tmp.vec3f, _tmp.vec3i, _tmp.vec3u }; } @@ -61,7 +60,6 @@ fragment main_vec2scalarOutput main_vec2scalar( output_1.scalarf = 0.0; output_1.scalari = 0; output_1.scalaru = 0u; - FragmentOutputVec2Scalar _e16 = output_1; - const auto _tmp = _e16; + const auto _tmp = output_1; return main_vec2scalarOutput { _tmp.vec2f, _tmp.vec2i, _tmp.vec2u, _tmp.scalarf, _tmp.scalari, _tmp.scalaru }; } diff --git a/naga/tests/out/msl/globals.msl b/naga/tests/out/msl/globals.msl index d2ed89ed46..fad0beab27 100644 --- a/naga/tests/out/msl/globals.msl +++ b/naga/tests/out/msl/globals.msl @@ -46,8 +46,7 @@ void test_msl_packed_vec3_( alignment.v3_ = metal::float3(1.0); alignment.v3_[0] = 1.0; alignment.v3_[0] = 2.0; - int _e16 = idx; - alignment.v3_[_e16] = 3.0; + alignment.v3_[idx] = 3.0; FooStruct data = alignment; metal::float3 l0_ = data.v3_; metal::float2 l1_ = metal::float3(data.v3_).zx; @@ -79,20 +78,12 @@ kernel void main_( float Foo = 1.0; bool at = true; test_msl_packed_vec3_(alignment); - metal::float4x2 _e5 = global_nested_arrays_of_matrices_4x2_.inner[0].inner[0]; - metal::float4 _e10 = global_nested_arrays_of_matrices_2x4_.inner[0].inner[0][0]; - wg.inner[7] = (_e5 * _e10).x; - metal::float3x2 _e16 = global_mat; - metal::float3 _e18 = global_vec; - wg.inner[6] = (_e16 * _e18).x; - float _e26 = dummy[1].y; - wg.inner[5] = _e26; - float _e32 = float_vecs.inner[0].w; - wg.inner[4] = _e32; - float _e37 = alignment.v1_; - wg.inner[3] = _e37; - float _e43 = alignment.v3_[0]; - wg.inner[2] = _e43; + wg.inner[7] = (global_nested_arrays_of_matrices_4x2_.inner[0].inner[0] * global_nested_arrays_of_matrices_2x4_.inner[0].inner[0][0]).x; + wg.inner[6] = (global_mat * global_vec).x; + wg.inner[5] = dummy[1].y; + wg.inner[4] = float_vecs.inner[0].w; + wg.inner[3] = alignment.v1_; + wg.inner[2] = alignment.v3_[0]; alignment.v1_ = 4.0; wg.inner[1] = static_cast(1 + (_buffer_sizes.size3 - 0 - 8) / 8); metal::atomic_store_explicit(&at_1, 2u, metal::memory_order_relaxed); diff --git a/naga/tests/out/msl/image.msl b/naga/tests/out/msl/image.msl index 114ed36553..51b531e2ea 100644 --- a/naga/tests/out/msl/image.msl +++ b/naga/tests/out/msl/image.msl @@ -121,73 +121,50 @@ fragment texture_sampleOutput texture_sample( metal::float2 tc = metal::float2(0.5); metal::float3 tc3_ = metal::float3(0.5); metal::float4 _e9 = image_1d.sample(sampler_reg, tc.x); - metal::float4 _e10 = a; - a = _e10 + _e9; + a = a + _e9; metal::float4 _e14 = image_2d.sample(sampler_reg, tc); - metal::float4 _e15 = a; - a = _e15 + _e14; + a = a + _e14; metal::float4 _e19 = image_2d.sample(sampler_reg, tc, metal::int2(3, 1)); - metal::float4 _e20 = a; - a = _e20 + _e19; + a = a + _e19; metal::float4 _e24 = image_2d.sample(sampler_reg, tc, metal::level(2.3)); - metal::float4 _e25 = a; - a = _e25 + _e24; + a = a + _e24; metal::float4 _e29 = image_2d.sample(sampler_reg, tc, metal::level(2.3), metal::int2(3, 1)); - metal::float4 _e30 = a; - a = _e30 + _e29; + a = a + _e29; metal::float4 _e35 = image_2d.sample(sampler_reg, tc, metal::bias(2.0), metal::int2(3, 1)); - metal::float4 _e36 = a; - a = _e36 + _e35; + a = a + _e35; metal::float4 _e41 = image_2d_array.sample(sampler_reg, tc, 0u); - metal::float4 _e42 = a; - a = _e42 + _e41; + a = a + _e41; metal::float4 _e47 = image_2d_array.sample(sampler_reg, tc, 0u, metal::int2(3, 1)); - metal::float4 _e48 = a; - a = _e48 + _e47; + a = a + _e47; metal::float4 _e53 = image_2d_array.sample(sampler_reg, tc, 0u, metal::level(2.3)); - metal::float4 _e54 = a; - a = _e54 + _e53; + a = a + _e53; metal::float4 _e59 = image_2d_array.sample(sampler_reg, tc, 0u, metal::level(2.3), metal::int2(3, 1)); - metal::float4 _e60 = a; - a = _e60 + _e59; + a = a + _e59; metal::float4 _e66 = image_2d_array.sample(sampler_reg, tc, 0u, metal::bias(2.0), metal::int2(3, 1)); - metal::float4 _e67 = a; - a = _e67 + _e66; + a = a + _e66; metal::float4 _e72 = image_2d_array.sample(sampler_reg, tc, 0); - metal::float4 _e73 = a; - a = _e73 + _e72; + a = a + _e72; metal::float4 _e78 = image_2d_array.sample(sampler_reg, tc, 0, metal::int2(3, 1)); - metal::float4 _e79 = a; - a = _e79 + _e78; + a = a + _e78; metal::float4 _e84 = image_2d_array.sample(sampler_reg, tc, 0, metal::level(2.3)); - metal::float4 _e85 = a; - a = _e85 + _e84; + a = a + _e84; metal::float4 _e90 = image_2d_array.sample(sampler_reg, tc, 0, metal::level(2.3), metal::int2(3, 1)); - metal::float4 _e91 = a; - a = _e91 + _e90; + a = a + _e90; metal::float4 _e97 = image_2d_array.sample(sampler_reg, tc, 0, metal::bias(2.0), metal::int2(3, 1)); - metal::float4 _e98 = a; - a = _e98 + _e97; + a = a + _e97; metal::float4 _e103 = image_cube_array.sample(sampler_reg, tc3_, 0u); - metal::float4 _e104 = a; - a = _e104 + _e103; + a = a + _e103; metal::float4 _e109 = image_cube_array.sample(sampler_reg, tc3_, 0u, metal::level(2.3)); - metal::float4 _e110 = a; - a = _e110 + _e109; + a = a + _e109; metal::float4 _e116 = image_cube_array.sample(sampler_reg, tc3_, 0u, metal::bias(2.0)); - metal::float4 _e117 = a; - a = _e117 + _e116; + a = a + _e116; metal::float4 _e122 = image_cube_array.sample(sampler_reg, tc3_, 0); - metal::float4 _e123 = a; - a = _e123 + _e122; + a = a + _e122; metal::float4 _e128 = image_cube_array.sample(sampler_reg, tc3_, 0, metal::level(2.3)); - metal::float4 _e129 = a; - a = _e129 + _e128; + a = a + _e128; metal::float4 _e135 = image_cube_array.sample(sampler_reg, tc3_, 0, metal::bias(2.0)); - metal::float4 _e136 = a; - a = _e136 + _e135; - metal::float4 _e138 = a; - return texture_sampleOutput { _e138 }; + a = a + _e135; + return texture_sampleOutput { a }; } @@ -204,31 +181,22 @@ fragment texture_sample_comparisonOutput texture_sample_comparison( metal::float2 tc_1 = metal::float2(0.5); metal::float3 tc3_1 = metal::float3(0.5); float _e8 = image_2d_depth.sample_compare(sampler_cmp, tc_1, 0.5); - float _e9 = a_1; - a_1 = _e9 + _e8; + a_1 = a_1 + _e8; float _e14 = image_2d_array_depth.sample_compare(sampler_cmp, tc_1, 0u, 0.5); - float _e15 = a_1; - a_1 = _e15 + _e14; + a_1 = a_1 + _e14; float _e20 = image_2d_array_depth.sample_compare(sampler_cmp, tc_1, 0, 0.5); - float _e21 = a_1; - a_1 = _e21 + _e20; + a_1 = a_1 + _e20; float _e25 = image_cube_depth.sample_compare(sampler_cmp, tc3_1, 0.5); - float _e26 = a_1; - a_1 = _e26 + _e25; + a_1 = a_1 + _e25; float _e30 = image_2d_depth.sample_compare(sampler_cmp, tc_1, 0.5); - float _e31 = a_1; - a_1 = _e31 + _e30; + a_1 = a_1 + _e30; float _e36 = image_2d_array_depth.sample_compare(sampler_cmp, tc_1, 0u, 0.5); - float _e37 = a_1; - a_1 = _e37 + _e36; + a_1 = a_1 + _e36; float _e42 = image_2d_array_depth.sample_compare(sampler_cmp, tc_1, 0, 0.5); - float _e43 = a_1; - a_1 = _e43 + _e42; + a_1 = a_1 + _e42; float _e47 = image_cube_depth.sample_compare(sampler_cmp, tc3_1, 0.5); - float _e48 = a_1; - a_1 = _e48 + _e47; - float _e50 = a_1; - return texture_sample_comparisonOutput { _e50 }; + a_1 = a_1 + _e47; + return texture_sample_comparisonOutput { a_1 }; } diff --git a/naga/tests/out/msl/int64.msl b/naga/tests/out/msl/int64.msl index 2ef03d9aeb..88a94b91c1 100644 --- a/naga/tests/out/msl/int64.msl +++ b/naga/tests/out/msl/int64.msl @@ -43,79 +43,31 @@ long int64_function( device StorageCompatible& output_arrays ) { long val = 20L; - long _e6 = val; - val = _e6 + (31L - 1002003004005006L); - long _e8 = val; - long _e11 = val; - val = _e11 + (_e8 + 5L); - uint _e15 = input_uniform.val_u32_; - long _e16 = val; - long _e20 = val; - val = _e20 + static_cast(_e15 + static_cast(_e16)); - int _e24 = input_uniform.val_i32_; - long _e25 = val; - long _e29 = val; - val = _e29 + static_cast(_e24 + static_cast(_e25)); - float _e33 = input_uniform.val_f32_; - long _e34 = val; - long _e38 = val; - val = _e38 + static_cast(_e33 + static_cast(_e34)); - long _e42 = input_uniform.val_i64_; - long _e45 = val; - val = _e45 + metal::long3(_e42).z; - ulong _e49 = input_uniform.val_u64_; - long _e51 = val; - val = _e51 + as_type(_e49); - metal::ulong2 _e55 = input_uniform.val_u64_2_; - long _e58 = val; - val = _e58 + as_type(_e55).y; - metal::ulong3 _e62 = input_uniform.val_u64_3_; - long _e65 = val; - val = _e65 + as_type(_e62).z; - metal::ulong4 _e69 = input_uniform.val_u64_4_; - long _e72 = val; - val = _e72 + as_type(_e69).w; - long _e78 = input_uniform.val_i64_; - long _e81 = input_storage.val_i64_; - output.val_i64_ = _e78 + _e81; - metal::long2 _e87 = input_uniform.val_i64_2_; - metal::long2 _e90 = input_storage.val_i64_2_; - output.val_i64_2_ = _e87 + _e90; - metal::long3 _e96 = input_uniform.val_i64_3_; - metal::long3 _e99 = input_storage.val_i64_3_; - output.val_i64_3_ = _e96 + _e99; - metal::long4 _e105 = input_uniform.val_i64_4_; - metal::long4 _e108 = input_storage.val_i64_4_; - output.val_i64_4_ = _e105 + _e108; - type_12 _e114 = input_arrays.val_i64_array_2_; - output_arrays.val_i64_array_2_ = _e114; - long _e115 = val; - long _e117 = val; - val = _e117 + metal::abs(_e115); - long _e119 = val; - long _e120 = val; - long _e121 = val; - long _e123 = val; - val = _e123 + metal::clamp(_e119, _e120, _e121); - long _e125 = val; - metal::long2 _e126 = metal::long2(_e125); - long _e127 = val; - metal::long2 _e128 = metal::long2(_e127); - long _e130 = val; - val = _e130 + ( + _e126.x * _e128.x + _e126.y * _e128.y); - long _e132 = val; - long _e133 = val; - long _e135 = val; - val = _e135 + metal::max(_e132, _e133); - long _e137 = val; - long _e138 = val; - long _e140 = val; - val = _e140 + metal::min(_e137, _e138); + val = val + (31L - 1002003004005006L); + val = val + (val + 5L); + val = val + static_cast(input_uniform.val_u32_ + static_cast(val)); + val = val + static_cast(input_uniform.val_i32_ + static_cast(val)); + val = val + static_cast(input_uniform.val_f32_ + static_cast(val)); + val = val + metal::long3(input_uniform.val_i64_).z; + val = val + as_type(input_uniform.val_u64_); + val = val + as_type(input_uniform.val_u64_2_).y; + val = val + as_type(input_uniform.val_u64_3_).z; + val = val + as_type(input_uniform.val_u64_4_).w; + output.val_i64_ = input_uniform.val_i64_ + input_storage.val_i64_; + output.val_i64_2_ = input_uniform.val_i64_2_ + input_storage.val_i64_2_; + output.val_i64_3_ = input_uniform.val_i64_3_ + input_storage.val_i64_3_; + output.val_i64_4_ = input_uniform.val_i64_4_ + input_storage.val_i64_4_; + output_arrays.val_i64_array_2_ = input_arrays.val_i64_array_2_; + val = val + metal::abs(val); + val = val + metal::clamp(val, val, val); + metal::long2 _e126 = metal::long2(val); + metal::long2 _e128 = metal::long2(val); + val = val + ( + _e126.x * _e128.x + _e126.y * _e128.y); + val = val + metal::max(val, val); + val = val + metal::min(val, val); long _e142 = val; - long _e144 = val; - val = _e144 + metal::select(metal::select(-1, 1, (_e142 > 0)), 0, (_e142 == 0)); - long _e146 = val; - return _e146; + val = val + metal::select(metal::select(-1, 1, (_e142 > 0)), 0, (_e142 == 0)); + return val; } ulong uint64_function( @@ -127,76 +79,29 @@ ulong uint64_function( device StorageCompatible& output_arrays ) { ulong val_1 = 20uL; - ulong _e6 = val_1; - val_1 = _e6 + (31uL + 1002003004005006uL); - ulong _e8 = val_1; - ulong _e11 = val_1; - val_1 = _e11 + (_e8 + 5uL); - uint _e15 = input_uniform.val_u32_; - ulong _e16 = val_1; - ulong _e20 = val_1; - val_1 = _e20 + static_cast(_e15 + static_cast(_e16)); - int _e24 = input_uniform.val_i32_; - ulong _e25 = val_1; - ulong _e29 = val_1; - val_1 = _e29 + static_cast(_e24 + static_cast(_e25)); - float _e33 = input_uniform.val_f32_; - ulong _e34 = val_1; - ulong _e38 = val_1; - val_1 = _e38 + static_cast(_e33 + static_cast(_e34)); - ulong _e42 = input_uniform.val_u64_; - ulong _e45 = val_1; - val_1 = _e45 + metal::ulong3(_e42).z; - long _e49 = input_uniform.val_i64_; - ulong _e51 = val_1; - val_1 = _e51 + as_type(_e49); - metal::long2 _e55 = input_uniform.val_i64_2_; - ulong _e58 = val_1; - val_1 = _e58 + as_type(_e55).y; - metal::long3 _e62 = input_uniform.val_i64_3_; - ulong _e65 = val_1; - val_1 = _e65 + as_type(_e62).z; - metal::long4 _e69 = input_uniform.val_i64_4_; - ulong _e72 = val_1; - val_1 = _e72 + as_type(_e69).w; - ulong _e78 = input_uniform.val_u64_; - ulong _e81 = input_storage.val_u64_; - output.val_u64_ = _e78 + _e81; - metal::ulong2 _e87 = input_uniform.val_u64_2_; - metal::ulong2 _e90 = input_storage.val_u64_2_; - output.val_u64_2_ = _e87 + _e90; - metal::ulong3 _e96 = input_uniform.val_u64_3_; - metal::ulong3 _e99 = input_storage.val_u64_3_; - output.val_u64_3_ = _e96 + _e99; - metal::ulong4 _e105 = input_uniform.val_u64_4_; - metal::ulong4 _e108 = input_storage.val_u64_4_; - output.val_u64_4_ = _e105 + _e108; - type_11 _e114 = input_arrays.val_u64_array_2_; - output_arrays.val_u64_array_2_ = _e114; - ulong _e115 = val_1; - ulong _e117 = val_1; - val_1 = _e117 + metal::abs(_e115); - ulong _e119 = val_1; - ulong _e120 = val_1; - ulong _e121 = val_1; - ulong _e123 = val_1; - val_1 = _e123 + metal::clamp(_e119, _e120, _e121); - ulong _e125 = val_1; - metal::ulong2 _e126 = metal::ulong2(_e125); - ulong _e127 = val_1; - metal::ulong2 _e128 = metal::ulong2(_e127); - ulong _e130 = val_1; - val_1 = _e130 + ( + _e126.x * _e128.x + _e126.y * _e128.y); - ulong _e132 = val_1; - ulong _e133 = val_1; - ulong _e135 = val_1; - val_1 = _e135 + metal::max(_e132, _e133); - ulong _e137 = val_1; - ulong _e138 = val_1; - ulong _e140 = val_1; - val_1 = _e140 + metal::min(_e137, _e138); - ulong _e142 = val_1; - return _e142; + val_1 = val_1 + (31uL + 1002003004005006uL); + val_1 = val_1 + (val_1 + 5uL); + val_1 = val_1 + static_cast(input_uniform.val_u32_ + static_cast(val_1)); + val_1 = val_1 + static_cast(input_uniform.val_i32_ + static_cast(val_1)); + val_1 = val_1 + static_cast(input_uniform.val_f32_ + static_cast(val_1)); + val_1 = val_1 + metal::ulong3(input_uniform.val_u64_).z; + val_1 = val_1 + as_type(input_uniform.val_i64_); + val_1 = val_1 + as_type(input_uniform.val_i64_2_).y; + val_1 = val_1 + as_type(input_uniform.val_i64_3_).z; + val_1 = val_1 + as_type(input_uniform.val_i64_4_).w; + output.val_u64_ = input_uniform.val_u64_ + input_storage.val_u64_; + output.val_u64_2_ = input_uniform.val_u64_2_ + input_storage.val_u64_2_; + output.val_u64_3_ = input_uniform.val_u64_3_ + input_storage.val_u64_3_; + output.val_u64_4_ = input_uniform.val_u64_4_ + input_storage.val_u64_4_; + output_arrays.val_u64_array_2_ = input_arrays.val_u64_array_2_; + val_1 = val_1 + metal::abs(val_1); + val_1 = val_1 + metal::clamp(val_1, val_1, val_1); + metal::ulong2 _e126 = metal::ulong2(val_1); + metal::ulong2 _e128 = metal::ulong2(val_1); + val_1 = val_1 + ( + _e126.x * _e128.x + _e126.y * _e128.y); + val_1 = val_1 + metal::max(val_1, val_1); + val_1 = val_1 + metal::min(val_1, val_1); + return val_1; } kernel void main_( diff --git a/naga/tests/out/msl/interface.msl b/naga/tests/out/msl/interface.msl index 047873da9f..dbf63c34f5 100644 --- a/naga/tests/out/msl/interface.msl +++ b/naga/tests/out/msl/interface.msl @@ -98,6 +98,5 @@ vertex vertex_two_structsOutput vertex_two_structs( const Input1_ in1_ = { index_1 }; const Input2_ in2_ = { index_2 }; uint index = 2u; - uint _e8 = index; - return vertex_two_structsOutput { metal::float4(static_cast(in1_.index), static_cast(in2_.index), static_cast(_e8), 0.0), 1.0 }; + return vertex_two_structsOutput { metal::float4(static_cast(in1_.index), static_cast(in2_.index), static_cast(index), 0.0), 1.0 }; } diff --git a/naga/tests/out/msl/interpolate.msl b/naga/tests/out/msl/interpolate.msl index c19005753f..03d2d4789e 100644 --- a/naga/tests/out/msl/interpolate.msl +++ b/naga/tests/out/msl/interpolate.msl @@ -49,8 +49,7 @@ vertex vert_mainOutput vert_main( out.perspective_centroid = 2197.0; out.perspective_sample = 2744.0; out.perspective_center = 2812.0; - FragmentInput _e41 = out; - const auto _tmp = _e41; + const auto _tmp = out; return vert_mainOutput { _tmp.position, _tmp._flat, _tmp.flat_first, _tmp.flat_either, _tmp._linear, _tmp.linear_centroid, _tmp.linear_sample, _tmp.linear_center, _tmp.perspective, _tmp.perspective_centroid, _tmp.perspective_sample, _tmp.perspective_center }; } diff --git a/naga/tests/out/msl/interpolate_compat.msl b/naga/tests/out/msl/interpolate_compat.msl index e386c07db0..b389772e5c 100644 --- a/naga/tests/out/msl/interpolate_compat.msl +++ b/naga/tests/out/msl/interpolate_compat.msl @@ -47,8 +47,7 @@ vertex vert_mainOutput vert_main( out.perspective_centroid = 2197.0; out.perspective_sample = 2744.0; out.perspective_center = 2812.0; - FragmentInput _e39 = out; - const auto _tmp = _e39; + const auto _tmp = out; return vert_mainOutput { _tmp.position, _tmp._flat, _tmp.flat_either, _tmp._linear, _tmp.linear_centroid, _tmp.linear_sample, _tmp.linear_center, _tmp.perspective, _tmp.perspective_centroid, _tmp.perspective_sample, _tmp.perspective_center }; } diff --git a/naga/tests/out/msl/msl-varyings.msl b/naga/tests/out/msl/msl-varyings.msl index 5e5788c8c5..7aabc5af0e 100644 --- a/naga/tests/out/msl/msl-varyings.msl +++ b/naga/tests/out/msl/msl-varyings.msl @@ -27,8 +27,7 @@ vertex vs_mainOutput vs_main( const Vertex vertex_ = { varyings.position }; const NoteInstance note = { varyings.position_1 }; VertexOutput out = {}; - VertexOutput _e3 = out; - const auto _tmp = _e3; + const auto _tmp = out; return vs_mainOutput { _tmp.position }; } diff --git a/naga/tests/out/msl/operators.msl b/naga/tests/out/msl/operators.msl index 85fba28c33..8240690258 100644 --- a/naga/tests/out/msl/operators.msl +++ b/naga/tests/out/msl/operators.msl @@ -34,14 +34,10 @@ metal::float4 splat( metal::float2 splat_assignment( ) { metal::float2 a = metal::float2(2.0); - metal::float2 _e4 = a; - a = _e4 + metal::float2(1.0); - metal::float2 _e8 = a; - a = _e8 - metal::float2(3.0); - metal::float2 _e12 = a; - a = _e12 / metal::float2(4.0); - metal::float2 _e15 = a; - return _e15; + a = a + metal::float2(1.0); + a = a - metal::float2(3.0); + a = a / metal::float2(4.0); + return a; } metal::float3 bool_cast( @@ -212,36 +208,20 @@ void assignment( int a_1 = {}; metal::int3 vec0_ = metal::int3 {}; a_1 = 1; - int _e5 = a_1; - a_1 = _e5 + 1; - int _e7 = a_1; - a_1 = _e7 - 1; - int _e9 = a_1; - int _e10 = a_1; - a_1 = _e10 * _e9; - int _e12 = a_1; - int _e13 = a_1; - a_1 = _e13 / _e12; - int _e15 = a_1; - a_1 = _e15 % 1; - int _e17 = a_1; - a_1 = _e17 & 0; - int _e19 = a_1; - a_1 = _e19 | 0; - int _e21 = a_1; - a_1 = _e21 ^ 0; - int _e23 = a_1; - a_1 = _e23 << 2u; - int _e25 = a_1; - a_1 = _e25 >> 1u; - int _e28 = a_1; - a_1 = _e28 + 1; - int _e31 = a_1; - a_1 = _e31 - 1; - int _e37 = vec0_[1]; - vec0_[1] = _e37 + 1; - int _e41 = vec0_[1]; - vec0_[1] = _e41 - 1; + a_1 = a_1 + 1; + a_1 = a_1 - 1; + a_1 = a_1 * a_1; + a_1 = a_1 / a_1; + a_1 = a_1 % 1; + a_1 = a_1 & 0; + a_1 = a_1 | 0; + a_1 = a_1 ^ 0; + a_1 = a_1 << 2u; + a_1 = a_1 >> 1u; + a_1 = a_1 + 1; + a_1 = a_1 - 1; + vec0_[1] = vec0_[1] + 1; + vec0_[1] = vec0_[1] - 1; return; } diff --git a/naga/tests/out/msl/overrides.msl b/naga/tests/out/msl/overrides.msl index d3638dd4cd..6595cca52c 100644 --- a/naga/tests/out/msl/overrides.msl +++ b/naga/tests/out/msl/overrides.msl @@ -20,8 +20,7 @@ kernel void main_( bool x = {}; float gain_x_100_ = {}; x = true; - float _e9 = gain_x_10_; - gain_x_100_ = _e9 * 10.0; + gain_x_100_ = gain_x_10_ * 10.0; store_override = gain; return; } diff --git a/naga/tests/out/msl/padding.msl b/naga/tests/out/msl/padding.msl index ae11b7d168..4b17fad73b 100644 --- a/naga/tests/out/msl/padding.msl +++ b/naga/tests/out/msl/padding.msl @@ -31,8 +31,5 @@ vertex vertex_Output vertex_( , constant Test2_& input2_ [[buffer(1)]] , constant Test3_& input3_ [[buffer(2)]] ) { - float _e4 = input1_.b; - float _e8 = input2_.b; - float _e12 = input3_.b; - return vertex_Output { ((metal::float4(1.0) * _e4) * _e8) * _e12 }; + return vertex_Output { ((metal::float4(1.0) * input1_.b) * input2_.b) * input3_.b }; } diff --git a/naga/tests/out/msl/policy-mix.msl b/naga/tests/out/msl/policy-mix.msl index 468b6f507a..4c44dafa01 100644 --- a/naga/tests/out/msl/policy-mix.msl +++ b/naga/tests/out/msl/policy-mix.msl @@ -43,11 +43,6 @@ metal::float4 mock_function( thread type_6& in_private ) { type_9 in_function = type_9 {metal::float4(0.707, 0.0, 0.0, 1.0), metal::float4(0.0, 0.707, 0.0, 1.0)}; - metal::float4 _e18 = in_storage.a.inner[i]; - metal::float4 _e22 = in_uniform.a.inner[i]; metal::float4 _e25 = (uint(l) < image_2d_array.get_num_mip_levels() && uint(i) < image_2d_array.get_array_size() && metal::all(metal::uint2(c) < metal::uint2(image_2d_array.get_width(l), image_2d_array.get_height(l))) ? image_2d_array.read(metal::uint2(c), i, l): DefaultConstructible()); - float _e29 = in_workgroup.inner[metal::min(unsigned(i), 29u)]; - float _e34 = in_private.inner[metal::min(unsigned(i), 39u)]; - metal::float4 _e38 = in_function.inner[metal::min(unsigned(i), 1u)]; - return ((((_e18 + _e22) + _e25) + metal::float4(_e29)) + metal::float4(_e34)) + _e38; + return ((((in_storage.a.inner[i] + in_uniform.a.inner[i]) + _e25) + metal::float4(in_workgroup.inner[metal::min(unsigned(i), 29u)])) + metal::float4(in_private.inner[metal::min(unsigned(i), 39u)])) + in_function.inner[metal::min(unsigned(i), 1u)]; } diff --git a/naga/tests/out/msl/quad-vert.msl b/naga/tests/out/msl/quad-vert.msl index e70df2260d..36f2c32d4d 100644 --- a/naga/tests/out/msl/quad-vert.msl +++ b/naga/tests/out/msl/quad-vert.msl @@ -24,8 +24,7 @@ void main_1( thread gl_PerVertex& unnamed, thread metal::float2& a_pos_1 ) { - metal::float2 _e6 = a_uv_1; - v_uv = _e6; + v_uv = a_uv_1; metal::float2 _e7 = a_pos_1; unnamed.gl_Position = metal::float4(_e7.x, _e7.y, 0.0, 1.0); return; @@ -51,8 +50,6 @@ vertex main_Output main_( a_uv_1 = a_uv; a_pos_1 = a_pos; main_1(v_uv, a_uv_1, unnamed, a_pos_1); - metal::float2 _e7 = v_uv; - metal::float4 _e8 = unnamed.gl_Position; - const auto _tmp = type_4 {_e7, _e8}; + const auto _tmp = type_4 {v_uv, unnamed.gl_Position}; return main_Output { _tmp.member, _tmp.gl_Position }; } diff --git a/naga/tests/out/msl/resource-binding-map.msl b/naga/tests/out/msl/resource-binding-map.msl index 56fcea0cce..f10c291848 100644 --- a/naga/tests/out/msl/resource-binding-map.msl +++ b/naga/tests/out/msl/resource-binding-map.msl @@ -41,8 +41,7 @@ fragment entry_point_twoOutput entry_point_two( , metal::sampler s1_ [[sampler(0)]] , constant metal::float2& uniformOne [[buffer(0)]] ) { - metal::float2 _e3 = uniformOne; - metal::float4 _e4 = t1_.sample(s1_, _e3); + metal::float4 _e4 = t1_.sample(s1_, uniformOne); return entry_point_twoOutput { _e4 }; } @@ -65,10 +64,7 @@ fragment entry_point_threeOutput entry_point_three( metal::min_filter::linear, metal::coord::normalized ); - metal::float2 _e3 = uniformTwo; - metal::float2 _e5 = uniformOne; - metal::float4 _e7 = t1_.sample(s1_, _e3 + _e5); - metal::float2 _e11 = uniformOne; - metal::float4 _e12 = t2_.sample(s2_, _e11); + metal::float4 _e7 = t1_.sample(s1_, uniformTwo + uniformOne); + metal::float4 _e12 = t2_.sample(s2_, uniformOne); return entry_point_threeOutput { _e7 + _e12 }; } diff --git a/naga/tests/out/msl/shadow.msl b/naga/tests/out/msl/shadow.msl index 18cc842110..6164b1ee45 100644 --- a/naga/tests/out/msl/shadow.msl +++ b/naga/tests/out/msl/shadow.msl @@ -67,14 +67,11 @@ vertex vs_mainOutput vs_main( const auto normal = varyings.normal; VertexOutput out = {}; metal::float4x4 w = u_entity.world; - metal::float4x4 _e7 = u_entity.world; - metal::float4 world_pos = _e7 * static_cast(position); + metal::float4 world_pos = u_entity.world * static_cast(position); out.world_normal = metal::float3x3(w[0].xyz, w[1].xyz, w[2].xyz) * static_cast(normal.xyz); out.world_position = world_pos; - metal::float4x4 _e26 = u_globals.view_proj; - out.proj_position = _e26 * world_pos; - VertexOutput _e28 = out; - const auto _tmp = _e28; + out.proj_position = u_globals.view_proj * world_pos; + const auto _tmp = out; return vs_mainOutput { _tmp.proj_position, _tmp.world_normal, _tmp.world_position }; } @@ -103,32 +100,24 @@ fragment fs_mainOutput fs_main( bool loop_init = true; while(true) { if (!loop_init) { - uint _e40 = i; - i = _e40 + 1u; + i = i + 1u; } loop_init = false; - uint _e7 = i; - uint _e11 = u_globals.num_lights.x; - if (_e7 < metal::min(_e11, c_max_lights)) { + if (i < metal::min(u_globals.num_lights.x, c_max_lights)) { } else { break; } { - uint _e16 = i; - Light light = s_lights[_e16]; - uint _e19 = i; - float _e23 = fetch_shadow(_e19, light.proj * in.world_position, t_shadow, sampler_shadow); + Light light = s_lights[i]; + float _e23 = fetch_shadow(i, light.proj * in.world_position, t_shadow, sampler_shadow); metal::float3 light_dir = metal::normalize(light.pos.xyz - in.world_position.xyz); float diffuse = metal::max(0.0, metal::dot(normal_1, light_dir)); - metal::float3 _e37 = color; - color = _e37 + ((_e23 * diffuse) * light.color.xyz); + color = color + ((_e23 * diffuse) * light.color.xyz); } #define LOOP_IS_BOUNDED { volatile bool unpredictable_break_from_loop = false; if (unpredictable_break_from_loop) break; } LOOP_IS_BOUNDED } - metal::float3 _e42 = color; - metal::float4 _e47 = u_entity.color; - return fs_mainOutput { metal::float4(_e42, 1.0) * _e47 }; + return fs_mainOutput { metal::float4(color, 1.0) * u_entity.color }; } @@ -155,29 +144,21 @@ fragment fs_main_without_storageOutput fs_main_without_storage( bool loop_init_1 = true; while(true) { if (!loop_init_1) { - uint _e40 = i_1; - i_1 = _e40 + 1u; + i_1 = i_1 + 1u; } loop_init_1 = false; - uint _e7 = i_1; - uint _e11 = u_globals.num_lights.x; - if (_e7 < metal::min(_e11, c_max_lights)) { + if (i_1 < metal::min(u_globals.num_lights.x, c_max_lights)) { } else { break; } { - uint _e16 = i_1; - Light light_1 = u_lights.inner[_e16]; - uint _e19 = i_1; - float _e23 = fetch_shadow(_e19, light_1.proj * in_1.world_position, t_shadow, sampler_shadow); + Light light_1 = u_lights.inner[i_1]; + float _e23 = fetch_shadow(i_1, light_1.proj * in_1.world_position, t_shadow, sampler_shadow); metal::float3 light_dir_1 = metal::normalize(light_1.pos.xyz - in_1.world_position.xyz); float diffuse_1 = metal::max(0.0, metal::dot(normal_2, light_dir_1)); - metal::float3 _e37 = color_1; - color_1 = _e37 + ((_e23 * diffuse_1) * light_1.color.xyz); + color_1 = color_1 + ((_e23 * diffuse_1) * light_1.color.xyz); } LOOP_IS_BOUNDED } - metal::float3 _e42 = color_1; - metal::float4 _e47 = u_entity.color; - return fs_main_without_storageOutput { metal::float4(_e42, 1.0) * _e47 }; + return fs_main_without_storageOutput { metal::float4(color_1, 1.0) * u_entity.color }; } diff --git a/naga/tests/out/msl/skybox.msl b/naga/tests/out/msl/skybox.msl index 7b10ea23e7..99b6aee147 100644 --- a/naga/tests/out/msl/skybox.msl +++ b/naga/tests/out/msl/skybox.msl @@ -27,15 +27,9 @@ vertex vs_mainOutput vs_main( int tmp2_ = {}; tmp1_ = static_cast(vertex_index) / 2; tmp2_ = static_cast(vertex_index) & 1; - int _e9 = tmp1_; - int _e15 = tmp2_; - metal::float4 pos = metal::float4((static_cast(_e9) * 4.0) - 1.0, (static_cast(_e15) * 4.0) - 1.0, 0.0, 1.0); - metal::float4 _e27 = r_data.view[0]; - metal::float4 _e32 = r_data.view[1]; - metal::float4 _e37 = r_data.view[2]; - metal::float3x3 inv_model_view = metal::transpose(metal::float3x3(_e27.xyz, _e32.xyz, _e37.xyz)); - metal::float4x4 _e43 = r_data.proj_inv; - metal::float4 unprojected = _e43 * pos; + metal::float4 pos = metal::float4((static_cast(tmp1_) * 4.0) - 1.0, (static_cast(tmp2_) * 4.0) - 1.0, 0.0, 1.0); + metal::float3x3 inv_model_view = metal::transpose(metal::float3x3(r_data.view[0].xyz, r_data.view[1].xyz, r_data.view[2].xyz)); + metal::float4 unprojected = r_data.proj_inv * pos; const auto _tmp = VertexOutput {pos, inv_model_view * unprojected.xyz}; return vs_mainOutput { _tmp.position, _tmp.uv }; } diff --git a/naga/tests/out/msl/standard.msl b/naga/tests/out/msl/standard.msl index e02ef7f892..adb89ab898 100644 --- a/naga/tests/out/msl/standard.msl +++ b/naga/tests/out/msl/standard.msl @@ -40,8 +40,5 @@ fragment derivativesOutput derivatives( metal::float4 _e12 = metal::fwidth(foo); z = _e12; bool _e13 = test_any_and_all_for_bool(); - metal::float4 _e14 = x; - metal::float4 _e15 = y; - metal::float4 _e17 = z; - return derivativesOutput { (_e14 + _e15) * _e17 }; + return derivativesOutput { (x + y) * z }; } diff --git a/naga/tests/out/msl/struct-layout.msl b/naga/tests/out/msl/struct-layout.msl index e1f266435b..bdd459c5c9 100644 --- a/naga/tests/out/msl/struct-layout.msl +++ b/naga/tests/out/msl/struct-layout.msl @@ -50,10 +50,8 @@ kernel void no_padding_comp( , device NoPadding const& no_padding_storage [[user(fake0)]] ) { NoPadding x = {}; - NoPadding _e2 = no_padding_uniform; - x = _e2; - NoPadding _e4 = no_padding_storage; - x = _e4; + x = no_padding_uniform; + x = no_padding_storage; return; } @@ -95,9 +93,7 @@ kernel void needs_padding_comp( , device NeedsPadding const& needs_padding_storage [[user(fake0)]] ) { NeedsPadding x_1 = {}; - NeedsPadding _e2 = needs_padding_uniform; - x_1 = _e2; - NeedsPadding _e4 = needs_padding_storage; - x_1 = _e4; + x_1 = needs_padding_uniform; + x_1 = needs_padding_storage; return; } diff --git a/naga/tests/out/msl/unnamed-gl-per-vertex.msl b/naga/tests/out/msl/unnamed-gl-per-vertex.msl index 83aea653df..e7e71d85af 100644 --- a/naga/tests/out/msl/unnamed-gl-per-vertex.msl +++ b/naga/tests/out/msl/unnamed-gl-per-vertex.msl @@ -35,8 +35,6 @@ vertex main_Output main_( int global_1 = {}; global_1 = static_cast(param); function(global, global_1); - float _e6 = global.member.y; - global.member.y = -(_e6); - metal::float4 _e8 = global.member; - return main_Output { _e8 }; + global.member.y = -(global.member.y); + return main_Output { global.member }; } diff --git a/naga/tests/out/msl/vertex-pulling-transform.msl b/naga/tests/out/msl/vertex-pulling-transform.msl index 6481e24c22..98e767ed9d 100644 --- a/naga/tests/out/msl/vertex-pulling-transform.msl +++ b/naga/tests/out/msl/vertex-pulling-transform.msl @@ -65,12 +65,10 @@ vertex render_vertexOutput render_vertex( } const VertexInput v_in = { position_1, normal_1, texcoord }; VertexOutput v_out = {}; - metal::float4x4 _e6 = mvp_matrix; - v_out.position = v_in.position * _e6; + v_out.position = v_in.position * mvp_matrix; metal::float4 _e11 = do_lighting(v_in.position, v_in.normal); v_out.color = _e11; v_out.texcoord = v_in.texcoord; - VertexOutput _e14 = v_out; - const auto _tmp = _e14; + const auto _tmp = v_out; return render_vertexOutput { _tmp.position, _tmp.color, _tmp.texcoord }; } diff --git a/naga/tests/out/msl/workgroup-var-init.msl b/naga/tests/out/msl/workgroup-var-init.msl index 991c8b014b..51e94724ad 100644 --- a/naga/tests/out/msl/workgroup-var-init.msl +++ b/naga/tests/out/msl/workgroup-var-init.msl @@ -34,7 +34,6 @@ kernel void main_( } } metal::threadgroup_barrier(metal::mem_flags::mem_threadgroup); - type_1 _e3 = w_mem.arr; - output = _e3; + output = w_mem.arr; return; } diff --git a/naga/tests/out/wgsl/210-bevy-2d-shader.frag.wgsl b/naga/tests/out/wgsl/210-bevy-2d-shader.frag.wgsl index a800b0f856..3efe7142fe 100644 --- a/naga/tests/out/wgsl/210-bevy-2d-shader.frag.wgsl +++ b/naga/tests/out/wgsl/210-bevy-2d-shader.frag.wgsl @@ -14,10 +14,8 @@ var global: ColorMaterial_color; fn main_1() { var color: vec4; - let _e4 = global.Color; - color = _e4; - let _e6 = color; - o_Target = _e6; + color = global.Color; + o_Target = color; return; } @@ -25,6 +23,5 @@ fn main_1() { fn main(@location(0) v_Uv: vec2) -> FragmentOutput { v_Uv_1 = v_Uv; main_1(); - let _e9 = o_Target; - return FragmentOutput(_e9); + return FragmentOutput(o_Target); } 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 52355cd404..311d6503a3 100644 --- a/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl +++ b/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl @@ -30,15 +30,11 @@ var gl_Position: vec4; fn main_1() { var position: vec3; - let _e10 = Vertex_Uv_1; - v_Uv = _e10; - let _e11 = Vertex_Position_1; + v_Uv = Vertex_Uv_1; let _e12 = global_2.size; - position = (_e11 * vec3(_e12.x, _e12.y, 1f)); - let _e20 = global.ViewProj; - let _e21 = global_1.Model; + position = (Vertex_Position_1 * vec3(_e12.x, _e12.y, 1f)); let _e23 = position; - gl_Position = ((_e20 * _e21) * vec4(_e23.x, _e23.y, _e23.z, 1f)); + gl_Position = ((global.ViewProj * global_1.Model) * vec4(_e23.x, _e23.y, _e23.z, 1f)); return; } @@ -48,7 +44,5 @@ fn main(@location(0) Vertex_Position: vec3, @location(1) Vertex_Normal: vec Vertex_Normal_1 = Vertex_Normal; Vertex_Uv_1 = Vertex_Uv; main_1(); - let _e21 = v_Uv; - let _e23 = gl_Position; - return VertexOutput(_e21, _e23); + return VertexOutput(v_Uv, gl_Position); } diff --git a/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl b/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl index 223538e4e0..ec000341c7 100644 --- a/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl +++ b/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl @@ -26,20 +26,15 @@ var global_1: Transform; 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, 1f)).xyz; + v_Normal = (global_1.Model * 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; + v_Normal = (mat3x3(_e19[0].xyz, _e19[1].xyz, _e19[2].xyz) * Vertex_Normal_1); let _e32 = Vertex_Position_1; - v_Position = (_e31 * vec4(_e32.x, _e32.y, _e32.z, 1f)).xyz; - let _e40 = Vertex_Uv_1; - v_Uv = _e40; - let _e42 = global.ViewProj; + v_Position = (global_1.Model * vec4(_e32.x, _e32.y, _e32.z, 1f)).xyz; + v_Uv = Vertex_Uv_1; let _e43 = v_Position; - gl_Position = (_e42 * vec4(_e43.x, _e43.y, _e43.z, 1f)); + gl_Position = (global.ViewProj * vec4(_e43.x, _e43.y, _e43.z, 1f)); return; } @@ -49,9 +44,5 @@ fn main(@location(0) Vertex_Position: vec3, @location(1) Vertex_Normal: vec Vertex_Normal_1 = Vertex_Normal; Vertex_Uv_1 = Vertex_Uv; main_1(); - let _e23 = v_Position; - let _e25 = v_Normal; - let _e27 = v_Uv; - let _e29 = gl_Position; - return VertexOutput(_e23, _e25, _e27, _e29); + return VertexOutput(v_Position, v_Normal, v_Uv, gl_Position); } diff --git a/naga/tests/out/wgsl/246-collatz.comp.wgsl b/naga/tests/out/wgsl/246-collatz.comp.wgsl index 71453bfe1c..53f863464a 100644 --- a/naga/tests/out/wgsl/246-collatz.comp.wgsl +++ b/naga/tests/out/wgsl/246-collatz.comp.wgsl @@ -12,42 +12,32 @@ fn collatz_iterations(n: u32) -> u32 { n_1 = n; loop { - let _e7 = n_1; - if !((_e7 != 1u)) { + if !((n_1 != 1u)) { break; } { - let _e12 = n_1; - let _e14 = f32(_e12); + let _e14 = f32(n_1); if ((_e14 - (floor((_e14 / 2f)) * 2f)) == 0f) { { - let _e23 = n_1; - n_1 = (_e23 / 2u); + n_1 = (n_1 / 2u); } } else { { - let _e28 = n_1; - n_1 = ((3u * _e28) + 1u); + n_1 = ((3u * n_1) + 1u); } } - let _e34 = i; - i = (_e34 + 1u); + i = (i + 1u); } } - let _e37 = i; - return _e37; + return i; } fn main_1() { var index: u32; - let _e3 = gl_GlobalInvocationID_1; - index = _e3.x; - let _e6 = index; - let _e8 = index; - let _e10 = global.indices[_e8]; - let _e11 = collatz_iterations(_e10); - global.indices[_e6] = _e11; + index = gl_GlobalInvocationID_1.x; + let _e11 = collatz_iterations(global.indices[index]); + global.indices[index] = _e11; return; } diff --git a/naga/tests/out/wgsl/5246-dual-iteration.frag.wgsl b/naga/tests/out/wgsl/5246-dual-iteration.frag.wgsl index e2672a9951..084318a18d 100644 --- a/naga/tests/out/wgsl/5246-dual-iteration.frag.wgsl +++ b/naga/tests/out/wgsl/5246-dual-iteration.frag.wgsl @@ -4,41 +4,35 @@ fn main_1() { var z: i32; loop { - let _e2 = x; - if !((_e2 < 10i)) { + if !((x < 10i)) { break; } { y = 0i; loop { - let _e11 = y; - if !((_e11 < 10i)) { + if !((y < 10i)) { break; } { z = 0i; loop { - let _e20 = z; - if !((_e20 < 10i)) { + if !((z < 10i)) { break; } { } continuing { - let _e24 = z; - z = (_e24 + 1i); + z = (z + 1i); } } } continuing { - let _e15 = y; - y = (_e15 + 1i); + y = (y + 1i); } } } continuing { - let _e6 = x; - x = (_e6 + 1i); + x = (x + 1i); } } return; diff --git a/naga/tests/out/wgsl/6438-conflicting-idents.wgsl b/naga/tests/out/wgsl/6438-conflicting-idents.wgsl index d13216bf94..2bb153bc34 100644 --- a/naga/tests/out/wgsl/6438-conflicting-idents.wgsl +++ b/naga/tests/out/wgsl/6438-conflicting-idents.wgsl @@ -8,8 +8,7 @@ fn vs(@location(0) xy: vec2) -> OurVertexShaderOutput { var vsOutput: OurVertexShaderOutput; vsOutput.position = vec4(xy, 0f, 1f); - let _e6 = vsOutput; - return _e6; + return vsOutput; } @fragment 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 8d6bc50af0..c2a8f41f82 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 @@ -20,15 +20,10 @@ var frag_color: vec4; var gl_Position: vec4; fn main_1() { - let _e7 = color_1; - frag_color = _e7; - let _e9 = global.view_matrix; - let _e10 = global_1.world_matrix; + frag_color = color_1; let _e12 = position_1; - 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) / 2f); + gl_Position = ((global.view_matrix * global_1.world_matrix) * vec4(_e12.x, _e12.y, 0f, 1f)); + gl_Position.z = ((gl_Position.z + gl_Position.w) / 2f); return; } @@ -37,7 +32,5 @@ fn main(@location(0) position: vec2, @location(1) color: vec4) -> Vert position_1 = position; color_1 = color; main_1(); - let _e15 = frag_color; - let _e17 = gl_Position; - return VertexOutput(_e15, _e17); + return VertexOutput(frag_color, gl_Position); } diff --git a/naga/tests/out/wgsl/932-for-loop-if.frag.wgsl b/naga/tests/out/wgsl/932-for-loop-if.frag.wgsl index bf6a281b49..dc62e6a52f 100644 --- a/naga/tests/out/wgsl/932-for-loop-if.frag.wgsl +++ b/naga/tests/out/wgsl/932-for-loop-if.frag.wgsl @@ -2,15 +2,13 @@ fn main_1() { var i: i32 = 0i; loop { - let _e2 = i; - if !((_e2 < 1i)) { + if !((i < 1i)) { break; } { } continuing { - let _e6 = i; - i = (_e6 + 1i); + i = (i + 1i); } } return; diff --git a/naga/tests/out/wgsl/abstract-types-operators.wgsl b/naga/tests/out/wgsl/abstract-types-operators.wgsl index de2b073074..8f7ed6c9e5 100644 --- a/naga/tests/out/wgsl/abstract-types-operators.wgsl +++ b/naga/tests/out/wgsl/abstract-types-operators.wgsl @@ -46,31 +46,17 @@ fn runtime_values() { var plus_u_uai: u32; var plus_u_u_u: u32; - let _e8 = f; - plus_faf_f = (1f + _e8); - let _e14 = f; - plus_fai_f = (1f + _e14); - let _e18 = f; - plus_f_faf = (_e18 + 2f); - let _e22 = f; - plus_f_fai = (_e22 + 2f); - let _e26 = f; - let _e27 = f; - plus_f_f_f = (_e26 + _e27); - let _e31 = i; - plus_iai_i = (1i + _e31); - let _e35 = i; - plus_i_iai = (_e35 + 2i); - let _e39 = i; - let _e40 = i; - plus_i_i_i = (_e39 + _e40); - let _e44 = u; - plus_uai_u = (1u + _e44); - let _e48 = u; - plus_u_uai = (_e48 + 2u); - let _e52 = u; - let _e53 = u; - plus_u_u_u = (_e52 + _e53); + plus_faf_f = (1f + f); + plus_fai_f = (1f + f); + plus_f_faf = (f + 2f); + plus_f_fai = (f + 2f); + plus_f_f_f = (f + f); + plus_iai_i = (1i + i); + plus_i_iai = (i + 2i); + plus_i_i_i = (i + i); + plus_uai_u = (1u + u); + plus_u_uai = (u + 2u); + plus_u_u_u = (u + u); return; } diff --git a/naga/tests/out/wgsl/abstract-types-var.wgsl b/naga/tests/out/wgsl/abstract-types-var.wgsl index 596595ba44..16503d1326 100644 --- a/naga/tests/out/wgsl/abstract-types-var.wgsl +++ b/naga/tests/out/wgsl/abstract-types-var.wgsl @@ -96,46 +96,26 @@ fn mixed_constant_and_runtime_arguments() { var xaip_iai: array; var xaipai_i: array; - let _e3 = u; - xvupuai_1 = vec2(_e3, 43u); - let _e7 = u; - xvupaiu_1 = vec2(42u, _e7); - let _e11 = u; - xvuuai_1 = vec2(_e11, 43u); - let _e15 = u; - xvuaiu_1 = vec2(42u, _e15); - let _e19 = f; - xmfp_faiaiai_1 = mat2x2(vec2(_e19, 2f), vec2(3f, 4f)); - let _e27 = f; - xmfpai_faiai_1 = mat2x2(vec2(1f, _e27), vec2(3f, 4f)); - let _e35 = f; - xmfpaiai_fai_1 = mat2x2(vec2(1f, 2f), vec2(_e35, 4f)); - let _e43 = f; - xmfpaiaiai_f_1 = mat2x2(vec2(1f, 2f), vec2(3f, _e43)); - let _e51 = f; - xaf_faf_1 = array(_e51, 2f); - let _e55 = f; - xafaf_f_1 = array(1f, _e55); - let _e59 = f; - xaf_fai = array(_e59, 2f); - let _e63 = f; - 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, 2f); - let _e79 = f; - xafpaf_f = array(1f, _e79); - let _e83 = f; - xafp_fai = array(_e83, 2f); - let _e87 = f; - xafpai_f = array(1f, _e87); - let _e91 = i; - xaip_iai = array(_e91, 2i); - let _e95 = i; - xaipai_i = array(1i, _e95); + xvupuai_1 = vec2(u, 43u); + xvupaiu_1 = vec2(42u, u); + xvuuai_1 = vec2(u, 43u); + xvuaiu_1 = vec2(42u, u); + xmfp_faiaiai_1 = mat2x2(vec2(f, 2f), vec2(3f, 4f)); + xmfpai_faiai_1 = mat2x2(vec2(1f, f), vec2(3f, 4f)); + xmfpaiai_fai_1 = mat2x2(vec2(1f, 2f), vec2(f, 4f)); + xmfpaiaiai_f_1 = mat2x2(vec2(1f, 2f), vec2(3f, f)); + xaf_faf_1 = array(f, 2f); + xafaf_f_1 = array(1f, f); + xaf_fai = array(f, 2f); + xafai_f = array(1f, f); + xai_iai_1 = array(i, 2i); + xaiai_i_1 = array(1i, i); + xafp_faf = array(f, 2f); + xafpaf_f = array(1f, f); + xafp_fai = array(f, 2f); + xafpai_f = array(1f, f); + xaip_iai = array(i, 2i); + xaipai_i = array(1i, i); return; } diff --git a/naga/tests/out/wgsl/access.wgsl b/naga/tests/out/wgsl/access.wgsl index 4d60beddb7..4b0325fe9e 100644 --- a/naga/tests/out/wgsl/access.wgsl +++ b/naga/tests/out/wgsl/access.wgsl @@ -43,34 +43,22 @@ fn test_matrix_within_struct_accesses() { var idx: i32 = 1i; var t: Baz = Baz(mat3x2(vec2(1f), vec2(2f), vec2(3f))); - let _e3 = idx; - idx = (_e3 - 1i); + idx = (idx - 1i); let l0_ = baz.m; let l1_ = baz.m[0]; - let _e14 = idx; - let l2_ = baz.m[_e14]; + let l2_ = baz.m[idx]; let l3_ = baz.m[0][1]; - let _e25 = idx; - let l4_ = baz.m[0][_e25]; - let _e30 = idx; - let l5_ = baz.m[_e30][1]; - let _e36 = idx; - let _e38 = idx; - let l6_ = baz.m[_e36][_e38]; - let _e51 = idx; - idx = (_e51 + 1i); + let l4_ = baz.m[0][idx]; + let l5_ = baz.m[idx][1]; + let l6_ = baz.m[idx][idx]; + idx = (idx + 1i); t.m = mat3x2(vec2(6f), vec2(5f), vec2(4f)); t.m[0] = vec2(9f); - let _e66 = idx; - t.m[_e66] = vec2(90f); + t.m[idx] = vec2(90f); t.m[0][1] = 10f; - let _e76 = idx; - t.m[0][_e76] = 20f; - let _e80 = idx; - t.m[_e80][1] = 30f; - let _e85 = idx; - let _e87 = idx; - t.m[_e85][_e87] = 40f; + t.m[0][idx] = 20f; + t.m[idx][1] = 30f; + t.m[idx][idx] = 40f; return; } @@ -78,42 +66,29 @@ fn test_matrix_within_array_within_struct_accesses() { var idx_1: i32 = 1i; var t_1: MatCx2InArray = MatCx2InArray(array, 2>()); - let _e3 = idx_1; - idx_1 = (_e3 - 1i); + idx_1 = (idx_1 - 1i); let l0_1 = nested_mat_cx2_.am; let l1_1 = nested_mat_cx2_.am[0]; let l2_1 = nested_mat_cx2_.am[0][0]; - let _e20 = idx_1; - let l3_1 = nested_mat_cx2_.am[0][_e20]; + let l3_1 = nested_mat_cx2_.am[0][idx_1]; let l4_1 = nested_mat_cx2_.am[0][0][1]; - let _e33 = idx_1; - let l5_1 = nested_mat_cx2_.am[0][0][_e33]; - let _e39 = idx_1; - let l6_1 = nested_mat_cx2_.am[0][_e39][1]; - let _e46 = idx_1; - let _e48 = idx_1; - let l7_ = nested_mat_cx2_.am[0][_e46][_e48]; - let _e55 = idx_1; - idx_1 = (_e55 + 1i); + let l5_1 = nested_mat_cx2_.am[0][0][idx_1]; + let l6_1 = nested_mat_cx2_.am[0][idx_1][1]; + let l7_ = nested_mat_cx2_.am[0][idx_1][idx_1]; + idx_1 = (idx_1 + 1i); t_1.am = array, 2>(); 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(90f); + t_1.am[0][idx_1] = vec2(90f); t_1.am[0][0][1] = 10f; - let _e89 = idx_1; - t_1.am[0][0][_e89] = 20f; - let _e94 = idx_1; - t_1.am[0][_e94][1] = 30f; - let _e100 = idx_1; - let _e102 = idx_1; - t_1.am[0][_e100][_e102] = 40f; + t_1.am[0][0][idx_1] = 20f; + t_1.am[0][idx_1][1] = 30f; + t_1.am[0][idx_1][idx_1] = 40f; return; } fn read_from_private(foo_1: ptr) -> f32 { - let _e1 = (*foo_1); - return _e1; + return (*foo_1); } fn test_arr_as_arg(a: array, 5>) -> f32 { @@ -131,8 +106,7 @@ fn assign_array_through_ptr_fn(foo_2: ptr, 2>>) { } fn fetch_arg_ptr_member(p_1: ptr) -> u32 { - let _e2 = (*p_1).x; - return _e2; + return (*p_1).x; } fn assign_to_arg_ptr_member(p_2: ptr) { @@ -141,8 +115,7 @@ fn assign_to_arg_ptr_member(p_2: ptr) { } fn fetch_arg_ptr_array_element(p_3: ptr>) -> u32 { - let _e2 = (*p_3)[1]; - return _e2; + return (*p_3)[1]; } fn assign_to_arg_ptr_array_element(p_4: ptr>) { diff --git a/naga/tests/out/wgsl/atomicCompareExchange-int64.wgsl b/naga/tests/out/wgsl/atomicCompareExchange-int64.wgsl index 07cce9a89f..e220b9e8e0 100644 --- a/naga/tests/out/wgsl/atomicCompareExchange-int64.wgsl +++ b/naga/tests/out/wgsl/atomicCompareExchange-int64.wgsl @@ -12,36 +12,28 @@ fn test_atomic_compare_exchange_i64_() { var exchanged: bool; loop { - let _e2 = i; - if (_e2 < SIZE) { + if (i < SIZE) { } else { break; } { - let _e6 = i; - let _e8 = atomicLoad((&arr_i64_[_e6])); - old = _e8; + old = atomicLoad((&arr_i64_[i])); exchanged = false; loop { - let _e12 = exchanged; - if !(_e12) { + if !(exchanged) { } else { break; } { - let _e14 = old; - let new_ = bitcast((_e14 + 10li)); - let _e19 = i; - let _e21 = old; - let _e22 = atomicCompareExchangeWeak((&arr_i64_[_e19]), _e21, new_); + let new_ = bitcast((old + 10li)); + let _e22 = atomicCompareExchangeWeak((&arr_i64_[i]), old, new_); old = _e22.old_value; exchanged = _e22.exchanged; } } } continuing { - let _e26 = i; - i = (_e26 + 1u); + i = (i + 1u); } } return; @@ -54,36 +46,28 @@ fn test_atomic_compare_exchange_u64_() { var exchanged_1: bool; loop { - let _e2 = i_1; - if (_e2 < SIZE) { + if (i_1 < SIZE) { } else { break; } { - let _e6 = i_1; - let _e8 = atomicLoad((&arr_u64_[_e6])); - old_1 = _e8; + old_1 = atomicLoad((&arr_u64_[i_1])); exchanged_1 = false; loop { - let _e12 = exchanged_1; - if !(_e12) { + if !(exchanged_1) { } else { break; } { - let _e14 = old_1; - let new_1 = bitcast((_e14 + 10lu)); - let _e19 = i_1; - let _e21 = old_1; - let _e22 = atomicCompareExchangeWeak((&arr_u64_[_e19]), _e21, new_1); + let new_1 = bitcast((old_1 + 10lu)); + let _e22 = atomicCompareExchangeWeak((&arr_u64_[i_1]), old_1, new_1); old_1 = _e22.old_value; exchanged_1 = _e22.exchanged; } } } continuing { - let _e26 = i_1; - i_1 = (_e26 + 1u); + i_1 = (i_1 + 1u); } } return; diff --git a/naga/tests/out/wgsl/atomicCompareExchange.wgsl b/naga/tests/out/wgsl/atomicCompareExchange.wgsl index 17bd5144b1..15ecddb380 100644 --- a/naga/tests/out/wgsl/atomicCompareExchange.wgsl +++ b/naga/tests/out/wgsl/atomicCompareExchange.wgsl @@ -12,36 +12,28 @@ fn test_atomic_compare_exchange_i32_() { var exchanged: bool; loop { - let _e2 = i; - if (_e2 < SIZE) { + if (i < SIZE) { } else { break; } { - let _e6 = i; - let _e8 = atomicLoad((&arr_i32_[_e6])); - old = _e8; + old = atomicLoad((&arr_i32_[i])); exchanged = false; loop { - let _e12 = exchanged; - if !(_e12) { + if !(exchanged) { } else { break; } { - let _e14 = old; - let new_ = bitcast((bitcast(_e14) + 1f)); - let _e20 = i; - let _e22 = old; - let _e23 = atomicCompareExchangeWeak((&arr_i32_[_e20]), _e22, new_); + let new_ = bitcast((bitcast(old) + 1f)); + let _e23 = atomicCompareExchangeWeak((&arr_i32_[i]), old, new_); old = _e23.old_value; exchanged = _e23.exchanged; } } } continuing { - let _e27 = i; - i = (_e27 + 1u); + i = (i + 1u); } } return; @@ -54,36 +46,28 @@ fn test_atomic_compare_exchange_u32_() { var exchanged_1: bool; loop { - let _e2 = i_1; - if (_e2 < SIZE) { + if (i_1 < SIZE) { } else { break; } { - let _e6 = i_1; - let _e8 = atomicLoad((&arr_u32_[_e6])); - old_1 = _e8; + old_1 = atomicLoad((&arr_u32_[i_1])); exchanged_1 = false; loop { - let _e12 = exchanged_1; - if !(_e12) { + if !(exchanged_1) { } else { break; } { - let _e14 = old_1; - let new_1 = bitcast((bitcast(_e14) + 1f)); - let _e20 = i_1; - let _e22 = old_1; - let _e23 = atomicCompareExchangeWeak((&arr_u32_[_e20]), _e22, new_1); + let new_1 = bitcast((bitcast(old_1) + 1f)); + let _e23 = atomicCompareExchangeWeak((&arr_u32_[i_1]), old_1, new_1); old_1 = _e23.old_value; exchanged_1 = _e23.exchanged; } } } continuing { - let _e27 = i_1; - i_1 = (_e27 + 1u); + i_1 = (i_1 + 1u); } } return; diff --git a/naga/tests/out/wgsl/atomicOps-int64-min-max.wgsl b/naga/tests/out/wgsl/atomicOps-int64-min-max.wgsl index 126758b0b5..b136a5ad39 100644 --- a/naga/tests/out/wgsl/atomicOps-int64-min-max.wgsl +++ b/naga/tests/out/wgsl/atomicOps-int64-min-max.wgsl @@ -14,17 +14,13 @@ var input: u64; @compute @workgroup_size(2, 1, 1) fn cs_main(@builtin(local_invocation_id) id: vec3) { - let _e3 = input; - atomicMax((&storage_atomic_scalar), _e3); - let _e7 = input; - atomicMax((&storage_atomic_arr[1]), (1lu + _e7)); + atomicMax((&storage_atomic_scalar), input); + atomicMax((&storage_atomic_arr[1]), (1lu + input)); atomicMax((&storage_struct.atomic_scalar), 1lu); atomicMax((&storage_struct.atomic_arr[1]), u64(id.x)); workgroupBarrier(); - let _e20 = input; - atomicMin((&storage_atomic_scalar), _e20); - let _e24 = input; - atomicMin((&storage_atomic_arr[1]), (1lu + _e24)); + atomicMin((&storage_atomic_scalar), input); + atomicMin((&storage_atomic_arr[1]), (1lu + input)); atomicMin((&storage_struct.atomic_scalar), 1lu); atomicMin((&storage_struct.atomic_arr[1]), u64(id.x)); return; diff --git a/naga/tests/out/wgsl/bevy-pbr.frag.wgsl b/naga/tests/out/wgsl/bevy-pbr.frag.wgsl index 78d3fbe606..7b30ffc16f 100644 --- a/naga/tests/out/wgsl/bevy-pbr.frag.wgsl +++ b/naga/tests/out/wgsl/bevy-pbr.frag.wgsl @@ -100,13 +100,8 @@ fn pow5_(x: f32) -> f32 { var x2_: f32; x_1 = x; - let _e42 = x_1; - let _e43 = x_1; - x2_ = (_e42 * _e43); - let _e46 = x2_; - let _e47 = x2_; - let _e49 = x_1; - return ((_e46 * _e47) * _e49); + x2_ = (x_1 * x_1); + return ((x2_ * x2_) * x_1); } fn getDistanceAttenuation(distanceSquare: f32, inverseRangeSquared: f32) -> f32 { @@ -118,18 +113,10 @@ fn getDistanceAttenuation(distanceSquare: f32, inverseRangeSquared: f32) -> f32 distanceSquare_1 = distanceSquare; inverseRangeSquared_1 = inverseRangeSquared; - let _e44 = distanceSquare_1; - let _e45 = inverseRangeSquared_1; - factor = (_e44 * _e45); - let _e49 = factor; - let _e50 = factor; - smoothFactor = clamp((1f - (_e49 * _e50)), 0f, 1f); - let _e57 = smoothFactor; - let _e58 = smoothFactor; - attenuation = (_e57 * _e58); - let _e61 = attenuation; - let _e64 = distanceSquare_1; - return ((_e61 * 1f) / max(_e64, 0.001f)); + factor = (distanceSquare_1 * inverseRangeSquared_1); + smoothFactor = clamp((1f - (factor * factor)), 0f, 1f); + attenuation = (smoothFactor * smoothFactor); + return ((attenuation * 1f) / max(distanceSquare_1, 0.001f)); } fn D_GGX(roughness: f32, NoH: f32, h: vec3) -> f32 { @@ -142,22 +129,11 @@ fn D_GGX(roughness: f32, NoH: f32, h: vec3) -> f32 { roughness_1 = roughness; NoH_1 = NoH; - let _e46 = NoH_1; - let _e47 = NoH_1; - oneMinusNoHSquared = (1f - (_e46 * _e47)); - let _e51 = NoH_1; - let _e52 = roughness_1; - a = (_e51 * _e52); - let _e55 = roughness_1; - let _e56 = oneMinusNoHSquared; - let _e57 = a; - let _e58 = a; - k = (_e55 / (_e56 + (_e57 * _e58))); - let _e63 = k; - let _e64 = k; - d = ((_e63 * _e64) * 0.31830987f); - let _e71 = d; - return _e71; + oneMinusNoHSquared = (1f - (NoH_1 * NoH_1)); + a = (NoH_1 * roughness_1); + k = (roughness_1 / (oneMinusNoHSquared + (a * a))); + d = ((k * k) * 0.31830987f); + return d; } fn V_SmithGGXCorrelated(roughness_2: f32, NoV: f32, NoL: f32) -> f32 { @@ -172,28 +148,11 @@ fn V_SmithGGXCorrelated(roughness_2: f32, NoV: f32, NoL: f32) -> f32 { roughness_3 = roughness_2; NoV_1 = NoV; NoL_1 = NoL; - let _e46 = roughness_3; - let _e47 = roughness_3; - a2_ = (_e46 * _e47); - let _e50 = NoL_1; - let _e51 = NoV_1; - let _e52 = a2_; - let _e53 = NoV_1; - let _e56 = NoV_1; - let _e58 = a2_; - lambdaV = (_e50 * sqrt((((_e51 - (_e52 * _e53)) * _e56) + _e58))); - let _e63 = NoV_1; - let _e64 = NoL_1; - let _e65 = a2_; - let _e66 = NoL_1; - let _e69 = NoL_1; - let _e71 = a2_; - lambdaL = (_e63 * sqrt((((_e64 - (_e65 * _e66)) * _e69) + _e71))); - let _e77 = lambdaV; - let _e78 = lambdaL; - v = (0.5f / (_e77 + _e78)); - let _e82 = v; - return _e82; + a2_ = (roughness_3 * roughness_3); + lambdaV = (NoL_1 * sqrt((((NoV_1 - (a2_ * NoV_1)) * NoV_1) + a2_))); + lambdaL = (NoV_1 * sqrt((((NoL_1 - (a2_ * NoL_1)) * NoL_1) + a2_))); + v = (0.5f / (lambdaV + lambdaL)); + return v; } fn F_Schlick(f0_: vec3, f90_: f32, VoH: f32) -> vec3 { @@ -202,10 +161,8 @@ fn F_Schlick(f0_: vec3, f90_: f32, VoH: f32) -> vec3 { f90_1 = f90_; VoH_1 = VoH; - let _e45 = f90_1; - let _e49 = VoH_1; - let _e51 = pow5_((1f - _e49)); - return (f0_ + ((vec3(_e45) - f0_) * _e51)); + let _e51 = pow5_((1f - VoH_1)); + return (f0_ + ((vec3(f90_1) - f0_) * _e51)); } fn F_Schlick_1(f0_1: f32, f90_2: f32, VoH_2: f32) -> f32 { @@ -216,12 +173,8 @@ fn F_Schlick_1(f0_1: f32, f90_2: f32, VoH_2: f32) -> f32 { f0_2 = f0_1; f90_3 = f90_2; VoH_3 = VoH_2; - let _e46 = f0_2; - let _e47 = f90_3; - let _e48 = f0_2; - let _e51 = VoH_3; - let _e53 = pow5_((1f - _e51)); - return (_e46 + ((_e47 - _e48) * _e53)); + let _e53 = pow5_((1f - VoH_3)); + return (f0_2 + ((f90_3 - f0_2) * _e53)); } fn fresnel(f0_3: vec3, LoH: f32) -> vec3 { @@ -231,12 +184,8 @@ fn fresnel(f0_3: vec3, LoH: f32) -> vec3 { f0_4 = f0_3; LoH_1 = LoH; - let _e44 = f0_4; - f90_4 = clamp(dot(_e44, vec3(16.5f)), 0f, 1f); - let _e54 = f0_4; - let _e55 = f90_4; - let _e56 = LoH_1; - let _e57 = F_Schlick(_e54, _e55, _e56); + f90_4 = clamp(dot(f0_4, vec3(16.5f)), 0f, 1f); + let _e57 = F_Schlick(f0_4, f90_4, LoH_1); return _e57; } @@ -259,24 +208,13 @@ fn specular(f0_5: vec3, roughness_4: f32, h_1: vec3, NoV_2: f32, NoL_2 NoH_3 = NoH_2; LoH_3 = LoH_2; specularIntensity_1 = specularIntensity; - let _e55 = roughness_5; - let _e56 = NoH_3; - let _e57 = D_GGX(_e55, _e56, h_1); + let _e57 = D_GGX(roughness_5, NoH_3, h_1); D = _e57; - let _e59 = roughness_5; - let _e60 = NoV_3; - let _e61 = NoL_3; - let _e62 = V_SmithGGXCorrelated(_e59, _e60, _e61); + let _e62 = V_SmithGGXCorrelated(roughness_5, NoV_3, NoL_3); V = _e62; - let _e64 = f0_6; - let _e65 = LoH_3; - let _e66 = fresnel(_e64, _e65); + let _e66 = fresnel(f0_6, LoH_3); F = _e66; - let _e68 = specularIntensity_1; - let _e69 = D; - let _e71 = V; - let _e73 = F; - return (((_e68 * _e69) * _e71) * _e73); + return (((specularIntensity_1 * D) * V) * F); } fn Fd_Burley(roughness_6: f32, NoV_4: f32, NoL_4: f32, LoH_4: f32) -> f32 { @@ -292,21 +230,12 @@ fn Fd_Burley(roughness_6: f32, NoV_4: f32, NoL_4: f32, LoH_4: f32) -> f32 { NoV_5 = NoV_4; NoL_5 = NoL_4; LoH_5 = LoH_4; - let _e50 = roughness_7; - let _e52 = LoH_5; - let _e54 = LoH_5; - f90_5 = (0.5f + (((2f * _e50) * _e52) * _e54)); - let _e59 = f90_5; - let _e60 = NoL_5; - let _e61 = F_Schlick_1(1f, _e59, _e60); + f90_5 = (0.5f + (((2f * roughness_7) * LoH_5) * LoH_5)); + let _e61 = F_Schlick_1(1f, f90_5, NoL_5); lightScatter = _e61; - let _e64 = f90_5; - let _e65 = NoV_5; - let _e66 = F_Schlick_1(1f, _e64, _e65); + let _e66 = F_Schlick_1(1f, f90_5, NoV_5); viewScatter = _e66; - let _e68 = lightScatter; - let _e69 = viewScatter; - return ((_e68 * _e69) * 0.31830987f); + return ((lightScatter * viewScatter) * 0.31830987f); } fn EnvBRDFApprox(f0_7: vec3, perceptual_roughness: f32, NoV_6: f32) -> vec3 { @@ -322,23 +251,10 @@ fn EnvBRDFApprox(f0_7: vec3, perceptual_roughness: f32, NoV_6: f32) -> vec3 f0_8 = f0_7; perceptual_roughness_1 = perceptual_roughness; NoV_7 = NoV_6; - let _e62 = perceptual_roughness_1; - let _e64 = c0_; - let _e66 = c1_; - r = ((vec4(_e62) * _e64) + _e66); - let _e69 = r; - let _e71 = r; - let _e76 = NoV_7; - let _e80 = r; - let _e83 = r; - a004_ = ((min((_e69.x * _e71.x), exp2((-9.28f * _e76))) * _e80.x) + _e83.y); - let _e91 = a004_; - let _e94 = r; - AB = ((vec2(-1.04f, 1.04f) * vec2(_e91)) + _e94.zw); - let _e98 = f0_8; - let _e99 = AB; - let _e103 = AB; - return ((_e98 * vec3(_e99.x)) + vec3(_e103.y)); + r = ((vec4(perceptual_roughness_1) * c0_) + c1_); + a004_ = ((min((r.x * r.x), exp2((-9.28f * NoV_7))) * r.x) + r.y); + AB = ((vec2(-1.04f, 1.04f) * vec2(a004_)) + r.zw); + return ((f0_8 * vec3(AB.x)) + vec3(AB.y)); } fn perceptualRoughnessToRoughness(perceptualRoughness: f32) -> f32 { @@ -346,20 +262,15 @@ fn perceptualRoughnessToRoughness(perceptualRoughness: f32) -> f32 { var clampedPerceptualRoughness: f32; perceptualRoughness_1 = perceptualRoughness; - let _e42 = perceptualRoughness_1; - clampedPerceptualRoughness = clamp(_e42, 0.089f, 1f); - let _e47 = clampedPerceptualRoughness; - let _e48 = clampedPerceptualRoughness; - return (_e47 * _e48); + clampedPerceptualRoughness = clamp(perceptualRoughness_1, 0.089f, 1f); + return (clampedPerceptualRoughness * clampedPerceptualRoughness); } fn reinhard(color: vec3) -> vec3 { var color_1: vec3; color_1 = color; - let _e42 = color_1; - let _e45 = color_1; - return (_e42 / (vec3(1f) + _e45)); + return (color_1 / (vec3(1f) + color_1)); } fn reinhard_extended(color_2: vec3, max_white: f32) -> vec3 { @@ -369,22 +280,15 @@ fn reinhard_extended(color_2: vec3, max_white: f32) -> vec3 { color_3 = color_2; max_white_1 = max_white; - let _e44 = color_3; - let _e47 = color_3; - let _e48 = max_white_1; - let _e49 = max_white_1; - numerator = (_e44 * (vec3(1f) + (_e47 / vec3((_e48 * _e49))))); - let _e56 = numerator; - let _e59 = color_3; - return (_e56 / (vec3(1f) + _e59)); + numerator = (color_3 * (vec3(1f) + (color_3 / vec3((max_white_1 * max_white_1))))); + return (numerator / (vec3(1f) + color_3)); } fn luminance(v_1: vec3) -> f32 { var v_2: vec3; v_2 = v_1; - let _e42 = v_2; - return dot(_e42, vec3(0.2126f, 0.7152f, 0.0722f)); + return dot(v_2, vec3(0.2126f, 0.7152f, 0.0722f)); } fn change_luminance(c_in: vec3, l_out: f32) -> vec3 { @@ -394,13 +298,9 @@ fn change_luminance(c_in: vec3, l_out: f32) -> vec3 { c_in_1 = c_in; l_out_1 = l_out; - let _e44 = c_in_1; - let _e45 = luminance(_e44); + let _e45 = luminance(c_in_1); l_in = _e45; - let _e47 = c_in_1; - let _e48 = l_out_1; - let _e49 = l_in; - return (_e47 * (_e48 / _e49)); + return (c_in_1 * (l_out_1 / l_in)); } fn reinhard_luminance(color_4: vec3) -> vec3 { @@ -409,15 +309,10 @@ fn reinhard_luminance(color_4: vec3) -> vec3 { var l_new: f32; color_5 = color_4; - let _e42 = color_5; - let _e43 = luminance(_e42); + let _e43 = luminance(color_5); l_old = _e43; - let _e45 = l_old; - let _e47 = l_old; - l_new = (_e45 / (1f + _e47)); - let _e51 = color_5; - let _e52 = l_new; - let _e53 = change_luminance(_e51, _e52); + l_new = (l_old / (1f + l_old)); + let _e53 = change_luminance(color_5, l_new); return _e53; } @@ -430,20 +325,11 @@ fn reinhard_extended_luminance(color_6: vec3, max_white_l: f32) -> vec3, V_ R_1 = R; F0_1 = F0_; diffuseColor_1 = diffuseColor; - let _e56 = light_1; - let _e59 = v_WorldPosition_1; - light_to_frag = (_e56.pos.xyz - _e59.xyz); - let _e63 = light_to_frag; - let _e64 = light_to_frag; - distance_square = dot(_e63, _e64); - let _e67 = distance_square; - let _e68 = light_1; - let _e71 = getDistanceAttenuation(_e67, _e68.lightParams.x); + light_to_frag = (light_1.pos.xyz - v_WorldPosition_1.xyz); + distance_square = dot(light_to_frag, light_to_frag); + let _e71 = getDistanceAttenuation(distance_square, light_1.lightParams.x); rangeAttenuation = _e71; - let _e73 = roughness_9; - a_1 = _e73; - let _e75 = light_1; - radius = _e75.lightParams.y; - let _e79 = light_to_frag; - let _e80 = R_1; - let _e82 = R_1; - let _e84 = light_to_frag; - centerToRay = ((dot(_e79, _e80) * _e82) - _e84); - let _e87 = light_to_frag; - let _e88 = centerToRay; - let _e89 = radius; - let _e90 = centerToRay; - let _e91 = centerToRay; - closestPoint = (_e87 + (_e88 * clamp((_e89 * inverseSqrt(dot(_e90, _e91))), 0f, 1f))); - let _e101 = closestPoint; - let _e102 = closestPoint; - LspecLengthInverse = inverseSqrt(dot(_e101, _e102)); - let _e106 = a_1; - let _e107 = a_1; - let _e108 = radius; - let _e111 = LspecLengthInverse; - normalizationFactor = (_e106 / clamp((_e107 + ((_e108 * 0.5f) * _e111)), 0f, 1f)); - let _e119 = normalizationFactor; - let _e120 = normalizationFactor; - specularIntensity_2 = (_e119 * _e120); - let _e123 = closestPoint; - let _e124 = LspecLengthInverse; - L = (_e123 * _e124); - let _e127 = L; - let _e128 = V_2; - H = normalize((_e127 + _e128)); - let _e132 = N_1; - let _e133 = L; - NoL_6 = clamp(dot(_e132, _e133), 0f, 1f); - let _e139 = N_1; - let _e140 = H; - NoH_4 = clamp(dot(_e139, _e140), 0f, 1f); - let _e146 = L; - let _e147 = H; - LoH_6 = clamp(dot(_e146, _e147), 0f, 1f); - let _e153 = F0_1; - let _e154 = roughness_9; - let _e155 = H; - let _e156 = NdotV_1; - let _e157 = NoL_6; - let _e158 = NoH_4; - let _e159 = LoH_6; - let _e160 = specularIntensity_2; - let _e161 = specular(_e153, _e154, _e155, _e156, _e157, _e158, _e159, _e160); + a_1 = roughness_9; + radius = light_1.lightParams.y; + centerToRay = ((dot(light_to_frag, R_1) * R_1) - light_to_frag); + closestPoint = (light_to_frag + (centerToRay * clamp((radius * inverseSqrt(dot(centerToRay, centerToRay))), 0f, 1f))); + LspecLengthInverse = inverseSqrt(dot(closestPoint, closestPoint)); + normalizationFactor = (a_1 / clamp((a_1 + ((radius * 0.5f) * LspecLengthInverse)), 0f, 1f)); + specularIntensity_2 = (normalizationFactor * normalizationFactor); + L = (closestPoint * LspecLengthInverse); + H = normalize((L + V_2)); + NoL_6 = clamp(dot(N_1, L), 0f, 1f); + NoH_4 = clamp(dot(N_1, H), 0f, 1f); + LoH_6 = clamp(dot(L, H), 0f, 1f); + let _e161 = specular(F0_1, roughness_9, H, NdotV_1, NoL_6, NoH_4, LoH_6, specularIntensity_2); specular_1 = _e161; - let _e163 = light_to_frag; - L = normalize(_e163); - let _e165 = L; - let _e166 = V_2; - H = normalize((_e165 + _e166)); - let _e169 = N_1; - let _e170 = L; - NoL_6 = clamp(dot(_e169, _e170), 0f, 1f); - let _e175 = N_1; - let _e176 = H; - NoH_4 = clamp(dot(_e175, _e176), 0f, 1f); - let _e181 = L; - let _e182 = H; - LoH_6 = clamp(dot(_e181, _e182), 0f, 1f); - let _e187 = diffuseColor_1; - let _e188 = roughness_9; - let _e189 = NdotV_1; - let _e190 = NoL_6; - let _e191 = LoH_6; - let _e192 = Fd_Burley(_e188, _e189, _e190, _e191); - diffuse = (_e187 * _e192); - let _e195 = diffuse; - let _e196 = specular_1; - let _e198 = light_1; - let _e202 = rangeAttenuation; - let _e203 = NoL_6; - return (((_e195 + _e196) * _e198.color.xyz) * (_e202 * _e203)); + L = normalize(light_to_frag); + H = normalize((L + V_2)); + NoL_6 = clamp(dot(N_1, L), 0f, 1f); + NoH_4 = clamp(dot(N_1, H), 0f, 1f); + LoH_6 = clamp(dot(L, H), 0f, 1f); + let _e192 = Fd_Burley(roughness_9, NdotV_1, NoL_6, LoH_6); + diffuse = (diffuseColor_1 * _e192); + return (((diffuse + specular_1) * light_1.color.xyz) * (rangeAttenuation * NoL_6)); } fn dir_light(light_2: DirectionalLight, roughness_10: f32, NdotV_2: f32, normal: vec3, view: vec3, R_2: vec3, F0_2: vec3, diffuseColor_2: vec3) -> vec3 { @@ -598,42 +422,16 @@ fn dir_light(light_2: DirectionalLight, roughness_10: f32, NdotV_2: f32, normal: R_3 = R_2; F0_3 = F0_2; diffuseColor_3 = diffuseColor_2; - let _e56 = light_3; - incident_light = _e56.direction.xyz; - let _e60 = incident_light; - let _e61 = view_1; - half_vector = normalize((_e60 + _e61)); - let _e65 = normal_1; - let _e66 = incident_light; - NoL_7 = clamp(dot(_e65, _e66), 0f, 1f); - let _e72 = normal_1; - let _e73 = half_vector; - NoH_5 = clamp(dot(_e72, _e73), 0f, 1f); - let _e79 = incident_light; - let _e80 = half_vector; - LoH_7 = clamp(dot(_e79, _e80), 0f, 1f); - let _e86 = diffuseColor_3; - let _e87 = roughness_11; - let _e88 = NdotV_3; - let _e89 = NoL_7; - let _e90 = LoH_7; - let _e91 = Fd_Burley(_e87, _e88, _e89, _e90); - diffuse_1 = (_e86 * _e91); - let _e96 = F0_3; - let _e97 = roughness_11; - let _e98 = half_vector; - let _e99 = NdotV_3; - let _e100 = NoL_7; - let _e101 = NoH_5; - let _e102 = LoH_7; - let _e103 = specularIntensity_3; - let _e104 = specular(_e96, _e97, _e98, _e99, _e100, _e101, _e102, _e103); + incident_light = light_3.direction.xyz; + half_vector = normalize((incident_light + view_1)); + NoL_7 = clamp(dot(normal_1, incident_light), 0f, 1f); + NoH_5 = clamp(dot(normal_1, half_vector), 0f, 1f); + LoH_7 = clamp(dot(incident_light, half_vector), 0f, 1f); + let _e91 = Fd_Burley(roughness_11, NdotV_3, NoL_7, LoH_7); + diffuse_1 = (diffuseColor_3 * _e91); + let _e104 = specular(F0_3, roughness_11, half_vector, NdotV_3, NoL_7, NoH_5, LoH_7, specularIntensity_3); specular_2 = _e104; - let _e106 = specular_2; - let _e107 = diffuse_1; - let _e109 = light_3; - let _e113 = NoL_7; - return (((_e106 + _e107) * _e109.color.xyz) * _e113); + return (((specular_2 + diffuse_1) * light_3.color.xyz) * NoL_7); } fn main_1() { @@ -662,193 +460,100 @@ fn main_1() { var diffuse_ambient: vec3; var specular_ambient: vec3; - let _e40 = global_3.base_color; - output_color = _e40; - let _e42 = output_color; - let _e43 = v_Uv_1; - let _e44 = textureSample(StandardMaterial_base_color_texture, StandardMaterial_base_color_texture_sampler, _e43); - output_color = (_e42 * _e44); - let _e46 = v_Uv_1; - let _e47 = textureSample(StandardMaterial_metallic_roughness_texture, StandardMaterial_metallic_roughness_texture_sampler, _e46); + output_color = global_3.base_color; + let _e44 = textureSample(StandardMaterial_base_color_texture, StandardMaterial_base_color_texture_sampler, v_Uv_1); + output_color = (output_color * _e44); + let _e47 = textureSample(StandardMaterial_metallic_roughness_texture, StandardMaterial_metallic_roughness_texture_sampler, v_Uv_1); metallic_roughness = _e47; - let _e49 = global_5.metallic; - let _e50 = metallic_roughness; - metallic = (_e49 * _e50.z); - let _e54 = global_4.perceptual_roughness; - let _e55 = metallic_roughness; - perceptual_roughness_2 = (_e54 * _e55.y); - let _e59 = perceptual_roughness_2; - let _e60 = perceptualRoughnessToRoughness(_e59); + metallic = (global_5.metallic * metallic_roughness.z); + perceptual_roughness_2 = (global_4.perceptual_roughness * metallic_roughness.y); + let _e60 = perceptualRoughnessToRoughness(perceptual_roughness_2); roughness_12 = _e60; - let _e62 = v_WorldNormal_1; - N_2 = normalize(_e62); - let _e65 = v_WorldTangent_1; - T = normalize(_e65.xyz); - let _e69 = N_2; - let _e70 = T; - let _e72 = v_WorldTangent_1; - B = (cross(_e69, _e70) * _e72.w); - let _e77 = gl_FrontFacing_1; - if _e77 { - let _e78 = N_2; - local = _e78; + N_2 = normalize(v_WorldNormal_1); + T = normalize(v_WorldTangent_1.xyz); + B = (cross(N_2, T) * v_WorldTangent_1.w); + if gl_FrontFacing_1 { + local = N_2; } else { - let _e79 = N_2; - local = -(_e79); + local = -(N_2); } - let _e82 = local; - N_2 = _e82; - let _e83 = gl_FrontFacing_1; - if _e83 { - let _e84 = T; - local_1 = _e84; + N_2 = local; + if gl_FrontFacing_1 { + local_1 = T; } else { - let _e85 = T; - local_1 = -(_e85); + local_1 = -(T); } - let _e88 = local_1; - T = _e88; - let _e89 = gl_FrontFacing_1; - if _e89 { - let _e90 = B; - local_2 = _e90; + T = local_1; + if gl_FrontFacing_1 { + local_2 = B; } else { - let _e91 = B; - local_2 = -(_e91); + local_2 = -(B); } - let _e94 = local_2; - B = _e94; + B = local_2; let _e95 = T; let _e96 = B; let _e97 = N_2; TBN = mat3x3(vec3(_e95.x, _e95.y, _e95.z), vec3(_e96.x, _e96.y, _e96.z), vec3(_e97.x, _e97.y, _e97.z)); - let _e112 = TBN; - let _e113 = v_Uv_1; - let _e114 = textureSample(StandardMaterial_normal_map, StandardMaterial_normal_map_sampler, _e113); - N_2 = (_e112 * normalize(((_e114.xyz * 2f) - vec3(1f)))); - let _e123 = v_Uv_1; - let _e124 = textureSample(StandardMaterial_occlusion_texture, StandardMaterial_occlusion_texture_sampler, _e123); + let _e114 = textureSample(StandardMaterial_normal_map, StandardMaterial_normal_map_sampler, v_Uv_1); + N_2 = (TBN * normalize(((_e114.xyz * 2f) - vec3(1f)))); + let _e124 = textureSample(StandardMaterial_occlusion_texture, StandardMaterial_occlusion_texture_sampler, v_Uv_1); occlusion = _e124.x; - let _e127 = global_7.emissive; - emissive = _e127; - let _e129 = emissive; - let _e131 = emissive; - let _e133 = v_Uv_1; - let _e134 = textureSample(StandardMaterial_emissive_texture, StandardMaterial_emissive_texture_sampler, _e133); - let _e136 = (_e131.xyz * _e134.xyz); + emissive = global_7.emissive; + let _e134 = textureSample(StandardMaterial_emissive_texture, StandardMaterial_emissive_texture_sampler, v_Uv_1); + let _e136 = (emissive.xyz * _e134.xyz); emissive.x = _e136.x; emissive.y = _e136.y; emissive.z = _e136.z; - let _e143 = global_1.CameraPos; - let _e145 = v_WorldPosition_1; - V_3 = normalize((_e143.xyz - _e145.xyz)); - let _e150 = N_2; - let _e151 = V_3; - NdotV_4 = max(dot(_e150, _e151), 0.001f); - let _e157 = global_6.reflectance; - let _e159 = global_6.reflectance; - let _e162 = metallic; - let _e166 = output_color; - let _e168 = metallic; - F0_4 = (vec3((((0.16f * _e157) * _e159) * (1f - _e162))) + (_e166.xyz * vec3(_e168))); - let _e173 = output_color; - let _e176 = metallic; - diffuseColor_4 = (_e173.xyz * vec3((1f - _e176))); - let _e181 = V_3; - let _e183 = N_2; - R_4 = reflect(-(_e181), _e183); + V_3 = normalize((global_1.CameraPos.xyz - v_WorldPosition_1.xyz)); + NdotV_4 = max(dot(N_2, V_3), 0.001f); + F0_4 = (vec3((((0.16f * global_6.reflectance) * global_6.reflectance) * (1f - metallic))) + (output_color.xyz * vec3(metallic))); + diffuseColor_4 = (output_color.xyz * vec3((1f - metallic))); + R_4 = reflect(-(V_3), N_2); loop { - let _e191 = i; - let _e192 = global_2.NumLights; - let _e196 = i; - if !(((_e191 < i32(_e192.x)) && (_e196 < MAX_POINT_LIGHTS))) { + if !(((i < i32(global_2.NumLights.x)) && (i < MAX_POINT_LIGHTS))) { break; } { - let _e203 = light_accum; - let _e204 = i; - let _e206 = global_2.PointLights[_e204]; - let _e207 = roughness_12; - let _e208 = NdotV_4; - let _e209 = N_2; - let _e210 = V_3; - let _e211 = R_4; - let _e212 = F0_4; - let _e213 = diffuseColor_4; - let _e214 = point_light(_e206, _e207, _e208, _e209, _e210, _e211, _e212, _e213); - light_accum = (_e203 + _e214); + let _e214 = point_light(global_2.PointLights[i], roughness_12, NdotV_4, N_2, V_3, R_4, F0_4, diffuseColor_4); + light_accum = (light_accum + _e214); } continuing { - let _e200 = i; - i = (_e200 + 1i); + i = (i + 1i); } } loop { - let _e218 = i_1; - let _e219 = global_2.NumLights; - let _e223 = i_1; - if !(((_e218 < i32(_e219.y)) && (_e223 < MAX_DIRECTIONAL_LIGHTS))) { + if !(((i_1 < i32(global_2.NumLights.y)) && (i_1 < MAX_DIRECTIONAL_LIGHTS))) { break; } { - let _e230 = light_accum; - let _e231 = i_1; - let _e233 = global_2.DirectionalLights[_e231]; - let _e234 = roughness_12; - let _e235 = NdotV_4; - let _e236 = N_2; - let _e237 = V_3; - let _e238 = R_4; - let _e239 = F0_4; - let _e240 = diffuseColor_4; - let _e241 = dir_light(_e233, _e234, _e235, _e236, _e237, _e238, _e239, _e240); - light_accum = (_e230 + _e241); + let _e241 = dir_light(global_2.DirectionalLights[i_1], roughness_12, NdotV_4, N_2, V_3, R_4, F0_4, diffuseColor_4); + light_accum = (light_accum + _e241); } continuing { - let _e227 = i_1; - i_1 = (_e227 + 1i); + i_1 = (i_1 + 1i); } } - let _e243 = diffuseColor_4; - let _e245 = NdotV_4; - let _e246 = EnvBRDFApprox(_e243, 1f, _e245); + let _e246 = EnvBRDFApprox(diffuseColor_4, 1f, NdotV_4); diffuse_ambient = _e246; - let _e248 = F0_4; - let _e249 = perceptual_roughness_2; - let _e250 = NdotV_4; - let _e251 = EnvBRDFApprox(_e248, _e249, _e250); + let _e251 = EnvBRDFApprox(F0_4, perceptual_roughness_2, NdotV_4); specular_ambient = _e251; - let _e253 = output_color; let _e255 = light_accum; output_color.x = _e255.x; output_color.y = _e255.y; output_color.z = _e255.z; - let _e262 = output_color; - let _e264 = output_color; - let _e266 = diffuse_ambient; - let _e267 = specular_ambient; - let _e269 = global_2.AmbientColor; - let _e272 = occlusion; - let _e274 = (_e264.xyz + (((_e266 + _e267) * _e269.xyz) * _e272)); + let _e274 = (output_color.xyz + (((diffuse_ambient + specular_ambient) * global_2.AmbientColor.xyz) * occlusion)); output_color.x = _e274.x; output_color.y = _e274.y; output_color.z = _e274.z; - let _e281 = output_color; - let _e283 = output_color; - let _e285 = emissive; - let _e287 = output_color; - let _e290 = (_e283.xyz + (_e285.xyz * _e287.w)); + let _e290 = (output_color.xyz + (emissive.xyz * output_color.w)); output_color.x = _e290.x; output_color.y = _e290.y; output_color.z = _e290.z; - let _e297 = output_color; - let _e299 = output_color; - let _e301 = reinhard_luminance(_e299.xyz); + let _e301 = reinhard_luminance(output_color.xyz); output_color.x = _e301.x; output_color.y = _e301.y; output_color.z = _e301.z; - let _e308 = output_color; - o_Target = _e308; + o_Target = output_color; return; } @@ -860,6 +565,5 @@ fn main(@location(0) v_WorldPosition: vec3, @location(1) v_WorldNormal: vec v_WorldTangent_1 = v_WorldTangent; gl_FrontFacing_1 = gl_FrontFacing; main_1(); - let _e69 = o_Target; - return FragmentOutput(_e69); + return FragmentOutput(o_Target); } diff --git a/naga/tests/out/wgsl/bevy-pbr.vert.wgsl b/naga/tests/out/wgsl/bevy-pbr.vert.wgsl index 1524b9e469..299fce13d1 100644 --- a/naga/tests/out/wgsl/bevy-pbr.vert.wgsl +++ b/naga/tests/out/wgsl/bevy-pbr.vert.wgsl @@ -31,24 +31,16 @@ var gl_Position: vec4; fn main_1() { var world_position: vec4; - let _e12 = global_1.Model; let _e13 = Vertex_Position_1; - world_position = (_e12 * vec4(_e13.x, _e13.y, _e13.z, 1f)); - let _e21 = world_position; - v_WorldPosition = _e21.xyz; + world_position = (global_1.Model * vec4(_e13.x, _e13.y, _e13.z, 1f)); + v_WorldPosition = world_position.xyz; let _e23 = global_1.Model; - let _e33 = Vertex_Normal_1; - v_WorldNormal = (mat3x3(_e23[0].xyz, _e23[1].xyz, _e23[2].xyz) * _e33); - let _e35 = Vertex_Uv_1; - v_Uv = _e35; + v_WorldNormal = (mat3x3(_e23[0].xyz, _e23[1].xyz, _e23[2].xyz) * Vertex_Normal_1); + v_Uv = Vertex_Uv_1; let _e36 = global_1.Model; - let _e46 = Vertex_Tangent_1; - let _e48 = (mat3x3(_e36[0].xyz, _e36[1].xyz, _e36[2].xyz) * _e46.xyz); - let _e49 = Vertex_Tangent_1; - v_WorldTangent = vec4(_e48.x, _e48.y, _e48.z, _e49.w); - let _e56 = global.ViewProj; - let _e57 = world_position; - gl_Position = (_e56 * _e57); + let _e48 = (mat3x3(_e36[0].xyz, _e36[1].xyz, _e36[2].xyz) * Vertex_Tangent_1.xyz); + v_WorldTangent = vec4(_e48.x, _e48.y, _e48.z, Vertex_Tangent_1.w); + gl_Position = (global.ViewProj * world_position); return; } @@ -59,10 +51,5 @@ fn main(@location(0) Vertex_Position: vec3, @location(1) Vertex_Normal: vec Vertex_Uv_1 = Vertex_Uv; Vertex_Tangent_1 = Vertex_Tangent; main_1(); - let _e29 = v_WorldPosition; - let _e31 = v_WorldNormal; - let _e33 = v_Uv; - let _e35 = v_WorldTangent; - let _e37 = gl_Position; - return VertexOutput(_e29, _e31, _e33, _e35, _e37); + return VertexOutput(v_WorldPosition, v_WorldNormal, v_Uv, v_WorldTangent, gl_Position); } diff --git a/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl b/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl index 4b2f079206..800fdbda7b 100644 --- a/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl +++ b/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl @@ -13,6 +13,5 @@ fn function() { @fragment fn main() -> @location(0) vec4 { function(); - let _e1 = global_2; - return _e1; + return global_2; } diff --git a/naga/tests/out/wgsl/binding-arrays.static.wgsl b/naga/tests/out/wgsl/binding-arrays.static.wgsl index bf87a16844..c64e9c2def 100644 --- a/naga/tests/out/wgsl/binding-arrays.static.wgsl +++ b/naga/tests/out/wgsl/binding-arrays.static.wgsl @@ -13,6 +13,5 @@ fn function() { @fragment fn main() -> @location(0) vec4 { function(); - let _e1 = global_2; - return _e1; + return global_2; } diff --git a/naga/tests/out/wgsl/binding-arrays.wgsl b/naga/tests/out/wgsl/binding-arrays.wgsl index 5bed8ef007..a71ee9930d 100644 --- a/naga/tests/out/wgsl/binding-arrays.wgsl +++ b/naga/tests/out/wgsl/binding-arrays.wgsl @@ -37,132 +37,86 @@ fn main(fragment_in: FragmentIn) -> @location(0) vec4 { const uv = vec2(0f); const pix = vec2(0i); let _e21 = textureDimensions(texture_array_unbounded[0]); - let _e22 = u2_; - u2_ = (_e22 + _e21); + u2_ = (u2_ + _e21); let _e26 = textureDimensions(texture_array_unbounded[uniform_index]); - let _e27 = u2_; - u2_ = (_e27 + _e26); + u2_ = (u2_ + _e26); let _e31 = textureDimensions(texture_array_unbounded[non_uniform_index]); - let _e32 = u2_; - u2_ = (_e32 + _e31); + u2_ = (u2_ + _e31); let _e38 = textureGather(0, texture_array_bounded[0], samp[0], uv); - let _e39 = v4_; - v4_ = (_e39 + _e38); + v4_ = (v4_ + _e38); let _e45 = textureGather(0, texture_array_bounded[uniform_index], samp[uniform_index], uv); - let _e46 = v4_; - v4_ = (_e46 + _e45); + v4_ = (v4_ + _e45); let _e52 = textureGather(0, texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv); - let _e53 = v4_; - v4_ = (_e53 + _e52); + v4_ = (v4_ + _e52); let _e60 = textureGatherCompare(texture_array_depth[0], samp_comp[0], uv, 0f); - let _e61 = v4_; - v4_ = (_e61 + _e60); + v4_ = (v4_ + _e60); let _e68 = textureGatherCompare(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0f); - let _e69 = v4_; - v4_ = (_e69 + _e68); + v4_ = (v4_ + _e68); let _e76 = textureGatherCompare(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0f); - let _e77 = v4_; - v4_ = (_e77 + _e76); + v4_ = (v4_ + _e76); let _e82 = textureLoad(texture_array_unbounded[0], pix, 0i); - let _e83 = v4_; - v4_ = (_e83 + _e82); + v4_ = (v4_ + _e82); let _e88 = textureLoad(texture_array_unbounded[uniform_index], pix, 0i); - let _e89 = v4_; - v4_ = (_e89 + _e88); + v4_ = (v4_ + _e88); let _e94 = textureLoad(texture_array_unbounded[non_uniform_index], pix, 0i); - let _e95 = v4_; - v4_ = (_e95 + _e94); + v4_ = (v4_ + _e94); let _e99 = textureNumLayers(texture_array_2darray[0]); - let _e100 = u1_; - u1_ = (_e100 + _e99); + u1_ = (u1_ + _e99); let _e104 = textureNumLayers(texture_array_2darray[uniform_index]); - let _e105 = u1_; - u1_ = (_e105 + _e104); + u1_ = (u1_ + _e104); let _e109 = textureNumLayers(texture_array_2darray[non_uniform_index]); - let _e110 = u1_; - u1_ = (_e110 + _e109); + u1_ = (u1_ + _e109); let _e114 = textureNumLevels(texture_array_bounded[0]); - let _e115 = u1_; - u1_ = (_e115 + _e114); + u1_ = (u1_ + _e114); let _e119 = textureNumLevels(texture_array_bounded[uniform_index]); - let _e120 = u1_; - u1_ = (_e120 + _e119); + u1_ = (u1_ + _e119); let _e124 = textureNumLevels(texture_array_bounded[non_uniform_index]); - let _e125 = u1_; - u1_ = (_e125 + _e124); + u1_ = (u1_ + _e124); let _e129 = textureNumSamples(texture_array_multisampled[0]); - let _e130 = u1_; - u1_ = (_e130 + _e129); + u1_ = (u1_ + _e129); let _e134 = textureNumSamples(texture_array_multisampled[uniform_index]); - let _e135 = u1_; - u1_ = (_e135 + _e134); + u1_ = (u1_ + _e134); let _e139 = textureNumSamples(texture_array_multisampled[non_uniform_index]); - let _e140 = u1_; - u1_ = (_e140 + _e139); + u1_ = (u1_ + _e139); let _e146 = textureSample(texture_array_bounded[0], samp[0], uv); - let _e147 = v4_; - v4_ = (_e147 + _e146); + v4_ = (v4_ + _e146); let _e153 = textureSample(texture_array_bounded[uniform_index], samp[uniform_index], uv); - let _e154 = v4_; - v4_ = (_e154 + _e153); + v4_ = (v4_ + _e153); let _e160 = textureSample(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv); - let _e161 = v4_; - v4_ = (_e161 + _e160); + v4_ = (v4_ + _e160); let _e168 = textureSampleBias(texture_array_bounded[0], samp[0], uv, 0f); - let _e169 = v4_; - v4_ = (_e169 + _e168); + v4_ = (v4_ + _e168); let _e176 = textureSampleBias(texture_array_bounded[uniform_index], samp[uniform_index], uv, 0f); - let _e177 = v4_; - v4_ = (_e177 + _e176); + v4_ = (v4_ + _e176); let _e184 = textureSampleBias(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, 0f); - let _e185 = v4_; - v4_ = (_e185 + _e184); + v4_ = (v4_ + _e184); let _e192 = textureSampleCompare(texture_array_depth[0], samp_comp[0], uv, 0f); - let _e193 = v1_; - v1_ = (_e193 + _e192); + v1_ = (v1_ + _e192); let _e200 = textureSampleCompare(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0f); - let _e201 = v1_; - v1_ = (_e201 + _e200); + v1_ = (v1_ + _e200); let _e208 = textureSampleCompare(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0f); - let _e209 = v1_; - v1_ = (_e209 + _e208); + v1_ = (v1_ + _e208); let _e216 = textureSampleCompareLevel(texture_array_depth[0], samp_comp[0], uv, 0f); - let _e217 = v1_; - v1_ = (_e217 + _e216); + v1_ = (v1_ + _e216); let _e224 = textureSampleCompareLevel(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0f); - let _e225 = v1_; - v1_ = (_e225 + _e224); + v1_ = (v1_ + _e224); let _e232 = textureSampleCompareLevel(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0f); - let _e233 = v1_; - v1_ = (_e233 + _e232); + v1_ = (v1_ + _e232); let _e239 = textureSampleGrad(texture_array_bounded[0], samp[0], uv, uv, uv); - let _e240 = v4_; - v4_ = (_e240 + _e239); + v4_ = (v4_ + _e239); let _e246 = textureSampleGrad(texture_array_bounded[uniform_index], samp[uniform_index], uv, uv, uv); - let _e247 = v4_; - v4_ = (_e247 + _e246); + v4_ = (v4_ + _e246); let _e253 = textureSampleGrad(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, uv, uv); - let _e254 = v4_; - v4_ = (_e254 + _e253); + v4_ = (v4_ + _e253); let _e261 = textureSampleLevel(texture_array_bounded[0], samp[0], uv, 0f); - let _e262 = v4_; - v4_ = (_e262 + _e261); + v4_ = (v4_ + _e261); let _e269 = textureSampleLevel(texture_array_bounded[uniform_index], samp[uniform_index], uv, 0f); - let _e270 = v4_; - v4_ = (_e270 + _e269); + v4_ = (v4_ + _e269); let _e277 = textureSampleLevel(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, 0f); - let _e278 = v4_; - v4_ = (_e278 + _e277); - let _e282 = v4_; - textureStore(texture_array_storage[0], pix, _e282); - let _e285 = v4_; - textureStore(texture_array_storage[uniform_index], pix, _e285); - let _e288 = v4_; - textureStore(texture_array_storage[non_uniform_index], pix, _e288); - let _e289 = u2_; - let _e290 = u1_; - let v2_ = vec2((_e289 + vec2(_e290))); - let _e294 = v4_; - let _e301 = v1_; - return ((_e294 + vec4(v2_.x, v2_.y, v2_.x, v2_.y)) + vec4(_e301)); + v4_ = (v4_ + _e277); + textureStore(texture_array_storage[0], pix, v4_); + textureStore(texture_array_storage[uniform_index], pix, v4_); + textureStore(texture_array_storage[non_uniform_index], pix, v4_); + let v2_ = vec2((u2_ + vec2(u1_))); + return ((v4_ + vec4(v2_.x, v2_.y, v2_.x, v2_.y)) + vec4(v1_)); } diff --git a/naga/tests/out/wgsl/binding-buffer-arrays.wgsl b/naga/tests/out/wgsl/binding-buffer-arrays.wgsl index a11ef3d0fe..35af37ebf1 100644 --- a/naga/tests/out/wgsl/binding-buffer-arrays.wgsl +++ b/naga/tests/out/wgsl/binding-buffer-arrays.wgsl @@ -22,21 +22,11 @@ fn main(fragment_in: FragmentIn) -> @location(0) @interpolate(flat) u32 { let uniform_index = uni.index; let non_uniform_index = fragment_in.index; - let _e10 = storage_array[0].x; - let _e11 = u1_; - u1_ = (_e11 + _e10); - let _e16 = storage_array[uniform_index].x; - let _e17 = u1_; - u1_ = (_e17 + _e16); - let _e22 = storage_array[non_uniform_index].x; - let _e23 = u1_; - u1_ = (_e23 + _e22); - let _e29 = u1_; - u1_ = (_e29 + arrayLength((&storage_array[0].far))); - let _e35 = u1_; - u1_ = (_e35 + arrayLength((&storage_array[uniform_index].far))); - let _e41 = u1_; - u1_ = (_e41 + arrayLength((&storage_array[non_uniform_index].far))); - let _e43 = u1_; - return _e43; + u1_ = (u1_ + storage_array[0].x); + u1_ = (u1_ + storage_array[uniform_index].x); + u1_ = (u1_ + storage_array[non_uniform_index].x); + u1_ = (u1_ + arrayLength((&storage_array[0].far))); + u1_ = (u1_ + arrayLength((&storage_array[uniform_index].far))); + u1_ = (u1_ + arrayLength((&storage_array[non_uniform_index].far))); + return u1_; } diff --git a/naga/tests/out/wgsl/bitcast.wgsl b/naga/tests/out/wgsl/bitcast.wgsl index 1f36ce5e66..d9f43a0dde 100644 --- a/naga/tests/out/wgsl/bitcast.wgsl +++ b/naga/tests/out/wgsl/bitcast.wgsl @@ -10,23 +10,14 @@ fn main() { var f3_: vec3 = vec3(0f); var f4_: vec4 = vec4(0f); - let _e27 = i2_; - u2_ = bitcast>(_e27); - let _e29 = i3_; - u3_ = bitcast>(_e29); - let _e31 = i4_; - u4_ = bitcast>(_e31); - let _e33 = u2_; - i2_ = bitcast>(_e33); - let _e35 = u3_; - i3_ = bitcast>(_e35); - let _e37 = u4_; - i4_ = bitcast>(_e37); - let _e39 = i2_; - f2_ = bitcast>(_e39); - let _e41 = i3_; - f3_ = bitcast>(_e41); - let _e43 = i4_; - f4_ = bitcast>(_e43); + u2_ = bitcast>(i2_); + u3_ = bitcast>(i3_); + u4_ = bitcast>(i4_); + i2_ = bitcast>(u2_); + i3_ = bitcast>(u3_); + i4_ = bitcast>(u4_); + f2_ = bitcast>(i2_); + f3_ = bitcast>(i3_); + f4_ = bitcast>(i4_); return; } diff --git a/naga/tests/out/wgsl/bits.wgsl b/naga/tests/out/wgsl/bits.wgsl index 0d23b1e782..637cfbc847 100644 --- a/naga/tests/out/wgsl/bits.wgsl +++ b/naga/tests/out/wgsl/bits.wgsl @@ -11,117 +11,57 @@ fn main() { var f2_: vec2 = vec2(0f); var f4_: vec4 = vec4(0f); - let _e28 = f4_; - u = pack4x8snorm(_e28); - let _e30 = f4_; - u = pack4x8unorm(_e30); - let _e32 = f2_; - u = pack2x16snorm(_e32); - let _e34 = f2_; - u = pack2x16unorm(_e34); - let _e36 = f2_; - u = pack2x16float(_e36); - let _e38 = i4_; - u = pack4xI8(_e38); - let _e40 = u4_; - u = pack4xU8(_e40); - let _e42 = u; - f4_ = unpack4x8snorm(_e42); - let _e44 = u; - f4_ = unpack4x8unorm(_e44); - let _e46 = u; - f2_ = unpack2x16snorm(_e46); - let _e48 = u; - f2_ = unpack2x16unorm(_e48); - let _e50 = u; - f2_ = unpack2x16float(_e50); - let _e52 = u; - i4_ = unpack4xI8(_e52); - let _e54 = u; - u4_ = unpack4xU8(_e54); - let _e56 = i; - let _e57 = i; - i = insertBits(_e56, _e57, 5u, 10u); - let _e61 = i2_; - let _e62 = i2_; - i2_ = insertBits(_e61, _e62, 5u, 10u); - let _e66 = i3_; - let _e67 = i3_; - i3_ = insertBits(_e66, _e67, 5u, 10u); - let _e71 = i4_; - let _e72 = i4_; - i4_ = insertBits(_e71, _e72, 5u, 10u); - let _e76 = u; - let _e77 = u; - u = insertBits(_e76, _e77, 5u, 10u); - let _e81 = u2_; - let _e82 = u2_; - u2_ = insertBits(_e81, _e82, 5u, 10u); - let _e86 = u3_; - let _e87 = u3_; - u3_ = insertBits(_e86, _e87, 5u, 10u); - let _e91 = u4_; - let _e92 = u4_; - u4_ = insertBits(_e91, _e92, 5u, 10u); - let _e96 = i; - i = extractBits(_e96, 5u, 10u); - let _e100 = i2_; - i2_ = extractBits(_e100, 5u, 10u); - let _e104 = i3_; - i3_ = extractBits(_e104, 5u, 10u); - let _e108 = i4_; - i4_ = extractBits(_e108, 5u, 10u); - let _e112 = u; - u = extractBits(_e112, 5u, 10u); - let _e116 = u2_; - u2_ = extractBits(_e116, 5u, 10u); - let _e120 = u3_; - u3_ = extractBits(_e120, 5u, 10u); - let _e124 = u4_; - u4_ = extractBits(_e124, 5u, 10u); - let _e128 = i; - i = firstTrailingBit(_e128); - let _e130 = u2_; - u2_ = firstTrailingBit(_e130); - let _e132 = i3_; - i3_ = firstLeadingBit(_e132); - let _e134 = u3_; - u3_ = firstLeadingBit(_e134); - let _e136 = i; - i = firstLeadingBit(_e136); - let _e138 = u; - u = firstLeadingBit(_e138); - let _e140 = i; - i = countOneBits(_e140); - let _e142 = i2_; - i2_ = countOneBits(_e142); - let _e144 = i3_; - i3_ = countOneBits(_e144); - let _e146 = i4_; - i4_ = countOneBits(_e146); - let _e148 = u; - u = countOneBits(_e148); - let _e150 = u2_; - u2_ = countOneBits(_e150); - let _e152 = u3_; - u3_ = countOneBits(_e152); - let _e154 = u4_; - u4_ = countOneBits(_e154); - let _e156 = i; - i = reverseBits(_e156); - let _e158 = i2_; - i2_ = reverseBits(_e158); - let _e160 = i3_; - i3_ = reverseBits(_e160); - let _e162 = i4_; - i4_ = reverseBits(_e162); - let _e164 = u; - u = reverseBits(_e164); - let _e166 = u2_; - u2_ = reverseBits(_e166); - let _e168 = u3_; - u3_ = reverseBits(_e168); - let _e170 = u4_; - u4_ = reverseBits(_e170); + u = pack4x8snorm(f4_); + u = pack4x8unorm(f4_); + u = pack2x16snorm(f2_); + u = pack2x16unorm(f2_); + u = pack2x16float(f2_); + u = pack4xI8(i4_); + u = pack4xU8(u4_); + f4_ = unpack4x8snorm(u); + f4_ = unpack4x8unorm(u); + f2_ = unpack2x16snorm(u); + f2_ = unpack2x16unorm(u); + f2_ = unpack2x16float(u); + i4_ = unpack4xI8(u); + u4_ = unpack4xU8(u); + i = insertBits(i, i, 5u, 10u); + i2_ = insertBits(i2_, i2_, 5u, 10u); + i3_ = insertBits(i3_, i3_, 5u, 10u); + i4_ = insertBits(i4_, i4_, 5u, 10u); + u = insertBits(u, u, 5u, 10u); + u2_ = insertBits(u2_, u2_, 5u, 10u); + u3_ = insertBits(u3_, u3_, 5u, 10u); + u4_ = insertBits(u4_, u4_, 5u, 10u); + i = extractBits(i, 5u, 10u); + i2_ = extractBits(i2_, 5u, 10u); + i3_ = extractBits(i3_, 5u, 10u); + i4_ = extractBits(i4_, 5u, 10u); + u = extractBits(u, 5u, 10u); + u2_ = extractBits(u2_, 5u, 10u); + u3_ = extractBits(u3_, 5u, 10u); + u4_ = extractBits(u4_, 5u, 10u); + i = firstTrailingBit(i); + u2_ = firstTrailingBit(u2_); + i3_ = firstLeadingBit(i3_); + u3_ = firstLeadingBit(u3_); + i = firstLeadingBit(i); + u = firstLeadingBit(u); + i = countOneBits(i); + i2_ = countOneBits(i2_); + i3_ = countOneBits(i3_); + i4_ = countOneBits(i4_); + u = countOneBits(u); + u2_ = countOneBits(u2_); + u3_ = countOneBits(u3_); + u4_ = countOneBits(u4_); + i = reverseBits(i); + i2_ = reverseBits(i2_); + i3_ = reverseBits(i3_); + i4_ = reverseBits(i4_); + u = reverseBits(u); + u2_ = reverseBits(u2_); + u3_ = reverseBits(u3_); + u4_ = reverseBits(u4_); return; } diff --git a/naga/tests/out/wgsl/bits_glsl.frag.wgsl b/naga/tests/out/wgsl/bits_glsl.frag.wgsl index 3513d1ba25..6aeb2f7974 100644 --- a/naga/tests/out/wgsl/bits_glsl.frag.wgsl +++ b/naga/tests/out/wgsl/bits_glsl.frag.wgsl @@ -10,98 +10,48 @@ fn main_1() { var f2_: vec2 = vec2(0f); var f4_: vec4 = vec4(0f); - let _e32 = f4_; - u = pack4x8snorm(_e32); - let _e34 = f4_; - u = pack4x8unorm(_e34); - let _e36 = f2_; - u = pack2x16unorm(_e36); - let _e38 = f2_; - u = pack2x16snorm(_e38); - let _e40 = f2_; - u = pack2x16float(_e40); - let _e42 = u; - f4_ = unpack4x8snorm(_e42); - let _e44 = u; - f4_ = unpack4x8unorm(_e44); - let _e46 = u; - f2_ = unpack2x16snorm(_e46); - let _e48 = u; - f2_ = unpack2x16unorm(_e48); - let _e50 = u; - f2_ = unpack2x16float(_e50); - let _e52 = i; - let _e53 = i; - i = insertBits(_e52, _e53, 5u, 10u); - let _e59 = i2_; - let _e60 = i2_; - i2_ = insertBits(_e59, _e60, 5u, 10u); - let _e66 = i3_; - let _e67 = i3_; - i3_ = insertBits(_e66, _e67, 5u, 10u); - let _e73 = i4_; - let _e74 = i4_; - i4_ = insertBits(_e73, _e74, 5u, 10u); - let _e80 = u; - let _e81 = u; - u = insertBits(_e80, _e81, 5u, 10u); - let _e87 = u2_; - let _e88 = u2_; - u2_ = insertBits(_e87, _e88, 5u, 10u); - let _e94 = u3_; - let _e95 = u3_; - u3_ = insertBits(_e94, _e95, 5u, 10u); - let _e101 = u4_; - let _e102 = u4_; - u4_ = insertBits(_e101, _e102, 5u, 10u); - let _e108 = i; - i = extractBits(_e108, 5u, 10u); - let _e114 = i2_; - i2_ = extractBits(_e114, 5u, 10u); - let _e120 = i3_; - i3_ = extractBits(_e120, 5u, 10u); - let _e126 = i4_; - i4_ = extractBits(_e126, 5u, 10u); - let _e132 = u; - u = extractBits(_e132, 5u, 10u); - let _e138 = u2_; - u2_ = extractBits(_e138, 5u, 10u); - let _e144 = u3_; - u3_ = extractBits(_e144, 5u, 10u); - let _e150 = u4_; - u4_ = extractBits(_e150, 5u, 10u); - let _e156 = i; - i = firstTrailingBit(_e156); - let _e158 = i2_; - i2_ = firstTrailingBit(_e158); - let _e160 = i3_; - i3_ = firstTrailingBit(_e160); - let _e162 = i4_; - i4_ = firstTrailingBit(_e162); - let _e164 = u; - i = i32(firstTrailingBit(_e164)); - let _e167 = u2_; - i2_ = vec2(firstTrailingBit(_e167)); - let _e170 = u3_; - i3_ = vec3(firstTrailingBit(_e170)); - let _e173 = u4_; - i4_ = vec4(firstTrailingBit(_e173)); - let _e176 = i; - i = firstLeadingBit(_e176); - let _e178 = i2_; - i2_ = firstLeadingBit(_e178); - let _e180 = i3_; - i3_ = firstLeadingBit(_e180); - let _e182 = i4_; - i4_ = firstLeadingBit(_e182); - let _e184 = u; - i = i32(firstLeadingBit(_e184)); - let _e187 = u2_; - i2_ = vec2(firstLeadingBit(_e187)); - let _e190 = u3_; - i3_ = vec3(firstLeadingBit(_e190)); - let _e193 = u4_; - i4_ = vec4(firstLeadingBit(_e193)); + u = pack4x8snorm(f4_); + u = pack4x8unorm(f4_); + u = pack2x16unorm(f2_); + u = pack2x16snorm(f2_); + u = pack2x16float(f2_); + f4_ = unpack4x8snorm(u); + f4_ = unpack4x8unorm(u); + f2_ = unpack2x16snorm(u); + f2_ = unpack2x16unorm(u); + f2_ = unpack2x16float(u); + i = insertBits(i, i, 5u, 10u); + i2_ = insertBits(i2_, i2_, 5u, 10u); + i3_ = insertBits(i3_, i3_, 5u, 10u); + i4_ = insertBits(i4_, i4_, 5u, 10u); + u = insertBits(u, u, 5u, 10u); + u2_ = insertBits(u2_, u2_, 5u, 10u); + u3_ = insertBits(u3_, u3_, 5u, 10u); + u4_ = insertBits(u4_, u4_, 5u, 10u); + i = extractBits(i, 5u, 10u); + i2_ = extractBits(i2_, 5u, 10u); + i3_ = extractBits(i3_, 5u, 10u); + i4_ = extractBits(i4_, 5u, 10u); + u = extractBits(u, 5u, 10u); + u2_ = extractBits(u2_, 5u, 10u); + u3_ = extractBits(u3_, 5u, 10u); + u4_ = extractBits(u4_, 5u, 10u); + i = firstTrailingBit(i); + i2_ = firstTrailingBit(i2_); + i3_ = firstTrailingBit(i3_); + i4_ = firstTrailingBit(i4_); + i = i32(firstTrailingBit(u)); + i2_ = vec2(firstTrailingBit(u2_)); + i3_ = vec3(firstTrailingBit(u3_)); + i4_ = vec4(firstTrailingBit(u4_)); + i = firstLeadingBit(i); + i2_ = firstLeadingBit(i2_); + i3_ = firstLeadingBit(i3_); + i4_ = firstLeadingBit(i4_); + i = i32(firstLeadingBit(u)); + i2_ = vec2(firstLeadingBit(u2_)); + i3_ = vec3(firstLeadingBit(u3_)); + i4_ = vec4(firstLeadingBit(u4_)); return; } diff --git a/naga/tests/out/wgsl/boids.wgsl b/naga/tests/out/wgsl/boids.wgsl index ee28ca6786..dd28ace42a 100644 --- a/naga/tests/out/wgsl/boids.wgsl +++ b/naga/tests/out/wgsl/boids.wgsl @@ -43,106 +43,54 @@ fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { if (index >= NUM_PARTICLES) { return; } - let _e8 = particlesSrc.particles[index].pos; - vPos = _e8; - let _e14 = particlesSrc.particles[index].vel; - vVel = _e14; + vPos = particlesSrc.particles[index].pos; + vVel = particlesSrc.particles[index].vel; loop { - let _e36 = i; - if (_e36 >= NUM_PARTICLES) { + if (i >= NUM_PARTICLES) { break; } - let _e39 = i; - if (_e39 == index) { + if (i == index) { continue; } - let _e43 = i; - let _e46 = particlesSrc.particles[_e43].pos; - pos = _e46; - let _e49 = i; - let _e52 = particlesSrc.particles[_e49].vel; - vel = _e52; - let _e53 = pos; - let _e54 = vPos; - let _e58 = params.rule1Distance; - if (distance(_e53, _e54) < _e58) { - let _e60 = cMass; - let _e61 = pos; - cMass = (_e60 + _e61); - let _e63 = cMassCount; - cMassCount = (_e63 + 1i); + pos = particlesSrc.particles[i].pos; + vel = particlesSrc.particles[i].vel; + if (distance(pos, vPos) < params.rule1Distance) { + cMass = (cMass + pos); + cMassCount = (cMassCount + 1i); } - let _e66 = pos; - let _e67 = vPos; - let _e71 = params.rule2Distance; - if (distance(_e66, _e67) < _e71) { - let _e73 = colVel; - let _e74 = pos; - let _e75 = vPos; - colVel = (_e73 - (_e74 - _e75)); + if (distance(pos, vPos) < params.rule2Distance) { + colVel = (colVel - (pos - vPos)); } - let _e78 = pos; - let _e79 = vPos; - let _e83 = params.rule3Distance; - if (distance(_e78, _e79) < _e83) { - let _e85 = cVel; - let _e86 = vel; - cVel = (_e85 + _e86); - let _e88 = cVelCount; - cVelCount = (_e88 + 1i); + if (distance(pos, vPos) < params.rule3Distance) { + cVel = (cVel + vel); + cVelCount = (cVelCount + 1i); } continuing { - let _e91 = i; - i = (_e91 + 1u); + i = (i + 1u); } } - let _e94 = cMassCount; - if (_e94 > 0i) { - let _e97 = cMass; - let _e98 = cMassCount; - let _e102 = vPos; - cMass = ((_e97 / vec2(f32(_e98))) - _e102); + if (cMassCount > 0i) { + cMass = ((cMass / vec2(f32(cMassCount))) - vPos); } - let _e104 = cVelCount; - if (_e104 > 0i) { - let _e107 = cVel; - let _e108 = cVelCount; - cVel = (_e107 / vec2(f32(_e108))); + if (cVelCount > 0i) { + cVel = (cVel / vec2(f32(cVelCount))); } - let _e112 = vVel; - let _e113 = cMass; - let _e116 = params.rule1Scale; - let _e119 = colVel; - let _e122 = params.rule2Scale; - let _e125 = cVel; - let _e128 = params.rule3Scale; - vVel = (((_e112 + (_e113 * _e116)) + (_e119 * _e122)) + (_e125 * _e128)); - let _e131 = vVel; - let _e133 = vVel; - 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 < -1f) { + vVel = (((vVel + (cMass * params.rule1Scale)) + (colVel * params.rule2Scale)) + (cVel * params.rule3Scale)); + vVel = (normalize(vVel) * clamp(length(vVel), 0f, 0.1f)); + vPos = (vPos + (vVel * params.deltaT)); + if (vPos.x < -1f) { vPos.x = 1f; } - let _e153 = vPos.x; - if (_e153 > 1f) { + if (vPos.x > 1f) { vPos.x = -1f; } - let _e159 = vPos.y; - if (_e159 < -1f) { + if (vPos.y < -1f) { vPos.y = 1f; } - let _e165 = vPos.y; - if (_e165 > 1f) { + if (vPos.y > 1f) { vPos.y = -1f; } - let _e174 = vPos; - particlesDst.particles[index].pos = _e174; - let _e179 = vVel; - particlesDst.particles[index].vel = _e179; + particlesDst.particles[index].pos = vPos; + particlesDst.particles[index].vel = vVel; return; } diff --git a/naga/tests/out/wgsl/bool-select.frag.wgsl b/naga/tests/out/wgsl/bool-select.frag.wgsl index 4045a3de45..0e6436d522 100644 --- a/naga/tests/out/wgsl/bool-select.frag.wgsl +++ b/naga/tests/out/wgsl/bool-select.frag.wgsl @@ -10,9 +10,7 @@ fn TevPerCompGT(a: f32, b: f32) -> f32 { a_1 = a; b_1 = b; - let _e5 = a_1; - let _e6 = b_1; - return select(0f, 1f, (_e5 > _e6)); + return select(0f, 1f, (a_1 > b_1)); } fn TevPerCompGT_1(a_2: vec3, b_2: vec3) -> vec3 { @@ -21,13 +19,10 @@ fn TevPerCompGT_1(a_2: vec3, b_2: vec3) -> vec3 { a_3 = a_2; b_3 = b_2; - let _e5 = a_3; - let _e6 = b_3; - return select(vec3(0f), vec3(1f), (_e5 > _e6)); + return select(vec3(0f), vec3(1f), (a_3 > b_3)); } fn main_1() { - let _e1 = o_color; let _e7 = TevPerCompGT_1(vec3(3f), vec3(5f)); o_color.x = _e7.x; o_color.y = _e7.y; @@ -40,6 +35,5 @@ fn main_1() { @fragment fn main() -> FragmentOutput { main_1(); - let _e3 = o_color; - return FragmentOutput(_e3); + return FragmentOutput(o_color); } diff --git a/naga/tests/out/wgsl/break-if.wgsl b/naga/tests/out/wgsl/break-if.wgsl index c3d45a50ac..bbd7e95faf 100644 --- a/naga/tests/out/wgsl/break-if.wgsl +++ b/naga/tests/out/wgsl/break-if.wgsl @@ -14,10 +14,8 @@ fn breakIfEmptyBody(a: bool) { loop { continuing { b = a; - let _e2 = b; - c = (a != _e2); - let _e5 = c; - break if (a == _e5); + c = (a != b); + break if (a == c); } } return; @@ -29,11 +27,9 @@ fn breakIf(a_1: bool) { loop { d = a_1; - let _e2 = d; - e = (a_1 != _e2); + e = (a_1 != d); continuing { - let _e5 = e; - break if (a_1 == _e5); + break if (a_1 == e); } } return; @@ -43,11 +39,9 @@ fn breakIfSeparateVariable() { var counter: u32 = 0u; loop { - let _e3 = counter; - counter = (_e3 + 1u); + counter = (counter + 1u); continuing { - let _e5 = counter; - break if (_e5 == 5u); + break if (counter == 5u); } } return; diff --git a/naga/tests/out/wgsl/buffer.frag.wgsl b/naga/tests/out/wgsl/buffer.frag.wgsl index 349d062e74..de7a876213 100644 --- a/naga/tests/out/wgsl/buffer.frag.wgsl +++ b/naga/tests/out/wgsl/buffer.frag.wgsl @@ -15,11 +15,9 @@ fn main_1() { var a: u32; var b: u32; - let _e9 = testBuffer.data[0]; - a = _e9; + a = testBuffer.data[0]; testBuffer.data[1i] = 2u; - let _e19 = testBufferReadOnly.data[0]; - b = _e19; + b = testBufferReadOnly.data[0]; return; } diff --git a/naga/tests/out/wgsl/builtin-accessed-outside-entrypoint.wgsl b/naga/tests/out/wgsl/builtin-accessed-outside-entrypoint.wgsl index 8e1b885bf7..b62261a68c 100644 --- a/naga/tests/out/wgsl/builtin-accessed-outside-entrypoint.wgsl +++ b/naga/tests/out/wgsl/builtin-accessed-outside-entrypoint.wgsl @@ -9,9 +9,7 @@ var unnamed: gl_PerVertex = gl_PerVertex(vec4(0f, 0f, 0f, 1f), 1f, var gl_VertexIndex_1: i32; fn builtin_usage() { - let _e9 = gl_VertexIndex_1; - let _e12 = gl_VertexIndex_1; - unnamed.gl_Position = vec4(select(1f, -4f, (_e9 == 0i)), select(-1f, 4f, (_e12 == 2i)), 0f, 1f); + unnamed.gl_Position = vec4(select(1f, -4f, (gl_VertexIndex_1 == 0i)), select(-1f, 4f, (gl_VertexIndex_1 == 2i)), 0f, 1f); return; } @@ -24,8 +22,6 @@ fn main_1() { fn main(@builtin(vertex_index) gl_VertexIndex: u32) -> @builtin(position) vec4 { gl_VertexIndex_1 = i32(gl_VertexIndex); main_1(); - let _e6 = unnamed.gl_Position.y; - unnamed.gl_Position.y = -(_e6); - let _e8 = unnamed.gl_Position; - return _e8; + unnamed.gl_Position.y = -(unnamed.gl_Position.y); + return unnamed.gl_Position; } diff --git a/naga/tests/out/wgsl/clamp-splat.vert.wgsl b/naga/tests/out/wgsl/clamp-splat.vert.wgsl index 909ff07209..ecc9529b6c 100644 --- a/naga/tests/out/wgsl/clamp-splat.vert.wgsl +++ b/naga/tests/out/wgsl/clamp-splat.vert.wgsl @@ -6,8 +6,7 @@ var a_pos_1: vec2; var gl_Position: vec4; fn main_1() { - let _e2 = a_pos_1; - let _e7 = clamp(_e2, vec2(0f), vec2(1f)); + let _e7 = clamp(a_pos_1, vec2(0f), vec2(1f)); gl_Position = vec4(_e7.x, _e7.y, 0f, 1f); return; } @@ -16,6 +15,5 @@ fn main_1() { fn main(@location(0) a_pos: vec2) -> VertexOutput { a_pos_1 = a_pos; main_1(); - let _e5 = gl_Position; - return VertexOutput(_e5); + return VertexOutput(gl_Position); } diff --git a/naga/tests/out/wgsl/collatz.wgsl b/naga/tests/out/wgsl/collatz.wgsl index 477317594f..06d0ee7925 100644 --- a/naga/tests/out/wgsl/collatz.wgsl +++ b/naga/tests/out/wgsl/collatz.wgsl @@ -11,32 +11,25 @@ fn collatz_iterations(n_base: u32) -> u32 { n = n_base; loop { - let _e4 = n; - if (_e4 > 1u) { + if (n > 1u) { } else { break; } { - let _e7 = n; - if ((_e7 % 2u) == 0u) { - let _e12 = n; - n = (_e12 / 2u); + if ((n % 2u) == 0u) { + n = (n / 2u); } else { - let _e16 = n; - n = ((3u * _e16) + 1u); + n = ((3u * n) + 1u); } - let _e20 = i; - i = (_e20 + 1u); + i = (i + 1u); } } - let _e23 = i; - return _e23; + return i; } @compute @workgroup_size(1, 1, 1) fn main(@builtin(global_invocation_id) global_id: vec3) { - let _e9 = v_indices.data[global_id.x]; - let _e10 = collatz_iterations(_e9); + let _e10 = collatz_iterations(v_indices.data[global_id.x]); v_indices.data[global_id.x] = _e10; return; } diff --git a/naga/tests/out/wgsl/const-exprs.wgsl b/naga/tests/out/wgsl/const-exprs.wgsl index 20a43e2044..90a348ef86 100644 --- a/naga/tests/out/wgsl/const-exprs.wgsl +++ b/naga/tests/out/wgsl/const-exprs.wgsl @@ -35,15 +35,9 @@ fn non_constant_initializers() { var z: i32 = 70i; var out_3: vec4; - let _e2 = w; - x = _e2; - let _e4 = x; - y = _e4; - let _e8 = w; - let _e9 = x; - let _e10 = y; - let _e11 = z; - out_3 = vec4(_e8, _e9, _e10, _e11); + x = w; + y = x; + out_3 = vec4(w, x, y, z); return; } diff --git a/naga/tests/out/wgsl/const-global-swizzle.frag.wgsl b/naga/tests/out/wgsl/const-global-swizzle.frag.wgsl index dee49c2463..28ac16b9ce 100644 --- a/naga/tests/out/wgsl/const-global-swizzle.frag.wgsl +++ b/naga/tests/out/wgsl/const-global-swizzle.frag.wgsl @@ -10,8 +10,7 @@ var o_Target: vec4; fn main_1() { var col: vec2; - let _e3 = v_Uv_1; - col = (_e3.xy * blank); + col = (v_Uv_1.xy * blank); let _e7 = col; o_Target = vec4(_e7.x, _e7.y, 0f, 1f); return; @@ -21,6 +20,5 @@ fn main_1() { fn main(@location(0) v_Uv: vec2) -> FragmentOutput { v_Uv_1 = v_Uv; main_1(); - let _e9 = o_Target; - return FragmentOutput(_e9); + return FragmentOutput(o_Target); } diff --git a/naga/tests/out/wgsl/constant-array-size.frag.wgsl b/naga/tests/out/wgsl/constant-array-size.frag.wgsl index 46697cb7c2..ea2527f701 100644 --- a/naga/tests/out/wgsl/constant-array-size.frag.wgsl +++ b/naga/tests/out/wgsl/constant-array-size.frag.wgsl @@ -12,23 +12,17 @@ fn function() -> vec4 { var i: i32 = 0i; loop { - let _e9 = i; - if !((_e9 < NUM_VECS)) { + if !((i < NUM_VECS)) { break; } { - let _e15 = sum; - let _e16 = i; - let _e18 = global.vecs[_e16]; - sum = (_e15 + _e18); + sum = (sum + global.vecs[i]); } continuing { - let _e12 = i; - i = (_e12 + 1i); + i = (i + 1i); } } - let _e20 = sum; - return _e20; + return sum; } fn main_1() { diff --git a/naga/tests/out/wgsl/control-flow.wgsl b/naga/tests/out/wgsl/control-flow.wgsl index ad071af58a..210f851ae7 100644 --- a/naga/tests/out/wgsl/control-flow.wgsl +++ b/naga/tests/out/wgsl/control-flow.wgsl @@ -127,8 +127,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { pos = 1i; } } - let _e4 = pos; - switch _e4 { + switch pos { case 1: { pos = 0i; break; @@ -152,8 +151,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { default: { } } - let _e11 = pos; - switch _e11 { + switch pos { case 1: { pos = 0i; break; diff --git a/naga/tests/out/wgsl/declarations.frag.wgsl b/naga/tests/out/wgsl/declarations.frag.wgsl index c0c0236ad6..eae6731251 100644 --- a/naga/tests/out/wgsl/declarations.frag.wgsl +++ b/naga/tests/out/wgsl/declarations.frag.wgsl @@ -44,12 +44,9 @@ fn main_1() { var a_1: f32; var b: f32; - let _e35 = in_array_2[1]; - from_input_array = _e35; - let _e41 = array_2d[0][0]; - a_1 = _e41; - let _e57 = array_toomanyd[0][0][0][0][0][0][0]; - b = _e57; + from_input_array = in_array_2[1]; + a_1 = array_2d[0][0]; + b = array_toomanyd[0][0][0][0][0][0][0]; out_array[0i] = vec4(2f); return; } @@ -61,9 +58,5 @@ fn main(@location(0) position: vec2, @location(1) a: vec2, @location(2 in_array_2[0] = in_array; in_array_2[1] = in_array_1; main_1(); - let _e30 = frag.position; - let _e32 = frag.a; - let _e35 = out_array[0]; - let _e37 = out_array[1]; - return FragmentOutput(_e30, _e32, _e35, _e37); + return FragmentOutput(frag.position, frag.a, out_array[0], out_array[1]); } diff --git a/naga/tests/out/wgsl/do-while.wgsl b/naga/tests/out/wgsl/do-while.wgsl index 0b7e3afbcc..51b8ee3ee0 100644 --- a/naga/tests/out/wgsl/do-while.wgsl +++ b/naga/tests/out/wgsl/do-while.wgsl @@ -2,8 +2,7 @@ fn fb1_(cond: ptr) { loop { continue; continuing { - let _e1 = (*cond); - break if !(_e1); + break if !((*cond)); } } return; diff --git a/naga/tests/out/wgsl/double-math-functions.frag.wgsl b/naga/tests/out/wgsl/double-math-functions.frag.wgsl index 01c798586a..6292108635 100644 --- a/naga/tests/out/wgsl/double-math-functions.frag.wgsl +++ b/naga/tests/out/wgsl/double-math-functions.frag.wgsl @@ -34,59 +34,28 @@ fn main_1() { let _e10 = a; let _e11 = b; m = mat4x4(vec4(_e8.x, _e8.y, _e8.z, _e8.w), vec4(_e9.x, _e9.y, _e9.z, _e9.w), vec4(_e10.x, _e10.y, _e10.z, _e10.w), vec4(_e11.x, _e11.y, _e11.z, _e11.w)); - let _e36 = a; - ceilOut = ceil(_e36); - let _e39 = a; - roundOut = round(_e39); - let _e42 = a; - floorOut = floor(_e42); - let _e45 = a; - fractOut = fract(_e45); - let _e48 = a; - truncOut = trunc(_e48); - let _e51 = a; - absOut = abs(_e51); - let _e54 = a; - sqrtOut = sqrt(_e54); - let _e57 = a; - inversesqrtOut = inverseSqrt(_e57); - let _e60 = a; - signOut = sign(_e60); - let _e63 = m; - transposeOut = transpose(_e63); - let _e66 = a; - normalizeOut = normalize(_e66); - let _e69 = a; - lengthOut = length(_e69); - let _e72 = m; - determinantOut = determinant(_e72); - let _e75 = a; - let _e77 = b; - modOut = (_e75.x - (floor((_e75.x / _e77.x)) * _e77.x)); - let _e84 = a; - let _e85 = b; - dotOut = dot(_e84, _e85); - let _e88 = a; - let _e89 = b; - maxOut = max(_e88, _e89); - let _e92 = a; - let _e93 = b; - minOut = min(_e92, _e93); - let _e96 = a; - let _e97 = b; - reflectOut = reflect(_e96, _e97); - let _e100 = a; - let _e102 = b; - crossOut = cross(_e100.xyz, _e102.xyz); - let _e106 = a; - let _e107 = b; - distanceOut = distance(_e106, _e107); - let _e110 = a; - let _e111 = b; - stepOut = step(_e110, _e111); - let _e114 = a; - let _e116 = i; - ldexpOut = ldexp(_e114.x, _e116); + ceilOut = ceil(a); + roundOut = round(a); + floorOut = floor(a); + fractOut = fract(a); + truncOut = trunc(a); + absOut = abs(a); + sqrtOut = sqrt(a); + inversesqrtOut = inverseSqrt(a); + signOut = sign(a); + transposeOut = transpose(m); + normalizeOut = normalize(a); + lengthOut = length(a); + determinantOut = determinant(m); + modOut = (a.x - (floor((a.x / b.x)) * b.x)); + dotOut = dot(a, b); + maxOut = max(a, b); + minOut = min(a, b); + reflectOut = reflect(a, b); + crossOut = cross(a.xyz, b.xyz); + distanceOut = distance(a, b); + stepOut = step(a, b); + ldexpOut = ldexp(a.x, i); 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)); diff --git a/naga/tests/out/wgsl/dualsource.wgsl b/naga/tests/out/wgsl/dualsource.wgsl index 505159bb45..8f241d6cc1 100644 --- a/naga/tests/out/wgsl/dualsource.wgsl +++ b/naga/tests/out/wgsl/dualsource.wgsl @@ -8,7 +8,5 @@ fn main(@builtin(position) position: vec4) -> FragmentOutput { 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; - return FragmentOutput(_e13, _e14); + return FragmentOutput(color, mask); } diff --git a/naga/tests/out/wgsl/empty-global-name.wgsl b/naga/tests/out/wgsl/empty-global-name.wgsl index 1be54db130..08933133d5 100644 --- a/naga/tests/out/wgsl/empty-global-name.wgsl +++ b/naga/tests/out/wgsl/empty-global-name.wgsl @@ -6,8 +6,7 @@ struct type_1 { var unnamed: type_1; fn function() { - let _e3 = unnamed.member; - unnamed.member = (_e3 + 1i); + unnamed.member = (unnamed.member + 1i); return; } diff --git a/naga/tests/out/wgsl/expressions.frag.wgsl b/naga/tests/out/wgsl/expressions.frag.wgsl index ec53847d5f..fb66224324 100644 --- a/naga/tests/out/wgsl/expressions.frag.wgsl +++ b/naga/tests/out/wgsl/expressions.frag.wgsl @@ -28,14 +28,10 @@ fn testBinOpVecFloat(a: vec4, b: f32) { a_1 = a; b_1 = b; - let _e5 = a_1; - v = (_e5 * 2f); - let _e8 = a_1; - v = (_e8 / vec4(2f)); - let _e12 = a_1; - v = (_e12 + vec4(2f)); - let _e16 = a_1; - v = (_e16 - vec4(2f)); + v = (a_1 * 2f); + v = (a_1 / vec4(2f)); + v = (a_1 + vec4(2f)); + v = (a_1 - vec4(2f)); return; } @@ -46,18 +42,10 @@ fn testBinOpFloatVec(a_2: vec4, b_2: f32) { a_3 = a_2; b_3 = b_2; - let _e5 = a_3; - let _e6 = b_3; - v_1 = (_e5 * _e6); - let _e8 = a_3; - let _e9 = b_3; - v_1 = (_e8 / vec4(_e9)); - let _e12 = a_3; - let _e13 = b_3; - v_1 = (_e12 + vec4(_e13)); - let _e16 = a_3; - let _e17 = b_3; - v_1 = (_e16 - vec4(_e17)); + v_1 = (a_3 * b_3); + v_1 = (a_3 / vec4(b_3)); + v_1 = (a_3 + vec4(b_3)); + v_1 = (a_3 - vec4(b_3)); return; } @@ -68,33 +56,15 @@ fn testBinOpIVecInt(a_4: vec4, b_4: i32) { a_5 = a_4; b_5 = b_4; - let _e5 = a_5; - let _e6 = b_5; - v_2 = (_e5 * _e6); - let _e8 = a_5; - let _e9 = b_5; - v_2 = (_e8 / vec4(_e9)); - let _e12 = a_5; - let _e13 = b_5; - v_2 = (_e12 + vec4(_e13)); - let _e16 = a_5; - let _e17 = b_5; - v_2 = (_e16 - vec4(_e17)); - let _e20 = a_5; - let _e21 = b_5; - v_2 = (_e20 & vec4(_e21)); - let _e24 = a_5; - let _e25 = b_5; - v_2 = (_e24 | vec4(_e25)); - let _e28 = a_5; - let _e29 = b_5; - v_2 = (_e28 ^ vec4(_e29)); - let _e32 = a_5; - let _e33 = b_5; - v_2 = (_e32 >> vec4(u32(_e33))); - let _e37 = a_5; - let _e38 = b_5; - v_2 = (_e37 << vec4(u32(_e38))); + v_2 = (a_5 * b_5); + v_2 = (a_5 / vec4(b_5)); + v_2 = (a_5 + vec4(b_5)); + v_2 = (a_5 - vec4(b_5)); + v_2 = (a_5 & vec4(b_5)); + v_2 = (a_5 | vec4(b_5)); + v_2 = (a_5 ^ vec4(b_5)); + v_2 = (a_5 >> vec4(u32(b_5))); + v_2 = (a_5 << vec4(u32(b_5))); return; } @@ -105,24 +75,12 @@ fn testBinOpIntIVec(a_6: i32, b_6: vec4) { a_7 = a_6; b_7 = b_6; - let _e5 = a_7; - let _e6 = b_7; - v_3 = (_e5 * _e6); - let _e8 = a_7; - let _e9 = b_7; - v_3 = (vec4(_e8) + _e9); - let _e12 = a_7; - let _e13 = b_7; - v_3 = (vec4(_e12) - _e13); - let _e16 = a_7; - let _e17 = b_7; - v_3 = (vec4(_e16) & _e17); - let _e20 = a_7; - let _e21 = b_7; - v_3 = (vec4(_e20) | _e21); - let _e24 = a_7; - let _e25 = b_7; - v_3 = (vec4(_e24) ^ _e25); + v_3 = (a_7 * b_7); + v_3 = (vec4(a_7) + b_7); + v_3 = (vec4(a_7) - b_7); + v_3 = (vec4(a_7) & b_7); + v_3 = (vec4(a_7) | b_7); + v_3 = (vec4(a_7) ^ b_7); return; } @@ -133,33 +91,15 @@ fn testBinOpUVecUint(a_8: vec4, b_8: u32) { a_9 = a_8; b_9 = b_8; - let _e5 = a_9; - let _e6 = b_9; - v_4 = (_e5 * _e6); - let _e8 = a_9; - let _e9 = b_9; - v_4 = (_e8 / vec4(_e9)); - let _e12 = a_9; - let _e13 = b_9; - v_4 = (_e12 + vec4(_e13)); - let _e16 = a_9; - let _e17 = b_9; - v_4 = (_e16 - vec4(_e17)); - let _e20 = a_9; - let _e21 = b_9; - v_4 = (_e20 & vec4(_e21)); - let _e24 = a_9; - let _e25 = b_9; - v_4 = (_e24 | vec4(_e25)); - let _e28 = a_9; - let _e29 = b_9; - v_4 = (_e28 ^ vec4(_e29)); - let _e32 = a_9; - let _e33 = b_9; - v_4 = (_e32 >> vec4(_e33)); - let _e36 = a_9; - let _e37 = b_9; - v_4 = (_e36 << vec4(_e37)); + v_4 = (a_9 * b_9); + v_4 = (a_9 / vec4(b_9)); + v_4 = (a_9 + vec4(b_9)); + v_4 = (a_9 - vec4(b_9)); + v_4 = (a_9 & vec4(b_9)); + v_4 = (a_9 | vec4(b_9)); + v_4 = (a_9 ^ vec4(b_9)); + v_4 = (a_9 >> vec4(b_9)); + v_4 = (a_9 << vec4(b_9)); return; } @@ -170,24 +110,12 @@ fn testBinOpUintUVec(a_10: u32, b_10: vec4) { a_11 = a_10; b_11 = b_10; - let _e5 = a_11; - let _e6 = b_11; - v_5 = (_e5 * _e6); - let _e8 = a_11; - let _e9 = b_11; - v_5 = (vec4(_e8) + _e9); - let _e12 = a_11; - let _e13 = b_11; - v_5 = (vec4(_e12) - _e13); - let _e16 = a_11; - let _e17 = b_11; - v_5 = (vec4(_e16) & _e17); - let _e20 = a_11; - let _e21 = b_11; - v_5 = (vec4(_e20) | _e21); - let _e24 = a_11; - let _e25 = b_11; - v_5 = (vec4(_e24) ^ _e25); + v_5 = (a_11 * b_11); + v_5 = (vec4(a_11) + b_11); + v_5 = (vec4(a_11) - b_11); + v_5 = (vec4(a_11) & b_11); + v_5 = (vec4(a_11) | b_11); + v_5 = (vec4(a_11) ^ b_11); return; } @@ -202,15 +130,9 @@ fn testBinOpMatMat(a_12: mat3x3, b_12: mat3x3) { let _e6 = a_13; let _e7 = b_13; v_6 = mat3x3((_e6[0] / _e7[0]), (_e6[1] / _e7[1]), (_e6[2] / _e7[2])); - let _e18 = a_13; - let _e19 = b_13; - v_6 = (_e18 * _e19); - let _e21 = a_13; - let _e22 = b_13; - v_6 = (_e21 + _e22); - let _e24 = a_13; - let _e25 = b_13; - v_6 = (_e24 - _e25); + v_6 = (a_13 * b_13); + v_6 = (a_13 + b_13); + v_6 = (a_13 - b_13); let _e27 = a_13; let _e28 = b_13; c = (all((_e27[2] == _e28[2])) && (all((_e27[1] == _e28[1])) && all((_e27[0] == _e28[0])))); @@ -227,35 +149,25 @@ fn testBinOpMatFloat(a_14: f32, b_14: mat3x3) { a_15 = a_14; b_15 = b_14; - let _e5 = a_15; let _e6 = b_15; - let _e7 = vec3(_e5); + let _e7 = vec3(a_15); v_7 = mat3x3((_e7 / _e6[0]), (_e7 / _e6[1]), (_e7 / _e6[2])); - let _e15 = a_15; - let _e16 = b_15; - v_7 = (_e15 * _e16); - let _e18 = a_15; + v_7 = (a_15 * b_15); let _e19 = b_15; - let _e20 = vec3(_e18); + let _e20 = vec3(a_15); v_7 = mat3x3((_e20 + _e19[0]), (_e20 + _e19[1]), (_e20 + _e19[2])); - let _e28 = a_15; let _e29 = b_15; - let _e30 = vec3(_e28); + let _e30 = vec3(a_15); v_7 = mat3x3((_e30 - _e29[0]), (_e30 - _e29[1]), (_e30 - _e29[2])); let _e38 = b_15; - let _e39 = a_15; - let _e40 = vec3(_e39); + let _e40 = vec3(a_15); v_7 = mat3x3((_e38[0] / _e40), (_e38[1] / _e40), (_e38[2] / _e40)); - let _e48 = b_15; - let _e49 = a_15; - v_7 = (_e48 * _e49); + v_7 = (b_15 * a_15); let _e51 = b_15; - let _e52 = a_15; - let _e53 = vec3(_e52); + let _e53 = vec3(a_15); v_7 = mat3x3((_e51[0] + _e53), (_e51[1] + _e53), (_e51[2] + _e53)); let _e61 = b_15; - let _e62 = a_15; - let _e63 = vec3(_e62); + let _e63 = vec3(a_15); v_7 = mat3x3((_e61[0] - _e63), (_e61[1] - _e63), (_e61[2] - _e63)); return; } @@ -265,11 +177,9 @@ fn testUnaryOpMat(a_16: mat3x3) { var v_8: mat3x3; a_17 = a_16; - let _e3 = a_17; - v_8 = -(_e3); - let _e5 = a_17; + v_8 = -(a_17); const _e7 = vec3(1f); - let _e9 = (_e5 - mat3x3(_e7, _e7, _e7)); + let _e9 = (a_17 - mat3x3(_e7, _e7, _e7)); a_17 = _e9; v_8 = _e9; let _e10 = a_17; @@ -302,8 +212,7 @@ fn testNonImplicitCastVectorCast() { var a_18: u32 = 1u; var b_16: vec4; - let _e3 = a_18; - b_16 = vec4(i32(_e3)); + b_16 = vec4(i32(a_18)); return; } @@ -323,44 +232,34 @@ fn ternary(a_20: bool) { var nested: u32; a_21 = a_20; - let _e3 = a_21; - if _e3 { + if a_21 { local = 0u; } else { local = 1u; } - let _e8 = local; - b_17 = _e8; - let _e10 = a_21; - if _e10 { + b_17 = local; + if a_21 { local_1 = 0u; } else { local_1 = 1u; } - let _e15 = local_1; - c_1 = _e15; - let _e17 = a_21; - if _e17 { - let _e18 = a_21; - if _e18 { - let _e19 = a_21; - if _e19 { + c_1 = local_1; + if a_21 { + if a_21 { + if a_21 { local_2 = 2u; } else { local_2 = 3u; } - let _e24 = local_2; - local_3 = _e24; + local_3 = local_2; } else { local_3 = 4u; } - let _e27 = local_3; - local_4 = _e27; + local_4 = local_3; } else { local_4 = 5u; } - let _e31 = local_4; - nested = _e31; + nested = local_4; return; } @@ -371,9 +270,7 @@ fn testMatrixMultiplication(a_22: mat4x3, b_18: mat4x4) { a_23 = a_22; b_19 = b_18; - let _e5 = a_23; - let _e6 = b_19; - c_2 = (_e5 * _e6); + c_2 = (a_23 * b_19); return; } @@ -397,9 +294,7 @@ fn indexConstantNonConstantIndex(i: i32) { var a_26: vec4; i_1 = i; - let _e6 = i_1; - let _e11 = local_5.array_[_e6]; - a_26 = _e11; + a_26 = local_5.array_[i_1]; return; } @@ -410,13 +305,10 @@ fn testSwizzleWrites(a_27: vec3) { let _e6 = a_28; a_28.z = 3f; a_28.x = 4f; - let _e14 = a_28; - let _e16 = a_28; - let _e19 = (_e16.xy * 5f); + let _e19 = (a_28.xy * 5f); a_28.x = _e19.x; a_28.y = _e19.y; - let _e24 = a_28; - let _e28 = (_e24.zy + vec2(1f)); + let _e28 = (a_28.zy + vec2(1f)); a_28.z = _e28.x; a_28.y = _e28.y; return; @@ -425,12 +317,9 @@ fn testSwizzleWrites(a_27: vec3) { fn main_1() { var local_6: f32; - let _e6 = global; - local_6 = _e6; + local_6 = global; privatePointer((&local_6)); - let _e8 = local_6; - global = _e8; - let _e9 = o_color; + global = local_6; o_color.x = 1f; o_color.y = 1f; o_color.z = 1f; @@ -441,6 +330,5 @@ fn main_1() { @fragment fn main() -> FragmentOutput { main_1(); - let _e9 = o_color; - return FragmentOutput(_e9); + return FragmentOutput(o_color); } diff --git a/naga/tests/out/wgsl/extra.wgsl b/naga/tests/out/wgsl/extra.wgsl index 25f894e7f5..01609fd483 100644 --- a/naga/tests/out/wgsl/extra.wgsl +++ b/naga/tests/out/wgsl/extra.wgsl @@ -12,8 +12,7 @@ var pc: PushConstants; @fragment fn main(in: FragmentIn) -> @location(0) vec4 { - let _e4 = pc.index; - if (in.primitive_index == _e4) { + if (in.primitive_index == pc.index) { return in.color; } else { return vec4((vec3(1f) - in.color.xyz), in.color.w); diff --git a/naga/tests/out/wgsl/fetch_depth.wgsl b/naga/tests/out/wgsl/fetch_depth.wgsl index 3e206bc267..1e4f7f12e5 100644 --- a/naga/tests/out/wgsl/fetch_depth.wgsl +++ b/naga/tests/out/wgsl/fetch_depth.wgsl @@ -14,8 +14,7 @@ var global_1: type_4; var global_2: texture_depth_2d; fn function() { - let _e6 = global_1.member; - let _e7 = textureLoad(global_2, _e6, 0i); + let _e7 = textureLoad(global_2, global_1.member, 0i); global.member = vec4(_e7).x; return; } diff --git a/naga/tests/out/wgsl/fma.frag.wgsl b/naga/tests/out/wgsl/fma.frag.wgsl index 57d11c1d24..adfff19b27 100644 --- a/naga/tests/out/wgsl/fma.frag.wgsl +++ b/naga/tests/out/wgsl/fma.frag.wgsl @@ -16,23 +16,13 @@ fn Fma(d: ptr, m: Mat4x3_, s: f32) { m_1 = m; s_1 = s; - let _e6 = (*d); - let _e8 = m_1; - let _e10 = s_1; - (*d).mx = (_e6.mx + (_e8.mx * _e10)); - let _e14 = (*d); - let _e16 = m_1; - let _e18 = s_1; - (*d).my = (_e14.my + (_e16.my * _e18)); - let _e22 = (*d); - let _e24 = m_1; - let _e26 = s_1; - (*d).mz = (_e22.mz + (_e24.mz * _e26)); + (*d).mx = ((*d).mx + (m_1.mx * s_1)); + (*d).my = ((*d).my + (m_1.my * s_1)); + (*d).mz = ((*d).mz + (m_1.mz * s_1)); return; } fn main_1() { - let _e1 = o_color; o_color.x = 1f; o_color.y = 1f; o_color.z = 1f; @@ -43,6 +33,5 @@ fn main_1() { @fragment fn main() -> FragmentOutput { main_1(); - let _e3 = o_color; - return FragmentOutput(_e3); + return FragmentOutput(o_color); } diff --git a/naga/tests/out/wgsl/fragment-output.wgsl b/naga/tests/out/wgsl/fragment-output.wgsl index 1a17003979..e07b47bf1d 100644 --- a/naga/tests/out/wgsl/fragment-output.wgsl +++ b/naga/tests/out/wgsl/fragment-output.wgsl @@ -26,8 +26,7 @@ fn main_vec4vec3_() -> FragmentOutputVec4Vec3_ { output.vec3f = vec3(0f); output.vec3i = vec3(0i); output.vec3u = vec3(0u); - let _e19 = output; - return _e19; + return output; } @fragment @@ -40,6 +39,5 @@ fn main_vec2scalar() -> FragmentOutputVec2Scalar { output_1.scalarf = 0f; output_1.scalari = 0i; output_1.scalaru = 0u; - let _e16 = output_1; - return _e16; + return output_1; } diff --git a/naga/tests/out/wgsl/functions_call.frag.wgsl b/naga/tests/out/wgsl/functions_call.frag.wgsl index 62aaeb2033..a13fc7d684 100644 --- a/naga/tests/out/wgsl/functions_call.frag.wgsl +++ b/naga/tests/out/wgsl/functions_call.frag.wgsl @@ -7,14 +7,10 @@ fn swizzleCaller(a_1: vec3) { var local: vec2; a_2 = a_1; - let _e2 = a_2; - let _e4 = a_2; - local = _e4.xz; + local = a_2.xz; swizzleCallee((&local)); - let _e11 = local.x; - a_2.x = _e11; - let _e12 = local.y; - a_2.z = _e12; + a_2.x = local.x; + a_2.z = local.y; return; } @@ -28,8 +24,7 @@ fn outImplicitCastCaller(a_4: f32) { a_5 = a_4; outImplicitCastCallee((&local_1)); - let _e5 = local_1; - a_5 = f32(_e5); + a_5 = f32(local_1); return; } @@ -42,13 +37,9 @@ fn swizzleImplicitCastCaller(a_7: vec3) { var local_2: vec2; a_8 = a_7; - let _e2 = a_8; - let _e4 = a_8; swizzleImplicitCastCallee((&local_2)); - let _e11 = local_2.x; - a_8.x = f32(_e11); - let _e13 = local_2.y; - a_8.z = f32(_e13); + a_8.x = f32(local_2.x); + a_8.z = f32(local_2.y); return; } diff --git a/naga/tests/out/wgsl/global-constant-array.frag.wgsl b/naga/tests/out/wgsl/global-constant-array.frag.wgsl index bdb509dc35..f233c106a6 100644 --- a/naga/tests/out/wgsl/global-constant-array.frag.wgsl +++ b/naga/tests/out/wgsl/global-constant-array.frag.wgsl @@ -5,7 +5,6 @@ var i: u32; fn main_1() { var local: array = array_; - let _e2 = i; } @fragment diff --git a/naga/tests/out/wgsl/globals.wgsl b/naga/tests/out/wgsl/globals.wgsl index 229d40ccf6..c9ba491710 100644 --- a/naga/tests/out/wgsl/globals.wgsl +++ b/naga/tests/out/wgsl/globals.wgsl @@ -32,8 +32,7 @@ fn test_msl_packed_vec3_() { alignment.v3_ = vec3(1f); alignment.v3_.x = 1f; alignment.v3_.x = 2f; - let _e16 = idx; - alignment.v3_[_e16] = 3f; + alignment.v3_[idx] = 3f; let data = alignment; let l0_ = data.v3_; let l1_ = data.v3_.zx; @@ -50,20 +49,12 @@ fn main() { var at: bool = true; test_msl_packed_vec3_(); - let _e5 = global_nested_arrays_of_matrices_4x2_[0][0]; - let _e10 = global_nested_arrays_of_matrices_2x4_[0][0][0]; - wg[7] = (_e5 * _e10).x; - let _e16 = global_mat; - let _e18 = global_vec; - wg[6] = (_e16 * _e18).x; - let _e26 = dummy[1].y; - wg[5] = _e26; - let _e32 = float_vecs[0].w; - wg[4] = _e32; - let _e37 = alignment.v1_; - wg[3] = _e37; - let _e43 = alignment.v3_.x; - wg[2] = _e43; + wg[7] = (global_nested_arrays_of_matrices_4x2_[0][0] * global_nested_arrays_of_matrices_2x4_[0][0][0]).x; + wg[6] = (global_mat * global_vec).x; + wg[5] = dummy[1].y; + wg[4] = float_vecs[0].w; + wg[3] = alignment.v1_; + wg[2] = alignment.v3_.x; alignment.v1_ = 4f; wg[1] = f32(arrayLength((&dummy))); atomicStore((&at_1), 2u); diff --git a/naga/tests/out/wgsl/image.wgsl b/naga/tests/out/wgsl/image.wgsl index 0c10eda857..b9557c155c 100644 --- a/naga/tests/out/wgsl/image.wgsl +++ b/naga/tests/out/wgsl/image.wgsl @@ -114,73 +114,50 @@ fn texture_sample() -> @location(0) vec4 { const tc = vec2(0.5f); const tc3_ = vec3(0.5f); let _e9 = textureSample(image_1d, sampler_reg, tc.x); - let _e10 = a; - a = (_e10 + _e9); + a = (a + _e9); let _e14 = textureSample(image_2d, sampler_reg, tc); - let _e15 = a; - a = (_e15 + _e14); + a = (a + _e14); let _e19 = textureSample(image_2d, sampler_reg, tc, vec2(3i, 1i)); - let _e20 = a; - a = (_e20 + _e19); + a = (a + _e19); let _e24 = textureSampleLevel(image_2d, sampler_reg, tc, 2.3f); - let _e25 = a; - a = (_e25 + _e24); + a = (a + _e24); let _e29 = textureSampleLevel(image_2d, sampler_reg, tc, 2.3f, vec2(3i, 1i)); - let _e30 = a; - a = (_e30 + _e29); + a = (a + _e29); let _e35 = textureSampleBias(image_2d, sampler_reg, tc, 2f, vec2(3i, 1i)); - let _e36 = a; - a = (_e36 + _e35); + a = (a + _e35); let _e41 = textureSample(image_2d_array, sampler_reg, tc, 0u); - let _e42 = a; - a = (_e42 + _e41); + a = (a + _e41); let _e47 = textureSample(image_2d_array, sampler_reg, tc, 0u, vec2(3i, 1i)); - let _e48 = a; - a = (_e48 + _e47); + a = (a + _e47); let _e53 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, 2.3f); - let _e54 = a; - a = (_e54 + _e53); + a = (a + _e53); let _e59 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, 2.3f, vec2(3i, 1i)); - let _e60 = a; - a = (_e60 + _e59); + a = (a + _e59); let _e66 = textureSampleBias(image_2d_array, sampler_reg, tc, 0u, 2f, vec2(3i, 1i)); - let _e67 = a; - a = (_e67 + _e66); + a = (a + _e66); let _e72 = textureSample(image_2d_array, sampler_reg, tc, 0i); - let _e73 = a; - a = (_e73 + _e72); + a = (a + _e72); let _e78 = textureSample(image_2d_array, sampler_reg, tc, 0i, vec2(3i, 1i)); - let _e79 = a; - a = (_e79 + _e78); + a = (a + _e78); let _e84 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0i, 2.3f); - let _e85 = a; - a = (_e85 + _e84); + a = (a + _e84); let _e90 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0i, 2.3f, vec2(3i, 1i)); - let _e91 = a; - a = (_e91 + _e90); + a = (a + _e90); let _e97 = textureSampleBias(image_2d_array, sampler_reg, tc, 0i, 2f, vec2(3i, 1i)); - let _e98 = a; - a = (_e98 + _e97); + a = (a + _e97); let _e103 = textureSample(image_cube_array, sampler_reg, tc3_, 0u); - let _e104 = a; - a = (_e104 + _e103); + a = (a + _e103); let _e109 = textureSampleLevel(image_cube_array, sampler_reg, tc3_, 0u, 2.3f); - let _e110 = a; - a = (_e110 + _e109); + a = (a + _e109); let _e116 = textureSampleBias(image_cube_array, sampler_reg, tc3_, 0u, 2f); - let _e117 = a; - a = (_e117 + _e116); + a = (a + _e116); let _e122 = textureSample(image_cube_array, sampler_reg, tc3_, 0i); - let _e123 = a; - a = (_e123 + _e122); + a = (a + _e122); let _e128 = textureSampleLevel(image_cube_array, sampler_reg, tc3_, 0i, 2.3f); - let _e129 = a; - a = (_e129 + _e128); + a = (a + _e128); let _e135 = textureSampleBias(image_cube_array, sampler_reg, tc3_, 0i, 2f); - let _e136 = a; - a = (_e136 + _e135); - let _e138 = a; - return _e138; + a = (a + _e135); + return a; } @fragment @@ -190,31 +167,22 @@ fn texture_sample_comparison() -> @location(0) f32 { const tc_1 = vec2(0.5f); const 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); + a_1 = (a_1 + _e8); let _e14 = textureSampleCompare(image_2d_array_depth, sampler_cmp, tc_1, 0u, 0.5f); - let _e15 = a_1; - a_1 = (_e15 + _e14); + a_1 = (a_1 + _e14); let _e20 = textureSampleCompare(image_2d_array_depth, sampler_cmp, tc_1, 0i, 0.5f); - let _e21 = a_1; - a_1 = (_e21 + _e20); + a_1 = (a_1 + _e20); let _e25 = textureSampleCompare(image_cube_depth, sampler_cmp, tc3_1, 0.5f); - let _e26 = a_1; - a_1 = (_e26 + _e25); + a_1 = (a_1 + _e25); let _e30 = textureSampleCompareLevel(image_2d_depth, sampler_cmp, tc_1, 0.5f); - let _e31 = a_1; - a_1 = (_e31 + _e30); + a_1 = (a_1 + _e30); let _e36 = textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc_1, 0u, 0.5f); - let _e37 = a_1; - a_1 = (_e37 + _e36); + a_1 = (a_1 + _e36); let _e42 = textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc_1, 0i, 0.5f); - let _e43 = a_1; - a_1 = (_e43 + _e42); + a_1 = (a_1 + _e42); let _e47 = textureSampleCompareLevel(image_cube_depth, sampler_cmp, tc3_1, 0.5f); - let _e48 = a_1; - a_1 = (_e48 + _e47); - let _e50 = a_1; - return _e50; + a_1 = (a_1 + _e47); + return a_1; } @fragment diff --git a/naga/tests/out/wgsl/images.frag.wgsl b/naga/tests/out/wgsl/images.frag.wgsl index 6b57b52aeb..208d404523 100644 --- a/naga/tests/out/wgsl/images.frag.wgsl +++ b/naga/tests/out/wgsl/images.frag.wgsl @@ -23,10 +23,8 @@ fn testImg1D(coord: i32) { coord_1 = coord; let _e10 = textureDimensions(img1D); size = i32(_e10); - let _e13 = coord_1; - textureStore(img1D, _e13, vec4(2f)); - let _e17 = coord_1; - let _e18 = textureLoad(img1D, _e17); + textureStore(img1D, coord_1, vec4(2f)); + let _e18 = textureLoad(img1D, coord_1); c = _e18; return; } @@ -56,11 +54,9 @@ fn testImg2D(coord_4: vec2) { coord_5 = coord_4; let _e10 = textureDimensions(img2D); size_2 = vec2(vec2(_e10)); - let _e14 = coord_5; - let _e15 = textureLoad(img2D, _e14); + let _e15 = textureLoad(img2D, coord_5); c_2 = _e15; - let _e17 = coord_5; - textureStore(img2D, _e17, vec4(2f)); + textureStore(img2D, coord_5, vec4(2f)); return; } @@ -89,11 +85,9 @@ fn testImg3D(coord_8: vec3) { coord_9 = coord_8; let _e10 = textureDimensions(img3D); size_4 = vec3(vec3(_e10)); - let _e14 = coord_9; - let _e15 = textureLoad(img3D, _e14); + let _e15 = textureLoad(img3D, coord_9); c_4 = _e15; - let _e17 = coord_9; - textureStore(img3D, _e17, vec4(2f)); + textureStore(img3D, coord_9, vec4(2f)); return; } @@ -105,8 +99,7 @@ fn testImgReadOnly(coord_10: vec2) { coord_11 = coord_10; let _e10 = textureDimensions(img2D); size_5 = vec2(vec2(_e10)); - let _e14 = coord_11; - let _e15 = textureLoad(imgReadOnly, _e14); + let _e15 = textureLoad(imgReadOnly, coord_11); c_5 = _e15; return; } @@ -118,8 +111,7 @@ fn testImgWriteOnly(coord_12: vec2) { coord_13 = coord_12; let _e10 = textureDimensions(img2D); size_6 = vec2(vec2(_e10)); - let _e14 = coord_13; - textureStore(imgWriteOnly, _e14, vec4(2f)); + textureStore(imgWriteOnly, coord_13, vec4(2f)); return; } diff --git a/naga/tests/out/wgsl/int64.wgsl b/naga/tests/out/wgsl/int64.wgsl index f378bef20b..bf005087ca 100644 --- a/naga/tests/out/wgsl/int64.wgsl +++ b/naga/tests/out/wgsl/int64.wgsl @@ -35,150 +35,54 @@ var output_arrays: StorageCompatible; fn int64_function(x: i64) -> i64 { var val: i64 = 20li; - let _e6 = val; - val = (_e6 + (31li - 1002003004005006li)); - let _e8 = val; - let _e11 = val; - val = (_e11 + (_e8 + 5li)); - let _e15 = input_uniform.val_u32_; - let _e16 = val; - let _e20 = val; - val = (_e20 + i64((_e15 + u32(_e16)))); - let _e24 = input_uniform.val_i32_; - let _e25 = val; - let _e29 = val; - val = (_e29 + i64((_e24 + i32(_e25)))); - let _e33 = input_uniform.val_f32_; - let _e34 = val; - let _e38 = val; - val = (_e38 + i64((_e33 + f32(_e34)))); - let _e42 = input_uniform.val_i64_; - let _e45 = val; - val = (_e45 + vec3(_e42).z); - let _e49 = input_uniform.val_u64_; - let _e51 = val; - val = (_e51 + bitcast(_e49)); - let _e55 = input_uniform.val_u64_2_; - let _e58 = val; - val = (_e58 + bitcast>(_e55).y); - let _e62 = input_uniform.val_u64_3_; - let _e65 = val; - val = (_e65 + bitcast>(_e62).z); - let _e69 = input_uniform.val_u64_4_; - let _e72 = val; - val = (_e72 + bitcast>(_e69).w); - let _e78 = input_uniform.val_i64_; - let _e81 = input_storage.val_i64_; - output.val_i64_ = (_e78 + _e81); - let _e87 = input_uniform.val_i64_2_; - let _e90 = input_storage.val_i64_2_; - output.val_i64_2_ = (_e87 + _e90); - let _e96 = input_uniform.val_i64_3_; - let _e99 = input_storage.val_i64_3_; - output.val_i64_3_ = (_e96 + _e99); - let _e105 = input_uniform.val_i64_4_; - let _e108 = input_storage.val_i64_4_; - output.val_i64_4_ = (_e105 + _e108); - let _e114 = input_arrays.val_i64_array_2_; - output_arrays.val_i64_array_2_ = _e114; - let _e115 = val; - let _e117 = val; - val = (_e117 + abs(_e115)); - let _e119 = val; - let _e120 = val; - let _e121 = val; - let _e123 = val; - val = (_e123 + clamp(_e119, _e120, _e121)); - let _e125 = val; - let _e127 = val; - let _e130 = val; - val = (_e130 + dot(vec2(_e125), vec2(_e127))); - let _e132 = val; - let _e133 = val; - let _e135 = val; - val = (_e135 + max(_e132, _e133)); - let _e137 = val; - let _e138 = val; - let _e140 = val; - val = (_e140 + min(_e137, _e138)); - let _e142 = val; - let _e144 = val; - val = (_e144 + sign(_e142)); - let _e146 = val; - return _e146; + val = (val + (31li - 1002003004005006li)); + val = (val + (val + 5li)); + val = (val + i64((input_uniform.val_u32_ + u32(val)))); + val = (val + i64((input_uniform.val_i32_ + i32(val)))); + val = (val + i64((input_uniform.val_f32_ + f32(val)))); + val = (val + vec3(input_uniform.val_i64_).z); + val = (val + bitcast(input_uniform.val_u64_)); + val = (val + bitcast>(input_uniform.val_u64_2_).y); + val = (val + bitcast>(input_uniform.val_u64_3_).z); + val = (val + bitcast>(input_uniform.val_u64_4_).w); + output.val_i64_ = (input_uniform.val_i64_ + input_storage.val_i64_); + output.val_i64_2_ = (input_uniform.val_i64_2_ + input_storage.val_i64_2_); + output.val_i64_3_ = (input_uniform.val_i64_3_ + input_storage.val_i64_3_); + output.val_i64_4_ = (input_uniform.val_i64_4_ + input_storage.val_i64_4_); + output_arrays.val_i64_array_2_ = input_arrays.val_i64_array_2_; + val = (val + abs(val)); + val = (val + clamp(val, val, val)); + val = (val + dot(vec2(val), vec2(val))); + val = (val + max(val, val)); + val = (val + min(val, val)); + val = (val + sign(val)); + return val; } fn uint64_function(x_1: u64) -> u64 { var val_1: u64 = 20lu; - let _e6 = val_1; - val_1 = (_e6 + (31lu + 1002003004005006lu)); - let _e8 = val_1; - let _e11 = val_1; - val_1 = (_e11 + (_e8 + 5lu)); - let _e15 = input_uniform.val_u32_; - let _e16 = val_1; - let _e20 = val_1; - val_1 = (_e20 + u64((_e15 + u32(_e16)))); - let _e24 = input_uniform.val_i32_; - let _e25 = val_1; - let _e29 = val_1; - val_1 = (_e29 + u64((_e24 + i32(_e25)))); - let _e33 = input_uniform.val_f32_; - let _e34 = val_1; - let _e38 = val_1; - val_1 = (_e38 + u64((_e33 + f32(_e34)))); - let _e42 = input_uniform.val_u64_; - let _e45 = val_1; - val_1 = (_e45 + vec3(_e42).z); - let _e49 = input_uniform.val_i64_; - let _e51 = val_1; - val_1 = (_e51 + bitcast(_e49)); - let _e55 = input_uniform.val_i64_2_; - let _e58 = val_1; - val_1 = (_e58 + bitcast>(_e55).y); - let _e62 = input_uniform.val_i64_3_; - let _e65 = val_1; - val_1 = (_e65 + bitcast>(_e62).z); - let _e69 = input_uniform.val_i64_4_; - let _e72 = val_1; - val_1 = (_e72 + bitcast>(_e69).w); - let _e78 = input_uniform.val_u64_; - let _e81 = input_storage.val_u64_; - output.val_u64_ = (_e78 + _e81); - let _e87 = input_uniform.val_u64_2_; - let _e90 = input_storage.val_u64_2_; - output.val_u64_2_ = (_e87 + _e90); - let _e96 = input_uniform.val_u64_3_; - let _e99 = input_storage.val_u64_3_; - output.val_u64_3_ = (_e96 + _e99); - let _e105 = input_uniform.val_u64_4_; - let _e108 = input_storage.val_u64_4_; - output.val_u64_4_ = (_e105 + _e108); - let _e114 = input_arrays.val_u64_array_2_; - output_arrays.val_u64_array_2_ = _e114; - let _e115 = val_1; - let _e117 = val_1; - val_1 = (_e117 + abs(_e115)); - let _e119 = val_1; - let _e120 = val_1; - let _e121 = val_1; - let _e123 = val_1; - val_1 = (_e123 + clamp(_e119, _e120, _e121)); - let _e125 = val_1; - let _e127 = val_1; - let _e130 = val_1; - val_1 = (_e130 + dot(vec2(_e125), vec2(_e127))); - let _e132 = val_1; - let _e133 = val_1; - let _e135 = val_1; - val_1 = (_e135 + max(_e132, _e133)); - let _e137 = val_1; - let _e138 = val_1; - let _e140 = val_1; - val_1 = (_e140 + min(_e137, _e138)); - let _e142 = val_1; - return _e142; + val_1 = (val_1 + (31lu + 1002003004005006lu)); + val_1 = (val_1 + (val_1 + 5lu)); + val_1 = (val_1 + u64((input_uniform.val_u32_ + u32(val_1)))); + val_1 = (val_1 + u64((input_uniform.val_i32_ + i32(val_1)))); + val_1 = (val_1 + u64((input_uniform.val_f32_ + f32(val_1)))); + val_1 = (val_1 + vec3(input_uniform.val_u64_).z); + val_1 = (val_1 + bitcast(input_uniform.val_i64_)); + val_1 = (val_1 + bitcast>(input_uniform.val_i64_2_).y); + val_1 = (val_1 + bitcast>(input_uniform.val_i64_3_).z); + val_1 = (val_1 + bitcast>(input_uniform.val_i64_4_).w); + output.val_u64_ = (input_uniform.val_u64_ + input_storage.val_u64_); + output.val_u64_2_ = (input_uniform.val_u64_2_ + input_storage.val_u64_2_); + output.val_u64_3_ = (input_uniform.val_u64_3_ + input_storage.val_u64_3_); + output.val_u64_4_ = (input_uniform.val_u64_4_ + input_storage.val_u64_4_); + output_arrays.val_u64_array_2_ = input_arrays.val_u64_array_2_; + val_1 = (val_1 + abs(val_1)); + val_1 = (val_1 + clamp(val_1, val_1, val_1)); + val_1 = (val_1 + dot(vec2(val_1), vec2(val_1))); + val_1 = (val_1 + max(val_1, val_1)); + val_1 = (val_1 + min(val_1, val_1)); + return val_1; } @compute @workgroup_size(1, 1, 1) diff --git a/naga/tests/out/wgsl/interface.wgsl b/naga/tests/out/wgsl/interface.wgsl index 1f46278ab8..4b21538f57 100644 --- a/naga/tests/out/wgsl/interface.wgsl +++ b/naga/tests/out/wgsl/interface.wgsl @@ -42,6 +42,5 @@ fn compute(@builtin(global_invocation_id) global_id: vec3, @builtin(local_i fn vertex_two_structs(in1_: Input1_, in2_: Input2_) -> @builtin(position) @invariant vec4 { var index: u32 = 2u; - let _e8: u32 = index; - return vec4(f32(in1_.index), f32(in2_.index), f32(_e8), 0f); + return vec4(f32(in1_.index), f32(in2_.index), f32(index), 0f); } diff --git a/naga/tests/out/wgsl/interpolate.wgsl b/naga/tests/out/wgsl/interpolate.wgsl index adb90568e4..88b1de1e74 100644 --- a/naga/tests/out/wgsl/interpolate.wgsl +++ b/naga/tests/out/wgsl/interpolate.wgsl @@ -29,8 +29,7 @@ fn vert_main() -> FragmentInput { out.perspective_centroid = 2197f; out.perspective_sample = 2744f; out.perspective_center = 2812f; - let _e41 = out; - return _e41; + return out; } @fragment diff --git a/naga/tests/out/wgsl/interpolate_compat.wgsl b/naga/tests/out/wgsl/interpolate_compat.wgsl index aeaac63547..f47d40f040 100644 --- a/naga/tests/out/wgsl/interpolate_compat.wgsl +++ b/naga/tests/out/wgsl/interpolate_compat.wgsl @@ -27,8 +27,7 @@ fn vert_main() -> FragmentInput { out.perspective_centroid = 2197f; out.perspective_sample = 2744f; out.perspective_center = 2812f; - let _e39 = out; - return _e39; + return out; } @fragment diff --git a/naga/tests/out/wgsl/inv-hyperbolic-trig-functions.wgsl b/naga/tests/out/wgsl/inv-hyperbolic-trig-functions.wgsl index e68413c279..6b719b58d9 100644 --- a/naga/tests/out/wgsl/inv-hyperbolic-trig-functions.wgsl +++ b/naga/tests/out/wgsl/inv-hyperbolic-trig-functions.wgsl @@ -5,12 +5,9 @@ fn main_1() { var c: f32; var d: f32; - let _e4 = a; - b = asinh(_e4); - let _e6 = a; - c = acosh(_e6); - let _e8 = a; - d = atanh(_e8); + b = asinh(a); + c = acosh(a); + d = atanh(a); return; } diff --git a/naga/tests/out/wgsl/inverse-polyfill.frag.wgsl b/naga/tests/out/wgsl/inverse-polyfill.frag.wgsl index 1efea1d9f6..2b6995c37a 100644 --- a/naga/tests/out/wgsl/inverse-polyfill.frag.wgsl +++ b/naga/tests/out/wgsl/inverse-polyfill.frag.wgsl @@ -19,12 +19,9 @@ fn main_1() { let _e39 = b3_; let _e40 = a3_; m3_ = mat3x3(vec3(_e38.x, _e38.y, _e38.z), vec3(_e39.x, _e39.y, _e39.z), vec3(_e40.x, _e40.y, _e40.z)); - let _e63 = m4_; - m4_inverse = _naga_inverse_4x4_f32(_e63); - let _e66 = m3_; - m3_inverse = _naga_inverse_3x3_f32(_e66); - let _e69 = m2_; - m2_inverse = _naga_inverse_2x2_f32(_e69); + m4_inverse = _naga_inverse_4x4_f32(m4_); + m3_inverse = _naga_inverse_3x3_f32(m3_); + m2_inverse = _naga_inverse_2x2_f32(m2_); return; } diff --git a/naga/tests/out/wgsl/lexical-scopes.wgsl b/naga/tests/out/wgsl/lexical-scopes.wgsl index e787f96b10..3d3feff446 100644 --- a/naga/tests/out/wgsl/lexical-scopes.wgsl +++ b/naga/tests/out/wgsl/lexical-scopes.wgsl @@ -24,16 +24,14 @@ fn forLexicalScope(a_3: f32) { var a_4: i32 = 0i; loop { - let _e3 = a_4; - if (_e3 < 1i) { + if (a_4 < 1i) { } else { break; } { } continuing { - let _e8 = a_4; - a_4 = (_e8 + 1i); + a_4 = (a_4 + 1i); } } return; 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 a4bb55437a..59d38f3c14 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 @@ -4,19 +4,15 @@ fn main_1() { var a: vec4; loop { - let _e6 = i; - if !((_e6 < 4i)) { + if !((i < 4i)) { break; } { a = vec4(1f); - let _e17 = sum; - let _e18 = a; - sum = (_e17 + _e18); + sum = (sum + a); } continuing { - let _e10 = i; - i = (_e10 + 1i); + i = (i + 1i); } } return; diff --git a/naga/tests/out/wgsl/math-functions.frag.wgsl b/naga/tests/out/wgsl/math-functions.frag.wgsl index 10dc84c9a5..e554392502 100644 --- a/naga/tests/out/wgsl/math-functions.frag.wgsl +++ b/naga/tests/out/wgsl/math-functions.frag.wgsl @@ -53,99 +53,47 @@ fn main_1() { let _e8 = a; let _e9 = b; m = mat4x4(vec4(_e6.x, _e6.y, _e6.z, _e6.w), vec4(_e7.x, _e7.y, _e7.z, _e7.w), vec4(_e8.x, _e8.y, _e8.z, _e8.w), vec4(_e9.x, _e9.y, _e9.z, _e9.w)); - let _e34 = a; - ceilOut = ceil(_e34); - let _e37 = a; - roundOut = round(_e37); - let _e40 = a; - floorOut = floor(_e40); - let _e43 = a; - fractOut = fract(_e43); - let _e46 = a; - truncOut = trunc(_e46); - let _e49 = a; - sinOut = sin(_e49); - let _e52 = a; - absOut = abs(_e52); - let _e55 = a; - sqrtOut = sqrt(_e55); - let _e58 = a; - inversesqrtOut = inverseSqrt(_e58); - let _e61 = a; - expOut = exp(_e61); - let _e64 = a; - exp2Out = exp2(_e64); - let _e67 = a; - signOut = sign(_e67); - let _e70 = m; - transposeOut = transpose(_e70); - let _e73 = a; - normalizeOut = normalize(_e73); - let _e76 = a; - sinhOut = sinh(_e76); - let _e79 = a; - cosOut = cos(_e79); - let _e82 = a; - coshOut = cosh(_e82); - let _e85 = a; - tanOut = tan(_e85); - let _e88 = a; - tanhOut = tanh(_e88); - let _e91 = a; - acosOut = acos(_e91); - let _e94 = a; - asinOut = asin(_e94); - let _e97 = a; - logOut = log(_e97); - let _e100 = a; - log2Out = log2(_e100); - let _e103 = a; - lengthOut = length(_e103); - let _e106 = m; - determinantOut = determinant(_e106); - let _e109 = i; - bitCountOut = countOneBits(_e109); - let _e112 = i; - bitfieldReverseOut = reverseBits(_e112); - let _e115 = a; - atanOut = atan(_e115.x); - let _e119 = a; - let _e121 = a; - atan2Out = atan2(_e119.x, _e121.y); - let _e125 = a; - let _e127 = b; - modOut = (_e125.x - (floor((_e125.x / _e127.x)) * _e127.x)); - let _e134 = a; - let _e135 = b; - powOut = pow(_e134, _e135); - let _e138 = a; - let _e139 = b; - dotOut = dot(_e138, _e139); - let _e142 = a; - let _e143 = b; - maxOut = max(_e142, _e143); - let _e146 = a; - let _e147 = b; - minOut = min(_e146, _e147); - let _e150 = a; - let _e151 = b; - reflectOut = reflect(_e150, _e151); - let _e154 = a; - let _e156 = b; - crossOut = cross(_e154.xyz, _e156.xyz); - let _e160 = a; - let _e161 = b; - distanceOut = distance(_e160, _e161); - let _e164 = a; - let _e165 = b; - stepOut = step(_e164, _e165); - let _e168 = a; - let _e170 = i; - ldexpOut = ldexp(_e168.x, _e170); - let _e173 = a; - rad = radians(_e173); - let _e176 = a; - deg = degrees(_e176.x); + ceilOut = ceil(a); + roundOut = round(a); + floorOut = floor(a); + fractOut = fract(a); + truncOut = trunc(a); + sinOut = sin(a); + absOut = abs(a); + sqrtOut = sqrt(a); + inversesqrtOut = inverseSqrt(a); + expOut = exp(a); + exp2Out = exp2(a); + signOut = sign(a); + transposeOut = transpose(m); + normalizeOut = normalize(a); + sinhOut = sinh(a); + cosOut = cos(a); + coshOut = cosh(a); + tanOut = tan(a); + tanhOut = tanh(a); + acosOut = acos(a); + asinOut = asin(a); + logOut = log(a); + log2Out = log2(a); + lengthOut = length(a); + determinantOut = determinant(m); + bitCountOut = countOneBits(i); + bitfieldReverseOut = reverseBits(i); + atanOut = atan(a.x); + atan2Out = atan2(a.x, a.y); + modOut = (a.x - (floor((a.x / b.x)) * b.x)); + powOut = pow(a, b); + dotOut = dot(a, b); + maxOut = max(a, b); + minOut = min(a, b); + reflectOut = reflect(a, b); + crossOut = cross(a.xyz, b.xyz); + distanceOut = distance(a, b); + stepOut = step(a, b); + ldexpOut = ldexp(a.x, i); + rad = radians(a); + deg = degrees(a.x); smoothStepScalar = smoothstep(0f, 1f, 0.5f); smoothStepVector = smoothstep(vec4(0f), vec4(1f), vec4(0.5f)); smoothStepMixed = smoothstep(vec4(0f), vec4(1f), vec4(0.5f)); diff --git a/naga/tests/out/wgsl/operators.wgsl b/naga/tests/out/wgsl/operators.wgsl index 2194a01df1..72270c8d7d 100644 --- a/naga/tests/out/wgsl/operators.wgsl +++ b/naga/tests/out/wgsl/operators.wgsl @@ -24,14 +24,10 @@ fn splat(m: f32, n: i32) -> vec4 { fn splat_assignment() -> vec2 { var a: vec2 = vec2(2f); - let _e4 = a; - a = (_e4 + vec2(1f)); - let _e8 = a; - a = (_e8 - vec2(3f)); - let _e12 = a; - a = (_e12 / vec2(4f)); - let _e15 = a; - return _e15; + a = (a + vec2(1f)); + a = (a - vec2(3f)); + a = (a / vec2(4f)); + return a; } fn bool_cast(x: vec3) -> vec3 { @@ -196,36 +192,20 @@ fn assignment() { var vec0_: vec3 = vec3(); a_1 = 1i; - let _e5 = a_1; - a_1 = (_e5 + 1i); - let _e7 = a_1; - a_1 = (_e7 - 1i); - let _e9 = a_1; - let _e10 = a_1; - a_1 = (_e10 * _e9); - let _e12 = a_1; - let _e13 = a_1; - a_1 = (_e13 / _e12); - let _e15 = a_1; - a_1 = (_e15 % 1i); - let _e17 = a_1; - a_1 = (_e17 & 0i); - let _e19 = a_1; - a_1 = (_e19 | 0i); - let _e21 = a_1; - a_1 = (_e21 ^ 0i); - let _e23 = a_1; - a_1 = (_e23 << 2u); - let _e25 = a_1; - a_1 = (_e25 >> 1u); - let _e28 = a_1; - a_1 = (_e28 + 1i); - let _e31 = a_1; - a_1 = (_e31 - 1i); - let _e37 = vec0_[1i]; - vec0_[1i] = (_e37 + 1i); - let _e41 = vec0_[1i]; - vec0_[1i] = (_e41 - 1i); + a_1 = (a_1 + 1i); + a_1 = (a_1 - 1i); + a_1 = (a_1 * a_1); + a_1 = (a_1 / a_1); + a_1 = (a_1 % 1i); + a_1 = (a_1 & 0i); + a_1 = (a_1 | 0i); + a_1 = (a_1 ^ 0i); + a_1 = (a_1 << 2u); + a_1 = (a_1 >> 1u); + a_1 = (a_1 + 1i); + a_1 = (a_1 - 1i); + vec0_[1i] = (vec0_[1i] + 1i); + vec0_[1i] = (vec0_[1i] - 1i); return; } diff --git a/naga/tests/out/wgsl/padding.wgsl b/naga/tests/out/wgsl/padding.wgsl index 62a5c7d567..94e6f51836 100644 --- a/naga/tests/out/wgsl/padding.wgsl +++ b/naga/tests/out/wgsl/padding.wgsl @@ -26,8 +26,5 @@ var input3_: Test3_; @vertex fn vertex() -> @builtin(position) vec4 { - let _e4 = input1_.b; - let _e8 = input2_.b; - let _e12 = input3_.b; - return (((vec4(1f) * _e4) * _e8) * _e12); + return (((vec4(1f) * input1_.b) * input2_.b) * input3_.b); } diff --git a/naga/tests/out/wgsl/prepostfix.frag.wgsl b/naga/tests/out/wgsl/prepostfix.frag.wgsl index 15916303bb..7e3967f859 100644 --- a/naga/tests/out/wgsl/prepostfix.frag.wgsl +++ b/naga/tests/out/wgsl/prepostfix.frag.wgsl @@ -9,24 +9,21 @@ fn main_1() { let _e3 = scalar; scalar = (_e3 + 1i); scalar_target = _e3; - let _e6 = scalar; - let _e8 = (_e6 - 1i); + let _e8 = (scalar - 1i); scalar = _e8; scalar_target = _e8; let _e14 = vec; vec = (_e14 - vec2(1u)); vec_target = _e14; - let _e18 = vec; - let _e21 = (_e18 + vec2(1u)); + let _e21 = (vec + vec2(1u)); vec = _e21; vec_target = _e21; let _e32 = mat; const _e34 = vec3(1f); mat = (_e32 + mat4x3(_e34, _e34, _e34, _e34)); mat_target = _e32; - let _e37 = mat; const _e39 = vec3(1f); - let _e41 = (_e37 - mat4x3(_e39, _e39, _e39, _e39)); + let _e41 = (mat - mat4x3(_e39, _e39, _e39, _e39)); mat = _e41; mat_target = _e41; return; diff --git a/naga/tests/out/wgsl/quad-vert.wgsl b/naga/tests/out/wgsl/quad-vert.wgsl index 2de0528cca..f949e4198e 100644 --- a/naga/tests/out/wgsl/quad-vert.wgsl +++ b/naga/tests/out/wgsl/quad-vert.wgsl @@ -16,8 +16,7 @@ var unnamed: gl_PerVertex = gl_PerVertex(vec4(0f, 0f, 0f, 1f), 1f, var a_pos_1: vec2; fn main_1() { - let _e6 = a_uv_1; - v_uv = _e6; + v_uv = a_uv_1; let _e7 = a_pos_1; unnamed.gl_Position = vec4(_e7.x, _e7.y, 0f, 1f); return; @@ -28,7 +27,5 @@ fn main(@location(1) a_uv: vec2, @location(0) a_pos: vec2) -> VertexOu a_uv_1 = a_uv; a_pos_1 = a_pos; main_1(); - let _e7 = v_uv; - let _e8 = unnamed.gl_Position; - return VertexOutput(_e7, _e8); + return VertexOutput(v_uv, unnamed.gl_Position); } diff --git a/naga/tests/out/wgsl/quad_glsl.frag.wgsl b/naga/tests/out/wgsl/quad_glsl.frag.wgsl index 9de0a19c4b..19686f2a32 100644 --- a/naga/tests/out/wgsl/quad_glsl.frag.wgsl +++ b/naga/tests/out/wgsl/quad_glsl.frag.wgsl @@ -14,6 +14,5 @@ fn main_1() { fn main(@location(0) v_uv: vec2) -> FragmentOutput { v_uv_1 = v_uv; main_1(); - let _e7 = o_color; - return FragmentOutput(_e7); + return FragmentOutput(o_color); } diff --git a/naga/tests/out/wgsl/quad_glsl.vert.wgsl b/naga/tests/out/wgsl/quad_glsl.vert.wgsl index 0a3d7cecac..c99c242af0 100644 --- a/naga/tests/out/wgsl/quad_glsl.vert.wgsl +++ b/naga/tests/out/wgsl/quad_glsl.vert.wgsl @@ -11,10 +11,8 @@ var v_uv: vec2; var gl_Position: vec4; fn main_1() { - let _e4 = a_uv_1; - v_uv = _e4; - let _e6 = a_pos_1; - let _e7 = (c_scale * _e6); + v_uv = a_uv_1; + let _e7 = (c_scale * a_pos_1); gl_Position = vec4(_e7.x, _e7.y, 0f, 1f); return; } @@ -24,7 +22,5 @@ fn main(@location(0) a_pos: vec2, @location(1) a_uv: vec2) -> VertexOu a_pos_1 = a_pos; a_uv_1 = a_uv; main_1(); - let _e13 = v_uv; - let _e15 = gl_Position; - return VertexOutput(_e13, _e15); + return VertexOutput(v_uv, gl_Position); } diff --git a/naga/tests/out/wgsl/sampler-functions.frag.wgsl b/naga/tests/out/wgsl/sampler-functions.frag.wgsl index 0f79bd9693..a13b7f326a 100644 --- a/naga/tests/out/wgsl/sampler-functions.frag.wgsl +++ b/naga/tests/out/wgsl/sampler-functions.frag.wgsl @@ -3,13 +3,10 @@ fn CalcShadowPCF1_(T_P_t_TextureDepth: texture_depth_2d, S_P_t_TextureDepth: sam var t_Res: f32 = 0f; t_ProjCoord_1 = t_ProjCoord; - let _e6 = t_Res; - let _e7 = t_ProjCoord_1; - let _e8 = _e7.xyz; + let _e8 = t_ProjCoord_1.xyz; let _e11 = textureSampleCompare(T_P_t_TextureDepth, S_P_t_TextureDepth, _e8.xy, _e8.z); - t_Res = (_e6 + (_e11 * 0.2f)); - let _e17 = t_Res; - return _e17; + t_Res = (t_Res + (_e11 * 0.2f)); + return t_Res; } fn CalcShadowPCF(T_P_t_TextureDepth_1: texture_depth_2d, S_P_t_TextureDepth_1: sampler_comparison, t_ProjCoord_2: vec3, t_Bias: f32) -> f32 { @@ -18,11 +15,8 @@ fn CalcShadowPCF(T_P_t_TextureDepth_1: texture_depth_2d, S_P_t_TextureDepth_1: s t_ProjCoord_3 = t_ProjCoord_2; t_Bias_1 = t_Bias; - let _e7 = t_ProjCoord_3; - let _e9 = t_Bias_1; - t_ProjCoord_3.z = (_e7.z + _e9); - let _e11 = t_ProjCoord_3; - let _e13 = CalcShadowPCF1_(T_P_t_TextureDepth_1, S_P_t_TextureDepth_1, _e11.xyz); + t_ProjCoord_3.z = (t_ProjCoord_3.z + t_Bias_1); + let _e13 = CalcShadowPCF1_(T_P_t_TextureDepth_1, S_P_t_TextureDepth_1, t_ProjCoord_3.xyz); return _e13; } diff --git a/naga/tests/out/wgsl/samplers.frag.wgsl b/naga/tests/out/wgsl/samplers.frag.wgsl index 170b0491b3..065f61249e 100644 --- a/naga/tests/out/wgsl/samplers.frag.wgsl +++ b/naga/tests/out/wgsl/samplers.frag.wgsl @@ -46,77 +46,57 @@ fn testTex1D(coord: f32) { size1D = i32(_e21); let _e24 = textureNumLevels(tex1D); levels = i32(_e24); - let _e28 = coord_1; - let _e29 = textureSample(tex1D, samp, _e28); + let _e29 = textureSample(tex1D, samp, coord_1); c = _e29; - let _e30 = coord_1; - let _e33 = textureSampleGrad(tex1D, samp, _e30, 4f, 4f); + let _e33 = textureSampleGrad(tex1D, samp, coord_1, 4f, 4f); c = _e33; - let _e34 = coord_1; - let _e38 = textureSampleGrad(tex1D, samp, _e34, 4f, 4f, 5i); + let _e38 = textureSampleGrad(tex1D, samp, coord_1, 4f, 4f, 5i); c = _e38; - let _e39 = coord_1; - let _e41 = textureSampleLevel(tex1D, samp, _e39, 3f); + let _e41 = textureSampleLevel(tex1D, samp, coord_1, 3f); c = _e41; - let _e42 = coord_1; - let _e45 = textureSampleLevel(tex1D, samp, _e42, 3f, 5i); + let _e45 = textureSampleLevel(tex1D, samp, coord_1, 3f, 5i); c = _e45; - let _e46 = coord_1; - let _e48 = textureSample(tex1D, samp, _e46, 5i); + let _e48 = textureSample(tex1D, samp, coord_1, 5i); c = _e48; - let _e49 = coord_1; - let _e51 = vec2(_e49, 6f); + let _e51 = vec2(coord_1, 6f); let _e55 = textureSample(tex1D, samp, (_e51.x / _e51.y)); c = _e55; - let _e56 = coord_1; - let _e60 = vec4(_e56, 0f, 0f, 6f); + let _e60 = vec4(coord_1, 0f, 0f, 6f); let _e66 = textureSample(tex1D, samp, (_e60.xyz / vec3(_e60.w)).x); c = _e66; - let _e67 = coord_1; - let _e69 = vec2(_e67, 6f); + let _e69 = vec2(coord_1, 6f); let _e75 = textureSampleGrad(tex1D, samp, (_e69.x / _e69.y), 4f, 4f); c = _e75; - let _e76 = coord_1; - let _e80 = vec4(_e76, 0f, 0f, 6f); + let _e80 = vec4(coord_1, 0f, 0f, 6f); let _e88 = textureSampleGrad(tex1D, samp, (_e80.xyz / vec3(_e80.w)).x, 4f, 4f); c = _e88; - let _e89 = coord_1; - let _e91 = vec2(_e89, 6f); + let _e91 = vec2(coord_1, 6f); let _e98 = textureSampleGrad(tex1D, samp, (_e91.x / _e91.y), 4f, 4f, 5i); c = _e98; - let _e99 = coord_1; - let _e103 = vec4(_e99, 0f, 0f, 6f); + let _e103 = vec4(coord_1, 0f, 0f, 6f); let _e112 = textureSampleGrad(tex1D, samp, (_e103.xyz / vec3(_e103.w)).x, 4f, 4f, 5i); c = _e112; - let _e113 = coord_1; - let _e115 = vec2(_e113, 6f); + let _e115 = vec2(coord_1, 6f); let _e120 = textureSampleLevel(tex1D, samp, (_e115.x / _e115.y), 3f); c = _e120; - let _e121 = coord_1; - let _e125 = vec4(_e121, 0f, 0f, 6f); + let _e125 = vec4(coord_1, 0f, 0f, 6f); let _e132 = textureSampleLevel(tex1D, samp, (_e125.xyz / vec3(_e125.w)).x, 3f); c = _e132; - let _e133 = coord_1; - let _e135 = vec2(_e133, 6f); + let _e135 = vec2(coord_1, 6f); let _e141 = textureSampleLevel(tex1D, samp, (_e135.x / _e135.y), 3f, 5i); c = _e141; - let _e142 = coord_1; - let _e146 = vec4(_e142, 0f, 0f, 6f); + let _e146 = vec4(coord_1, 0f, 0f, 6f); let _e154 = textureSampleLevel(tex1D, samp, (_e146.xyz / vec3(_e146.w)).x, 3f, 5i); c = _e154; - let _e155 = coord_1; - let _e157 = vec2(_e155, 6f); + let _e157 = vec2(coord_1, 6f); let _e162 = textureSample(tex1D, samp, (_e157.x / _e157.y), 5i); c = _e162; - let _e163 = coord_1; - let _e167 = vec4(_e163, 0f, 0f, 6f); + let _e167 = vec4(coord_1, 0f, 0f, 6f); let _e174 = textureSample(tex1D, samp, (_e167.xyz / vec3(_e167.w)).x, 5i); c = _e174; - let _e175 = coord_1; - let _e178 = textureLoad(tex1D, i32(_e175), 3i); + let _e178 = textureLoad(tex1D, i32(coord_1), 3i); c = _e178; - let _e179 = coord_1; - let _e183 = textureLoad(tex1D, i32(_e179), 3i); + let _e183 = textureLoad(tex1D, i32(coord_1), 3i); c = _e183; return; } @@ -151,12 +131,10 @@ fn testTex1DArray(coord_2: vec2) { let _e63 = coord_3; let _e68 = textureSample(tex1DArray, samp, _e63.x, i32(_e63.y), 5i); c_1 = _e68; - let _e69 = coord_3; - let _e70 = vec2(_e69); + let _e70 = vec2(coord_3); let _e74 = textureLoad(tex1DArray, _e70.x, _e70.y, 3i); c_1 = _e74; - let _e75 = coord_3; - let _e76 = vec2(_e75); + let _e76 = vec2(coord_3); let _e81 = textureLoad(tex1DArray, _e76.x, _e76.y, 3i); c_1 = _e81; return; @@ -173,29 +151,21 @@ fn testTex2D(coord_4: vec2) { size2D = vec2(_e21); let _e24 = textureNumLevels(tex2D); levels_2 = i32(_e24); - let _e28 = coord_5; - let _e29 = textureSample(tex2D, samp, _e28); + let _e29 = textureSample(tex2D, samp, coord_5); c_2 = _e29; - let _e30 = coord_5; - let _e32 = textureSampleBias(tex2D, samp, _e30, 2f); + let _e32 = textureSampleBias(tex2D, samp, coord_5, 2f); c_2 = _e32; - let _e33 = coord_5; - let _e38 = textureSampleGrad(tex2D, samp, _e33, vec2(4f), vec2(4f)); + let _e38 = textureSampleGrad(tex2D, samp, coord_5, vec2(4f), vec2(4f)); c_2 = _e38; - let _e39 = coord_5; - let _e46 = textureSampleGrad(tex2D, samp, _e39, vec2(4f), vec2(4f), vec2(5i)); + let _e46 = textureSampleGrad(tex2D, samp, coord_5, vec2(4f), vec2(4f), vec2(5i)); c_2 = _e46; - let _e47 = coord_5; - let _e49 = textureSampleLevel(tex2D, samp, _e47, 3f); + let _e49 = textureSampleLevel(tex2D, samp, coord_5, 3f); c_2 = _e49; - let _e50 = coord_5; - let _e54 = textureSampleLevel(tex2D, samp, _e50, 3f, vec2(5i)); + let _e54 = textureSampleLevel(tex2D, samp, coord_5, 3f, vec2(5i)); c_2 = _e54; - let _e55 = coord_5; - let _e58 = textureSample(tex2D, samp, _e55, vec2(5i)); + let _e58 = textureSample(tex2D, samp, coord_5, vec2(5i)); c_2 = _e58; - let _e59 = coord_5; - let _e63 = textureSampleBias(tex2D, samp, _e59, 2f, vec2(5i)); + let _e63 = textureSampleBias(tex2D, samp, coord_5, 2f, vec2(5i)); c_2 = _e63; let _e64 = coord_5; let _e68 = vec3(_e64.x, _e64.y, 6f); @@ -261,23 +231,17 @@ fn testTex2D(coord_4: vec2) { let _e270 = vec4(_e265.x, _e265.y, 0f, 6f); let _e279 = textureSampleBias(tex2D, samp, (_e270.xyz / vec3(_e270.w)).xy, 2f, vec2(5i)); c_2 = _e279; - let _e280 = coord_5; - let _e283 = textureLoad(tex2D, vec2(_e280), 3i); + let _e283 = textureLoad(tex2D, vec2(coord_5), 3i); c_2 = _e283; - let _e284 = coord_5; - let _e287 = textureLoad(utex2D, vec2(_e284), 3i); + let _e287 = textureLoad(utex2D, vec2(coord_5), 3i); c_2 = vec4(_e287); - let _e289 = coord_5; - let _e292 = textureLoad(itex2D, vec2(_e289), 3i); + let _e292 = textureLoad(itex2D, vec2(coord_5), 3i); c_2 = vec4(_e292); - let _e294 = coord_5; - let _e299 = textureLoad(tex2D, vec2(_e294), 3i); + let _e299 = textureLoad(tex2D, vec2(coord_5), 3i); c_2 = _e299; - let _e300 = coord_5; - let _e305 = textureLoad(utex2D, vec2(_e300), 3i); + let _e305 = textureLoad(utex2D, vec2(coord_5), 3i); c_2 = vec4(_e305); - let _e307 = coord_5; - let _e312 = textureLoad(itex2D, vec2(_e307), 3i); + let _e312 = textureLoad(itex2D, vec2(coord_5), 3i); c_2 = vec4(_e312); return; } @@ -386,12 +350,10 @@ fn testTex2DArray(coord_8: vec3) { let _e84 = coord_9; let _e91 = textureSampleBias(tex2DArray, samp, _e84.xy, i32(_e84.z), 2f, vec2(5i)); c_3 = _e91; - let _e92 = coord_9; - let _e93 = vec3(_e92); + let _e93 = vec3(coord_9); let _e97 = textureLoad(tex2DArray, _e93.xy, _e93.z, 3i); c_3 = _e97; - let _e98 = coord_9; - let _e99 = vec3(_e98); + let _e99 = vec3(coord_9); let _e105 = textureLoad(tex2DArray, _e99.xy, _e99.z, 3i); c_3 = _e105; return; @@ -439,17 +401,13 @@ fn testTexCube(coord_12: vec3) { sizeCube = vec2(_e21); let _e24 = textureNumLevels(texCube); levels_6 = i32(_e24); - let _e28 = coord_13; - let _e29 = textureSample(texCube, samp, _e28); + let _e29 = textureSample(texCube, samp, coord_13); c_4 = _e29; - let _e30 = coord_13; - let _e32 = textureSampleBias(texCube, samp, _e30, 2f); + let _e32 = textureSampleBias(texCube, samp, coord_13, 2f); c_4 = _e32; - let _e33 = coord_13; - let _e38 = textureSampleGrad(texCube, samp, _e33, vec3(4f), vec3(4f)); + let _e38 = textureSampleGrad(texCube, samp, coord_13, vec3(4f), vec3(4f)); c_4 = _e38; - let _e39 = coord_13; - let _e41 = textureSampleLevel(texCube, samp, _e39, 3f); + let _e41 = textureSampleLevel(texCube, samp, coord_13, 3f); c_4 = _e41; return; } @@ -532,11 +490,9 @@ fn testTex3D(coord_20: vec3) { size3D = vec3(_e21); let _e24 = textureNumLevels(tex3D); levels_10 = i32(_e24); - let _e28 = coord_21; - let _e29 = textureSample(tex3D, samp, _e28); + let _e29 = textureSample(tex3D, samp, coord_21); c_6 = _e29; - let _e30 = coord_21; - let _e32 = textureSampleBias(tex3D, samp, _e30, 2f); + let _e32 = textureSampleBias(tex3D, samp, coord_21, 2f); c_6 = _e32; let _e33 = coord_21; let _e38 = vec4(_e33.x, _e33.y, _e33.z, 6f); @@ -570,29 +526,21 @@ fn testTex3D(coord_20: vec3) { let _e129 = vec4(_e124.x, _e124.y, _e124.z, 6f); let _e140 = textureSampleGrad(tex3D, samp, (_e129.xyz / vec3(_e129.w)), vec3(4f), vec3(4f), vec3(5i)); c_6 = _e140; - let _e141 = coord_21; - let _e146 = textureSampleGrad(tex3D, samp, _e141, vec3(4f), vec3(4f)); + let _e146 = textureSampleGrad(tex3D, samp, coord_21, vec3(4f), vec3(4f)); c_6 = _e146; - let _e147 = coord_21; - let _e154 = textureSampleGrad(tex3D, samp, _e147, vec3(4f), vec3(4f), vec3(5i)); + let _e154 = textureSampleGrad(tex3D, samp, coord_21, vec3(4f), vec3(4f), vec3(5i)); c_6 = _e154; - let _e155 = coord_21; - let _e157 = textureSampleLevel(tex3D, samp, _e155, 3f); + let _e157 = textureSampleLevel(tex3D, samp, coord_21, 3f); c_6 = _e157; - let _e158 = coord_21; - let _e162 = textureSampleLevel(tex3D, samp, _e158, 3f, vec3(5i)); + let _e162 = textureSampleLevel(tex3D, samp, coord_21, 3f, vec3(5i)); c_6 = _e162; - let _e163 = coord_21; - let _e166 = textureSample(tex3D, samp, _e163, vec3(5i)); + let _e166 = textureSample(tex3D, samp, coord_21, vec3(5i)); c_6 = _e166; - let _e167 = coord_21; - let _e171 = textureSampleBias(tex3D, samp, _e167, 2f, vec3(5i)); + let _e171 = textureSampleBias(tex3D, samp, coord_21, 2f, vec3(5i)); c_6 = _e171; - let _e172 = coord_21; - let _e175 = textureLoad(tex3D, vec3(_e172), 3i); + let _e175 = textureLoad(tex3D, vec3(coord_21), 3i); c_6 = _e175; - let _e176 = coord_21; - let _e181 = textureLoad(tex3D, vec3(_e176), 3i); + let _e181 = textureLoad(tex3D, vec3(coord_21), 3i); c_6 = _e181; return; } @@ -605,8 +553,7 @@ fn testTex2DMS(coord_22: vec2) { coord_23 = coord_22; let _e20 = textureDimensions(tex2DMS); size2DMS = vec2(_e20); - let _e24 = coord_23; - let _e27 = textureLoad(tex2DMS, vec2(_e24), 3i); + let _e27 = textureLoad(tex2DMS, vec2(coord_23), 3i); c_7 = _e27; return; } @@ -620,8 +567,7 @@ fn testTex2DMSArray(coord_24: vec3) { let _e20 = textureDimensions(tex2DMSArray); let _e23 = textureNumLayers(tex2DMSArray); size2DMSArray = vec3(vec3(_e20.x, _e20.y, _e23)); - let _e28 = coord_25; - let _e29 = vec3(_e28); + let _e29 = vec3(coord_25); let _e33 = textureLoad(tex2DMSArray, _e29.xy, _e29.z, 3i); c_8 = _e33; return; diff --git a/naga/tests/out/wgsl/shadow.wgsl b/naga/tests/out/wgsl/shadow.wgsl index 8b198d2ed1..743be246ad 100644 --- a/naga/tests/out/wgsl/shadow.wgsl +++ b/naga/tests/out/wgsl/shadow.wgsl @@ -52,14 +52,11 @@ fn vs_main(@location(0) @interpolate(flat) position: vec4, @location(1) @in var out: VertexOutput; let w = u_entity.world; - let _e7 = u_entity.world; - let world_pos = (_e7 * vec4(position)); + let world_pos = (u_entity.world * vec4(position)); out.world_normal = (mat3x3(w[0].xyz, w[1].xyz, w[2].xyz) * vec3(normal.xyz)); out.world_position = world_pos; - let _e26 = u_globals.view_proj; - out.proj_position = (_e26 * world_pos); - let _e28 = out; - return _e28; + out.proj_position = (u_globals.view_proj * world_pos); + return out; } @fragment @@ -69,30 +66,22 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { let normal_1 = normalize(in.world_normal); loop { - let _e7 = i; - let _e11 = u_globals.num_lights.x; - if (_e7 < min(_e11, c_max_lights)) { + if (i < min(u_globals.num_lights.x, c_max_lights)) { } else { break; } { - let _e16 = i; - let light = s_lights[_e16]; - let _e19 = i; - let _e23 = fetch_shadow(_e19, (light.proj * in.world_position)); + let light = s_lights[i]; + let _e23 = fetch_shadow(i, (light.proj * in.world_position)); let light_dir = normalize((light.pos.xyz - in.world_position.xyz)); let diffuse = max(0f, dot(normal_1, light_dir)); - let _e37 = color; - color = (_e37 + ((_e23 * diffuse) * light.color.xyz)); + color = (color + ((_e23 * diffuse) * light.color.xyz)); } continuing { - let _e40 = i; - i = (_e40 + 1u); + i = (i + 1u); } } - let _e42 = color; - let _e47 = u_entity.color; - return (vec4(_e42, 1f) * _e47); + return (vec4(color, 1f) * u_entity.color); } @fragment @@ -102,28 +91,20 @@ fn fs_main_without_storage(in_1: VertexOutput) -> @location(0) vec4 { let normal_2 = normalize(in_1.world_normal); loop { - let _e7 = i_1; - let _e11 = u_globals.num_lights.x; - if (_e7 < min(_e11, c_max_lights)) { + if (i_1 < min(u_globals.num_lights.x, c_max_lights)) { } else { break; } { - let _e16 = i_1; - let light_1 = u_lights[_e16]; - let _e19 = i_1; - let _e23 = fetch_shadow(_e19, (light_1.proj * in_1.world_position)); + let light_1 = u_lights[i_1]; + let _e23 = fetch_shadow(i_1, (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(0f, dot(normal_2, light_dir_1)); - let _e37 = color_1; - color_1 = (_e37 + ((_e23 * diffuse_1) * light_1.color.xyz)); + color_1 = (color_1 + ((_e23 * diffuse_1) * light_1.color.xyz)); } continuing { - let _e40 = i_1; - i_1 = (_e40 + 1u); + i_1 = (i_1 + 1u); } } - let _e42 = color_1; - let _e47 = u_entity.color; - return (vec4(_e42, 1f) * _e47); + return (vec4(color_1, 1f) * u_entity.color); } diff --git a/naga/tests/out/wgsl/skybox.wgsl b/naga/tests/out/wgsl/skybox.wgsl index c10801d0e7..e1c586830d 100644 --- a/naga/tests/out/wgsl/skybox.wgsl +++ b/naga/tests/out/wgsl/skybox.wgsl @@ -22,15 +22,9 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput { tmp1_ = (i32(vertex_index) / 2i); tmp2_ = (i32(vertex_index) & 1i); - let _e9 = tmp1_; - let _e15 = tmp2_; - 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]; - let inv_model_view = transpose(mat3x3(_e27.xyz, _e32.xyz, _e37.xyz)); - let _e43 = r_data.proj_inv; - let unprojected = (_e43 * pos); + let pos = vec4(((f32(tmp1_) * 4f) - 1f), ((f32(tmp2_) * 4f) - 1f), 0f, 1f); + let inv_model_view = transpose(mat3x3(r_data.view[0].xyz, r_data.view[1].xyz, r_data.view[2].xyz)); + let unprojected = (r_data.proj_inv * pos); return VertexOutput(pos, (inv_model_view * unprojected.xyz)); } diff --git a/naga/tests/out/wgsl/standard.wgsl b/naga/tests/out/wgsl/standard.wgsl index 886cf09193..b894ebbefb 100644 --- a/naga/tests/out/wgsl/standard.wgsl +++ b/naga/tests/out/wgsl/standard.wgsl @@ -27,8 +27,5 @@ fn derivatives(@builtin(position) foo: vec4) -> @location(0) vec4 { let _e12 = fwidth(foo); z = _e12; let _e13 = test_any_and_all_for_bool(); - let _e14 = x; - let _e15 = y; - let _e17 = z; - return ((_e14 + _e15) * _e17); + return ((x + y) * z); } diff --git a/naga/tests/out/wgsl/statements.frag.wgsl b/naga/tests/out/wgsl/statements.frag.wgsl index bc36eb2075..f6ad6c5764 100644 --- a/naga/tests/out/wgsl/statements.frag.wgsl +++ b/naga/tests/out/wgsl/statements.frag.wgsl @@ -2,8 +2,7 @@ fn switchEmpty(a: i32) { var a_1: i32; a_1 = a; - let _e2 = a_1; - switch _e2 { + switch a_1 { default: { } } @@ -14,8 +13,7 @@ fn switchNoDefault(a_2: i32) { var a_3: i32; a_3 = a_2; - let _e2 = a_3; - switch _e2 { + switch a_3 { case 0: { } default: { @@ -28,8 +26,7 @@ fn switchCaseImplConv(a_4: u32) { var a_5: u32; a_5 = a_4; - let _e2 = a_5; - switch _e2 { + switch a_5 { case 0u: { } default: { @@ -43,11 +40,9 @@ fn switchNoLastBreak(a_6: i32) { var b: i32; a_7 = a_6; - let _e2 = a_7; - switch _e2 { + switch a_7 { default: { - let _e3 = a_7; - b = _e3; + b = a_7; } } return; diff --git a/naga/tests/out/wgsl/struct-layout.wgsl b/naga/tests/out/wgsl/struct-layout.wgsl index b1569bde3e..e5b17d3d71 100644 --- a/naga/tests/out/wgsl/struct-layout.wgsl +++ b/naga/tests/out/wgsl/struct-layout.wgsl @@ -32,10 +32,8 @@ fn no_padding_vert(input_1: NoPadding) -> @builtin(position) vec4 { fn no_padding_comp() { var x: NoPadding; - let _e2 = no_padding_uniform; - x = _e2; - let _e4 = no_padding_storage; - x = _e4; + x = no_padding_uniform; + x = no_padding_storage; return; } @@ -53,9 +51,7 @@ fn needs_padding_vert(input_3: NeedsPadding) -> @builtin(position) vec4 { fn needs_padding_comp() { var x_1: NeedsPadding; - let _e2 = needs_padding_uniform; - x_1 = _e2; - let _e4 = needs_padding_storage; - x_1 = _e4; + x_1 = needs_padding_uniform; + x_1 = needs_padding_storage; return; } diff --git a/naga/tests/out/wgsl/unnamed-gl-per-vertex.wgsl b/naga/tests/out/wgsl/unnamed-gl-per-vertex.wgsl index 9f1b9ee607..8fddac8911 100644 --- a/naga/tests/out/wgsl/unnamed-gl-per-vertex.wgsl +++ b/naga/tests/out/wgsl/unnamed-gl-per-vertex.wgsl @@ -18,8 +18,6 @@ fn function() { fn main(@builtin(vertex_index) param: u32) -> @builtin(position) vec4 { global_1 = i32(param); function(); - let _e6 = global.member.y; - global.member.y = -(_e6); - let _e8 = global.member; - return _e8; + global.member.y = -(global.member.y); + return global.member; } diff --git a/naga/tests/out/wgsl/vector-functions.frag.wgsl b/naga/tests/out/wgsl/vector-functions.frag.wgsl index 0f28a40c87..708bbbfcd7 100644 --- a/naga/tests/out/wgsl/vector-functions.frag.wgsl +++ b/naga/tests/out/wgsl/vector-functions.frag.wgsl @@ -10,24 +10,12 @@ fn ftest(a: vec4, b: vec4) { a_1 = a; b_1 = b; - let _e4 = a_1; - let _e5 = b_1; - c = (_e4 < _e5); - let _e8 = a_1; - let _e9 = b_1; - d = (_e8 <= _e9); - let _e12 = a_1; - let _e13 = b_1; - e = (_e12 > _e13); - let _e16 = a_1; - let _e17 = b_1; - f = (_e16 >= _e17); - let _e20 = a_1; - let _e21 = b_1; - g = (_e20 == _e21); - let _e24 = a_1; - let _e25 = b_1; - h = (_e24 != _e25); + c = (a_1 < b_1); + d = (a_1 <= b_1); + e = (a_1 > b_1); + f = (a_1 >= b_1); + g = (a_1 == b_1); + h = (a_1 != b_1); return; } @@ -43,24 +31,12 @@ fn dtest(a_2: vec4, b_2: vec4) { a_3 = a_2; b_3 = b_2; - let _e4 = a_3; - let _e5 = b_3; - c_1 = (_e4 < _e5); - let _e8 = a_3; - let _e9 = b_3; - d_1 = (_e8 <= _e9); - let _e12 = a_3; - let _e13 = b_3; - e_1 = (_e12 > _e13); - let _e16 = a_3; - let _e17 = b_3; - f_1 = (_e16 >= _e17); - let _e20 = a_3; - let _e21 = b_3; - g_1 = (_e20 == _e21); - let _e24 = a_3; - let _e25 = b_3; - h_1 = (_e24 != _e25); + c_1 = (a_3 < b_3); + d_1 = (a_3 <= b_3); + e_1 = (a_3 > b_3); + f_1 = (a_3 >= b_3); + g_1 = (a_3 == b_3); + h_1 = (a_3 != b_3); return; } @@ -76,24 +52,12 @@ fn itest(a_4: vec4, b_4: vec4) { a_5 = a_4; b_5 = b_4; - let _e4 = a_5; - let _e5 = b_5; - c_2 = (_e4 < _e5); - let _e8 = a_5; - let _e9 = b_5; - d_2 = (_e8 <= _e9); - let _e12 = a_5; - let _e13 = b_5; - e_2 = (_e12 > _e13); - let _e16 = a_5; - let _e17 = b_5; - f_2 = (_e16 >= _e17); - let _e20 = a_5; - let _e21 = b_5; - g_2 = (_e20 == _e21); - let _e24 = a_5; - let _e25 = b_5; - h_2 = (_e24 != _e25); + c_2 = (a_5 < b_5); + d_2 = (a_5 <= b_5); + e_2 = (a_5 > b_5); + f_2 = (a_5 >= b_5); + g_2 = (a_5 == b_5); + h_2 = (a_5 != b_5); return; } @@ -109,24 +73,12 @@ fn utest(a_6: vec4, b_6: vec4) { a_7 = a_6; b_7 = b_6; - let _e4 = a_7; - let _e5 = b_7; - c_3 = (_e4 < _e5); - let _e8 = a_7; - let _e9 = b_7; - d_3 = (_e8 <= _e9); - let _e12 = a_7; - let _e13 = b_7; - e_3 = (_e12 > _e13); - let _e16 = a_7; - let _e17 = b_7; - f_3 = (_e16 >= _e17); - let _e20 = a_7; - let _e21 = b_7; - g_3 = (_e20 == _e21); - let _e24 = a_7; - let _e25 = b_7; - h_3 = (_e24 != _e25); + c_3 = (a_7 < b_7); + d_3 = (a_7 <= b_7); + e_3 = (a_7 > b_7); + f_3 = (a_7 >= b_7); + g_3 = (a_7 == b_7); + h_3 = (a_7 != b_7); return; } @@ -141,18 +93,11 @@ fn btest(a_8: vec4, b_8: vec4) { a_9 = a_8; b_9 = b_8; - let _e4 = a_9; - let _e5 = b_9; - c_4 = (_e4 == _e5); - let _e8 = a_9; - let _e9 = b_9; - d_4 = (_e8 != _e9); - let _e12 = a_9; - e_4 = any(_e12); - let _e15 = a_9; - f_4 = all(_e15); - let _e18 = a_9; - g_4 = !(_e18); + c_4 = (a_9 == b_9); + d_4 = (a_9 != b_9); + e_4 = any(a_9); + f_4 = all(a_9); + g_4 = !(a_9); return; } diff --git a/naga/tests/out/wgsl/workgroup-var-init.wgsl b/naga/tests/out/wgsl/workgroup-var-init.wgsl index fdad0477d6..1cf4af2f12 100644 --- a/naga/tests/out/wgsl/workgroup-var-init.wgsl +++ b/naga/tests/out/wgsl/workgroup-var-init.wgsl @@ -10,7 +10,6 @@ var output: array; @compute @workgroup_size(1, 1, 1) fn main() { - let _e3 = w_mem.arr; - output = _e3; + output = w_mem.arr; return; }