diff --git a/naga/src/arena.rs b/naga/src/arena.rs index 740df85b86..f401468dac 100644 --- a/naga/src/arena.rs +++ b/naga/src/arena.rs @@ -112,6 +112,16 @@ impl Handle { const unsafe fn from_usize_unchecked(index: usize) -> Self { Handle::new(Index::new_unchecked((index + 1) as u32)) } + + /// Write this handle's index to `formatter`, preceded by `prefix`. + pub fn write_prefixed( + &self, + formatter: &mut std::fmt::Formatter, + prefix: &'static str, + ) -> std::fmt::Result { + formatter.write_str(prefix)?; + ::fmt(&self.index(), formatter) + } } /// A strongly typed range of handles. diff --git a/naga/src/back/dot/mod.rs b/naga/src/back/dot/mod.rs index dffd5234b9..1a5b49c018 100644 --- a/naga/src/back/dot/mod.rs +++ b/naga/src/back/dot/mod.rs @@ -392,6 +392,32 @@ const COLORS: &[&str] = &[ "#d9d9d9", ]; +struct Prefixed(Handle); + +impl std::fmt::Display for Prefixed { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.write_prefixed(f, "e") + } +} + +impl std::fmt::Display for Prefixed { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.write_prefixed(f, "l") + } +} + +impl std::fmt::Display for Prefixed { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.write_prefixed(f, "g") + } +} + +impl std::fmt::Display for Prefixed { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.write_prefixed(f, "f") + } +} + fn write_fun( output: &mut String, prefix: String, @@ -405,9 +431,9 @@ fn write_fun( for (handle, var) in fun.local_variables.iter() { writeln!( output, - "\t\t{}_l{} [ shape=hexagon label=\"{:?} '{}'\" ]", + "\t\t{}_{} [ shape=hexagon label=\"{:?} '{}'\" ]", prefix, - handle.index(), + Prefixed(handle), handle, name(&var.name), )?; @@ -442,9 +468,9 @@ fn write_fun( for (to, expr, label) in sg.dependencies { writeln!( output, - "\t\t{}_e{} -> {}_s{} [ label=\"{}\" ]", + "\t\t{}_{} -> {}_s{} [ label=\"{}\" ]", prefix, - expr.index(), + Prefixed(expr), prefix, to, label, @@ -453,22 +479,23 @@ fn write_fun( for (from, to) in sg.emits { writeln!( output, - "\t\t{}_s{} -> {}_e{} [ style=dotted ]", + "\t\t{}_s{} -> {}_{} [ style=dotted ]", prefix, from, prefix, - to.index(), + Prefixed(to), )?; } } + assert!(sg.calls.is_empty()); for (from, function) in sg.calls { writeln!( output, - "\t\t{}_s{} -> f{}_s0", + "\t\t{}_s{} -> {}_s0", prefix, from, - function.index(), + Prefixed(function), )?; } @@ -688,9 +715,9 @@ fn write_function_expressions( }; writeln!( output, - "\t\t{}_e{} [ {}=\"{}\" label=\"{:?} {}\" ]", + "\t\t{}_{} [ {}=\"{}\" label=\"{:?} {}\" ]", prefix, - handle.index(), + Prefixed(handle), color_attr, COLORS[color_id], handle, @@ -700,11 +727,11 @@ fn write_function_expressions( for (key, edge) in edges.drain() { writeln!( output, - "\t\t{}_e{} -> {}_e{} [ label=\"{}\" ]", + "\t\t{}_{} -> {}_{} [ label=\"{}\" ]", prefix, - edge.index(), + Prefixed(edge), prefix, - handle.index(), + Prefixed(handle), key, )?; } @@ -712,27 +739,27 @@ fn write_function_expressions( Some(Payload::Arguments(list)) => { write!(output, "\t\t{{")?; for &comp in list { - write!(output, " {}_e{}", prefix, comp.index())?; + write!(output, " {}_{}", prefix, Prefixed(comp))?; } - writeln!(output, " }} -> {}_e{}", prefix, handle.index())?; + writeln!(output, " }} -> {}_{}", prefix, Prefixed(handle))?; } Some(Payload::Local(h)) => { writeln!( output, - "\t\t{}_l{} -> {}_e{}", + "\t\t{}_{} -> {}_{}", prefix, - h.index(), + Prefixed(h), prefix, - handle.index(), + Prefixed(handle), )?; } Some(Payload::Global(h)) => { writeln!( output, - "\t\tg{} -> {}_e{} [fillcolor=gray]", - h.index(), + "\t\t{} -> {}_{} [fillcolor=gray]", + Prefixed(h), prefix, - handle.index(), + Prefixed(handle), )?; } None => {} @@ -759,8 +786,8 @@ pub fn write( for (handle, var) in module.global_variables.iter() { writeln!( output, - "\t\tg{} [ shape=hexagon label=\"{:?} {:?}/'{}'\" ]", - handle.index(), + "\t\t{} [ shape=hexagon label=\"{:?} {:?}/'{}'\" ]", + Prefixed(handle), handle, var.space, name(&var.name), @@ -770,7 +797,7 @@ pub fn write( } for (handle, fun) in module.functions.iter() { - let prefix = format!("f{}", handle.index()); + let prefix = Prefixed(handle).to_string(); writeln!(output, "\tsubgraph cluster_{prefix} {{")?; writeln!( output, diff --git a/naga/src/back/glsl/mod.rs b/naga/src/back/glsl/mod.rs index caca38254f..bc2d2a90d8 100644 --- a/naga/src/back/glsl/mod.rs +++ b/naga/src/back/glsl/mod.rs @@ -46,7 +46,7 @@ to output a [`Module`](crate::Module) into glsl pub use features::Features; use crate::{ - back, + back::{self, Baked}, proc::{self, NameKey}, valid, Handle, ShaderStage, TypeInner, }; @@ -1982,7 +1982,7 @@ impl<'a, W: Write> Writer<'a, W> { // Also, we use sanitized names! It defense backend from generating variable with name from reserved keywords. Some(self.namer.call(name)) } else if self.need_bake_expressions.contains(&handle) { - Some(format!("{}{}", back::BAKE_PREFIX, handle.index())) + Some(Baked(handle).to_string()) } else { None }; @@ -2310,7 +2310,7 @@ impl<'a, W: Write> Writer<'a, W> { // This is done in `Emit` by never emitting a variable name for pointer variables self.write_barrier(crate::Barrier::WORK_GROUP, level)?; - let result_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let result_name = Baked(result).to_string(); write!(self.out, "{level}")?; // Expressions cannot have side effects, so just writing the expression here is fine. self.write_named_expr(pointer, result_name, result, ctx)?; @@ -2335,7 +2335,7 @@ impl<'a, W: Write> Writer<'a, W> { } => { write!(self.out, "{level}")?; if let Some(expr) = result { - let name = format!("{}{}", back::BAKE_PREFIX, expr.index()); + let name = Baked(expr).to_string(); let result = self.module.functions[function].result.as_ref().unwrap(); self.write_type(result.ty)?; write!(self.out, " {name}")?; @@ -2369,7 +2369,7 @@ impl<'a, W: Write> Writer<'a, W> { } => { write!(self.out, "{level}")?; if let Some(result) = result { - let res_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let res_name = Baked(result).to_string(); let res_ty = ctx.resolve_type(result, &self.module.types); self.write_value_type(res_ty)?; write!(self.out, " {res_name} = ")?; @@ -2399,7 +2399,7 @@ impl<'a, W: Write> Writer<'a, W> { Statement::RayQuery { .. } => unreachable!(), Statement::SubgroupBallot { result, predicate } => { write!(self.out, "{level}")?; - let res_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let res_name = Baked(result).to_string(); let res_ty = ctx.info[result].ty.inner_with(&self.module.types); self.write_value_type(res_ty)?; write!(self.out, " {res_name} = ")?; @@ -2419,7 +2419,7 @@ impl<'a, W: Write> Writer<'a, W> { result, } => { write!(self.out, "{level}")?; - let res_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let res_name = Baked(result).to_string(); let res_ty = ctx.info[result].ty.inner_with(&self.module.types); self.write_value_type(res_ty)?; write!(self.out, " {res_name} = ")?; @@ -2476,7 +2476,7 @@ impl<'a, W: Write> Writer<'a, W> { result, } => { write!(self.out, "{level}")?; - let res_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let res_name = Baked(result).to_string(); let res_ty = ctx.info[result].ty.inner_with(&self.module.types); self.write_value_type(res_ty)?; write!(self.out, " {res_name} = ")?; @@ -3865,9 +3865,8 @@ impl<'a, W: Write> Writer<'a, W> { // Define our local and start a call to `clamp` write!( self.out, - "int {}{}{} = clamp(", - back::BAKE_PREFIX, - expr.index(), + "int {}{} = clamp(", + Baked(expr), CLAMPED_LOD_SUFFIX )?; // Write the lod that will be clamped @@ -4205,13 +4204,7 @@ impl<'a, W: Write> Writer<'a, W> { // `textureSize` call, but this needs to be the clamped lod, this should // have been generated earlier and put in a local. if class.is_mipmapped() { - write!( - self.out, - ", {}{}{}", - back::BAKE_PREFIX, - handle.index(), - CLAMPED_LOD_SUFFIX - )?; + write!(self.out, ", {}{}", Baked(handle), CLAMPED_LOD_SUFFIX)?; } // Close the `textureSize` call write!(self.out, ")")?; @@ -4229,13 +4222,7 @@ impl<'a, W: Write> Writer<'a, W> { // Add the clamped lod (if present) as the second argument to the // image load function. if level.is_some() { - write!( - self.out, - ", {}{}{}", - back::BAKE_PREFIX, - handle.index(), - CLAMPED_LOD_SUFFIX - )?; + write!(self.out, ", {}{}", Baked(handle), CLAMPED_LOD_SUFFIX)?; } // If a sample argument is needed we need to clamp it between 0 and diff --git a/naga/src/back/hlsl/writer.rs b/naga/src/back/hlsl/writer.rs index dea37b6b2e..e06951b05a 100644 --- a/naga/src/back/hlsl/writer.rs +++ b/naga/src/back/hlsl/writer.rs @@ -7,7 +7,7 @@ use super::{ BackendResult, Error, Options, }; use crate::{ - back, + back::{self, Baked}, proc::{self, NameKey}, valid, Handle, Module, ScalarKind, ShaderStage, TypeInner, }; @@ -1410,7 +1410,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { // Also, we use sanitized names! It defense backend from generating variable with name from reserved keywords. Some(self.namer.call(name)) } else if self.need_bake_expressions.contains(&handle) { - Some(format!("_expr{}", handle.index())) + Some(Baked(handle).to_string()) } else { None }; @@ -1891,7 +1891,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { write!(self.out, "{level}")?; if let Some(expr) = result { write!(self.out, "const ")?; - let name = format!("{}{}", back::BAKE_PREFIX, expr.index()); + let name = Baked(expr).to_string(); let expr_ty = &func_ctx.info[expr].ty; match *expr_ty { proc::TypeResolution::Handle(handle) => self.write_type(module, handle)?, @@ -1922,7 +1922,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { let res_name = match result { None => None, Some(result) => { - let name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let name = Baked(result).to_string(); match func_ctx.info[result].ty { proc::TypeResolution::Handle(handle) => { self.write_type(module, handle)? @@ -1992,7 +1992,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { Statement::WorkGroupUniformLoad { pointer, result } => { self.write_barrier(crate::Barrier::WORK_GROUP, level)?; write!(self.out, "{level}")?; - let name = format!("_expr{}", result.index()); + let name = Baked(result).to_string(); self.write_named_expr(module, pointer, name, result, func_ctx)?; self.write_barrier(crate::Barrier::WORK_GROUP, level)?; @@ -2099,7 +2099,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { Statement::RayQuery { .. } => unreachable!(), Statement::SubgroupBallot { result, predicate } => { write!(self.out, "{level}")?; - let name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let name = Baked(result).to_string(); write!(self.out, "const uint4 {name} = ")?; self.named_expressions.insert(result, name); @@ -2118,7 +2118,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { } => { write!(self.out, "{level}")?; write!(self.out, "const ")?; - let name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let name = Baked(result).to_string(); match func_ctx.info[result].ty { proc::TypeResolution::Handle(handle) => self.write_type(module, handle)?, proc::TypeResolution::Value(ref value) => { @@ -2182,7 +2182,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { } => { write!(self.out, "{level}")?; write!(self.out, "const ")?; - let name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let name = Baked(result).to_string(); match func_ctx.info[result].ty { proc::TypeResolution::Handle(handle) => self.write_type(module, handle)?, proc::TypeResolution::Value(ref value) => { diff --git a/naga/src/back/mod.rs b/naga/src/back/mod.rs index 72c301d47b..28a726155a 100644 --- a/naga/src/back/mod.rs +++ b/naga/src/back/mod.rs @@ -28,12 +28,26 @@ pub mod pipeline_constants; pub const COMPONENTS: &[char] = &['x', 'y', 'z', 'w']; /// Indent for backends. pub const INDENT: &str = " "; -/// Prefix used for baking. -pub const BAKE_PREFIX: &str = "_e"; /// Expressions that need baking. pub type NeedBakeExpressions = crate::FastHashSet>; +/// A type for displaying expression handles as baking identifiers. +/// +/// Given an [`Expression`] [`Handle`] `h`, `Baked(h)` implements +/// [`std::fmt::Display`], showing the handle's index prefixed by +/// [`BAKE_PREFIX`]. +/// +/// [`Expression`]: crate::Expression +/// [`Handle`]: crate::Handle +struct Baked(crate::Handle); + +impl std::fmt::Display for Baked { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.write_prefixed(f, "_e") + } +} + /// Specifies the values of pipeline-overridable constants in the shader module. /// /// If an `@id` attribute was specified on the declaration, diff --git a/naga/src/back/msl/writer.rs b/naga/src/back/msl/writer.rs index ca5dfbd3c8..ada50ee412 100644 --- a/naga/src/back/msl/writer.rs +++ b/naga/src/back/msl/writer.rs @@ -1,7 +1,7 @@ use super::{sampler as sm, Error, LocationMode, Options, PipelineOptions, TranslationInfo}; use crate::{ arena::Handle, - back, + back::{self, Baked}, proc::index, proc::{self, NameKey, TypeResolution}, valid, FastHashMap, FastHashSet, @@ -86,6 +86,39 @@ const fn scalar_is_int(scalar: crate::Scalar) -> bool { /// Prefix for cached clamped level-of-detail values for `ImageLoad` expressions. const CLAMPED_LOD_LOAD_PREFIX: &str = "clamped_lod_e"; +/// Wrapper for identifier names for clamped level-of-detail values +/// +/// Values of this type implement [`std::fmt::Display`], formatting as +/// the name of the variable used to hold the cached clamped +/// level-of-detail value for an `ImageLoad` expression. +struct ClampedLod(Handle); + +impl Display for ClampedLod { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + self.0.write_prefixed(f, CLAMPED_LOD_LOAD_PREFIX) + } +} + +/// Wrapper for generating `struct _mslBufferSizes` member names for +/// runtime-sized array lengths. +/// +/// On Metal, `wgpu_hal` passes the element counts for all runtime-sized arrays +/// as an argument to the entry point. This argument's type in the MSL is +/// `struct _mslBufferSizes`, a Naga-synthesized struct with a `uint` member for +/// each global variable containing a runtime-sized array. +/// +/// If `global` is a [`Handle`] for a [`GlobalVariable`] that contains a +/// runtime-sized array, then the value `ArraySize(global)` implements +/// [`std::fmt::Display`], formatting as the name of the struct member carrying +/// the number of elements in that runtime-sized array. +struct ArraySizeMember(Handle); + +impl Display for ArraySizeMember { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + self.0.write_prefixed(f, "size") + } +} + struct TypeContext<'a> { handle: Handle, gctx: proc::GlobalCtx<'a>, @@ -677,9 +710,7 @@ impl Writer { ) -> BackendResult { match level { LevelOfDetail::Direct(expr) => self.put_expression(expr, context, true)?, - LevelOfDetail::Restricted(load) => { - write!(self.out, "{}{}", CLAMPED_LOD_LOAD_PREFIX, load.index())? - } + LevelOfDetail::Restricted(load) => write!(self.out, "{}", ClampedLod(load))?, } Ok(()) } @@ -1146,8 +1177,8 @@ impl Writer { // prevent that. write!( self.out, - "(_buffer_sizes.size{idx} - {offset} - {size}) / {stride}", - idx = handle.index(), + "(_buffer_sizes.{member} - {offset} - {size}) / {stride}", + member = ArraySizeMember(handle), offset = offset, size = size, stride = stride, @@ -2778,13 +2809,7 @@ impl Writer { return Ok(()); } - write!( - self.out, - "{}uint {}{} = ", - indent, - CLAMPED_LOD_LOAD_PREFIX, - load.index(), - )?; + write!(self.out, "{}uint {} = ", indent, ClampedLod(load),)?; self.put_restricted_scalar_image_index( image, level_of_detail, @@ -2854,7 +2879,7 @@ impl Writer { }; if bake { - Some(format!("{}{}", back::BAKE_PREFIX, handle.index())) + Some(Baked(handle).to_string()) } else { None } @@ -3009,7 +3034,7 @@ impl Writer { } => { write!(self.out, "{level}")?; if let Some(expr) = result { - let name = format!("{}{}", back::BAKE_PREFIX, expr.index()); + let name = Baked(expr).to_string(); self.start_baking_expression(expr, &context.expression, &name)?; self.named_expressions.insert(expr, name); } @@ -3064,7 +3089,7 @@ impl Writer { // operating on a 64-bit value, `result` is `None`. write!(self.out, "{level}")?; let fun_str = if let Some(result) = result { - let res_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let res_name = Baked(result).to_string(); self.start_baking_expression(result, &context.expression, &res_name)?; self.named_expressions.insert(result, res_name); fun.to_msl()? @@ -3170,7 +3195,7 @@ impl Writer { } crate::RayQueryFunction::Proceed { result } => { write!(self.out, "{level}")?; - let name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let name = Baked(result).to_string(); self.start_baking_expression(result, &context.expression, &name)?; self.named_expressions.insert(result, name); self.put_expression(query, &context.expression, true)?; @@ -3444,24 +3469,30 @@ impl Writer { writeln!(self.out)?; { - let mut indices = vec![]; - for (handle, var) in module.global_variables.iter() { - if needs_array_length(var.ty, &module.types) { - let idx = handle.index(); - indices.push(idx); - } - } + // Make a `Vec` of all the `GlobalVariable`s that contain + // runtime-sized arrays. + let globals: Vec> = module + .global_variables + .iter() + .filter(|&(_, var)| needs_array_length(var.ty, &module.types)) + .map(|(handle, _)| handle) + .collect(); let mut buffer_indices = vec![]; for vbm in &pipeline_options.vertex_buffer_mappings { buffer_indices.push(vbm.id); } - if !indices.is_empty() || !buffer_indices.is_empty() { + if !globals.is_empty() || !buffer_indices.is_empty() { writeln!(self.out, "struct _mslBufferSizes {{")?; - for idx in indices { - writeln!(self.out, "{}uint size{};", back::INDENT, idx)?; + for global in globals { + writeln!( + self.out, + "{}uint {};", + back::INDENT, + ArraySizeMember(global) + )?; } for idx in buffer_indices { diff --git a/naga/src/back/wgsl/writer.rs b/naga/src/back/wgsl/writer.rs index 8b61dbd2c5..8cd37830ec 100644 --- a/naga/src/back/wgsl/writer.rs +++ b/naga/src/back/wgsl/writer.rs @@ -1,6 +1,6 @@ use super::Error; use crate::{ - back, + back::{self, Baked}, proc::{self, NameKey}, valid, Handle, Module, ShaderStage, TypeInner, }; @@ -641,7 +641,7 @@ impl Writer { _ => false, }; if min_ref_count <= info.ref_count || required_baking_expr { - Some(format!("{}{}", back::BAKE_PREFIX, handle.index())) + Some(Baked(handle).to_string()) } else { None } @@ -733,7 +733,7 @@ impl Writer { } => { write!(self.out, "{level}")?; if let Some(expr) = result { - let name = format!("{}{}", back::BAKE_PREFIX, expr.index()); + let name = Baked(expr).to_string(); self.start_named_expr(module, expr, func_ctx, &name)?; self.named_expressions.insert(expr, name); } @@ -755,7 +755,7 @@ impl Writer { } => { write!(self.out, "{level}")?; if let Some(result) = result { - let res_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let res_name = Baked(result).to_string(); self.start_named_expr(module, result, func_ctx, &res_name)?; self.named_expressions.insert(result, res_name); } @@ -774,7 +774,7 @@ impl Writer { Statement::WorkGroupUniformLoad { pointer, result } => { write!(self.out, "{level}")?; // TODO: Obey named expressions here. - let res_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let res_name = Baked(result).to_string(); self.start_named_expr(module, result, func_ctx, &res_name)?; self.named_expressions.insert(result, res_name); write!(self.out, "workgroupUniformLoad(")?; @@ -934,7 +934,7 @@ impl Writer { Statement::RayQuery { .. } => unreachable!(), Statement::SubgroupBallot { result, predicate } => { write!(self.out, "{level}")?; - let res_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let res_name = Baked(result).to_string(); self.start_named_expr(module, result, func_ctx, &res_name)?; self.named_expressions.insert(result, res_name); @@ -951,7 +951,7 @@ impl Writer { result, } => { write!(self.out, "{level}")?; - let res_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let res_name = Baked(result).to_string(); self.start_named_expr(module, result, func_ctx, &res_name)?; self.named_expressions.insert(result, res_name); @@ -1006,7 +1006,7 @@ impl Writer { result, } => { write!(self.out, "{level}")?; - let res_name = format!("{}{}", back::BAKE_PREFIX, result.index()); + let res_name = Baked(result).to_string(); self.start_named_expr(module, result, func_ctx, &res_name)?; self.named_expressions.insert(result, res_name); diff --git a/naga/tests/out/hlsl/access.hlsl b/naga/tests/out/hlsl/access.hlsl index 4f0cb4b839..142083be68 100644 --- a/naga/tests/out/hlsl/access.hlsl +++ b/naga/tests/out/hlsl/access.hlsl @@ -121,34 +121,34 @@ void test_matrix_within_struct_accesses() int idx = 1; Baz t = ConstructBaz(float3x2((1.0).xx, (2.0).xx, (3.0).xx)); - int _expr3 = idx; - idx = (_expr3 - 1); + int _e3 = idx; + idx = (_e3 - 1); float3x2 l0_ = GetMatmOnBaz(baz); float2 l1_ = GetMatmOnBaz(baz)[0]; - int _expr14 = idx; - float2 l2_ = GetMatmOnBaz(baz)[_expr14]; + int _e14 = idx; + float2 l2_ = GetMatmOnBaz(baz)[_e14]; float l3_ = GetMatmOnBaz(baz)[0].y; - int _expr25 = idx; - float l4_ = GetMatmOnBaz(baz)[0][_expr25]; - int _expr30 = idx; - float l5_ = GetMatmOnBaz(baz)[_expr30].y; - int _expr36 = idx; - int _expr38 = idx; - float l6_ = GetMatmOnBaz(baz)[_expr36][_expr38]; - int _expr51 = idx; - idx = (_expr51 + 1); + 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); SetMatmOnBaz(t, float3x2((6.0).xx, (5.0).xx, (4.0).xx)); t.m_0 = (9.0).xx; - int _expr66 = idx; - SetMatVecmOnBaz(t, (90.0).xx, _expr66); + int _e66 = idx; + SetMatVecmOnBaz(t, (90.0).xx, _e66); t.m_0[1] = 10.0; - int _expr76 = idx; - t.m_0[_expr76] = 20.0; - int _expr80 = idx; - SetMatScalarmOnBaz(t, 30.0, _expr80, 1); - int _expr85 = idx; - int _expr87 = idx; - SetMatScalarmOnBaz(t, 40.0, _expr85, _expr87); + 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); return; } @@ -168,43 +168,43 @@ void test_matrix_within_array_within_struct_accesses() int idx_1 = 1; MatCx2InArray t_1 = ConstructMatCx2InArray(ZeroValuearray2_float4x2_()); - int _expr3 = idx_1; - idx_1 = (_expr3 - 1); + int _e3 = idx_1; + idx_1 = (_e3 - 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 _expr20 = idx_1; - float2 l3_1 = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _expr20); + int _e20 = idx_1; + float2 l3_1 = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _e20); float l4_1 = nested_mat_cx2_.am[0]._0.y; - int _expr33 = idx_1; - float l5_1 = nested_mat_cx2_.am[0]._0[_expr33]; - int _expr39 = idx_1; - float l6_1 = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _expr39).y; - int _expr46 = idx_1; - int _expr48 = idx_1; - float l7_ = __get_col_of_mat4x2(nested_mat_cx2_.am[0], _expr46)[_expr48]; - int _expr55 = idx_1; - idx_1 = (_expr55 + 1); + 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); 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 _expr77 = idx_1; - __set_col_of_mat4x2(t_1.am[0], _expr77, (90.0).xx); + int _e77 = idx_1; + __set_col_of_mat4x2(t_1.am[0], _e77, (90.0).xx); t_1.am[0]._0.y = 10.0; - int _expr89 = idx_1; - t_1.am[0]._0[_expr89] = 20.0; - int _expr94 = idx_1; - __set_el_of_mat4x2(t_1.am[0], _expr94, 1, 30.0); - int _expr100 = idx_1; - int _expr102 = idx_1; - __set_el_of_mat4x2(t_1.am[0], _expr100, _expr102, 40.0); + int _e89 = idx_1; + t_1.am[0]._0[_e89] = 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); return; } float read_from_private(inout float foo_1) { - float _expr1 = foo_1; - return _expr1; + float _e1 = foo_1; + return _e1; } float test_arr_as_arg(float a[5][10]) diff --git a/naga/tests/out/hlsl/binding-arrays.hlsl b/naga/tests/out/hlsl/binding-arrays.hlsl index aa631b3225..d6719c1fa6 100644 --- a/naga/tests/out/hlsl/binding-arrays.hlsl +++ b/naga/tests/out/hlsl/binding-arrays.hlsl @@ -60,121 +60,121 @@ 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 _expr22 = u2_; - u2_ = (_expr22 + NagaDimensions2D(texture_array_unbounded[0])); - uint2 _expr27 = u2_; - u2_ = (_expr27 + NagaDimensions2D(texture_array_unbounded[uniform_index])); - uint2 _expr32 = u2_; - u2_ = (_expr32 + NagaDimensions2D(texture_array_unbounded[NonUniformResourceIndex(non_uniform_index)])); - float4 _expr38 = texture_array_bounded[0].Gather(samp[0], uv); - float4 _expr39 = v4_; - v4_ = (_expr39 + _expr38); - float4 _expr45 = texture_array_bounded[uniform_index].Gather(samp[uniform_index], uv); - float4 _expr46 = v4_; - v4_ = (_expr46 + _expr45); - float4 _expr52 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].Gather(samp[NonUniformResourceIndex(non_uniform_index)], uv); - float4 _expr53 = v4_; - v4_ = (_expr53 + _expr52); - float4 _expr60 = texture_array_depth[0].GatherCmp(samp_comp[0], uv, 0.0); - float4 _expr61 = v4_; - v4_ = (_expr61 + _expr60); - float4 _expr68 = texture_array_depth[uniform_index].GatherCmp(samp_comp[uniform_index], uv, 0.0); - float4 _expr69 = v4_; - v4_ = (_expr69 + _expr68); - float4 _expr76 = texture_array_depth[NonUniformResourceIndex(non_uniform_index)].GatherCmp(samp_comp[NonUniformResourceIndex(non_uniform_index)], uv, 0.0); - float4 _expr77 = v4_; - v4_ = (_expr77 + _expr76); - float4 _expr82 = texture_array_unbounded[0].Load(int3(pix, 0)); - float4 _expr83 = v4_; - v4_ = (_expr83 + _expr82); - float4 _expr88 = texture_array_unbounded[uniform_index].Load(int3(pix, 0)); - float4 _expr89 = v4_; - v4_ = (_expr89 + _expr88); - float4 _expr94 = texture_array_unbounded[NonUniformResourceIndex(non_uniform_index)].Load(int3(pix, 0)); - float4 _expr95 = v4_; - v4_ = (_expr95 + _expr94); - uint _expr100 = u1_; - u1_ = (_expr100 + NagaNumLayers2DArray(texture_array_2darray[0])); - uint _expr105 = u1_; - u1_ = (_expr105 + NagaNumLayers2DArray(texture_array_2darray[uniform_index])); - uint _expr110 = u1_; - u1_ = (_expr110 + NagaNumLayers2DArray(texture_array_2darray[NonUniformResourceIndex(non_uniform_index)])); - uint _expr115 = u1_; - u1_ = (_expr115 + NagaNumLevels2D(texture_array_bounded[0])); - uint _expr120 = u1_; - u1_ = (_expr120 + NagaNumLevels2D(texture_array_bounded[uniform_index])); - uint _expr125 = u1_; - u1_ = (_expr125 + NagaNumLevels2D(texture_array_bounded[NonUniformResourceIndex(non_uniform_index)])); - uint _expr130 = u1_; - u1_ = (_expr130 + NagaMSNumSamples2D(texture_array_multisampled[0])); - uint _expr135 = u1_; - u1_ = (_expr135 + NagaMSNumSamples2D(texture_array_multisampled[uniform_index])); - uint _expr140 = u1_; - u1_ = (_expr140 + NagaMSNumSamples2D(texture_array_multisampled[NonUniformResourceIndex(non_uniform_index)])); - float4 _expr146 = texture_array_bounded[0].Sample(samp[0], uv); - float4 _expr147 = v4_; - v4_ = (_expr147 + _expr146); - float4 _expr153 = texture_array_bounded[uniform_index].Sample(samp[uniform_index], uv); - float4 _expr154 = v4_; - v4_ = (_expr154 + _expr153); - float4 _expr160 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].Sample(samp[NonUniformResourceIndex(non_uniform_index)], uv); - float4 _expr161 = v4_; - v4_ = (_expr161 + _expr160); - float4 _expr168 = texture_array_bounded[0].SampleBias(samp[0], uv, 0.0); - float4 _expr169 = v4_; - v4_ = (_expr169 + _expr168); - float4 _expr176 = texture_array_bounded[uniform_index].SampleBias(samp[uniform_index], uv, 0.0); - float4 _expr177 = v4_; - v4_ = (_expr177 + _expr176); - float4 _expr184 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].SampleBias(samp[NonUniformResourceIndex(non_uniform_index)], uv, 0.0); - float4 _expr185 = v4_; - v4_ = (_expr185 + _expr184); - float _expr192 = texture_array_depth[0].SampleCmp(samp_comp[0], uv, 0.0); - float _expr193 = v1_; - v1_ = (_expr193 + _expr192); - float _expr200 = texture_array_depth[uniform_index].SampleCmp(samp_comp[uniform_index], uv, 0.0); - float _expr201 = v1_; - v1_ = (_expr201 + _expr200); - float _expr208 = texture_array_depth[NonUniformResourceIndex(non_uniform_index)].SampleCmp(samp_comp[NonUniformResourceIndex(non_uniform_index)], uv, 0.0); - float _expr209 = v1_; - v1_ = (_expr209 + _expr208); - float _expr216 = texture_array_depth[0].SampleCmpLevelZero(samp_comp[0], uv, 0.0); - float _expr217 = v1_; - v1_ = (_expr217 + _expr216); - float _expr224 = texture_array_depth[uniform_index].SampleCmpLevelZero(samp_comp[uniform_index], uv, 0.0); - float _expr225 = v1_; - v1_ = (_expr225 + _expr224); - float _expr232 = texture_array_depth[NonUniformResourceIndex(non_uniform_index)].SampleCmpLevelZero(samp_comp[NonUniformResourceIndex(non_uniform_index)], uv, 0.0); - float _expr233 = v1_; - v1_ = (_expr233 + _expr232); - float4 _expr239 = texture_array_bounded[0].SampleGrad(samp[0], uv, uv, uv); - float4 _expr240 = v4_; - v4_ = (_expr240 + _expr239); - float4 _expr246 = texture_array_bounded[uniform_index].SampleGrad(samp[uniform_index], uv, uv, uv); - float4 _expr247 = v4_; - v4_ = (_expr247 + _expr246); - float4 _expr253 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].SampleGrad(samp[NonUniformResourceIndex(non_uniform_index)], uv, uv, uv); - float4 _expr254 = v4_; - v4_ = (_expr254 + _expr253); - float4 _expr261 = texture_array_bounded[0].SampleLevel(samp[0], uv, 0.0); - float4 _expr262 = v4_; - v4_ = (_expr262 + _expr261); - float4 _expr269 = texture_array_bounded[uniform_index].SampleLevel(samp[uniform_index], uv, 0.0); - float4 _expr270 = v4_; - v4_ = (_expr270 + _expr269); - float4 _expr277 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].SampleLevel(samp[NonUniformResourceIndex(non_uniform_index)], uv, 0.0); - float4 _expr278 = v4_; - v4_ = (_expr278 + _expr277); - float4 _expr282 = v4_; - texture_array_storage[0][pix] = _expr282; - float4 _expr285 = v4_; - texture_array_storage[uniform_index][pix] = _expr285; - float4 _expr288 = v4_; - texture_array_storage[NonUniformResourceIndex(non_uniform_index)][pix] = _expr288; - uint2 _expr289 = u2_; - uint _expr290 = u1_; - float2 v2_ = float2((_expr289 + (_expr290).xx)); - float4 _expr294 = v4_; - float _expr301 = v1_; - return ((_expr294 + float4(v2_.x, v2_.y, v2_.x, v2_.y)) + (_expr301).xxxx); + 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)])); + float4 _e38 = texture_array_bounded[0].Gather(samp[0], uv); + float4 _e39 = v4_; + v4_ = (_e39 + _e38); + float4 _e45 = texture_array_bounded[uniform_index].Gather(samp[uniform_index], uv); + float4 _e46 = v4_; + v4_ = (_e46 + _e45); + float4 _e52 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].Gather(samp[NonUniformResourceIndex(non_uniform_index)], uv); + float4 _e53 = v4_; + v4_ = (_e53 + _e52); + float4 _e60 = texture_array_depth[0].GatherCmp(samp_comp[0], uv, 0.0); + float4 _e61 = v4_; + v4_ = (_e61 + _e60); + float4 _e68 = texture_array_depth[uniform_index].GatherCmp(samp_comp[uniform_index], uv, 0.0); + float4 _e69 = v4_; + v4_ = (_e69 + _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); + float4 _e82 = texture_array_unbounded[0].Load(int3(pix, 0)); + float4 _e83 = v4_; + v4_ = (_e83 + _e82); + float4 _e88 = texture_array_unbounded[uniform_index].Load(int3(pix, 0)); + float4 _e89 = v4_; + v4_ = (_e89 + _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)])); + float4 _e146 = texture_array_bounded[0].Sample(samp[0], uv); + float4 _e147 = v4_; + v4_ = (_e147 + _e146); + float4 _e153 = texture_array_bounded[uniform_index].Sample(samp[uniform_index], uv); + float4 _e154 = v4_; + v4_ = (_e154 + _e153); + float4 _e160 = texture_array_bounded[NonUniformResourceIndex(non_uniform_index)].Sample(samp[NonUniformResourceIndex(non_uniform_index)], uv); + float4 _e161 = v4_; + v4_ = (_e161 + _e160); + float4 _e168 = texture_array_bounded[0].SampleBias(samp[0], uv, 0.0); + float4 _e169 = v4_; + v4_ = (_e169 + _e168); + float4 _e176 = texture_array_bounded[uniform_index].SampleBias(samp[uniform_index], uv, 0.0); + float4 _e177 = v4_; + v4_ = (_e177 + _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); + float _e192 = texture_array_depth[0].SampleCmp(samp_comp[0], uv, 0.0); + float _e193 = v1_; + v1_ = (_e193 + _e192); + float _e200 = texture_array_depth[uniform_index].SampleCmp(samp_comp[uniform_index], uv, 0.0); + float _e201 = v1_; + v1_ = (_e201 + _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); + float _e216 = texture_array_depth[0].SampleCmpLevelZero(samp_comp[0], uv, 0.0); + float _e217 = v1_; + v1_ = (_e217 + _e216); + float _e224 = texture_array_depth[uniform_index].SampleCmpLevelZero(samp_comp[uniform_index], uv, 0.0); + float _e225 = v1_; + v1_ = (_e225 + _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); + float4 _e239 = texture_array_bounded[0].SampleGrad(samp[0], uv, uv, uv); + float4 _e240 = v4_; + v4_ = (_e240 + _e239); + float4 _e246 = texture_array_bounded[uniform_index].SampleGrad(samp[uniform_index], uv, uv, uv); + float4 _e247 = v4_; + v4_ = (_e247 + _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); + float4 _e261 = texture_array_bounded[0].SampleLevel(samp[0], uv, 0.0); + float4 _e262 = v4_; + v4_ = (_e262 + _e261); + float4 _e269 = texture_array_bounded[uniform_index].SampleLevel(samp[uniform_index], uv, 0.0); + float4 _e270 = v4_; + v4_ = (_e270 + _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); } diff --git a/naga/tests/out/hlsl/bitcast.hlsl b/naga/tests/out/hlsl/bitcast.hlsl index 5208074002..b21408dda5 100644 --- a/naga/tests/out/hlsl/bitcast.hlsl +++ b/naga/tests/out/hlsl/bitcast.hlsl @@ -11,23 +11,23 @@ void main() float3 f3_ = (0.0).xxx; float4 f4_ = (0.0).xxxx; - int2 _expr27 = i2_; - u2_ = asuint(_expr27); - int3 _expr29 = i3_; - u3_ = asuint(_expr29); - int4 _expr31 = i4_; - u4_ = asuint(_expr31); - uint2 _expr33 = u2_; - i2_ = asint(_expr33); - uint3 _expr35 = u3_; - i3_ = asint(_expr35); - uint4 _expr37 = u4_; - i4_ = asint(_expr37); - int2 _expr39 = i2_; - f2_ = asfloat(_expr39); - int3 _expr41 = i3_; - f3_ = asfloat(_expr41); - int4 _expr43 = i4_; - f4_ = asfloat(_expr43); + 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); return; } diff --git a/naga/tests/out/hlsl/bits.hlsl b/naga/tests/out/hlsl/bits.hlsl index 06eb0fa8a0..c89eb19efe 100644 --- a/naga/tests/out/hlsl/bits.hlsl +++ b/naga/tests/out/hlsl/bits.hlsl @@ -188,117 +188,117 @@ void main() float2 f2_ = (0.0).xx; float4 f4_ = (0.0).xxxx; - float4 _expr28 = f4_; - u = uint((int(round(clamp(_expr28[0], -1.0, 1.0) * 127.0)) & 0xFF) | ((int(round(clamp(_expr28[1], -1.0, 1.0) * 127.0)) & 0xFF) << 8) | ((int(round(clamp(_expr28[2], -1.0, 1.0) * 127.0)) & 0xFF) << 16) | ((int(round(clamp(_expr28[3], -1.0, 1.0) * 127.0)) & 0xFF) << 24)); - float4 _expr30 = f4_; - u = (uint(round(clamp(_expr30[0], 0.0, 1.0) * 255.0)) | uint(round(clamp(_expr30[1], 0.0, 1.0) * 255.0)) << 8 | uint(round(clamp(_expr30[2], 0.0, 1.0) * 255.0)) << 16 | uint(round(clamp(_expr30[3], 0.0, 1.0) * 255.0)) << 24); - float2 _expr32 = f2_; - u = uint((int(round(clamp(_expr32[0], -1.0, 1.0) * 32767.0)) & 0xFFFF) | ((int(round(clamp(_expr32[1], -1.0, 1.0) * 32767.0)) & 0xFFFF) << 16)); - float2 _expr34 = f2_; - u = (uint(round(clamp(_expr34[0], 0.0, 1.0) * 65535.0)) | uint(round(clamp(_expr34[1], 0.0, 1.0) * 65535.0)) << 16); - float2 _expr36 = f2_; - u = (f32tof16(_expr36[0]) | f32tof16(_expr36[1]) << 16); - int4 _expr38 = i4_; - u = uint((_expr38[0] & 0xFF) | ((_expr38[1] & 0xFF) << 8) | ((_expr38[2] & 0xFF) << 16) | ((_expr38[3] & 0xFF) << 24)); - uint4 _expr40 = u4_; - u = (_expr40[0] & 0xFF) | ((_expr40[1] & 0xFF) << 8) | ((_expr40[2] & 0xFF) << 16) | ((_expr40[3] & 0xFF) << 24); - uint _expr42 = u; - f4_ = (float4(int4(_expr42 << 24, _expr42 << 16, _expr42 << 8, _expr42) >> 24) / 127.0); - uint _expr44 = u; - f4_ = (float4(_expr44 & 0xFF, _expr44 >> 8 & 0xFF, _expr44 >> 16 & 0xFF, _expr44 >> 24) / 255.0); - uint _expr46 = u; - f2_ = (float2(int2(_expr46 << 16, _expr46) >> 16) / 32767.0); - uint _expr48 = u; - f2_ = (float2(_expr48 & 0xFFFF, _expr48 >> 16) / 65535.0); - uint _expr50 = u; - f2_ = float2(f16tof32(_expr50), f16tof32((_expr50) >> 16)); - uint _expr52 = u; - i4_ = int4(_expr52, _expr52 >> 8, _expr52 >> 16, _expr52 >> 24) << 24 >> 24; - uint _expr54 = u; - u4_ = uint4(_expr54, _expr54 >> 8, _expr54 >> 16, _expr54 >> 24) << 24 >> 24; - int _expr56 = i; - int _expr57 = i; - i = naga_insertBits(_expr56, _expr57, 5u, 10u); - int2 _expr61 = i2_; - int2 _expr62 = i2_; - i2_ = naga_insertBits(_expr61, _expr62, 5u, 10u); - int3 _expr66 = i3_; - int3 _expr67 = i3_; - i3_ = naga_insertBits(_expr66, _expr67, 5u, 10u); - int4 _expr71 = i4_; - int4 _expr72 = i4_; - i4_ = naga_insertBits(_expr71, _expr72, 5u, 10u); - uint _expr76 = u; - uint _expr77 = u; - u = naga_insertBits(_expr76, _expr77, 5u, 10u); - uint2 _expr81 = u2_; - uint2 _expr82 = u2_; - u2_ = naga_insertBits(_expr81, _expr82, 5u, 10u); - uint3 _expr86 = u3_; - uint3 _expr87 = u3_; - u3_ = naga_insertBits(_expr86, _expr87, 5u, 10u); - uint4 _expr91 = u4_; - uint4 _expr92 = u4_; - u4_ = naga_insertBits(_expr91, _expr92, 5u, 10u); - int _expr96 = i; - i = naga_extractBits(_expr96, 5u, 10u); - int2 _expr100 = i2_; - i2_ = naga_extractBits(_expr100, 5u, 10u); - int3 _expr104 = i3_; - i3_ = naga_extractBits(_expr104, 5u, 10u); - int4 _expr108 = i4_; - i4_ = naga_extractBits(_expr108, 5u, 10u); - uint _expr112 = u; - u = naga_extractBits(_expr112, 5u, 10u); - uint2 _expr116 = u2_; - u2_ = naga_extractBits(_expr116, 5u, 10u); - uint3 _expr120 = u3_; - u3_ = naga_extractBits(_expr120, 5u, 10u); - uint4 _expr124 = u4_; - u4_ = naga_extractBits(_expr124, 5u, 10u); - int _expr128 = i; - i = asint(firstbitlow(_expr128)); - uint2 _expr130 = u2_; - u2_ = firstbitlow(_expr130); - int3 _expr132 = i3_; - i3_ = asint(firstbithigh(_expr132)); - uint3 _expr134 = u3_; - u3_ = firstbithigh(_expr134); - int _expr136 = i; - i = asint(firstbithigh(_expr136)); - uint _expr138 = u; - u = firstbithigh(_expr138); - int _expr140 = i; - i = asint(countbits(asuint(_expr140))); - int2 _expr142 = i2_; - i2_ = asint(countbits(asuint(_expr142))); - int3 _expr144 = i3_; - i3_ = asint(countbits(asuint(_expr144))); - int4 _expr146 = i4_; - i4_ = asint(countbits(asuint(_expr146))); - uint _expr148 = u; - u = countbits(_expr148); - uint2 _expr150 = u2_; - u2_ = countbits(_expr150); - uint3 _expr152 = u3_; - u3_ = countbits(_expr152); - uint4 _expr154 = u4_; - u4_ = countbits(_expr154); - int _expr156 = i; - i = asint(reversebits(asuint(_expr156))); - int2 _expr158 = i2_; - i2_ = asint(reversebits(asuint(_expr158))); - int3 _expr160 = i3_; - i3_ = asint(reversebits(asuint(_expr160))); - int4 _expr162 = i4_; - i4_ = asint(reversebits(asuint(_expr162))); - uint _expr164 = u; - u = reversebits(_expr164); - uint2 _expr166 = u2_; - u2_ = reversebits(_expr166); - uint3 _expr168 = u3_; - u3_ = reversebits(_expr168); - uint4 _expr170 = u4_; - u4_ = reversebits(_expr170); + float4 _e28 = f4_; + u = uint((int(round(clamp(_e28[0], -1.0, 1.0) * 127.0)) & 0xFF) | ((int(round(clamp(_e28[1], -1.0, 1.0) * 127.0)) & 0xFF) << 8) | ((int(round(clamp(_e28[2], -1.0, 1.0) * 127.0)) & 0xFF) << 16) | ((int(round(clamp(_e28[3], -1.0, 1.0) * 127.0)) & 0xFF) << 24)); + float4 _e30 = f4_; + u = (uint(round(clamp(_e30[0], 0.0, 1.0) * 255.0)) | uint(round(clamp(_e30[1], 0.0, 1.0) * 255.0)) << 8 | uint(round(clamp(_e30[2], 0.0, 1.0) * 255.0)) << 16 | uint(round(clamp(_e30[3], 0.0, 1.0) * 255.0)) << 24); + float2 _e32 = f2_; + u = uint((int(round(clamp(_e32[0], -1.0, 1.0) * 32767.0)) & 0xFFFF) | ((int(round(clamp(_e32[1], -1.0, 1.0) * 32767.0)) & 0xFFFF) << 16)); + float2 _e34 = f2_; + u = (uint(round(clamp(_e34[0], 0.0, 1.0) * 65535.0)) | uint(round(clamp(_e34[1], 0.0, 1.0) * 65535.0)) << 16); + float2 _e36 = f2_; + u = (f32tof16(_e36[0]) | f32tof16(_e36[1]) << 16); + int4 _e38 = i4_; + u = uint((_e38[0] & 0xFF) | ((_e38[1] & 0xFF) << 8) | ((_e38[2] & 0xFF) << 16) | ((_e38[3] & 0xFF) << 24)); + uint4 _e40 = u4_; + u = (_e40[0] & 0xFF) | ((_e40[1] & 0xFF) << 8) | ((_e40[2] & 0xFF) << 16) | ((_e40[3] & 0xFF) << 24); + uint _e42 = u; + f4_ = (float4(int4(_e42 << 24, _e42 << 16, _e42 << 8, _e42) >> 24) / 127.0); + uint _e44 = u; + f4_ = (float4(_e44 & 0xFF, _e44 >> 8 & 0xFF, _e44 >> 16 & 0xFF, _e44 >> 24) / 255.0); + uint _e46 = u; + f2_ = (float2(int2(_e46 << 16, _e46) >> 16) / 32767.0); + uint _e48 = u; + f2_ = (float2(_e48 & 0xFFFF, _e48 >> 16) / 65535.0); + uint _e50 = u; + f2_ = float2(f16tof32(_e50), f16tof32((_e50) >> 16)); + 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 = 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); return; } diff --git a/naga/tests/out/hlsl/boids.hlsl b/naga/tests/out/hlsl/boids.hlsl index bb6f6f9d1b..22e9c6cefd 100644 --- a/naga/tests/out/hlsl/boids.hlsl +++ b/naga/tests/out/hlsl/boids.hlsl @@ -37,108 +37,108 @@ void main(uint3 global_invocation_id : SV_DispatchThreadID) if ((index >= NUM_PARTICLES)) { return; } - float2 _expr8 = asfloat(particlesSrc.Load2(0+index*16+0)); - vPos = _expr8; - float2 _expr14 = asfloat(particlesSrc.Load2(8+index*16+0)); - vVel = _expr14; + float2 _e8 = asfloat(particlesSrc.Load2(0+index*16+0)); + vPos = _e8; + float2 _e14 = asfloat(particlesSrc.Load2(8+index*16+0)); + vVel = _e14; bool loop_init = true; while(true) { if (!loop_init) { - uint _expr91 = i; - i = (_expr91 + 1u); + uint _e91 = i; + i = (_e91 + 1u); } loop_init = false; - uint _expr36 = i; - if ((_expr36 >= NUM_PARTICLES)) { + uint _e36 = i; + if ((_e36 >= NUM_PARTICLES)) { break; } - uint _expr39 = i; - if ((_expr39 == index)) { + uint _e39 = i; + if ((_e39 == index)) { continue; } - uint _expr43 = i; - float2 _expr46 = asfloat(particlesSrc.Load2(0+_expr43*16+0)); - pos = _expr46; - uint _expr49 = i; - float2 _expr52 = asfloat(particlesSrc.Load2(8+_expr49*16+0)); - vel = _expr52; - float2 _expr53 = pos; - float2 _expr54 = vPos; - float _expr58 = params.rule1Distance; - if ((distance(_expr53, _expr54) < _expr58)) { - float2 _expr60 = cMass; - float2 _expr61 = pos; - cMass = (_expr60 + _expr61); - int _expr63 = cMassCount; - cMassCount = (_expr63 + 1); + 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); } - float2 _expr66 = pos; - float2 _expr67 = vPos; - float _expr71 = params.rule2Distance; - if ((distance(_expr66, _expr67) < _expr71)) { - float2 _expr73 = colVel; - float2 _expr74 = pos; - float2 _expr75 = vPos; - colVel = (_expr73 - (_expr74 - _expr75)); + 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)); } - float2 _expr78 = pos; - float2 _expr79 = vPos; - float _expr83 = params.rule3Distance; - if ((distance(_expr78, _expr79) < _expr83)) { - float2 _expr85 = cVel; - float2 _expr86 = vel; - cVel = (_expr85 + _expr86); - int _expr88 = cVelCount; - cVelCount = (_expr88 + 1); + 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); } } - int _expr94 = cMassCount; - if ((_expr94 > 0)) { - float2 _expr97 = cMass; - int _expr98 = cMassCount; - float2 _expr102 = vPos; - cMass = ((_expr97 / (float(_expr98)).xx) - _expr102); + int _e94 = cMassCount; + if ((_e94 > 0)) { + float2 _e97 = cMass; + int _e98 = cMassCount; + float2 _e102 = vPos; + cMass = ((_e97 / (float(_e98)).xx) - _e102); } - int _expr104 = cVelCount; - if ((_expr104 > 0)) { - float2 _expr107 = cVel; - int _expr108 = cVelCount; - cVel = (_expr107 / (float(_expr108)).xx); + int _e104 = cVelCount; + if ((_e104 > 0)) { + float2 _e107 = cVel; + int _e108 = cVelCount; + cVel = (_e107 / (float(_e108)).xx); } - float2 _expr112 = vVel; - float2 _expr113 = cMass; - float _expr116 = params.rule1Scale; - float2 _expr119 = colVel; - float _expr122 = params.rule2Scale; - float2 _expr125 = cVel; - float _expr128 = params.rule3Scale; - vVel = (((_expr112 + (_expr113 * _expr116)) + (_expr119 * _expr122)) + (_expr125 * _expr128)); - float2 _expr131 = vVel; - float2 _expr133 = vVel; - vVel = (normalize(_expr131) * clamp(length(_expr133), 0.0, 0.1)); - float2 _expr139 = vPos; - float2 _expr140 = vVel; - float _expr143 = params.deltaT; - vPos = (_expr139 + (_expr140 * _expr143)); - float _expr147 = vPos.x; - if ((_expr147 < -1.0)) { + 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)) { vPos.x = 1.0; } - float _expr153 = vPos.x; - if ((_expr153 > 1.0)) { + float _e153 = vPos.x; + if ((_e153 > 1.0)) { vPos.x = -1.0; } - float _expr159 = vPos.y; - if ((_expr159 < -1.0)) { + float _e159 = vPos.y; + if ((_e159 < -1.0)) { vPos.y = 1.0; } - float _expr165 = vPos.y; - if ((_expr165 > 1.0)) { + float _e165 = vPos.y; + if ((_e165 > 1.0)) { vPos.y = -1.0; } - float2 _expr174 = vPos; - particlesDst.Store2(0+index*16+0, asuint(_expr174)); - float2 _expr179 = vVel; - particlesDst.Store2(8+index*16+0, asuint(_expr179)); + float2 _e174 = vPos; + particlesDst.Store2(0+index*16+0, asuint(_e174)); + float2 _e179 = vVel; + particlesDst.Store2(8+index*16+0, asuint(_e179)); return; } diff --git a/naga/tests/out/hlsl/break-if.hlsl b/naga/tests/out/hlsl/break-if.hlsl index 56b7b48a2f..63a0185583 100644 --- a/naga/tests/out/hlsl/break-if.hlsl +++ b/naga/tests/out/hlsl/break-if.hlsl @@ -21,10 +21,10 @@ void breakIfEmptyBody(bool a) while(true) { if (!loop_init_1) { b = a; - bool _expr2 = b; - c = (a != _expr2); - bool _expr5 = c; - if ((a == _expr5)) { + bool _e2 = b; + c = (a != _e2); + bool _e5 = c; + if ((a == _e5)) { break; } } @@ -41,15 +41,15 @@ void breakIf(bool a_1) bool loop_init_2 = true; while(true) { if (!loop_init_2) { - bool _expr5 = e; - if ((a_1 == _expr5)) { + bool _e5 = e; + if ((a_1 == _e5)) { break; } } loop_init_2 = false; d = a_1; - bool _expr2 = d; - e = (a_1 != _expr2); + bool _e2 = d; + e = (a_1 != _e2); } return; } @@ -61,14 +61,14 @@ void breakIfSeparateVariable() bool loop_init_3 = true; while(true) { if (!loop_init_3) { - uint _expr5 = counter; - if ((_expr5 == 5u)) { + uint _e5 = counter; + if ((_e5 == 5u)) { break; } } loop_init_3 = false; - uint _expr3 = counter; - counter = (_expr3 + 1u); + uint _e3 = counter; + counter = (_e3 + 1u); } return; } diff --git a/naga/tests/out/hlsl/collatz.hlsl b/naga/tests/out/hlsl/collatz.hlsl index a8a5a776e3..b00586aa4c 100644 --- a/naga/tests/out/hlsl/collatz.hlsl +++ b/naga/tests/out/hlsl/collatz.hlsl @@ -7,33 +7,33 @@ uint collatz_iterations(uint n_base) n = n_base; while(true) { - uint _expr4 = n; - if ((_expr4 > 1u)) { + uint _e4 = n; + if ((_e4 > 1u)) { } else { break; } { - uint _expr7 = n; - if (((_expr7 % 2u) == 0u)) { - uint _expr12 = n; - n = (_expr12 / 2u); + uint _e7 = n; + if (((_e7 % 2u) == 0u)) { + uint _e12 = n; + n = (_e12 / 2u); } else { - uint _expr16 = n; - n = ((3u * _expr16) + 1u); + uint _e16 = n; + n = ((3u * _e16) + 1u); } - uint _expr20 = i; - i = (_expr20 + 1u); + uint _e20 = i; + i = (_e20 + 1u); } } - uint _expr23 = i; - return _expr23; + uint _e23 = i; + return _e23; } [numthreads(1, 1, 1)] void main(uint3 global_id : SV_DispatchThreadID) { - uint _expr9 = asuint(v_indices.Load(global_id.x*4+0)); - const uint _e10 = collatz_iterations(_expr9); + uint _e9 = asuint(v_indices.Load(global_id.x*4+0)); + const uint _e10 = collatz_iterations(_e9); 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 4cc2491ce8..29bec5f17a 100644 --- a/naga/tests/out/hlsl/const-exprs.hlsl +++ b/naga/tests/out/hlsl/const-exprs.hlsl @@ -39,15 +39,15 @@ void non_constant_initializers() int z = 70; int4 out_3 = (int4)0; - int _expr2 = w; - x = _expr2; - int _expr4 = x; - y = _expr4; - int _expr8 = w; - int _expr9 = x; - int _expr10 = y; - int _expr11 = z; - out_3 = int4(_expr8, _expr9, _expr10, _expr11); + 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); return; } diff --git a/naga/tests/out/hlsl/control-flow.hlsl b/naga/tests/out/hlsl/control-flow.hlsl index 8d71388c43..1e253add21 100644 --- a/naga/tests/out/hlsl/control-flow.hlsl +++ b/naga/tests/out/hlsl/control-flow.hlsl @@ -48,8 +48,8 @@ void main(uint3 global_id : SV_DispatchThreadID) break; } } - int _expr4 = pos; - switch(_expr4) { + int _e4 = pos; + switch(_e4) { case 1: { pos = 0; break; @@ -81,8 +81,8 @@ void main(uint3 global_id : SV_DispatchThreadID) break; } } - int _expr11 = pos; - switch(_expr11) { + int _e11 = pos; + switch(_e11) { case 1: { pos = 0; break; diff --git a/naga/tests/out/hlsl/do-while.hlsl b/naga/tests/out/hlsl/do-while.hlsl index b09e62457f..ca7d42e1e7 100644 --- a/naga/tests/out/hlsl/do-while.hlsl +++ b/naga/tests/out/hlsl/do-while.hlsl @@ -3,8 +3,8 @@ void fb1_(inout bool cond) bool loop_init = true; while(true) { if (!loop_init) { - bool _expr1 = cond; - if (!(_expr1)) { + bool _e1 = cond; + if (!(_e1)) { break; } } diff --git a/naga/tests/out/hlsl/dualsource.hlsl b/naga/tests/out/hlsl/dualsource.hlsl index 36784b13d2..6fbf8fa5c4 100644 --- a/naga/tests/out/hlsl/dualsource.hlsl +++ b/naga/tests/out/hlsl/dualsource.hlsl @@ -20,8 +20,8 @@ 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 _expr13 = color; - float4 _expr14 = mask; - const FragmentOutput fragmentoutput = ConstructFragmentOutput(_expr13, _expr14); + float4 _e13 = color; + float4 _e14 = mask; + const FragmentOutput fragmentoutput = ConstructFragmentOutput(_e13, _e14); return fragmentoutput; } diff --git a/naga/tests/out/hlsl/empty-global-name.hlsl b/naga/tests/out/hlsl/empty-global-name.hlsl index 8bb32b3648..64227b0bc7 100644 --- a/naga/tests/out/hlsl/empty-global-name.hlsl +++ b/naga/tests/out/hlsl/empty-global-name.hlsl @@ -6,8 +6,8 @@ RWByteAddressBuffer unnamed : register(u0); void function() { - int _expr3 = asint(unnamed.Load(0)); - unnamed.Store(0, asuint((_expr3 + 1))); + int _e3 = asint(unnamed.Load(0)); + unnamed.Store(0, asuint((_e3 + 1))); return; } diff --git a/naga/tests/out/hlsl/fragment-output.hlsl b/naga/tests/out/hlsl/fragment-output.hlsl index be425a5ef7..f1f0a82ae8 100644 --- a/naga/tests/out/hlsl/fragment-output.hlsl +++ b/naga/tests/out/hlsl/fragment-output.hlsl @@ -26,8 +26,8 @@ FragmentOutputVec4Vec3_ main_vec4vec3_() output.vec3f = (0.0).xxx; output.vec3i = (0).xxx; output.vec3u = (0u).xxx; - FragmentOutputVec4Vec3_ _expr19 = output; - const FragmentOutputVec4Vec3_ fragmentoutputvec4vec3_ = _expr19; + FragmentOutputVec4Vec3_ _e19 = output; + const FragmentOutputVec4Vec3_ fragmentoutputvec4vec3_ = _e19; return fragmentoutputvec4vec3_; } @@ -41,7 +41,7 @@ FragmentOutputVec2Scalar main_vec2scalar() output_1.scalarf = 0.0; output_1.scalari = 0; output_1.scalaru = 0u; - FragmentOutputVec2Scalar _expr16 = output_1; - const FragmentOutputVec2Scalar fragmentoutputvec2scalar = _expr16; + FragmentOutputVec2Scalar _e16 = output_1; + const FragmentOutputVec2Scalar fragmentoutputvec2scalar = _e16; return fragmentoutputvec2scalar; } diff --git a/naga/tests/out/hlsl/globals.hlsl b/naga/tests/out/hlsl/globals.hlsl index adf0b28b89..d6d8eb4107 100644 --- a/naga/tests/out/hlsl/globals.hlsl +++ b/naga/tests/out/hlsl/globals.hlsl @@ -89,8 +89,8 @@ 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 _expr16 = idx; - alignment.Store(_expr16*4+0, asuint(3.0)); + int _e16 = idx; + alignment.Store(_e16*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 +120,20 @@ void main(uint3 __local_invocation_id : SV_GroupThreadID) bool at = true; test_msl_packed_vec3_(); - float4x2 _expr5 = ((float4x2)global_nested_arrays_of_matrices_4x2_[0][0]); - float4 _expr10 = global_nested_arrays_of_matrices_2x4_[0][0][0]; - wg[7] = mul(_expr10, _expr5).x; - float3x2 _expr16 = ((float3x2)global_mat); - float3 _expr18 = global_vec; - wg[6] = mul(_expr18, _expr16).x; - float _expr26 = asfloat(dummy.Load(4+8)); - wg[5] = _expr26; - float _expr32 = float_vecs[0].w; - wg[4] = _expr32; - float _expr37 = asfloat(alignment.Load(12)); - wg[3] = _expr37; - float _expr43 = asfloat(alignment.Load(0+0)); - wg[2] = _expr43; + 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; 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 9259549ab2..7c5f769e4d 100644 --- a/naga/tests/out/hlsl/hlsl-keyword.hlsl +++ b/naga/tests/out/hlsl/hlsl-keyword.hlsl @@ -2,6 +2,6 @@ float4 fs_main() : SV_Target0 { float4 Pass_ = float4(1.0, 1.0, 1.0, 1.0); - float4 _expr6 = Pass_; - return _expr6; + float4 _e6 = Pass_; + return _e6; } diff --git a/naga/tests/out/hlsl/image.hlsl b/naga/tests/out/hlsl/image.hlsl index 7fbd68b105..1b41aa56eb 100644 --- a/naga/tests/out/hlsl/image.hlsl +++ b/naga/tests/out/hlsl/image.hlsl @@ -246,74 +246,74 @@ float4 texture_sample() : SV_Target0 float2 tc = (0.5).xx; float3 tc3_ = (0.5).xxx; - float4 _expr9 = image_1d.Sample(sampler_reg, tc.x); - float4 _expr10 = a; - a = (_expr10 + _expr9); - float4 _expr14 = image_2d.Sample(sampler_reg, tc); - float4 _expr15 = a; - a = (_expr15 + _expr14); - float4 _expr19 = image_2d.Sample(sampler_reg, tc, int2(int2(3, 1))); - float4 _expr20 = a; - a = (_expr20 + _expr19); - float4 _expr24 = image_2d.SampleLevel(sampler_reg, tc, 2.3); - float4 _expr25 = a; - a = (_expr25 + _expr24); - float4 _expr29 = image_2d.SampleLevel(sampler_reg, tc, 2.3, int2(int2(3, 1))); - float4 _expr30 = a; - a = (_expr30 + _expr29); - float4 _expr35 = image_2d.SampleBias(sampler_reg, tc, 2.0, int2(int2(3, 1))); - float4 _expr36 = a; - a = (_expr36 + _expr35); - float4 _expr41 = image_2d_array.Sample(sampler_reg, float3(tc, 0u)); - float4 _expr42 = a; - a = (_expr42 + _expr41); - float4 _expr47 = image_2d_array.Sample(sampler_reg, float3(tc, 0u), int2(int2(3, 1))); - float4 _expr48 = a; - a = (_expr48 + _expr47); - float4 _expr53 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0u), 2.3); - float4 _expr54 = a; - a = (_expr54 + _expr53); - float4 _expr59 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0u), 2.3, int2(int2(3, 1))); - float4 _expr60 = a; - a = (_expr60 + _expr59); - float4 _expr66 = image_2d_array.SampleBias(sampler_reg, float3(tc, 0u), 2.0, int2(int2(3, 1))); - float4 _expr67 = a; - a = (_expr67 + _expr66); - float4 _expr72 = image_2d_array.Sample(sampler_reg, float3(tc, 0)); - float4 _expr73 = a; - a = (_expr73 + _expr72); - float4 _expr78 = image_2d_array.Sample(sampler_reg, float3(tc, 0), int2(int2(3, 1))); - float4 _expr79 = a; - a = (_expr79 + _expr78); - float4 _expr84 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0), 2.3); - float4 _expr85 = a; - a = (_expr85 + _expr84); - float4 _expr90 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0), 2.3, int2(int2(3, 1))); - float4 _expr91 = a; - a = (_expr91 + _expr90); - float4 _expr97 = image_2d_array.SampleBias(sampler_reg, float3(tc, 0), 2.0, int2(int2(3, 1))); - float4 _expr98 = a; - a = (_expr98 + _expr97); - float4 _expr103 = image_cube_array.Sample(sampler_reg, float4(tc3_, 0u)); - float4 _expr104 = a; - a = (_expr104 + _expr103); - float4 _expr109 = image_cube_array.SampleLevel(sampler_reg, float4(tc3_, 0u), 2.3); - float4 _expr110 = a; - a = (_expr110 + _expr109); - float4 _expr116 = image_cube_array.SampleBias(sampler_reg, float4(tc3_, 0u), 2.0); - float4 _expr117 = a; - a = (_expr117 + _expr116); - float4 _expr122 = image_cube_array.Sample(sampler_reg, float4(tc3_, 0)); - float4 _expr123 = a; - a = (_expr123 + _expr122); - float4 _expr128 = image_cube_array.SampleLevel(sampler_reg, float4(tc3_, 0), 2.3); - float4 _expr129 = a; - a = (_expr129 + _expr128); - float4 _expr135 = image_cube_array.SampleBias(sampler_reg, float4(tc3_, 0), 2.0); - float4 _expr136 = a; - a = (_expr136 + _expr135); - float4 _expr138 = a; - return _expr138; + float4 _e9 = image_1d.Sample(sampler_reg, tc.x); + float4 _e10 = a; + a = (_e10 + _e9); + float4 _e14 = image_2d.Sample(sampler_reg, tc); + float4 _e15 = a; + a = (_e15 + _e14); + float4 _e19 = image_2d.Sample(sampler_reg, tc, int2(int2(3, 1))); + float4 _e20 = a; + a = (_e20 + _e19); + float4 _e24 = image_2d.SampleLevel(sampler_reg, tc, 2.3); + float4 _e25 = a; + a = (_e25 + _e24); + float4 _e29 = image_2d.SampleLevel(sampler_reg, tc, 2.3, int2(int2(3, 1))); + float4 _e30 = a; + a = (_e30 + _e29); + float4 _e35 = image_2d.SampleBias(sampler_reg, tc, 2.0, int2(int2(3, 1))); + float4 _e36 = a; + a = (_e36 + _e35); + float4 _e41 = image_2d_array.Sample(sampler_reg, float3(tc, 0u)); + float4 _e42 = a; + a = (_e42 + _e41); + float4 _e47 = image_2d_array.Sample(sampler_reg, float3(tc, 0u), int2(int2(3, 1))); + float4 _e48 = a; + a = (_e48 + _e47); + float4 _e53 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0u), 2.3); + float4 _e54 = a; + a = (_e54 + _e53); + float4 _e59 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0u), 2.3, int2(int2(3, 1))); + float4 _e60 = a; + a = (_e60 + _e59); + float4 _e66 = image_2d_array.SampleBias(sampler_reg, float3(tc, 0u), 2.0, int2(int2(3, 1))); + float4 _e67 = a; + a = (_e67 + _e66); + float4 _e72 = image_2d_array.Sample(sampler_reg, float3(tc, 0)); + float4 _e73 = a; + a = (_e73 + _e72); + float4 _e78 = image_2d_array.Sample(sampler_reg, float3(tc, 0), int2(int2(3, 1))); + float4 _e79 = a; + a = (_e79 + _e78); + float4 _e84 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0), 2.3); + float4 _e85 = a; + a = (_e85 + _e84); + float4 _e90 = image_2d_array.SampleLevel(sampler_reg, float3(tc, 0), 2.3, int2(int2(3, 1))); + float4 _e91 = a; + a = (_e91 + _e90); + float4 _e97 = image_2d_array.SampleBias(sampler_reg, float3(tc, 0), 2.0, int2(int2(3, 1))); + float4 _e98 = a; + a = (_e98 + _e97); + float4 _e103 = image_cube_array.Sample(sampler_reg, float4(tc3_, 0u)); + float4 _e104 = a; + a = (_e104 + _e103); + float4 _e109 = image_cube_array.SampleLevel(sampler_reg, float4(tc3_, 0u), 2.3); + float4 _e110 = a; + a = (_e110 + _e109); + float4 _e116 = image_cube_array.SampleBias(sampler_reg, float4(tc3_, 0u), 2.0); + float4 _e117 = a; + a = (_e117 + _e116); + float4 _e122 = image_cube_array.Sample(sampler_reg, float4(tc3_, 0)); + float4 _e123 = a; + a = (_e123 + _e122); + float4 _e128 = image_cube_array.SampleLevel(sampler_reg, float4(tc3_, 0), 2.3); + float4 _e129 = a; + a = (_e129 + _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; } float texture_sample_comparison() : SV_Target0 @@ -322,32 +322,32 @@ float texture_sample_comparison() : SV_Target0 float2 tc_1 = (0.5).xx; float3 tc3_1 = (0.5).xxx; - float _expr8 = image_2d_depth.SampleCmp(sampler_cmp, tc_1, 0.5); - float _expr9 = a_1; - a_1 = (_expr9 + _expr8); - float _expr14 = image_2d_array_depth.SampleCmp(sampler_cmp, float3(tc_1, 0u), 0.5); - float _expr15 = a_1; - a_1 = (_expr15 + _expr14); - float _expr20 = image_2d_array_depth.SampleCmp(sampler_cmp, float3(tc_1, 0), 0.5); - float _expr21 = a_1; - a_1 = (_expr21 + _expr20); - float _expr25 = image_cube_depth.SampleCmp(sampler_cmp, tc3_1, 0.5); - float _expr26 = a_1; - a_1 = (_expr26 + _expr25); - float _expr30 = image_2d_depth.SampleCmpLevelZero(sampler_cmp, tc_1, 0.5); - float _expr31 = a_1; - a_1 = (_expr31 + _expr30); - float _expr36 = image_2d_array_depth.SampleCmpLevelZero(sampler_cmp, float3(tc_1, 0u), 0.5); - float _expr37 = a_1; - a_1 = (_expr37 + _expr36); - float _expr42 = image_2d_array_depth.SampleCmpLevelZero(sampler_cmp, float3(tc_1, 0), 0.5); - float _expr43 = a_1; - a_1 = (_expr43 + _expr42); - float _expr47 = image_cube_depth.SampleCmpLevelZero(sampler_cmp, tc3_1, 0.5); - float _expr48 = a_1; - a_1 = (_expr48 + _expr47); - float _expr50 = a_1; - return _expr50; + float _e8 = image_2d_depth.SampleCmp(sampler_cmp, tc_1, 0.5); + float _e9 = a_1; + a_1 = (_e9 + _e8); + float _e14 = image_2d_array_depth.SampleCmp(sampler_cmp, float3(tc_1, 0u), 0.5); + float _e15 = a_1; + a_1 = (_e15 + _e14); + float _e20 = image_2d_array_depth.SampleCmp(sampler_cmp, float3(tc_1, 0), 0.5); + float _e21 = a_1; + a_1 = (_e21 + _e20); + float _e25 = image_cube_depth.SampleCmp(sampler_cmp, tc3_1, 0.5); + float _e26 = a_1; + a_1 = (_e26 + _e25); + float _e30 = image_2d_depth.SampleCmpLevelZero(sampler_cmp, tc_1, 0.5); + float _e31 = a_1; + a_1 = (_e31 + _e30); + float _e36 = image_2d_array_depth.SampleCmpLevelZero(sampler_cmp, float3(tc_1, 0u), 0.5); + float _e37 = a_1; + a_1 = (_e37 + _e36); + float _e42 = image_2d_array_depth.SampleCmpLevelZero(sampler_cmp, float3(tc_1, 0), 0.5); + float _e43 = a_1; + a_1 = (_e43 + _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; } float4 gather() : SV_Target0 diff --git a/naga/tests/out/hlsl/int64.hlsl b/naga/tests/out/hlsl/int64.hlsl index af53b303f6..ccce279baa 100644 --- a/naga/tests/out/hlsl/int64.hlsl +++ b/naga/tests/out/hlsl/int64.hlsl @@ -63,81 +63,81 @@ int64_t int64_function(int64_t x) { int64_t val = 20L; - int64_t _expr6 = val; - val = (_expr6 + (31L - 1002003004005006L)); - int64_t _expr8 = val; - int64_t _expr11 = val; - val = (_expr11 + (_expr8 + 5L)); - uint _expr15 = input_uniform.val_u32_; - int64_t _expr16 = val; - int64_t _expr20 = val; - val = (_expr20 + int64_t((_expr15 + uint(_expr16)))); - int _expr24 = input_uniform.val_i32_; - int64_t _expr25 = val; - int64_t _expr29 = val; - val = (_expr29 + int64_t((_expr24 + int(_expr25)))); - float _expr33 = input_uniform.val_f32_; - int64_t _expr34 = val; - int64_t _expr38 = val; - val = (_expr38 + int64_t((_expr33 + float(_expr34)))); - int64_t _expr42 = input_uniform.val_i64_; - int64_t _expr45 = val; - val = (_expr45 + (_expr42).xxx.z); - uint64_t _expr49 = input_uniform.val_u64_; - int64_t _expr51 = val; - val = (_expr51 + _expr49); - uint64_t2 _expr55 = input_uniform.val_u64_2_; - int64_t _expr58 = val; - val = (_expr58 + _expr55.y); - uint64_t3 _expr62 = input_uniform.val_u64_3_; - int64_t _expr65 = val; - val = (_expr65 + _expr62.z); - uint64_t4 _expr69 = input_uniform.val_u64_4_; - int64_t _expr72 = val; - val = (_expr72 + _expr69.w); - int64_t _expr78 = input_uniform.val_i64_; - int64_t _expr81 = input_storage.Load(128); - output.Store(128, (_expr78 + _expr81)); - int64_t2 _expr87 = input_uniform.val_i64_2_; - int64_t2 _expr90 = input_storage.Load(144); - output.Store(144, (_expr87 + _expr90)); - int64_t3 _expr96 = input_uniform.val_i64_3_; - int64_t3 _expr99 = input_storage.Load(160); - output.Store(160, (_expr96 + _expr99)); - int64_t4 _expr105 = input_uniform.val_i64_4_; - int64_t4 _expr108 = input_storage.Load(192); - output.Store(192, (_expr105 + _expr108)); - int64_t _expr114[2] = Constructarray2_int64_t_(input_arrays.Load(16+0), input_arrays.Load(16+8)); + 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)); { - int64_t _value2[2] = _expr114; + int64_t _value2[2] = _e114; output_arrays.Store(16+0, _value2[0]); output_arrays.Store(16+8, _value2[1]); } - int64_t _expr115 = val; - int64_t _expr117 = val; - val = (_expr117 + abs(_expr115)); - int64_t _expr119 = val; - int64_t _expr120 = val; - int64_t _expr121 = val; - int64_t _expr123 = val; - val = (_expr123 + clamp(_expr119, _expr120, _expr121)); - int64_t _expr125 = val; - int64_t _expr127 = val; - int64_t _expr130 = val; - val = (_expr130 + dot((_expr125).xx, (_expr127).xx)); - int64_t _expr132 = val; - int64_t _expr133 = val; - int64_t _expr135 = val; - val = (_expr135 + max(_expr132, _expr133)); - int64_t _expr137 = val; - int64_t _expr138 = val; - int64_t _expr140 = val; - val = (_expr140 + min(_expr137, _expr138)); - int64_t _expr142 = val; - int64_t _expr144 = val; - val = (_expr144 + sign(_expr142)); - int64_t _expr146 = val; - return _expr146; + 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; } typedef uint64_t ret_Constructarray2_uint64_t_[2]; @@ -150,78 +150,78 @@ uint64_t uint64_function(uint64_t x_1) { uint64_t val_1 = 20uL; - uint64_t _expr6 = val_1; - val_1 = (_expr6 + (31uL + 1002003004005006uL)); - uint64_t _expr8 = val_1; - uint64_t _expr11 = val_1; - val_1 = (_expr11 + (_expr8 + 5uL)); - uint _expr15 = input_uniform.val_u32_; - uint64_t _expr16 = val_1; - uint64_t _expr20 = val_1; - val_1 = (_expr20 + uint64_t((_expr15 + uint(_expr16)))); - int _expr24 = input_uniform.val_i32_; - uint64_t _expr25 = val_1; - uint64_t _expr29 = val_1; - val_1 = (_expr29 + uint64_t((_expr24 + int(_expr25)))); - float _expr33 = input_uniform.val_f32_; - uint64_t _expr34 = val_1; - uint64_t _expr38 = val_1; - val_1 = (_expr38 + uint64_t((_expr33 + float(_expr34)))); - uint64_t _expr42 = input_uniform.val_u64_; - uint64_t _expr45 = val_1; - val_1 = (_expr45 + (_expr42).xxx.z); - int64_t _expr49 = input_uniform.val_i64_; - uint64_t _expr51 = val_1; - val_1 = (_expr51 + _expr49); - int64_t2 _expr55 = input_uniform.val_i64_2_; - uint64_t _expr58 = val_1; - val_1 = (_expr58 + _expr55.y); - int64_t3 _expr62 = input_uniform.val_i64_3_; - uint64_t _expr65 = val_1; - val_1 = (_expr65 + _expr62.z); - int64_t4 _expr69 = input_uniform.val_i64_4_; - uint64_t _expr72 = val_1; - val_1 = (_expr72 + _expr69.w); - uint64_t _expr78 = input_uniform.val_u64_; - uint64_t _expr81 = input_storage.Load(16); - output.Store(16, (_expr78 + _expr81)); - uint64_t2 _expr87 = input_uniform.val_u64_2_; - uint64_t2 _expr90 = input_storage.Load(32); - output.Store(32, (_expr87 + _expr90)); - uint64_t3 _expr96 = input_uniform.val_u64_3_; - uint64_t3 _expr99 = input_storage.Load(64); - output.Store(64, (_expr96 + _expr99)); - uint64_t4 _expr105 = input_uniform.val_u64_4_; - uint64_t4 _expr108 = input_storage.Load(96); - output.Store(96, (_expr105 + _expr108)); - uint64_t _expr114[2] = Constructarray2_uint64_t_(input_arrays.Load(0+0), input_arrays.Load(0+8)); + 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)); { - uint64_t _value2[2] = _expr114; + uint64_t _value2[2] = _e114; output_arrays.Store(0+0, _value2[0]); output_arrays.Store(0+8, _value2[1]); } - uint64_t _expr115 = val_1; - uint64_t _expr117 = val_1; - val_1 = (_expr117 + abs(_expr115)); - uint64_t _expr119 = val_1; - uint64_t _expr120 = val_1; - uint64_t _expr121 = val_1; - uint64_t _expr123 = val_1; - val_1 = (_expr123 + clamp(_expr119, _expr120, _expr121)); - uint64_t _expr125 = val_1; - uint64_t _expr127 = val_1; - uint64_t _expr130 = val_1; - val_1 = (_expr130 + dot((_expr125).xx, (_expr127).xx)); - uint64_t _expr132 = val_1; - uint64_t _expr133 = val_1; - uint64_t _expr135 = val_1; - val_1 = (_expr135 + max(_expr132, _expr133)); - uint64_t _expr137 = val_1; - uint64_t _expr138 = val_1; - uint64_t _expr140 = val_1; - val_1 = (_expr140 + min(_expr137, _expr138)); - uint64_t _expr142 = val_1; - return _expr142; + 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; } [numthreads(1, 1, 1)] diff --git a/naga/tests/out/hlsl/interface.hlsl b/naga/tests/out/hlsl/interface.hlsl index bbf330d4d6..6187ca0974 100644 --- a/naga/tests/out/hlsl/interface.hlsl +++ b/naga/tests/out/hlsl/interface.hlsl @@ -89,6 +89,6 @@ precise float4 vertex_two_structs(Input1_ in1_, Input2_ in2_) : SV_Position { uint index = 2u; - uint _expr8 = index; - return float4(float((_NagaConstants.first_vertex + in1_.index)), float((_NagaConstants.first_instance + in2_.index)), float(_expr8), 0.0); + uint _e8 = index; + return float4(float((_NagaConstants.first_vertex + in1_.index)), float((_NagaConstants.first_instance + in2_.index)), float(_e8), 0.0); } diff --git a/naga/tests/out/hlsl/interpolate.hlsl b/naga/tests/out/hlsl/interpolate.hlsl index aa1986f5d2..29fd45e0ff 100644 --- a/naga/tests/out/hlsl/interpolate.hlsl +++ b/naga/tests/out/hlsl/interpolate.hlsl @@ -43,8 +43,8 @@ VertexOutput_vert_main vert_main() out_.perspective = float4(729.0, 1000.0, 1331.0, 1728.0); out_.perspective_centroid = 2197.0; out_.perspective_sample = 2744.0; - FragmentInput _expr30 = out_; - const FragmentInput fragmentinput = _expr30; + FragmentInput _e30 = out_; + const FragmentInput fragmentinput = _e30; const VertexOutput_vert_main fragmentinput_1 = { fragmentinput._flat, fragmentinput._linear, fragmentinput.linear_centroid, fragmentinput.linear_sample, fragmentinput.perspective, fragmentinput.perspective_centroid, fragmentinput.perspective_sample, fragmentinput.position }; return fragmentinput_1; } diff --git a/naga/tests/out/hlsl/inv-hyperbolic-trig-functions.hlsl b/naga/tests/out/hlsl/inv-hyperbolic-trig-functions.hlsl index d086bf14b4..16297258be 100644 --- a/naga/tests/out/hlsl/inv-hyperbolic-trig-functions.hlsl +++ b/naga/tests/out/hlsl/inv-hyperbolic-trig-functions.hlsl @@ -6,12 +6,12 @@ void main_1() float c = (float)0; float d = (float)0; - float _expr4 = a; - b = log(_expr4 + sqrt(_expr4 * _expr4 + 1.0)); - float _expr6 = a; - c = log(_expr6 + sqrt(_expr6 * _expr6 - 1.0)); - float _expr8 = a; - d = 0.5 * log((1.0 + _expr8) / (1.0 - _expr8)); + float _e4 = a; + b = log(_e4 + sqrt(_e4 * _e4 + 1.0)); + float _e6 = a; + c = log(_e6 + sqrt(_e6 * _e6 - 1.0)); + float _e8 = a; + d = 0.5 * log((1.0 + _e8) / (1.0 - _e8)); return; } diff --git a/naga/tests/out/hlsl/operators.hlsl b/naga/tests/out/hlsl/operators.hlsl index eab1a8d9fa..7d9dc8f401 100644 --- a/naga/tests/out/hlsl/operators.hlsl +++ b/naga/tests/out/hlsl/operators.hlsl @@ -27,14 +27,14 @@ float2 splat_assignment() { float2 a = (2.0).xx; - float2 _expr4 = a; - a = (_expr4 + (1.0).xx); - float2 _expr8 = a; - a = (_expr8 - (3.0).xx); - float2 _expr12 = a; - a = (_expr12 / (4.0).xx); - float2 _expr15 = a; - return _expr15; + 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; } float3 bool_cast(float3 x) @@ -221,36 +221,36 @@ void assignment() int3 vec0_ = ZeroValueint3(); a_1 = 1; - int _expr5 = a_1; - a_1 = (_expr5 + 1); - int _expr7 = a_1; - a_1 = (_expr7 - 1); - int _expr9 = a_1; - int _expr10 = a_1; - a_1 = (_expr10 * _expr9); - int _expr12 = a_1; - int _expr13 = a_1; - a_1 = (_expr13 / _expr12); - int _expr15 = a_1; - a_1 = (_expr15 % 1); - int _expr17 = a_1; - a_1 = (_expr17 & 0); - int _expr19 = a_1; - a_1 = (_expr19 | 0); - int _expr21 = a_1; - a_1 = (_expr21 ^ 0); - int _expr23 = a_1; - a_1 = (_expr23 << 2u); - int _expr25 = a_1; - a_1 = (_expr25 >> 1u); - int _expr28 = a_1; - a_1 = (_expr28 + 1); - int _expr31 = a_1; - a_1 = (_expr31 - 1); - int _expr37 = vec0_[1]; - vec0_[1] = (_expr37 + 1); - int _expr41 = vec0_[1]; - vec0_[1] = (_expr41 - 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); return; } diff --git a/naga/tests/out/hlsl/overrides.hlsl b/naga/tests/out/hlsl/overrides.hlsl index a7c49f9ba1..aae0b491bf 100644 --- a/naga/tests/out/hlsl/overrides.hlsl +++ b/naga/tests/out/hlsl/overrides.hlsl @@ -17,8 +17,8 @@ void main() float gain_x_100_ = (float)0; x = true; - float _expr9 = gain_x_10_; - gain_x_100_ = (_expr9 * 10.0); + float _e9 = gain_x_10_; + gain_x_100_ = (_e9 * 10.0); store_override = gain; return; } diff --git a/naga/tests/out/hlsl/padding.hlsl b/naga/tests/out/hlsl/padding.hlsl index e3271e5663..9408cb2f93 100644 --- a/naga/tests/out/hlsl/padding.hlsl +++ b/naga/tests/out/hlsl/padding.hlsl @@ -35,8 +35,8 @@ cbuffer input3_ : register(b2) { Test3_ input3_; } float4 vertex() : SV_Position { - float _expr4 = input1_.b; - float _expr8 = input2_.b; - float _expr12 = input3_.b; - return ((((1.0).xxxx * _expr4) * _expr8) * _expr12); + float _e4 = input1_.b; + float _e8 = input2_.b; + float _e12 = input3_.b; + return ((((1.0).xxxx * _e4) * _e8) * _e12); } diff --git a/naga/tests/out/hlsl/push-constants.hlsl b/naga/tests/out/hlsl/push-constants.hlsl index 187eb5b2fc..188e9e1b5f 100644 --- a/naga/tests/out/hlsl/push-constants.hlsl +++ b/naga/tests/out/hlsl/push-constants.hlsl @@ -21,13 +21,13 @@ struct FragmentInput_main { float4 vert_main(float2 pos : LOC0, uint ii : SV_InstanceID, uint vi : SV_VertexID) : SV_Position { - float _expr8 = pc.multiplier; - return float4((((float((_NagaConstants.first_instance + ii)) * float((_NagaConstants.first_vertex + vi))) * _expr8) * pos), 0.0, 1.0); + float _e8 = pc.multiplier; + return float4((((float((_NagaConstants.first_instance + ii)) * float((_NagaConstants.first_vertex + vi))) * _e8) * pos), 0.0, 1.0); } float4 main(FragmentInput_main fragmentinput_main) : SV_Target0 { FragmentIn in_ = { fragmentinput_main.color }; - float _expr4 = pc.multiplier; - return (in_.color * _expr4); + float _e4 = pc.multiplier; + return (in_.color * _e4); } diff --git a/naga/tests/out/hlsl/quad-vert.hlsl b/naga/tests/out/hlsl/quad-vert.hlsl index 5c4eeb7ecc..20834db423 100644 --- a/naga/tests/out/hlsl/quad-vert.hlsl +++ b/naga/tests/out/hlsl/quad-vert.hlsl @@ -37,10 +37,10 @@ struct VertexOutput_main { void main_1() { - float2 _expr6 = a_uv_1; - v_uv = _expr6; - float2 _expr7 = a_pos_1; - unnamed.gl_Position = float4(_expr7.x, _expr7.y, 0.0, 1.0); + float2 _e6 = a_uv_1; + v_uv = _e6; + float2 _e7 = a_pos_1; + unnamed.gl_Position = float4(_e7.x, _e7.y, 0.0, 1.0); return; } @@ -56,9 +56,9 @@ VertexOutput_main main(float2 a_uv : LOC1, float2 a_pos : LOC0) a_uv_1 = a_uv; a_pos_1 = a_pos; main_1(); - float2 _expr7 = v_uv; - float4 _expr8 = unnamed.gl_Position; - const type_4 type_4_ = Constructtype_4(_expr7, _expr8); + float2 _e7 = v_uv; + float4 _e8 = unnamed.gl_Position; + const type_4 type_4_ = Constructtype_4(_e7, _e8); 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 91a918283b..c0431bfef9 100644 --- a/naga/tests/out/hlsl/shadow.hlsl +++ b/naga/tests/out/hlsl/shadow.hlsl @@ -56,8 +56,8 @@ float fetch_shadow(uint light_id, float4 homogeneous_coords) float2 flip_correction = float2(0.5, -0.5); float proj_correction = (1.0 / homogeneous_coords.w); float2 light_local = (((homogeneous_coords.xy * flip_correction) * proj_correction) + float2(0.5, 0.5)); - float _expr24 = t_shadow.SampleCmpLevelZero(sampler_shadow, float3(light_local, int(light_id)), (homogeneous_coords.z * proj_correction)); - return _expr24; + float _e24 = t_shadow.SampleCmpLevelZero(sampler_shadow, float3(light_local, int(light_id)), (homogeneous_coords.z * proj_correction)); + return _e24; } VertexOutput_vs_main vs_main(int4 position : LOC0, int4 normal : LOC1) @@ -65,14 +65,14 @@ VertexOutput_vs_main vs_main(int4 position : LOC0, int4 normal : LOC1) VertexOutput out_ = (VertexOutput)0; float4x4 w = u_entity.world; - float4x4 _expr7 = u_entity.world; - float4 world_pos = mul(float4(position), _expr7); + float4x4 _e7 = u_entity.world; + float4 world_pos = mul(float4(position), _e7); out_.world_normal = mul(float3(normal.xyz), float3x3(w[0].xyz, w[1].xyz, w[2].xyz)); out_.world_position = world_pos; - float4x4 _expr26 = u_globals.view_proj; - out_.proj_position = mul(world_pos, _expr26); - VertexOutput _expr28 = out_; - const VertexOutput vertexoutput = _expr28; + float4x4 _e26 = u_globals.view_proj; + out_.proj_position = mul(world_pos, _e26); + VertexOutput _e28 = out_; + const VertexOutput vertexoutput = _e28; const VertexOutput_vs_main vertexoutput_1 = { vertexoutput.world_normal, vertexoutput.world_position, vertexoutput.proj_position }; return vertexoutput_1; } @@ -95,30 +95,30 @@ float4 fs_main(FragmentInput_fs_main fragmentinput_fs_main) : SV_Target0 bool loop_init = true; while(true) { if (!loop_init) { - uint _expr40 = i; - i = (_expr40 + 1u); + uint _e40 = i; + i = (_e40 + 1u); } loop_init = false; - uint _expr7 = i; - uint _expr11 = u_globals.num_lights.x; - if ((_expr7 < min(_expr11, c_max_lights))) { + uint _e7 = i; + uint _e11 = u_globals.num_lights.x; + if ((_e7 < min(_e11, c_max_lights))) { } else { break; } { - uint _expr16 = i; - Light light = ConstructLight(float4x4(asfloat(s_lights.Load4(_expr16*96+0+0)), asfloat(s_lights.Load4(_expr16*96+0+16)), asfloat(s_lights.Load4(_expr16*96+0+32)), asfloat(s_lights.Load4(_expr16*96+0+48))), asfloat(s_lights.Load4(_expr16*96+64)), asfloat(s_lights.Load4(_expr16*96+80))); - uint _expr19 = i; - const float _e23 = fetch_shadow(_expr19, mul(in_.world_position, light.proj)); + 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)); float3 light_dir = normalize((light.pos.xyz - in_.world_position.xyz)); float diffuse = max(0.0, dot(normal_1, light_dir)); - float3 _expr37 = color; - color = (_expr37 + ((_e23 * diffuse) * light.color.xyz)); + float3 _e37 = color; + color = (_e37 + ((_e23 * diffuse) * light.color.xyz)); } } - float3 _expr42 = color; - float4 _expr47 = u_entity.color; - return (float4(_expr42, 1.0) * _expr47); + float3 _e42 = color; + float4 _e47 = u_entity.color; + return (float4(_e42, 1.0) * _e47); } float4 fs_main_without_storage(FragmentInput_fs_main_without_storage fragmentinput_fs_main_without_storage) : SV_Target0 @@ -131,28 +131,28 @@ float4 fs_main_without_storage(FragmentInput_fs_main_without_storage fragmentinp bool loop_init_1 = true; while(true) { if (!loop_init_1) { - uint _expr40 = i_1; - i_1 = (_expr40 + 1u); + uint _e40 = i_1; + i_1 = (_e40 + 1u); } loop_init_1 = false; - uint _expr7 = i_1; - uint _expr11 = u_globals.num_lights.x; - if ((_expr7 < min(_expr11, c_max_lights))) { + uint _e7 = i_1; + uint _e11 = u_globals.num_lights.x; + if ((_e7 < min(_e11, c_max_lights))) { } else { break; } { - uint _expr16 = i_1; - Light light_1 = u_lights[_expr16]; - uint _expr19 = i_1; - const float _e23 = fetch_shadow(_expr19, mul(in_1.world_position, light_1.proj)); + 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)); 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 _expr37 = color_1; - color_1 = (_expr37 + ((_e23 * diffuse_1) * light_1.color.xyz)); + float3 _e37 = color_1; + color_1 = (_e37 + ((_e23 * diffuse_1) * light_1.color.xyz)); } } - float3 _expr42 = color_1; - float4 _expr47 = u_entity.color; - return (float4(_expr42, 1.0) * _expr47); + float3 _e42 = color_1; + float4 _e47 = u_entity.color; + return (float4(_e42, 1.0) * _e47); } diff --git a/naga/tests/out/hlsl/skybox.hlsl b/naga/tests/out/hlsl/skybox.hlsl index 8dc97b1e8e..f33cc461a2 100644 --- a/naga/tests/out/hlsl/skybox.hlsl +++ b/naga/tests/out/hlsl/skybox.hlsl @@ -43,15 +43,15 @@ 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 _expr9 = tmp1_; - int _expr15 = tmp2_; - float4 pos = float4(((float(_expr9) * 4.0) - 1.0), ((float(_expr15) * 4.0) - 1.0), 0.0, 1.0); - float4 _expr27 = r_data.view[0]; - float4 _expr32 = r_data.view[1]; - float4 _expr37 = r_data.view[2]; - float3x3 inv_model_view = transpose(float3x3(_expr27.xyz, _expr32.xyz, _expr37.xyz)); - float4x4 _expr43 = r_data.proj_inv; - float4 unprojected = mul(pos, _expr43); + 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); const VertexOutput vertexoutput = ConstructVertexOutput(pos, mul(unprojected.xyz, inv_model_view)); const VertexOutput_vs_main vertexoutput_1 = { vertexoutput.uv, vertexoutput.position }; return vertexoutput_1; @@ -60,6 +60,6 @@ VertexOutput_vs_main vs_main(uint vertex_index : SV_VertexID) float4 fs_main(FragmentInput_fs_main fragmentinput_fs_main) : SV_Target0 { VertexOutput in_ = { fragmentinput_fs_main.position_1, fragmentinput_fs_main.uv_1 }; - float4 _expr4 = r_texture.Sample(r_sampler, in_.uv); - return _expr4; + float4 _e4 = r_texture.Sample(r_sampler, in_.uv); + return _e4; } diff --git a/naga/tests/out/hlsl/standard.hlsl b/naga/tests/out/hlsl/standard.hlsl index d3fd537ebe..88ba1d14b0 100644 --- a/naga/tests/out/hlsl/standard.hlsl +++ b/naga/tests/out/hlsl/standard.hlsl @@ -14,27 +14,27 @@ float4 derivatives(FragmentInput_derivatives fragmentinput_derivatives) : SV_Tar float4 y = (float4)0; float4 z = (float4)0; - float4 _expr1 = ddx_coarse(foo); - x = _expr1; - float4 _expr3 = ddy_coarse(foo); - y = _expr3; - float4 _expr5 = abs(ddx_coarse(foo)) + abs(ddy_coarse(foo)); - z = _expr5; - float4 _expr7 = ddx_fine(foo); - x = _expr7; - float4 _expr8 = ddy_fine(foo); - y = _expr8; - float4 _expr9 = abs(ddx_fine(foo)) + abs(ddy_fine(foo)); - z = _expr9; - float4 _expr10 = ddx(foo); - x = _expr10; - float4 _expr11 = ddy(foo); - y = _expr11; - float4 _expr12 = fwidth(foo); - z = _expr12; + float4 _e1 = ddx_coarse(foo); + x = _e1; + float4 _e3 = ddy_coarse(foo); + y = _e3; + float4 _e5 = abs(ddx_coarse(foo)) + abs(ddy_coarse(foo)); + z = _e5; + float4 _e7 = ddx_fine(foo); + x = _e7; + float4 _e8 = ddy_fine(foo); + y = _e8; + float4 _e9 = abs(ddx_fine(foo)) + abs(ddy_fine(foo)); + z = _e9; + float4 _e10 = ddx(foo); + x = _e10; + float4 _e11 = ddy(foo); + y = _e11; + float4 _e12 = fwidth(foo); + z = _e12; const bool _e13 = test_any_and_all_for_bool(); - float4 _expr14 = x; - float4 _expr15 = y; - float4 _expr17 = z; - return ((_expr14 + _expr15) * _expr17); + float4 _e14 = x; + float4 _e15 = y; + float4 _e17 = z; + return ((_e14 + _e15) * _e17); } diff --git a/naga/tests/out/hlsl/struct-layout.hlsl b/naga/tests/out/hlsl/struct-layout.hlsl index 34bfe269ab..59f046ded6 100644 --- a/naga/tests/out/hlsl/struct-layout.hlsl +++ b/naga/tests/out/hlsl/struct-layout.hlsl @@ -48,10 +48,10 @@ void no_padding_comp() { NoPadding x = (NoPadding)0; - NoPadding _expr2 = no_padding_uniform; - x = _expr2; - NoPadding _expr4 = ConstructNoPadding(asfloat(no_padding_storage.Load3(0)), asfloat(no_padding_storage.Load(12))); - x = _expr4; + NoPadding _e2 = no_padding_uniform; + x = _e2; + NoPadding _e4 = ConstructNoPadding(asfloat(no_padding_storage.Load3(0)), asfloat(no_padding_storage.Load(12))); + x = _e4; return; } @@ -79,9 +79,9 @@ void needs_padding_comp() { NeedsPadding x_1 = (NeedsPadding)0; - NeedsPadding _expr2 = needs_padding_uniform; - x_1 = _expr2; - NeedsPadding _expr4 = ConstructNeedsPadding(asfloat(needs_padding_storage.Load(0)), asfloat(needs_padding_storage.Load3(16)), asfloat(needs_padding_storage.Load(28))); - x_1 = _expr4; + 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; return; } diff --git a/naga/tests/out/hlsl/subgroup-operations-s.hlsl b/naga/tests/out/hlsl/subgroup-operations-s.hlsl index d963e91503..5143f66065 100644 --- a/naga/tests/out/hlsl/subgroup-operations-s.hlsl +++ b/naga/tests/out/hlsl/subgroup-operations-s.hlsl @@ -9,29 +9,29 @@ struct ComputeInput_main { void main_1() { - uint _expr5 = subgroup_size_1; - uint _expr6 = subgroup_invocation_id_1; - const uint4 _e9 = WaveActiveBallot(((_expr6 & 1u) == 1u)); + uint _e5 = subgroup_size_1; + uint _e6 = subgroup_invocation_id_1; + const uint4 _e9 = WaveActiveBallot(((_e6 & 1u) == 1u)); const uint4 _e10 = WaveActiveBallot(true); - const bool _e12 = WaveActiveAllTrue((_expr6 != 0u)); - const bool _e14 = WaveActiveAnyTrue((_expr6 == 0u)); - const uint _e15 = WaveActiveSum(_expr6); - const uint _e16 = WaveActiveProduct(_expr6); - const uint _e17 = WaveActiveMin(_expr6); - const uint _e18 = WaveActiveMax(_expr6); - const uint _e19 = WaveActiveBitAnd(_expr6); - const uint _e20 = WaveActiveBitOr(_expr6); - const uint _e21 = WaveActiveBitXor(_expr6); - const uint _e22 = WavePrefixSum(_expr6); - const uint _e23 = WavePrefixProduct(_expr6); - const uint _e24 = _expr6 + WavePrefixSum(_expr6); - const uint _e25 = _expr6 * WavePrefixProduct(_expr6); - const uint _e26 = WaveReadLaneFirst(_expr6); - const uint _e27 = WaveReadLaneAt(_expr6, 4u); - const uint _e30 = WaveReadLaneAt(_expr6, ((_expr5 - 1u) - _expr6)); - const uint _e31 = WaveReadLaneAt(_expr6, WaveGetLaneIndex() + 1u); - const uint _e32 = WaveReadLaneAt(_expr6, WaveGetLaneIndex() - 1u); - const uint _e34 = WaveReadLaneAt(_expr6, WaveGetLaneIndex() ^ (_expr5 - 1u)); + const bool _e12 = WaveActiveAllTrue((_e6 != 0u)); + const bool _e14 = WaveActiveAnyTrue((_e6 == 0u)); + const uint _e15 = WaveActiveSum(_e6); + const uint _e16 = WaveActiveProduct(_e6); + const uint _e17 = WaveActiveMin(_e6); + const uint _e18 = WaveActiveMax(_e6); + const uint _e19 = WaveActiveBitAnd(_e6); + const uint _e20 = WaveActiveBitOr(_e6); + const uint _e21 = WaveActiveBitXor(_e6); + const uint _e22 = WavePrefixSum(_e6); + const uint _e23 = WavePrefixProduct(_e6); + const uint _e24 = _e6 + WavePrefixSum(_e6); + const uint _e25 = _e6 * WavePrefixProduct(_e6); + const uint _e26 = WaveReadLaneFirst(_e6); + const uint _e27 = WaveReadLaneAt(_e6, 4u); + const uint _e30 = WaveReadLaneAt(_e6, ((_e5 - 1u) - _e6)); + const uint _e31 = WaveReadLaneAt(_e6, WaveGetLaneIndex() + 1u); + const uint _e32 = WaveReadLaneAt(_e6, WaveGetLaneIndex() - 1u); + const uint _e34 = WaveReadLaneAt(_e6, WaveGetLaneIndex() ^ (_e5 - 1u)); return; } diff --git a/naga/tests/out/hlsl/texture-arg.hlsl b/naga/tests/out/hlsl/texture-arg.hlsl index b3fac887f4..14971d6b3f 100644 --- a/naga/tests/out/hlsl/texture-arg.hlsl +++ b/naga/tests/out/hlsl/texture-arg.hlsl @@ -3,8 +3,8 @@ SamplerState Sampler : register(s1); float4 test(Texture2D Passed_Texture, SamplerState Passed_Sampler) { - float4 _expr5 = Passed_Texture.Sample(Passed_Sampler, float2(0.0, 0.0)); - return _expr5; + float4 _e5 = Passed_Texture.Sample(Passed_Sampler, float2(0.0, 0.0)); + return _e5; } float4 main() : SV_Target0 diff --git a/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl b/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl index f0f330e7cc..6564f71f72 100644 --- a/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl +++ b/naga/tests/out/hlsl/unnamed-gl-per-vertex.hlsl @@ -25,8 +25,8 @@ static int global_1 = (int)0; void function() { - int _expr9 = global_1; - global.member = float4(((_expr9 == 0) ? -4.0 : 1.0), ((_expr9 == 2) ? 4.0 : -1.0), 0.0, 1.0); + int _e9 = global_1; + global.member = float4(((_e9 == 0) ? -4.0 : 1.0), ((_e9 == 2) ? 4.0 : -1.0), 0.0, 1.0); return; } @@ -34,8 +34,8 @@ float4 main(uint param : SV_VertexID) : SV_Position { global_1 = int(param); function(); - float _expr6 = global.member.y; - global.member.y = -(_expr6); - float4 _expr8 = global.member; - return _expr8; + float _e6 = global.member.y; + global.member.y = -(_e6); + float4 _e8 = global.member; + return _e8; } diff --git a/naga/tests/out/hlsl/workgroup-uniform-load.hlsl b/naga/tests/out/hlsl/workgroup-uniform-load.hlsl index 663fe33649..d12320ecd3 100644 --- a/naga/tests/out/hlsl/workgroup-uniform-load.hlsl +++ b/naga/tests/out/hlsl/workgroup-uniform-load.hlsl @@ -10,9 +10,9 @@ void test_workgroupUniformLoad(uint3 workgroup_id : SV_GroupID, uint3 __local_in } GroupMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync(); - int _expr4 = arr_i32_[workgroup_id.x]; + int _e4 = arr_i32_[workgroup_id.x]; GroupMemoryBarrierWithGroupSync(); - if ((_expr4 > 10)) { + if ((_e4 > 10)) { GroupMemoryBarrierWithGroupSync(); return; } else { diff --git a/naga/tests/out/hlsl/workgroup-var-init.hlsl b/naga/tests/out/hlsl/workgroup-var-init.hlsl index e0bd73f8ff..49b4fe621a 100644 --- a/naga/tests/out/hlsl/workgroup-var-init.hlsl +++ b/naga/tests/out/hlsl/workgroup-var-init.hlsl @@ -14,9 +14,9 @@ void main(uint3 __local_invocation_id : SV_GroupThreadID) w_mem = (WStruct)0; } GroupMemoryBarrierWithGroupSync(); - uint _expr3[512] = w_mem.arr; + uint _e3[512] = w_mem.arr; { - uint _value2[512] = _expr3; + uint _value2[512] = _e3; output.Store(0, asuint(_value2[0])); output.Store(4, asuint(_value2[1])); output.Store(8, asuint(_value2[2]));