diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c33eef76b..acb6c87a1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,8 +68,12 @@ This feature allowed you to call `global_id` on any wgpu opaque handle to get a #### Naga +- Naga's WGSL front end now allows binary operators to produce values with abstract types, rather than concretizing thir operands. By @jimblandy in [#4850](https://github.com/gfx-rs/wgpu/pull/4850). + - Naga's WGSL front and back ends now have experimental support for 64-bit floating-point literals: `1.0lf` denotes an `f64` value. There has been experimental support for an `f64` type for a while, but until now there was no syntax for writing literals with that type. As before, Naga module validation rejects `f64` values unless `naga::valid::Capabilities::FLOAT64` is requested. By @jimblandy in [#4747](https://github.com/gfx-rs/wgpu/pull/4747). +- Naga constant evaluation can now process binary operators whose operands are both vectors. By @jimblandy in [#4861](https://github.com/gfx-rs/wgpu/pull/4861). + ### Changes - Arcanization of wgpu core resources: By @gents83 in [#3626](https://github.com/gfx-rs/wgpu/pull/3626) and thanks also to @jimblandy, @nical, @Wumpf, @Elabajaba & @cwfitzgerald @@ -155,6 +159,10 @@ Passing an owned value `window` to `Surface` will return a `Surface<'static>`. S - Emit and init `struct` member padding always. By @ErichDonGubler in [#4701](https://github.com/gfx-rs/wgpu/pull/4701). +- In WGSL output, always include the `i` suffix on `i32` literals. By @jimblandy in [#4863](https://github.com/gfx-rs/wgpu/pull/4863). + +- In WGSL output, always include the `f` suffix on `f32` literals. By @jimblandy in [#4869](https://github.com/gfx-rs/wgpu/pull/4869). + ### Bug Fixes #### General diff --git a/Cargo.lock b/Cargo.lock index fa425fa74d..63bbef62d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -185,7 +185,7 @@ dependencies = [ "argh_shared", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -241,7 +241,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -375,7 +375,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -531,7 +531,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -851,12 +851,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" +checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" dependencies = [ "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -990,7 +990,7 @@ dependencies = [ "quote", "strum", "strum_macros", - "syn 2.0.39", + "syn 2.0.41", "thiserror", ] @@ -1063,7 +1063,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -1155,7 +1155,7 @@ checksum = "3fe2568f851fd6144a45fa91cfed8fe5ca8fc0b56ba6797bfc1ed2771b90e37c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -1291,7 +1291,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -1416,7 +1416,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -2362,7 +2362,7 @@ dependencies = [ "proc-macro-crate 2.0.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -2561,7 +2561,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -2699,7 +2699,7 @@ checksum = "07c277e4e643ef00c1233393c673f655e3672cf7eb3ba08a00bdd0ea59139b5f" dependencies = [ "proc-macro-rules-macros", "proc-macro2", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -2711,7 +2711,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3040,7 +3040,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3284,7 +3284,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3300,9 +3300,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" dependencies = [ "proc-macro2", "quote", @@ -3335,7 +3335,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3459,7 +3459,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -3706,7 +3706,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", "wasm-bindgen-shared", ] @@ -3740,7 +3740,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3773,7 +3773,7 @@ checksum = "794645f5408c9a039fd09f4d113cdfb2e7eba5ff1956b07bcf701cf4b394fe89" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -4133,7 +4133,7 @@ version = "0.18.0" dependencies = [ "heck", "quote", - "syn 2.0.39", + "syn 2.0.41", ] [[package]] @@ -4622,5 +4622,5 @@ checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.41", ] diff --git a/naga/src/back/wgsl/writer.rs b/naga/src/back/wgsl/writer.rs index a356c7e2ad..25a6979515 100644 --- a/naga/src/back/wgsl/writer.rs +++ b/naga/src/back/wgsl/writer.rs @@ -1087,25 +1087,21 @@ impl Writer { use crate::Expression; match expressions[expr] { - Expression::Literal(literal) => { - match literal { - // Floats are written using `Debug` instead of `Display` because it always appends the - // decimal part even it's zero - crate::Literal::F32(value) => write!(self.out, "{:?}", value)?, - crate::Literal::U32(value) => write!(self.out, "{}u", value)?, - crate::Literal::I32(value) => write!(self.out, "{}", value)?, - crate::Literal::Bool(value) => write!(self.out, "{}", value)?, - crate::Literal::F64(value) => write!(self.out, "{:?}lf", value)?, - crate::Literal::I64(_) => { - return Err(Error::Custom("unsupported i64 literal".to_string())); - } - crate::Literal::AbstractInt(_) | crate::Literal::AbstractFloat(_) => { - return Err(Error::Custom( - "Abstract types should not appear in IR presented to backends".into(), - )); - } + Expression::Literal(literal) => match literal { + crate::Literal::F32(value) => write!(self.out, "{}f", value)?, + crate::Literal::U32(value) => write!(self.out, "{}u", value)?, + crate::Literal::I32(value) => write!(self.out, "{}i", value)?, + crate::Literal::Bool(value) => write!(self.out, "{}", value)?, + crate::Literal::F64(value) => write!(self.out, "{:?}lf", value)?, + crate::Literal::I64(_) => { + return Err(Error::Custom("unsupported i64 literal".to_string())); } - } + crate::Literal::AbstractInt(_) | crate::Literal::AbstractFloat(_) => { + return Err(Error::Custom( + "Abstract types should not appear in IR presented to backends".into(), + )); + } + }, Expression::Constant(handle) => { let constant = &module.constants[handle]; if constant.name.is_some() { diff --git a/naga/src/front/wgsl/error.rs b/naga/src/front/wgsl/error.rs index f2db433e81..5b3657f1f1 100644 --- a/naga/src/front/wgsl/error.rs +++ b/naga/src/front/wgsl/error.rs @@ -257,6 +257,18 @@ pub enum Error<'a> { source_span: Span, source_type: String, }, + AutoConversionLeafScalar { + dest_span: Span, + dest_scalar: String, + source_span: Span, + source_type: String, + }, + ConcretizationFailed { + expr_span: Span, + expr_type: String, + scalar: String, + inner: ConstantEvaluatorError, + }, } impl<'a> Error<'a> { @@ -731,7 +743,33 @@ impl<'a> Error<'a> { ) ], notes: vec![], - } + }, + Error::AutoConversionLeafScalar { dest_span, ref dest_scalar, source_span, ref source_type } => ParseError { + message: format!("automatic conversions cannot convert elements of `{source_type}` to `{dest_scalar}`"), + labels: vec![ + ( + dest_span, + format!("a value with elements of type {dest_scalar} is required here").into(), + ), + ( + source_span, + format!("this expression has type {source_type}").into(), + ) + ], + notes: vec![], + }, + Error::ConcretizationFailed { expr_span, ref expr_type, ref scalar, ref inner } => ParseError { + message: format!("failed to convert expression to a concrete type: {}", inner), + labels: vec![ + ( + expr_span, + format!("this expression has type {}", expr_type).into(), + ) + ], + notes: vec![ + format!("the expression should have been converted to have {} scalar type", scalar), + ] + }, } } } diff --git a/naga/src/front/wgsl/lower/construction.rs b/naga/src/front/wgsl/lower/construction.rs index 96cc45bfa5..e996e35227 100644 --- a/naga/src/front/wgsl/lower/construction.rs +++ b/naga/src/front/wgsl/lower/construction.rs @@ -5,7 +5,6 @@ use crate::{Handle, Span}; use crate::front::wgsl::error::Error; use crate::front::wgsl::lower::{ExpressionContext, Lowerer}; -use crate::front::wgsl::Scalar; /// A cooked form of `ast::ConstructorType` that uses Naga types whenever /// possible. @@ -300,7 +299,10 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { }, Constructor::Type((_, &crate::TypeInner::Vector { size, scalar })), ) => { - ctx.convert_slice_to_common_scalar(std::slice::from_mut(&mut component), scalar)?; + ctx.convert_slice_to_common_leaf_scalar( + std::slice::from_mut(&mut component), + scalar, + )?; expr = crate::Expression::Splat { size, value: component, @@ -316,10 +318,11 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { Constructor::PartialVector { size }, ) => { let consensus_scalar = - automatic_conversion_consensus(&components, ctx).map_err(|index| { - Error::InvalidConstructorComponentType(spans[index], index as i32) - })?; - ctx.convert_slice_to_common_scalar(&mut components, consensus_scalar)?; + ctx.automatic_conversion_consensus(&components) + .map_err(|index| { + Error::InvalidConstructorComponentType(spans[index], index as i32) + })?; + ctx.convert_slice_to_common_leaf_scalar(&mut components, consensus_scalar)?; let inner = consensus_scalar.to_inner_vector(size); let ty = ctx.ensure_type_exists(inner); expr = crate::Expression::Compose { ty, components }; @@ -343,14 +346,15 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { Constructor::PartialMatrix { columns, rows }, ) if components.len() == columns as usize * rows as usize => { let consensus_scalar = - automatic_conversion_consensus(&components, ctx).map_err(|index| { - Error::InvalidConstructorComponentType(spans[index], index as i32) - })?; + ctx.automatic_conversion_consensus(&components) + .map_err(|index| { + Error::InvalidConstructorComponentType(spans[index], index as i32) + })?; // We actually only accept floating-point elements. let consensus_scalar = consensus_scalar .automatic_conversion_combine(crate::Scalar::ABSTRACT_FLOAT) .unwrap_or(consensus_scalar); - ctx.convert_slice_to_common_scalar(&mut components, consensus_scalar)?; + ctx.convert_slice_to_common_leaf_scalar(&mut components, consensus_scalar)?; let vec_ty = ctx.ensure_type_exists(consensus_scalar.to_inner_vector(rows)); let components = components @@ -420,10 +424,11 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { Constructor::PartialMatrix { columns, rows }, ) => { let consensus_scalar = - automatic_conversion_consensus(&components, ctx).map_err(|index| { - Error::InvalidConstructorComponentType(spans[index], index as i32) - })?; - ctx.convert_slice_to_common_scalar(&mut components, consensus_scalar)?; + ctx.automatic_conversion_consensus(&components) + .map_err(|index| { + Error::InvalidConstructorComponentType(spans[index], index as i32) + })?; + ctx.convert_slice_to_common_leaf_scalar(&mut components, consensus_scalar)?; let ty = ctx.ensure_type_exists(crate::TypeInner::Matrix { columns, rows, @@ -456,10 +461,10 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { // Array constructor - infer type (components, Constructor::PartialArray) => { let mut components = components.into_components_vec(); - if let Ok(consensus_scalar) = automatic_conversion_consensus(&components, ctx) { + if let Ok(consensus_scalar) = ctx.automatic_conversion_consensus(&components) { // Note that this will *not* necessarily convert all the // components to the same type! The `automatic_conversion_consensus` - // function only considers the parameters' leaf scalar + // method only considers the parameters' leaf scalar // types; the parameters themselves could be any mix of // vectors, matrices, and scalars. // @@ -471,7 +476,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { // do. And if this array construction is not well-typed, // these conversions will not make it so, and we can let // validation catch the error. - ctx.convert_slice_to_common_scalar(&mut components, consensus_scalar)?; + ctx.convert_slice_to_common_leaf_scalar(&mut components, consensus_scalar)?; } else { // There's no consensus scalar. Emit the `Compose` // expression anyway, and let validation catch the problem. @@ -609,50 +614,3 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { Ok(handle) } } - -/// Find the consensus scalar of `components` under WGSL's automatic -/// conversions. -/// -/// If `components` can all be converted to any common scalar via -/// WGSL's automatic conversions, return the best such scalar. -/// -/// The `components` slice must not be empty. All elements' types must -/// have been resolved. -/// -/// If `components` are definitely not acceptable as arguments to such -/// constructors, return `Err(i)`, where `i` is the index in -/// `components` of some problematic argument. -/// -/// This function doesn't fully type-check the arguments - it only -/// considers their leaf scalar types. This means it may return `Ok` -/// even when the Naga validator will reject the resulting -/// construction expression later. -fn automatic_conversion_consensus( - components: &[Handle], - ctx: &ExpressionContext<'_, '_, '_>, -) -> Result { - let types = &ctx.module.types; - let mut inners = components - .iter() - .map(|&c| ctx.typifier()[c].inner_with(types)); - log::debug!( - "wgsl automatic_conversion_consensus: {:?}", - inners - .clone() - .map(|inner| inner.to_wgsl(&ctx.module.to_ctx())) - .collect::>() - ); - let mut best = inners.next().unwrap().scalar().ok_or(0_usize)?; - for (inner, i) in inners.zip(1..) { - let scalar = inner.scalar().ok_or(i)?; - match best.automatic_conversion_combine(scalar) { - Some(new_best) => { - best = new_best; - } - None => return Err(i), - } - } - - log::debug!(" consensus: {:?}", best.to_wgsl()); - Ok(best) -} diff --git a/naga/src/front/wgsl/lower/conversion.rs b/naga/src/front/wgsl/lower/conversion.rs index 0819c13a66..2a2690f096 100644 --- a/naga/src/front/wgsl/lower/conversion.rs +++ b/naga/src/front/wgsl/lower/conversion.rs @@ -51,21 +51,80 @@ impl<'source, 'temp, 'out> super::ExpressionContext<'source, 'temp, 'out> { } }; - let converted = if let crate::TypeInner::Array { .. } = *goal_inner { - let span = self.get_expression_span(expr); + self.convert_leaf_scalar(expr, expr_span, goal_scalar) + } + + /// Try to convert `expr`'s leaf scalar to `goal` using automatic conversions. + /// + /// If no conversions are necessary, return `expr` unchanged. + /// + /// If automatic conversions cannot convert `expr` to `goal_scalar`, return + /// an [`AutoConversionLeafScalar`] error. + /// + /// Although the Load Rule is one of the automatic conversions, this + /// function assumes it has already been applied if appropriate, as + /// indicated by the fact that the Rust type of `expr` is not `Typed<_>`. + /// + /// [`AutoConversionLeafScalar`]: super::Error::AutoConversionLeafScalar + pub fn try_automatic_conversion_for_leaf_scalar( + &mut self, + expr: Handle, + goal_scalar: crate::Scalar, + goal_span: Span, + ) -> Result, super::Error<'source>> { + let expr_span = self.get_expression_span(expr); + let expr_resolution = super::resolve!(self, expr); + let types = &self.module.types; + let expr_inner = expr_resolution.inner_with(types); + + let make_error = || { + let gctx = &self.module.to_ctx(); + let source_type = expr_resolution.to_wgsl(gctx); + super::Error::AutoConversionLeafScalar { + dest_span: goal_span, + dest_scalar: goal_scalar.to_wgsl(), + source_span: expr_span, + source_type, + } + }; + + let expr_scalar = match expr_inner.scalar() { + Some(scalar) => scalar, + None => return Err(make_error()), + }; + + if expr_scalar == goal_scalar { + return Ok(expr); + } + + if !expr_scalar.automatically_converts_to(goal_scalar) { + return Err(make_error()); + } + + assert!(expr_scalar.is_abstract()); + + self.convert_leaf_scalar(expr, expr_span, goal_scalar) + } + + fn convert_leaf_scalar( + &mut self, + expr: Handle, + expr_span: Span, + goal_scalar: crate::Scalar, + ) -> Result, super::Error<'source>> { + let expr_inner = super::resolve_inner!(self, expr); + if let crate::TypeInner::Array { .. } = *expr_inner { self.as_const_evaluator() - .cast_array(expr, goal_scalar, span) - .map_err(|err| super::Error::ConstantEvaluatorError(err, span))? + .cast_array(expr, goal_scalar, expr_span) + .map_err(|err| super::Error::ConstantEvaluatorError(err, expr_span)) } else { let cast = crate::Expression::As { expr, kind: goal_scalar.kind, convert: Some(goal_scalar.width), }; - self.append_expression(cast, expr_span)? - }; - - Ok(converted) + self.append_expression(cast, expr_span) + } } /// Try to convert `exprs` to `goal_ty` using WGSL's automatic conversions. @@ -130,6 +189,28 @@ impl<'source, 'temp, 'out> super::ExpressionContext<'source, 'temp, 'out> { Ok(()) } + /// Convert `expr` to the leaf scalar type `scalar`. + pub fn convert_to_leaf_scalar( + &mut self, + expr: &mut Handle, + goal: crate::Scalar, + ) -> Result<(), super::Error<'source>> { + let inner = super::resolve_inner!(self, *expr); + // Do nothing if `inner` doesn't even have leaf scalars; + // it's a type error that validation will catch. + if inner.scalar() != Some(goal) { + let cast = crate::Expression::As { + expr: *expr, + kind: goal.kind, + convert: Some(goal.width), + }; + let expr_span = self.get_expression_span(*expr); + *expr = self.append_expression(cast, expr_span)?; + } + + Ok(()) + } + /// Convert all expressions in `exprs` to a common scalar type. /// /// Note that the caller is responsible for making sure these @@ -140,24 +221,13 @@ impl<'source, 'temp, 'out> super::ExpressionContext<'source, 'temp, 'out> { /// themselves whether the casts we we generate are justified, /// perhaps by calling `TypeInner::automatically_converts_to` or /// `Scalar::automatic_conversion_combine`. - pub fn convert_slice_to_common_scalar( + pub fn convert_slice_to_common_leaf_scalar( &mut self, exprs: &mut [Handle], goal: crate::Scalar, ) -> Result<(), super::Error<'source>> { for expr in exprs.iter_mut() { - let inner = super::resolve_inner!(self, *expr); - // Do nothing if `inner` doesn't even have leaf scalars; - // it's a type error that validation will catch. - if inner.scalar() != Some(goal) { - let cast = crate::Expression::As { - expr: *expr, - kind: goal.kind, - convert: Some(goal.width), - }; - let expr_span = self.get_expression_span(*expr); - *expr = self.append_expression(cast, expr_span)?; - } + self.convert_to_leaf_scalar(expr, goal)?; } Ok(()) @@ -174,16 +244,79 @@ impl<'source, 'temp, 'out> super::ExpressionContext<'source, 'temp, 'out> { if let Some(scalar) = inner.automatically_convertible_scalar(&self.module.types) { let concretized = scalar.concretize(); if concretized != scalar { - let span = self.get_expression_span(expr); + assert!(scalar.is_abstract()); + let expr_span = self.get_expression_span(expr); expr = self .as_const_evaluator() - .cast_array(expr, concretized, span) - .map_err(|err| super::Error::ConstantEvaluatorError(err, span))?; + .cast_array(expr, concretized, expr_span) + .map_err(|err| { + // A `TypeResolution` includes the type's full name, if + // it has one. Also, avoid holding the borrow of `inner` + // across the call to `cast_array`. + let expr_type = &self.typifier()[expr]; + super::Error::ConcretizationFailed { + expr_span, + expr_type: expr_type.to_wgsl(&self.module.to_ctx()), + scalar: concretized.to_wgsl(), + inner: err, + } + })?; } } Ok(expr) } + + /// Find the consensus scalar of `components` under WGSL's automatic + /// conversions. + /// + /// If `components` can all be converted to any common scalar via + /// WGSL's automatic conversions, return the best such scalar. + /// + /// The `components` slice must not be empty. All elements' types must + /// have been resolved. + /// + /// If `components` are definitely not acceptable as arguments to such + /// constructors, return `Err(i)`, where `i` is the index in + /// `components` of some problematic argument. + /// + /// This function doesn't fully type-check the arguments - it only + /// considers their leaf scalar types. This means it may return `Ok` + /// even when the Naga validator will reject the resulting + /// construction expression later. + pub fn automatic_conversion_consensus<'handle, I>( + &self, + components: I, + ) -> Result + where + I: IntoIterator>, + I::IntoIter: Clone, // for debugging + { + let types = &self.module.types; + let mut inners = components + .into_iter() + .map(|&c| self.typifier()[c].inner_with(types)); + log::debug!( + "wgsl automatic_conversion_consensus: {:?}", + inners + .clone() + .map(|inner| inner.to_wgsl(&self.module.to_ctx())) + .collect::>() + ); + let mut best = inners.next().unwrap().scalar().ok_or(0_usize)?; + for (inner, i) in inners.zip(1..) { + let scalar = inner.scalar().ok_or(i)?; + match best.automatic_conversion_combine(scalar) { + Some(new_best) => { + best = new_best; + } + None => return Err(i), + } + } + + log::debug!(" consensus: {:?}", best.to_wgsl()); + Ok(best) + } } impl crate::TypeInner { @@ -354,6 +487,11 @@ impl crate::Scalar { } } + /// Return `true` if automatic conversions will covert `self` to `goal`. + pub fn automatically_converts_to(self, goal: Self) -> bool { + self.automatic_conversion_combine(goal) == Some(goal) + } + const fn concretize(self) -> Self { use crate::ScalarKind as Sk; match self.kind { diff --git a/naga/src/front/wgsl/lower/mod.rs b/naga/src/front/wgsl/lower/mod.rs index 6486e6cf6b..a4a49da061 100644 --- a/naga/src/front/wgsl/lower/mod.rs +++ b/naga/src/front/wgsl/lower/mod.rs @@ -1602,11 +1602,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { return Ok(Typed::Reference(pointer)); } ast::Expression::Binary { op, left, right } => { - // Load both operands. - let mut left = self.expression(left, ctx)?; - let mut right = self.expression(right, ctx)?; - ctx.binary_op_splat(op, &mut left, &mut right)?; - Typed::Plain(crate::Expression::Binary { op, left, right }) + self.binary(op, left, right, span, ctx)? } ast::Expression::Call { ref function, @@ -1737,6 +1733,52 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { expr.try_map(|handle| ctx.append_expression(handle, span)) } + fn binary( + &mut self, + op: crate::BinaryOperator, + left: Handle>, + right: Handle>, + span: Span, + ctx: &mut ExpressionContext<'source, '_, '_>, + ) -> Result, Error<'source>> { + // Load both operands. + let mut left = self.expression_for_abstract(left, ctx)?; + let mut right = self.expression_for_abstract(right, ctx)?; + + // Convert `scalar op vector` to `vector op vector` by introducing + // `Splat` expressions. + ctx.binary_op_splat(op, &mut left, &mut right)?; + + // Apply automatic conversions. + match op { + // Shift operators require the right operand to be `u32` or + // `vecN`. We can let the validator sort out vector length + // issues, but the right operand must be, or convert to, a u32 leaf + // scalar. + crate::BinaryOperator::ShiftLeft | crate::BinaryOperator::ShiftRight => { + right = + ctx.try_automatic_conversion_for_leaf_scalar(right, crate::Scalar::U32, span)?; + } + + // All other operators follow the same pattern: reconcile the + // scalar leaf types. If there's no reconciliation possible, + // leave the expressions as they are: validation will report the + // problem. + _ => { + ctx.grow_types(left)?; + ctx.grow_types(right)?; + if let Ok(consensus_scalar) = + ctx.automatic_conversion_consensus([left, right].iter()) + { + ctx.convert_to_leaf_scalar(&mut left, consensus_scalar)?; + ctx.convert_to_leaf_scalar(&mut right, consensus_scalar)?; + } + } + } + + Ok(Typed::Plain(crate::Expression::Binary { op, left, right })) + } + /// Generate Naga IR for call expressions and statements, and type /// constructor expressions. /// diff --git a/naga/src/proc/constant_evaluator.rs b/naga/src/proc/constant_evaluator.rs index 826cb1da0d..81bcb35e58 100644 --- a/naga/src/proc/constant_evaluator.rs +++ b/naga/src/proc/constant_evaluator.rs @@ -141,7 +141,7 @@ pub enum ConstantEvaluatorError { InvalidAccessIndexTy, #[error("Constants don't support array length expressions")] ArrayLength, - #[error("Cannot cast type `{from}` to `{to}`")] + #[error("Cannot cast scalar components of expression `{from}` to type `{to}`")] InvalidCastArg { from: String, to: String }, #[error("Cannot apply the unary op to the argument")] InvalidUnaryOpArg, @@ -989,15 +989,11 @@ impl<'a> ConstantEvaluator<'a> { let expr = self.eval_zero_value(expr, span)?; let make_error = || -> Result<_, ConstantEvaluatorError> { - let ty = self.resolve_type(expr)?; + let from = format!("{:?} {:?}", expr, self.expressions[expr]); - #[cfg(feature = "wgsl-in")] - let from = ty.to_wgsl(&self.to_ctx()); #[cfg(feature = "wgsl-in")] let to = target.to_wgsl(); - #[cfg(not(feature = "wgsl-in"))] - let from = format!("{ty:?}"); #[cfg(not(feature = "wgsl-in"))] let to = format!("{target:?}"); @@ -1325,6 +1321,47 @@ impl<'a> ConstantEvaluator<'a> { BinaryOperator::Modulo => a % b, _ => return Err(ConstantEvaluatorError::InvalidBinaryOpArgs), }), + (Literal::AbstractInt(a), Literal::AbstractInt(b)) => { + Literal::AbstractInt(match op { + BinaryOperator::Add => a.checked_add(b).ok_or_else(|| { + ConstantEvaluatorError::Overflow("addition".into()) + })?, + BinaryOperator::Subtract => a.checked_sub(b).ok_or_else(|| { + ConstantEvaluatorError::Overflow("subtraction".into()) + })?, + BinaryOperator::Multiply => a.checked_mul(b).ok_or_else(|| { + ConstantEvaluatorError::Overflow("multiplication".into()) + })?, + BinaryOperator::Divide => a.checked_div(b).ok_or_else(|| { + if b == 0 { + ConstantEvaluatorError::DivisionByZero + } else { + ConstantEvaluatorError::Overflow("division".into()) + } + })?, + BinaryOperator::Modulo => a.checked_rem(b).ok_or_else(|| { + if b == 0 { + ConstantEvaluatorError::RemainderByZero + } else { + ConstantEvaluatorError::Overflow("remainder".into()) + } + })?, + BinaryOperator::And => a & b, + BinaryOperator::ExclusiveOr => a ^ b, + BinaryOperator::InclusiveOr => a | b, + _ => return Err(ConstantEvaluatorError::InvalidBinaryOpArgs), + }) + } + (Literal::AbstractFloat(a), Literal::AbstractFloat(b)) => { + Literal::AbstractFloat(match op { + BinaryOperator::Add => a + b, + BinaryOperator::Subtract => a - b, + BinaryOperator::Multiply => a * b, + BinaryOperator::Divide => a / b, + BinaryOperator::Modulo => a % b, + _ => return Err(ConstantEvaluatorError::InvalidBinaryOpArgs), + }) + } (Literal::Bool(a), Literal::Bool(b)) => Literal::Bool(match op { BinaryOperator::LogicalAnd => a && b, BinaryOperator::LogicalOr => a || b, @@ -1361,12 +1398,107 @@ impl<'a> ConstantEvaluator<'a> { } Expression::Compose { ty, components } } + ( + &Expression::Compose { + components: ref left_components, + ty: left_ty, + }, + &Expression::Compose { + components: ref right_components, + ty: right_ty, + }, + ) => { + // We have to make a copy of the component lists, because the + // call to `binary_op_vector` needs `&mut self`, but `self` owns + // the component lists. + let left_flattened = crate::proc::flatten_compose( + left_ty, + left_components, + self.expressions, + self.types, + ); + let right_flattened = crate::proc::flatten_compose( + right_ty, + right_components, + self.expressions, + self.types, + ); + + // `flatten_compose` doesn't return an `ExactSizeIterator`, so + // make a reasonable guess of the capacity we'll need. + let mut flattened = Vec::with_capacity(left_components.len()); + flattened.extend(left_flattened.zip(right_flattened)); + + match (&self.types[left_ty].inner, &self.types[right_ty].inner) { + ( + &TypeInner::Vector { + size: left_size, .. + }, + &TypeInner::Vector { + size: right_size, .. + }, + ) if left_size == right_size => { + self.binary_op_vector(op, left_size, &flattened, left_ty, span)? + } + _ => return Err(ConstantEvaluatorError::InvalidBinaryOpArgs), + } + } _ => return Err(ConstantEvaluatorError::InvalidBinaryOpArgs), }; self.register_evaluated_expr(expr, span) } + fn binary_op_vector( + &mut self, + op: BinaryOperator, + size: crate::VectorSize, + components: &[(Handle, Handle)], + left_ty: Handle, + span: Span, + ) -> Result { + let ty = match op { + // Relational operators produce vectors of booleans. + BinaryOperator::Equal + | BinaryOperator::NotEqual + | BinaryOperator::Less + | BinaryOperator::LessEqual + | BinaryOperator::Greater + | BinaryOperator::GreaterEqual => self.types.insert( + Type { + name: None, + inner: TypeInner::Vector { + size, + scalar: crate::Scalar::BOOL, + }, + }, + span, + ), + + // Other operators produce the same type as their left + // operand. + BinaryOperator::Add + | BinaryOperator::Subtract + | BinaryOperator::Multiply + | BinaryOperator::Divide + | BinaryOperator::Modulo + | BinaryOperator::And + | BinaryOperator::ExclusiveOr + | BinaryOperator::InclusiveOr + | BinaryOperator::LogicalAnd + | BinaryOperator::LogicalOr + | BinaryOperator::ShiftLeft + | BinaryOperator::ShiftRight => left_ty, + }; + + let components = components + .iter() + .map(|&(left, right)| self.binary_op(op, left, right, span)) + .collect::, _>>()?; + + Ok(Expression::Compose { ty, components }) + } + /// Deep copy `expr` from `expressions` into `self.expressions`. /// /// Return the root of the new copy. @@ -1455,7 +1587,10 @@ impl<'a> ConstantEvaluator<'a> { }; Tr::Value(TypeInner::Vector { scalar, size }) } - _ => return Err(ConstantEvaluatorError::SubexpressionsAreNotConstant), + _ => { + log::debug!("resolve_type: SubexpressionsAreNotConstant"); + return Err(ConstantEvaluatorError::SubexpressionsAreNotConstant); + } }; Ok(resolution) diff --git a/naga/src/proc/mod.rs b/naga/src/proc/mod.rs index e375bb1af3..deddc7033d 100644 --- a/naga/src/proc/mod.rs +++ b/naga/src/proc/mod.rs @@ -115,6 +115,16 @@ impl super::Scalar { width: crate::ABSTRACT_WIDTH, }; + pub const fn is_abstract(self) -> bool { + match self.kind { + crate::ScalarKind::AbstractInt | crate::ScalarKind::AbstractFloat => true, + crate::ScalarKind::Sint + | crate::ScalarKind::Uint + | crate::ScalarKind::Float + | crate::ScalarKind::Bool => false, + } + } + /// Construct a float `Scalar` with the given width. /// /// This is especially common when dealing with diff --git a/naga/src/valid/compose.rs b/naga/src/valid/compose.rs index bbb0d61d2a..c21e98c6f2 100644 --- a/naga/src/valid/compose.rs +++ b/naga/src/valid/compose.rs @@ -32,7 +32,12 @@ pub fn validate_compose( scalar: comp_scalar, } if comp_scalar == scalar => comp_size as u32, ref other => { - log::error!("Vector component[{}] type {:?}", index, other); + log::error!( + "Vector component[{}] type {:?}, building {:?}", + index, + other, + scalar + ); return Err(ComposeError::ComponentType { index: index as u32, }); diff --git a/naga/tests/in/abstract-types-operators.wgsl b/naga/tests/in/abstract-types-operators.wgsl new file mode 100644 index 0000000000..2c06ef43e4 --- /dev/null +++ b/naga/tests/in/abstract-types-operators.wgsl @@ -0,0 +1,45 @@ +const plus_fafaf: f32 = 1.0 + 2.0; +const plus_fafai: f32 = 1.0 + 2; +const plus_faf_f: f32 = 1.0 + 2f; +const plus_faiaf: f32 = 1 + 2.0; +const plus_faiai: f32 = 1 + 2; +const plus_fai_f: f32 = 1 + 2f; +const plus_f_faf: f32 = 1f + 2.0; +const plus_f_fai: f32 = 1f + 2; +const plus_f_f_f: f32 = 1f + 2f; + +const plus_iaiai: i32 = 1 + 2; +const plus_iai_i: i32 = 1 + 2i; +const plus_i_iai: i32 = 1i + 2; +const plus_i_i_i: i32 = 1i + 2i; + +const plus_uaiai: u32 = 1 + 2; +const plus_uai_u: u32 = 1 + 2u; +const plus_u_uai: u32 = 1u + 2; +const plus_u_u_u: u32 = 1u + 2u; + +fn runtime_values() { + var f: f32 = 42; + var i: i32 = 43; + var u: u32 = 44; + + var plus_fafaf: f32 = 1.0 + 2.0; + var plus_fafai: f32 = 1.0 + 2; + var plus_faf_f: f32 = 1.0 + f; + var plus_faiaf: f32 = 1 + 2.0; + var plus_faiai: f32 = 1 + 2; + var plus_fai_f: f32 = 1 + f; + var plus_f_faf: f32 = f + 2.0; + var plus_f_fai: f32 = f + 2; + var plus_f_f_f: f32 = f + f; + + var plus_iaiai: i32 = 1 + 2; + var plus_iai_i: i32 = 1 + i; + var plus_i_iai: i32 = i + 2; + var plus_i_i_i: i32 = i + i; + + var plus_uaiai: u32 = 1 + 2; + var plus_uai_u: u32 = 1 + u; + var plus_u_uai: u32 = u + 2; + var plus_u_u_u: u32 = u + u; +} diff --git a/naga/tests/in/const-exprs.wgsl b/naga/tests/in/const-exprs.wgsl index 9465d7a515..ee9304ce45 100644 --- a/naga/tests/in/const-exprs.wgsl +++ b/naga/tests/in/const-exprs.wgsl @@ -84,3 +84,6 @@ fn map_texture_kind(texture_kind: i32) -> u32 { fn compose_of_splat() { var x = vec4f(vec3f(1.0), 2.0).wzyx; } + +const add_vec = vec2(1.0f) + vec2(3.0f, 4.0f); +const compare_vec = vec2(3.0f) == vec2(3.0f, 4.0f); diff --git a/naga/tests/in/operators.wgsl b/naga/tests/in/operators.wgsl index 40d1ce8ead..293b84ab11 100644 --- a/naga/tests/in/operators.wgsl +++ b/naga/tests/in/operators.wgsl @@ -21,9 +21,9 @@ fn builtins() -> vec4 { return vec4(vec4(s1) + v_i32_zero) + s2 + m1 + m2 + b1 + b2; } -fn splat() -> vec4 { - let a = (1.0 + vec2(2.0) - 3.0) / 4.0; - let b = vec4(5) % 2; +fn splat(m: f32, n: i32) -> vec4 { + let a = (2.0 + vec2(m) - 4.0) / 8.0; + let b = vec4(n) % 2; return a.xyxy + vec4(b); } @@ -280,9 +280,9 @@ fn assignment() { } @compute @workgroup_size(1) -fn main() { +fn main(@builtin(workgroup_id) id: vec3) { builtins(); - splat(); + splat(f32(id.x), i32(id.y)); bool_cast(v_f32_one.xyz); logical(); diff --git a/naga/tests/out/glsl/const-exprs.main.Compute.glsl b/naga/tests/out/glsl/const-exprs.main.Compute.glsl index 85a7d01773..b095345de9 100644 --- a/naga/tests/out/glsl/const-exprs.main.Compute.glsl +++ b/naga/tests/out/glsl/const-exprs.main.Compute.glsl @@ -17,6 +17,8 @@ const vec4 DIV = vec4(0.44444445, 0.0, 0.0, 0.0); const int TEXTURE_KIND_REGULAR = 0; const int TEXTURE_KIND_WARP = 1; const int TEXTURE_KIND_SKY = 2; +const vec2 add_vec = vec2(4.0, 5.0); +const bvec2 compare_vec = bvec2(true, false); void swizzle_of_compose() { diff --git a/naga/tests/out/glsl/operators.main.Compute.glsl b/naga/tests/out/glsl/operators.main.Compute.glsl index 83dd56f8a4..006bce205e 100644 --- a/naga/tests/out/glsl/operators.main.Compute.glsl +++ b/naga/tests/out/glsl/operators.main.Compute.glsl @@ -23,9 +23,9 @@ vec4 builtins() { return (((((vec4((ivec4(s1_) + v_i32_zero)) + s2_) + m1_) + m2_) + vec4(b1_)) + b2_); } -vec4 splat() { - vec2 a_2 = (((vec2(1.0) + vec2(2.0)) - vec2(3.0)) / vec2(4.0)); - ivec4 b = (ivec4(5) % ivec4(2)); +vec4 splat(float m, int n) { + vec2 a_2 = (((vec2(2.0) + vec2(m)) - vec2(4.0)) / vec2(8.0)); + ivec4 b = (ivec4(n) % ivec4(2)); return (a_2.xyxy + vec4(b)); } @@ -247,9 +247,10 @@ void negation_avoids_prefix_decrement() { } void main() { - vec4 _e0 = builtins(); - vec4 _e1 = splat(); - vec3 _e6 = bool_cast(vec3(1.0, 1.0, 1.0)); + uvec3 id = gl_WorkGroupID; + vec4 _e1 = builtins(); + vec4 _e6 = splat(float(id.x), int(id.y)); + vec3 _e11 = bool_cast(vec3(1.0, 1.0, 1.0)); logical(); arithmetic(); bit(); diff --git a/naga/tests/out/hlsl/const-exprs.hlsl b/naga/tests/out/hlsl/const-exprs.hlsl index b9a2d1c905..4cc2491ce8 100644 --- a/naga/tests/out/hlsl/const-exprs.hlsl +++ b/naga/tests/out/hlsl/const-exprs.hlsl @@ -10,6 +10,8 @@ static const float4 DIV = float4(0.44444445, 0.0, 0.0, 0.0); static const int TEXTURE_KIND_REGULAR = 0; static const int TEXTURE_KIND_WARP = 1; static const int TEXTURE_KIND_SKY = 2; +static const float2 add_vec = float2(4.0, 5.0); +static const bool2 compare_vec = bool2(true, false); void swizzle_of_compose() { diff --git a/naga/tests/out/hlsl/operators.hlsl b/naga/tests/out/hlsl/operators.hlsl index 6d18d07ed6..58ec5a170d 100644 --- a/naga/tests/out/hlsl/operators.hlsl +++ b/naga/tests/out/hlsl/operators.hlsl @@ -16,10 +16,10 @@ float4 builtins() return (((((float4(((s1_).xxxx + v_i32_zero)) + s2_) + m1_) + m2_) + (b1_).xxxx) + b2_); } -float4 splat() +float4 splat(float m, int n) { - float2 a_2 = ((((1.0).xx + (2.0).xx) - (3.0).xx) / (4.0).xx); - int4 b = ((5).xxxx % (2).xxxx); + float2 a_2 = ((((2.0).xx + (m).xx) - (4.0).xx) / (8.0).xx); + int4 b = ((n).xxxx % (2).xxxx); return (a_2.xyxy + float4(b)); } @@ -251,11 +251,11 @@ void negation_avoids_prefix_decrement() } [numthreads(1, 1, 1)] -void main() +void main(uint3 id : SV_GroupID) { - const float4 _e0 = builtins(); - const float4 _e1 = splat(); - const float3 _e6 = bool_cast(float3(1.0, 1.0, 1.0)); + const float4 _e1 = builtins(); + const float4 _e6 = splat(float(id.x), int(id.y)); + const float3 _e11 = bool_cast(float3(1.0, 1.0, 1.0)); logical(); arithmetic(); bit(); diff --git a/naga/tests/out/msl/abstract-types-operators.msl b/naga/tests/out/msl/abstract-types-operators.msl new file mode 100644 index 0000000000..b018573152 --- /dev/null +++ b/naga/tests/out/msl/abstract-types-operators.msl @@ -0,0 +1,73 @@ +// language: metal1.0 +#include +#include + +using metal::uint; + +constant float plus_fafaf_1 = 3.0; +constant float plus_fafai_1 = 3.0; +constant float plus_faf_f_1 = 3.0; +constant float plus_faiaf_1 = 3.0; +constant float plus_faiai_1 = 3.0; +constant float plus_fai_f_1 = 3.0; +constant float plus_f_faf_1 = 3.0; +constant float plus_f_fai_1 = 3.0; +constant float plus_f_f_f_1 = 3.0; +constant int plus_iaiai_1 = 3; +constant int plus_iai_i_1 = 3; +constant int plus_i_iai_1 = 3; +constant int plus_i_i_i_1 = 3; +constant uint plus_uaiai_1 = 3u; +constant uint plus_uai_u_1 = 3u; +constant uint plus_u_uai_1 = 3u; +constant uint plus_u_u_u_1 = 3u; + +void runtime_values( +) { + float f = 42.0; + int i = 43; + uint u = 44u; + float plus_fafaf = 3.0; + float plus_fafai = 3.0; + float plus_faf_f = {}; + float plus_faiaf = 3.0; + float plus_faiai = 3.0; + float plus_fai_f = {}; + float plus_f_faf = {}; + float plus_f_fai = {}; + float plus_f_f_f = {}; + int plus_iaiai = 3; + int plus_iai_i = {}; + int plus_i_iai = {}; + int plus_i_i_i = {}; + uint plus_uaiai = 3u; + uint plus_uai_u = {}; + uint plus_u_uai = {}; + uint plus_u_u_u = {}; + float _e8 = f; + plus_faf_f = 1.0 + _e8; + float _e14 = f; + plus_fai_f = 1.0 + _e14; + float _e18 = f; + plus_f_faf = _e18 + 2.0; + float _e22 = f; + plus_f_fai = _e22 + 2.0; + float _e26 = f; + float _e27 = f; + plus_f_f_f = _e26 + _e27; + int _e31 = i; + plus_iai_i = 1 + _e31; + int _e35 = i; + plus_i_iai = _e35 + 2; + int _e39 = i; + int _e40 = i; + plus_i_i_i = _e39 + _e40; + uint _e44 = u; + plus_uai_u = 1u + _e44; + uint _e48 = u; + plus_u_uai = _e48 + 2u; + uint _e52 = u; + uint _e53 = u; + plus_u_u_u = _e52 + _e53; + return; +} diff --git a/naga/tests/out/msl/const-exprs.msl b/naga/tests/out/msl/const-exprs.msl index 33e281f37c..7798ae62b3 100644 --- a/naga/tests/out/msl/const-exprs.msl +++ b/naga/tests/out/msl/const-exprs.msl @@ -16,6 +16,8 @@ constant metal::float4 DIV = metal::float4(0.44444445, 0.0, 0.0, 0.0); constant int TEXTURE_KIND_REGULAR = 0; constant int TEXTURE_KIND_WARP = 1; constant int TEXTURE_KIND_SKY = 2; +constant metal::float2 add_vec = metal::float2(4.0, 5.0); +constant metal::bool2 compare_vec = metal::bool2(true, false); void swizzle_of_compose( ) { diff --git a/naga/tests/out/msl/operators.msl b/naga/tests/out/msl/operators.msl index 960a87f01c..85fba28c33 100644 --- a/naga/tests/out/msl/operators.msl +++ b/naga/tests/out/msl/operators.msl @@ -23,9 +23,11 @@ metal::float4 builtins( } metal::float4 splat( + float m, + int n ) { - metal::float2 a_2 = ((metal::float2(1.0) + metal::float2(2.0)) - metal::float2(3.0)) / metal::float2(4.0); - metal::int4 b = metal::int4(5) % metal::int4(2); + metal::float2 a_2 = ((metal::float2(2.0) + metal::float2(m)) - metal::float2(4.0)) / metal::float2(8.0); + metal::int4 b = metal::int4(n) % metal::int4(2); return a_2.xyxy + static_cast(b); } @@ -255,11 +257,14 @@ void negation_avoids_prefix_decrement( int p7_ = -(-(-(-(-(1))))); } +struct main_Input { +}; kernel void main_( + metal::uint3 id [[threadgroup_position_in_grid]] ) { - metal::float4 _e0 = builtins(); - metal::float4 _e1 = splat(); - metal::float3 _e6 = bool_cast(metal::float3(1.0, 1.0, 1.0)); + metal::float4 _e1 = builtins(); + metal::float4 _e6 = splat(static_cast(id.x), static_cast(id.y)); + metal::float3 _e11 = bool_cast(metal::float3(1.0, 1.0, 1.0)); logical(); arithmetic(); bit(); diff --git a/naga/tests/out/spv/abstract-types-operators.spvasm b/naga/tests/out/spv/abstract-types-operators.spvasm new file mode 100644 index 0000000000..ea9f858295 --- /dev/null +++ b/naga/tests/out/spv/abstract-types-operators.spvasm @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.1 +; Generator: rspirv +; Bound: 81 +OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +%2 = OpTypeVoid +%3 = OpTypeFloat 32 +%4 = OpTypeInt 32 1 +%5 = OpTypeInt 32 0 +%6 = OpConstant %3 3.0 +%7 = OpConstant %4 3 +%8 = OpConstant %5 3 +%11 = OpTypeFunction %2 +%12 = OpConstant %3 42.0 +%13 = OpConstant %4 43 +%14 = OpConstant %5 44 +%15 = OpConstant %3 1.0 +%16 = OpConstant %3 2.0 +%17 = OpConstant %4 1 +%18 = OpConstant %4 2 +%19 = OpConstant %5 1 +%20 = OpConstant %5 2 +%22 = OpTypePointer Function %3 +%24 = OpTypePointer Function %4 +%26 = OpTypePointer Function %5 +%30 = OpConstantNull %3 +%34 = OpConstantNull %3 +%36 = OpConstantNull %3 +%38 = OpConstantNull %3 +%40 = OpConstantNull %3 +%43 = OpConstantNull %4 +%45 = OpConstantNull %4 +%47 = OpConstantNull %4 +%50 = OpConstantNull %5 +%52 = OpConstantNull %5 +%54 = OpConstantNull %5 +%10 = OpFunction %2 None %11 +%9 = OpLabel +%53 = OpVariable %26 Function %54 +%48 = OpVariable %26 Function %8 +%42 = OpVariable %24 Function %43 +%37 = OpVariable %22 Function %38 +%32 = OpVariable %22 Function %6 +%28 = OpVariable %22 Function %6 +%23 = OpVariable %24 Function %13 +%51 = OpVariable %26 Function %52 +%46 = OpVariable %24 Function %47 +%41 = OpVariable %24 Function %7 +%35 = OpVariable %22 Function %36 +%31 = OpVariable %22 Function %6 +%27 = OpVariable %22 Function %6 +%21 = OpVariable %22 Function %12 +%49 = OpVariable %26 Function %50 +%44 = OpVariable %24 Function %45 +%39 = OpVariable %22 Function %40 +%33 = OpVariable %22 Function %34 +%29 = OpVariable %22 Function %30 +%25 = OpVariable %26 Function %14 +OpBranch %55 +%55 = OpLabel +%56 = OpLoad %3 %21 +%57 = OpFAdd %3 %15 %56 +OpStore %29 %57 +%58 = OpLoad %3 %21 +%59 = OpFAdd %3 %15 %58 +OpStore %33 %59 +%60 = OpLoad %3 %21 +%61 = OpFAdd %3 %60 %16 +OpStore %35 %61 +%62 = OpLoad %3 %21 +%63 = OpFAdd %3 %62 %16 +OpStore %37 %63 +%64 = OpLoad %3 %21 +%65 = OpLoad %3 %21 +%66 = OpFAdd %3 %64 %65 +OpStore %39 %66 +%67 = OpLoad %4 %23 +%68 = OpIAdd %4 %17 %67 +OpStore %42 %68 +%69 = OpLoad %4 %23 +%70 = OpIAdd %4 %69 %18 +OpStore %44 %70 +%71 = OpLoad %4 %23 +%72 = OpLoad %4 %23 +%73 = OpIAdd %4 %71 %72 +OpStore %46 %73 +%74 = OpLoad %5 %25 +%75 = OpIAdd %5 %19 %74 +OpStore %49 %75 +%76 = OpLoad %5 %25 +%77 = OpIAdd %5 %76 %20 +OpStore %51 %77 +%78 = OpLoad %5 %25 +%79 = OpLoad %5 %25 +%80 = OpIAdd %5 %78 %79 +OpStore %53 %80 +OpReturn +OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/const-exprs.spvasm b/naga/tests/out/spv/const-exprs.spvasm index 09a30da111..22fef53749 100644 --- a/naga/tests/out/spv/const-exprs.spvasm +++ b/naga/tests/out/spv/const-exprs.spvasm @@ -1,143 +1,152 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 100 +; Bound: 109 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %91 "main" -OpExecutionMode %91 LocalSize 2 3 1 +OpEntryPoint GLCompute %100 "main" +OpExecutionMode %100 LocalSize 2 3 1 %2 = OpTypeVoid %3 = OpTypeInt 32 0 %4 = OpTypeInt 32 1 %5 = OpTypeVector %4 4 %7 = OpTypeFloat 32 %6 = OpTypeVector %7 4 -%8 = OpConstant %3 2 -%9 = OpConstant %4 3 -%10 = OpConstant %4 4 -%11 = OpConstant %4 8 -%12 = OpConstant %7 3.141 -%13 = OpConstant %7 6.282 -%14 = OpConstant %7 0.44444445 -%15 = OpConstant %7 0.0 -%16 = OpConstantComposite %6 %14 %15 %15 %15 -%17 = OpConstant %4 0 -%18 = OpConstant %4 1 -%19 = OpConstant %4 2 -%22 = OpTypeFunction %2 -%23 = OpConstantComposite %5 %10 %9 %19 %18 -%25 = OpTypePointer Function %5 -%30 = OpTypePointer Function %4 -%34 = OpConstant %4 6 -%39 = OpConstant %4 30 -%40 = OpConstant %4 70 -%43 = OpConstantNull %4 -%45 = OpConstantNull %4 -%48 = OpConstantNull %5 -%59 = OpConstant %4 -4 -%60 = OpConstantComposite %5 %59 %59 %59 %59 -%69 = OpConstant %7 1.0 -%70 = OpConstant %7 2.0 -%71 = OpConstantComposite %6 %70 %69 %69 %69 -%73 = OpTypePointer Function %6 -%78 = OpTypeFunction %3 %4 -%79 = OpConstant %3 10 -%80 = OpConstant %3 20 -%81 = OpConstant %3 30 -%82 = OpConstant %3 0 -%89 = OpConstantNull %3 -%21 = OpFunction %2 None %22 -%20 = OpLabel -%24 = OpVariable %25 Function %23 -OpBranch %26 -%26 = OpLabel +%8 = OpTypeVector %7 2 +%10 = OpTypeBool +%9 = OpTypeVector %10 2 +%11 = OpConstant %3 2 +%12 = OpConstant %4 3 +%13 = OpConstant %4 4 +%14 = OpConstant %4 8 +%15 = OpConstant %7 3.141 +%16 = OpConstant %7 6.282 +%17 = OpConstant %7 0.44444445 +%18 = OpConstant %7 0.0 +%19 = OpConstantComposite %6 %17 %18 %18 %18 +%20 = OpConstant %4 0 +%21 = OpConstant %4 1 +%22 = OpConstant %4 2 +%23 = OpConstant %7 4.0 +%24 = OpConstant %7 5.0 +%25 = OpConstantComposite %8 %23 %24 +%26 = OpConstantTrue %10 +%27 = OpConstantFalse %10 +%28 = OpConstantComposite %9 %26 %27 +%31 = OpTypeFunction %2 +%32 = OpConstantComposite %5 %13 %12 %22 %21 +%34 = OpTypePointer Function %5 +%39 = OpTypePointer Function %4 +%43 = OpConstant %4 6 +%48 = OpConstant %4 30 +%49 = OpConstant %4 70 +%52 = OpConstantNull %4 +%54 = OpConstantNull %4 +%57 = OpConstantNull %5 +%68 = OpConstant %4 -4 +%69 = OpConstantComposite %5 %68 %68 %68 %68 +%78 = OpConstant %7 1.0 +%79 = OpConstant %7 2.0 +%80 = OpConstantComposite %6 %79 %78 %78 %78 +%82 = OpTypePointer Function %6 +%87 = OpTypeFunction %3 %4 +%88 = OpConstant %3 10 +%89 = OpConstant %3 20 +%90 = OpConstant %3 30 +%91 = OpConstant %3 0 +%98 = OpConstantNull %3 +%30 = OpFunction %2 None %31 +%29 = OpLabel +%33 = OpVariable %34 Function %32 +OpBranch %35 +%35 = OpLabel OpReturn OpFunctionEnd -%28 = OpFunction %2 None %22 -%27 = OpLabel -%29 = OpVariable %30 Function %19 -OpBranch %31 -%31 = OpLabel -OpReturn -OpFunctionEnd -%33 = OpFunction %2 None %22 -%32 = OpLabel -%35 = OpVariable %30 Function %34 -OpBranch %36 +%37 = OpFunction %2 None %31 %36 = OpLabel +%38 = OpVariable %39 Function %22 +OpBranch %40 +%40 = OpLabel OpReturn OpFunctionEnd -%38 = OpFunction %2 None %22 -%37 = OpLabel -%47 = OpVariable %25 Function %48 -%42 = OpVariable %30 Function %43 -%46 = OpVariable %30 Function %40 -%41 = OpVariable %30 Function %39 -%44 = OpVariable %30 Function %45 -OpBranch %49 -%49 = OpLabel -%50 = OpLoad %4 %41 -OpStore %42 %50 -%51 = OpLoad %4 %42 -OpStore %44 %51 -%52 = OpLoad %4 %41 -%53 = OpLoad %4 %42 -%54 = OpLoad %4 %44 -%55 = OpLoad %4 %46 -%56 = OpCompositeConstruct %5 %52 %53 %54 %55 -OpStore %47 %56 +%42 = OpFunction %2 None %31 +%41 = OpLabel +%44 = OpVariable %39 Function %43 +OpBranch %45 +%45 = OpLabel OpReturn OpFunctionEnd -%58 = OpFunction %2 None %22 -%57 = OpLabel -%61 = OpVariable %25 Function %60 -OpBranch %62 -%62 = OpLabel +%47 = OpFunction %2 None %31 +%46 = OpLabel +%56 = OpVariable %34 Function %57 +%51 = OpVariable %39 Function %52 +%55 = OpVariable %39 Function %49 +%50 = OpVariable %39 Function %48 +%53 = OpVariable %39 Function %54 +OpBranch %58 +%58 = OpLabel +%59 = OpLoad %4 %50 +OpStore %51 %59 +%60 = OpLoad %4 %51 +OpStore %53 %60 +%61 = OpLoad %4 %50 +%62 = OpLoad %4 %51 +%63 = OpLoad %4 %53 +%64 = OpLoad %4 %55 +%65 = OpCompositeConstruct %5 %61 %62 %63 %64 +OpStore %56 %65 OpReturn OpFunctionEnd -%64 = OpFunction %2 None %22 -%63 = OpLabel -%65 = OpVariable %25 Function %60 -OpBranch %66 +%67 = OpFunction %2 None %31 %66 = OpLabel +%70 = OpVariable %34 Function %69 +OpBranch %71 +%71 = OpLabel OpReturn OpFunctionEnd -%68 = OpFunction %2 None %22 -%67 = OpLabel -%72 = OpVariable %73 Function %71 -OpBranch %74 -%74 = OpLabel +%73 = OpFunction %2 None %31 +%72 = OpLabel +%74 = OpVariable %34 Function %69 +OpBranch %75 +%75 = OpLabel OpReturn OpFunctionEnd -%77 = OpFunction %3 None %78 -%76 = OpFunctionParameter %4 -%75 = OpLabel +%77 = OpFunction %2 None %31 +%76 = OpLabel +%81 = OpVariable %82 Function %80 OpBranch %83 %83 = OpLabel -OpSelectionMerge %84 None -OpSwitch %76 %88 0 %85 1 %86 2 %87 -%85 = OpLabel -OpReturnValue %79 -%86 = OpLabel -OpReturnValue %80 -%87 = OpLabel -OpReturnValue %81 -%88 = OpLabel -OpReturnValue %82 -%84 = OpLabel -OpReturnValue %89 +OpReturn OpFunctionEnd -%91 = OpFunction %2 None %22 -%90 = OpLabel +%86 = OpFunction %3 None %87 +%85 = OpFunctionParameter %4 +%84 = OpLabel OpBranch %92 %92 = OpLabel -%93 = OpFunctionCall %2 %21 -%94 = OpFunctionCall %2 %28 -%95 = OpFunctionCall %2 %33 -%96 = OpFunctionCall %2 %38 -%97 = OpFunctionCall %2 %58 -%98 = OpFunctionCall %2 %64 -%99 = OpFunctionCall %2 %68 +OpSelectionMerge %93 None +OpSwitch %85 %97 0 %94 1 %95 2 %96 +%94 = OpLabel +OpReturnValue %88 +%95 = OpLabel +OpReturnValue %89 +%96 = OpLabel +OpReturnValue %90 +%97 = OpLabel +OpReturnValue %91 +%93 = OpLabel +OpReturnValue %98 +OpFunctionEnd +%100 = OpFunction %2 None %31 +%99 = OpLabel +OpBranch %101 +%101 = OpLabel +%102 = OpFunctionCall %2 %30 +%103 = OpFunctionCall %2 %37 +%104 = OpFunctionCall %2 %42 +%105 = OpFunctionCall %2 %47 +%106 = OpFunctionCall %2 %67 +%107 = OpFunctionCall %2 %73 +%108 = OpFunctionCall %2 %77 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/debug-symbol-terrain.spvasm b/naga/tests/out/spv/debug-symbol-terrain.spvasm index 36fae9d60a..623b8dc2c1 100644 --- a/naga/tests/out/spv/debug-symbol-terrain.spvasm +++ b/naga/tests/out/spv/debug-symbol-terrain.spvasm @@ -555,9 +555,9 @@ OpDecorate %582 Location 0 %79 = OpConstantComposite %4 %78 %78 %78 %80 = OpConstantComposite %4 %74 %74 %74 %81 = OpConstant %5 2.0 -%82 = OpConstant %5 1.7928429 -%83 = OpConstant %5 0.85373473 -%84 = OpConstantComposite %4 %82 %82 %82 +%82 = OpConstant %5 0.85373473 +%83 = OpConstant %5 1.7928429 +%84 = OpConstantComposite %4 %83 %83 %83 %85 = OpConstant %5 130.0 %87 = OpTypePointer Function %6 %88 = OpConstantNull %6 @@ -659,6 +659,7 @@ OpBranch %60 %60 = OpLabel OpLine %3 10 52 %61 = OpVectorTimesScalar %4 %52 %55 +OpLine %3 10 63 OpLine %3 10 50 %62 = OpFAdd %4 %61 %57 %63 = OpFMul %4 %62 %52 @@ -755,6 +756,7 @@ OpLine %3 21 28 %154 = OpVectorShuffle %6 %153 %153 2 3 %155 = OpDot %5 %152 %154 %156 = OpCompositeConstruct %4 %145 %150 %155 +OpLine %3 21 28 %157 = OpFSub %4 %79 %156 OpLine %3 21 24 %158 = OpExtInst %4 %1 FMax %157 %80 @@ -772,17 +774,21 @@ OpLine %3 23 9 %164 = OpFMul %4 %162 %163 OpLine %3 23 5 OpStore %94 %164 -OpLine %3 24 13 +OpLine %3 24 18 %165 = OpVectorShuffle %4 %73 %73 3 3 3 %166 = OpFMul %4 %144 %165 %167 = OpExtInst %4 %1 Fract %166 +OpLine %3 24 13 %168 = OpVectorTimesScalar %4 %167 %81 +OpLine %3 24 37 OpLine %3 24 13 %169 = OpFSub %4 %168 %57 OpLine %3 25 13 %170 = OpExtInst %4 %1 FAbs %169 +OpLine %3 25 22 OpLine %3 25 13 %171 = OpFSub %4 %170 %79 +OpLine %3 26 24 OpLine %3 26 14 %172 = OpFAdd %4 %169 %79 %173 = OpExtInst %4 %1 Floor %172 @@ -790,11 +796,13 @@ OpLine %3 27 14 %174 = OpFSub %4 %169 %173 OpLine %3 1 1 %175 = OpLoad %4 %94 -OpLine %3 28 9 +OpLine %3 28 53 %176 = OpFMul %4 %174 %174 %177 = OpFMul %4 %171 %171 %178 = OpFAdd %4 %176 %177 -%179 = OpVectorTimesScalar %4 %178 %83 +OpLine %3 28 14 +%179 = OpVectorTimesScalar %4 %178 %82 +OpLine %3 28 9 %180 = OpFSub %4 %84 %179 %181 = OpFMul %4 %175 %180 OpLine %3 28 5 @@ -817,9 +825,10 @@ OpLine %3 29 13 %196 = OpFMul %6 %193 %195 %197 = OpFAdd %6 %192 %196 %198 = OpCompositeConstruct %4 %188 %197 -OpLine %3 30 12 +OpLine %3 30 19 %199 = OpLoad %4 %94 %200 = OpDot %5 %199 %198 +OpLine %3 30 12 %201 = OpFMul %5 %85 %200 OpReturnValue %201 OpFunctionEnd @@ -1149,6 +1158,7 @@ OpLine %3 163 14 %429 = OpCompositeConstruct %6 %424 %428 OpLine %3 165 30 %430 = OpVectorTimesScalar %6 %429 %81 +OpLine %3 165 30 %431 = OpFAdd %6 %419 %430 OpLine %3 165 20 %432 = OpCompositeConstruct %7 %431 %74 %56 diff --git a/naga/tests/out/spv/operators.spvasm b/naga/tests/out/spv/operators.spvasm index 89bc4ccf28..974623bc70 100644 --- a/naga/tests/out/spv/operators.spvasm +++ b/naga/tests/out/spv/operators.spvasm @@ -1,12 +1,13 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 377 +; Bound: 389 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %366 "main" -OpExecutionMode %366 LocalSize 1 1 1 +OpEntryPoint GLCompute %374 "main" %371 +OpExecutionMode %374 LocalSize 1 1 1 +OpDecorate %371 BuiltIn WorkgroupId %2 = OpTypeVoid %4 = OpTypeFloat 32 %3 = OpTypeVector %4 4 @@ -20,418 +21,430 @@ OpExecutionMode %366 LocalSize 1 1 1 %12 = OpTypeMatrix %10 4 %13 = OpTypeMatrix %3 3 %14 = OpTypeVector %6 3 -%15 = OpConstant %4 1.0 -%16 = OpConstantComposite %3 %15 %15 %15 %15 -%17 = OpConstant %4 0.0 +%16 = OpTypeInt 32 0 +%15 = OpTypeVector %16 3 +%17 = OpConstant %4 1.0 %18 = OpConstantComposite %3 %17 %17 %17 %17 -%19 = OpConstant %4 0.5 +%19 = OpConstant %4 0.0 %20 = OpConstantComposite %3 %19 %19 %19 %19 -%21 = OpConstant %6 1 -%22 = OpConstantComposite %5 %21 %21 %21 %21 -%25 = OpTypeFunction %3 -%26 = OpConstantTrue %8 -%27 = OpConstant %6 0 -%28 = OpConstantFalse %8 -%29 = OpConstantComposite %7 %28 %28 %28 %28 -%30 = OpConstant %4 0.1 -%31 = OpConstantComposite %5 %27 %27 %27 %27 -%53 = OpConstant %4 2.0 -%54 = OpConstantComposite %9 %53 %53 -%55 = OpConstantComposite %9 %15 %15 -%56 = OpConstant %4 3.0 -%57 = OpConstantComposite %9 %56 %56 -%58 = OpConstant %4 4.0 +%21 = OpConstant %4 0.5 +%22 = OpConstantComposite %3 %21 %21 %21 %21 +%23 = OpConstant %6 1 +%24 = OpConstantComposite %5 %23 %23 %23 %23 +%27 = OpTypeFunction %3 +%28 = OpConstantTrue %8 +%29 = OpConstant %6 0 +%30 = OpConstantFalse %8 +%31 = OpConstantComposite %7 %30 %30 %30 %30 +%32 = OpConstant %4 0.1 +%33 = OpConstantComposite %5 %29 %29 %29 %29 +%57 = OpTypeFunction %3 %4 %6 +%58 = OpConstant %4 2.0 %59 = OpConstantComposite %9 %58 %58 -%60 = OpConstant %6 5 -%61 = OpConstantComposite %5 %60 %60 %60 %60 -%62 = OpConstant %6 2 -%63 = OpConstantComposite %5 %62 %62 %62 %62 -%74 = OpTypeFunction %9 -%76 = OpTypePointer Function %9 -%88 = OpTypeFunction %10 %10 -%90 = OpTypeVector %8 3 -%91 = OpConstantComposite %10 %17 %17 %17 -%93 = OpConstantComposite %10 %15 %15 %15 -%97 = OpTypeFunction %2 -%98 = OpTypeVector %8 2 -%99 = OpConstantComposite %98 %26 %26 -%100 = OpConstantComposite %90 %26 %26 %26 -%101 = OpConstantComposite %90 %28 %28 %28 -%102 = OpConstantComposite %7 %26 %26 %26 %26 -%103 = OpConstantComposite %7 %28 %28 %28 %28 -%115 = OpTypeInt 32 0 -%116 = OpConstant %115 1 -%117 = OpConstant %115 2 -%118 = OpTypeVector %6 2 -%119 = OpConstantComposite %118 %21 %21 -%120 = OpConstantComposite %118 %62 %62 -%121 = OpTypeVector %115 3 -%122 = OpConstantComposite %121 %117 %117 %117 -%123 = OpConstantComposite %121 %116 %116 %116 -%124 = OpConstantComposite %3 %53 %53 %53 %53 -%125 = OpConstantComposite %3 %15 %15 %15 %15 -%126 = OpTypeVector %115 2 -%127 = OpConstantComposite %126 %117 %117 -%128 = OpConstantComposite %126 %116 %116 -%129 = OpConstantNull %11 -%130 = OpConstantNull %12 -%131 = OpConstantComposite %10 %53 %53 %53 -%132 = OpConstantNull %13 -%296 = OpConstantNull %14 -%298 = OpTypePointer Function %6 -%299 = OpConstantNull %6 -%301 = OpTypePointer Function %14 -%329 = OpTypePointer Function %6 -%367 = OpConstantComposite %10 %15 %15 %15 -%24 = OpFunction %3 None %25 -%23 = OpLabel -OpBranch %32 -%32 = OpLabel -%33 = OpSelect %6 %26 %21 %27 -%35 = OpCompositeConstruct %7 %26 %26 %26 %26 -%34 = OpSelect %3 %35 %16 %18 -%36 = OpSelect %3 %29 %18 %16 -%37 = OpExtInst %3 %1 FMix %18 %16 %20 -%39 = OpCompositeConstruct %3 %30 %30 %30 %30 -%38 = OpExtInst %3 %1 FMix %18 %16 %39 -%40 = OpBitcast %4 %21 -%41 = OpBitcast %3 %22 -%42 = OpCompositeConstruct %5 %33 %33 %33 %33 -%43 = OpIAdd %5 %42 %31 -%44 = OpConvertSToF %3 %43 -%45 = OpFAdd %3 %44 %34 -%46 = OpFAdd %3 %45 %37 -%47 = OpFAdd %3 %46 %38 -%48 = OpCompositeConstruct %3 %40 %40 %40 %40 -%49 = OpFAdd %3 %47 %48 -%50 = OpFAdd %3 %49 %41 -OpReturnValue %50 +%60 = OpConstant %4 4.0 +%61 = OpConstantComposite %9 %60 %60 +%62 = OpConstant %4 8.0 +%63 = OpConstantComposite %9 %62 %62 +%64 = OpConstant %6 2 +%65 = OpConstantComposite %5 %64 %64 %64 %64 +%78 = OpTypeFunction %9 +%79 = OpConstantComposite %9 %17 %17 +%80 = OpConstant %4 3.0 +%81 = OpConstantComposite %9 %80 %80 +%83 = OpTypePointer Function %9 +%95 = OpTypeFunction %10 %10 +%97 = OpTypeVector %8 3 +%98 = OpConstantComposite %10 %19 %19 %19 +%100 = OpConstantComposite %10 %17 %17 %17 +%104 = OpTypeFunction %2 +%105 = OpTypeVector %8 2 +%106 = OpConstantComposite %105 %28 %28 +%107 = OpConstantComposite %97 %28 %28 %28 +%108 = OpConstantComposite %97 %30 %30 %30 +%109 = OpConstantComposite %7 %28 %28 %28 %28 +%110 = OpConstantComposite %7 %30 %30 %30 %30 +%122 = OpConstant %16 1 +%123 = OpConstant %16 2 +%124 = OpTypeVector %6 2 +%125 = OpConstantComposite %124 %23 %23 +%126 = OpConstantComposite %124 %64 %64 +%127 = OpConstantComposite %15 %123 %123 %123 +%128 = OpConstantComposite %15 %122 %122 %122 +%129 = OpConstantComposite %3 %58 %58 %58 %58 +%130 = OpConstantComposite %3 %17 %17 %17 %17 +%131 = OpTypeVector %16 2 +%132 = OpConstantComposite %131 %123 %123 +%133 = OpConstantComposite %131 %122 %122 +%134 = OpConstantNull %11 +%135 = OpConstantNull %12 +%136 = OpConstantComposite %10 %58 %58 %58 +%137 = OpConstantNull %13 +%301 = OpConstantNull %14 +%303 = OpTypePointer Function %6 +%304 = OpConstantNull %6 +%306 = OpTypePointer Function %14 +%334 = OpTypePointer Function %6 +%372 = OpTypePointer Input %15 +%371 = OpVariable %372 Input +%375 = OpConstantComposite %10 %17 %17 %17 +%26 = OpFunction %3 None %27 +%25 = OpLabel +OpBranch %34 +%34 = OpLabel +%35 = OpSelect %6 %28 %23 %29 +%37 = OpCompositeConstruct %7 %28 %28 %28 %28 +%36 = OpSelect %3 %37 %18 %20 +%38 = OpSelect %3 %31 %20 %18 +%39 = OpExtInst %3 %1 FMix %20 %18 %22 +%41 = OpCompositeConstruct %3 %32 %32 %32 %32 +%40 = OpExtInst %3 %1 FMix %20 %18 %41 +%42 = OpBitcast %4 %23 +%43 = OpBitcast %3 %24 +%44 = OpCompositeConstruct %5 %35 %35 %35 %35 +%45 = OpIAdd %5 %44 %33 +%46 = OpConvertSToF %3 %45 +%47 = OpFAdd %3 %46 %36 +%48 = OpFAdd %3 %47 %39 +%49 = OpFAdd %3 %48 %40 +%50 = OpCompositeConstruct %3 %42 %42 %42 %42 +%51 = OpFAdd %3 %49 %50 +%52 = OpFAdd %3 %51 %43 +OpReturnValue %52 OpFunctionEnd -%52 = OpFunction %3 None %25 -%51 = OpLabel -OpBranch %64 -%64 = OpLabel -%65 = OpFAdd %9 %55 %54 -%66 = OpFSub %9 %65 %57 -%67 = OpFDiv %9 %66 %59 -%68 = OpSRem %5 %61 %63 -%69 = OpVectorShuffle %3 %67 %67 0 1 0 1 -%70 = OpConvertSToF %3 %68 -%71 = OpFAdd %3 %69 %70 -OpReturnValue %71 +%56 = OpFunction %3 None %57 +%54 = OpFunctionParameter %4 +%55 = OpFunctionParameter %6 +%53 = OpLabel +OpBranch %66 +%66 = OpLabel +%67 = OpCompositeConstruct %9 %54 %54 +%68 = OpFAdd %9 %59 %67 +%69 = OpFSub %9 %68 %61 +%70 = OpFDiv %9 %69 %63 +%71 = OpCompositeConstruct %5 %55 %55 %55 %55 +%72 = OpSRem %5 %71 %65 +%73 = OpVectorShuffle %3 %70 %70 0 1 0 1 +%74 = OpConvertSToF %3 %72 +%75 = OpFAdd %3 %73 %74 +OpReturnValue %75 OpFunctionEnd -%73 = OpFunction %9 None %74 -%72 = OpLabel -%75 = OpVariable %76 Function %54 -OpBranch %77 -%77 = OpLabel -%78 = OpLoad %9 %75 -%79 = OpFAdd %9 %78 %55 -OpStore %75 %79 -%80 = OpLoad %9 %75 -%81 = OpFSub %9 %80 %57 -OpStore %75 %81 -%82 = OpLoad %9 %75 -%83 = OpFDiv %9 %82 %59 -OpStore %75 %83 -%84 = OpLoad %9 %75 -OpReturnValue %84 +%77 = OpFunction %9 None %78 +%76 = OpLabel +%82 = OpVariable %83 Function %59 +OpBranch %84 +%84 = OpLabel +%85 = OpLoad %9 %82 +%86 = OpFAdd %9 %85 %79 +OpStore %82 %86 +%87 = OpLoad %9 %82 +%88 = OpFSub %9 %87 %81 +OpStore %82 %88 +%89 = OpLoad %9 %82 +%90 = OpFDiv %9 %89 %61 +OpStore %82 %90 +%91 = OpLoad %9 %82 +OpReturnValue %91 OpFunctionEnd -%87 = OpFunction %10 None %88 -%86 = OpFunctionParameter %10 -%85 = OpLabel -OpBranch %89 -%89 = OpLabel -%92 = OpFUnordNotEqual %90 %86 %91 -%94 = OpSelect %10 %92 %93 %91 -OpReturnValue %94 +%94 = OpFunction %10 None %95 +%93 = OpFunctionParameter %10 +%92 = OpLabel +OpBranch %96 +%96 = OpLabel +%99 = OpFUnordNotEqual %97 %93 %98 +%101 = OpSelect %10 %99 %100 %98 +OpReturnValue %101 OpFunctionEnd -%96 = OpFunction %2 None %97 -%95 = OpLabel -OpBranch %104 -%104 = OpLabel -%105 = OpLogicalNot %8 %26 -%106 = OpLogicalNot %98 %99 -%107 = OpLogicalOr %8 %26 %28 -%108 = OpLogicalAnd %8 %26 %28 -%109 = OpLogicalOr %8 %26 %28 -%110 = OpLogicalOr %90 %100 %101 -%111 = OpLogicalAnd %8 %26 %28 -%112 = OpLogicalAnd %7 %102 %103 +%103 = OpFunction %2 None %104 +%102 = OpLabel +OpBranch %111 +%111 = OpLabel +%112 = OpLogicalNot %8 %28 +%113 = OpLogicalNot %105 %106 +%114 = OpLogicalOr %8 %28 %30 +%115 = OpLogicalAnd %8 %28 %30 +%116 = OpLogicalOr %8 %28 %30 +%117 = OpLogicalOr %97 %107 %108 +%118 = OpLogicalAnd %8 %28 %30 +%119 = OpLogicalAnd %7 %109 %110 OpReturn OpFunctionEnd -%114 = OpFunction %2 None %97 -%113 = OpLabel -OpBranch %133 -%133 = OpLabel -%134 = OpFNegate %4 %15 -%135 = OpSNegate %118 %119 -%136 = OpFNegate %9 %55 -%137 = OpIAdd %6 %62 %21 -%138 = OpIAdd %115 %117 %116 -%139 = OpFAdd %4 %53 %15 -%140 = OpIAdd %118 %120 %119 -%141 = OpIAdd %121 %122 %123 -%142 = OpFAdd %3 %124 %125 -%143 = OpISub %6 %62 %21 -%144 = OpISub %115 %117 %116 -%145 = OpFSub %4 %53 %15 -%146 = OpISub %118 %120 %119 -%147 = OpISub %121 %122 %123 -%148 = OpFSub %3 %124 %125 -%149 = OpIMul %6 %62 %21 -%150 = OpIMul %115 %117 %116 -%151 = OpFMul %4 %53 %15 -%152 = OpIMul %118 %120 %119 -%153 = OpIMul %121 %122 %123 -%154 = OpFMul %3 %124 %125 -%155 = OpSDiv %6 %62 %21 -%156 = OpUDiv %115 %117 %116 -%157 = OpFDiv %4 %53 %15 -%158 = OpSDiv %118 %120 %119 -%159 = OpUDiv %121 %122 %123 -%160 = OpFDiv %3 %124 %125 -%161 = OpSRem %6 %62 %21 -%162 = OpUMod %115 %117 %116 -%163 = OpFRem %4 %53 %15 -%164 = OpSRem %118 %120 %119 -%165 = OpUMod %121 %122 %123 -%166 = OpFRem %3 %124 %125 -OpBranch %167 -%167 = OpLabel -%169 = OpIAdd %118 %120 %119 -%170 = OpIAdd %118 %120 %119 -%171 = OpIAdd %126 %127 %128 -%172 = OpIAdd %126 %127 %128 -%173 = OpFAdd %9 %54 %55 -%174 = OpFAdd %9 %54 %55 -%175 = OpISub %118 %120 %119 -%176 = OpISub %118 %120 %119 -%177 = OpISub %126 %127 %128 -%178 = OpISub %126 %127 %128 -%179 = OpFSub %9 %54 %55 -%180 = OpFSub %9 %54 %55 -%182 = OpCompositeConstruct %118 %21 %21 -%181 = OpIMul %118 %120 %182 -%184 = OpCompositeConstruct %118 %62 %62 -%183 = OpIMul %118 %119 %184 -%186 = OpCompositeConstruct %126 %116 %116 -%185 = OpIMul %126 %127 %186 -%188 = OpCompositeConstruct %126 %117 %117 -%187 = OpIMul %126 %128 %188 -%189 = OpVectorTimesScalar %9 %54 %15 -%190 = OpVectorTimesScalar %9 %55 %53 -%191 = OpSDiv %118 %120 %119 -%192 = OpSDiv %118 %120 %119 -%193 = OpUDiv %126 %127 %128 -%194 = OpUDiv %126 %127 %128 -%195 = OpFDiv %9 %54 %55 -%196 = OpFDiv %9 %54 %55 -%197 = OpSRem %118 %120 %119 -%198 = OpSRem %118 %120 %119 -%199 = OpUMod %126 %127 %128 -%200 = OpUMod %126 %127 %128 -%201 = OpFRem %9 %54 %55 -%202 = OpFRem %9 %54 %55 -OpBranch %168 -%168 = OpLabel -%204 = OpCompositeExtract %10 %129 0 -%205 = OpCompositeExtract %10 %129 0 -%206 = OpFAdd %10 %204 %205 -%207 = OpCompositeExtract %10 %129 1 -%208 = OpCompositeExtract %10 %129 1 -%209 = OpFAdd %10 %207 %208 -%210 = OpCompositeExtract %10 %129 2 -%211 = OpCompositeExtract %10 %129 2 -%212 = OpFAdd %10 %210 %211 -%203 = OpCompositeConstruct %11 %206 %209 %212 -%214 = OpCompositeExtract %10 %129 0 -%215 = OpCompositeExtract %10 %129 0 -%216 = OpFSub %10 %214 %215 -%217 = OpCompositeExtract %10 %129 1 -%218 = OpCompositeExtract %10 %129 1 -%219 = OpFSub %10 %217 %218 -%220 = OpCompositeExtract %10 %129 2 -%221 = OpCompositeExtract %10 %129 2 -%222 = OpFSub %10 %220 %221 -%213 = OpCompositeConstruct %11 %216 %219 %222 -%223 = OpMatrixTimesScalar %11 %129 %15 -%224 = OpMatrixTimesScalar %11 %129 %53 -%225 = OpMatrixTimesVector %10 %130 %125 -%226 = OpVectorTimesMatrix %3 %131 %130 -%227 = OpMatrixTimesMatrix %11 %130 %132 +%121 = OpFunction %2 None %104 +%120 = OpLabel +OpBranch %138 +%138 = OpLabel +%139 = OpFNegate %4 %17 +%140 = OpSNegate %124 %125 +%141 = OpFNegate %9 %79 +%142 = OpIAdd %6 %64 %23 +%143 = OpIAdd %16 %123 %122 +%144 = OpFAdd %4 %58 %17 +%145 = OpIAdd %124 %126 %125 +%146 = OpIAdd %15 %127 %128 +%147 = OpFAdd %3 %129 %130 +%148 = OpISub %6 %64 %23 +%149 = OpISub %16 %123 %122 +%150 = OpFSub %4 %58 %17 +%151 = OpISub %124 %126 %125 +%152 = OpISub %15 %127 %128 +%153 = OpFSub %3 %129 %130 +%154 = OpIMul %6 %64 %23 +%155 = OpIMul %16 %123 %122 +%156 = OpFMul %4 %58 %17 +%157 = OpIMul %124 %126 %125 +%158 = OpIMul %15 %127 %128 +%159 = OpFMul %3 %129 %130 +%160 = OpSDiv %6 %64 %23 +%161 = OpUDiv %16 %123 %122 +%162 = OpFDiv %4 %58 %17 +%163 = OpSDiv %124 %126 %125 +%164 = OpUDiv %15 %127 %128 +%165 = OpFDiv %3 %129 %130 +%166 = OpSRem %6 %64 %23 +%167 = OpUMod %16 %123 %122 +%168 = OpFRem %4 %58 %17 +%169 = OpSRem %124 %126 %125 +%170 = OpUMod %15 %127 %128 +%171 = OpFRem %3 %129 %130 +OpBranch %172 +%172 = OpLabel +%174 = OpIAdd %124 %126 %125 +%175 = OpIAdd %124 %126 %125 +%176 = OpIAdd %131 %132 %133 +%177 = OpIAdd %131 %132 %133 +%178 = OpFAdd %9 %59 %79 +%179 = OpFAdd %9 %59 %79 +%180 = OpISub %124 %126 %125 +%181 = OpISub %124 %126 %125 +%182 = OpISub %131 %132 %133 +%183 = OpISub %131 %132 %133 +%184 = OpFSub %9 %59 %79 +%185 = OpFSub %9 %59 %79 +%187 = OpCompositeConstruct %124 %23 %23 +%186 = OpIMul %124 %126 %187 +%189 = OpCompositeConstruct %124 %64 %64 +%188 = OpIMul %124 %125 %189 +%191 = OpCompositeConstruct %131 %122 %122 +%190 = OpIMul %131 %132 %191 +%193 = OpCompositeConstruct %131 %123 %123 +%192 = OpIMul %131 %133 %193 +%194 = OpVectorTimesScalar %9 %59 %17 +%195 = OpVectorTimesScalar %9 %79 %58 +%196 = OpSDiv %124 %126 %125 +%197 = OpSDiv %124 %126 %125 +%198 = OpUDiv %131 %132 %133 +%199 = OpUDiv %131 %132 %133 +%200 = OpFDiv %9 %59 %79 +%201 = OpFDiv %9 %59 %79 +%202 = OpSRem %124 %126 %125 +%203 = OpSRem %124 %126 %125 +%204 = OpUMod %131 %132 %133 +%205 = OpUMod %131 %132 %133 +%206 = OpFRem %9 %59 %79 +%207 = OpFRem %9 %59 %79 +OpBranch %173 +%173 = OpLabel +%209 = OpCompositeExtract %10 %134 0 +%210 = OpCompositeExtract %10 %134 0 +%211 = OpFAdd %10 %209 %210 +%212 = OpCompositeExtract %10 %134 1 +%213 = OpCompositeExtract %10 %134 1 +%214 = OpFAdd %10 %212 %213 +%215 = OpCompositeExtract %10 %134 2 +%216 = OpCompositeExtract %10 %134 2 +%217 = OpFAdd %10 %215 %216 +%208 = OpCompositeConstruct %11 %211 %214 %217 +%219 = OpCompositeExtract %10 %134 0 +%220 = OpCompositeExtract %10 %134 0 +%221 = OpFSub %10 %219 %220 +%222 = OpCompositeExtract %10 %134 1 +%223 = OpCompositeExtract %10 %134 1 +%224 = OpFSub %10 %222 %223 +%225 = OpCompositeExtract %10 %134 2 +%226 = OpCompositeExtract %10 %134 2 +%227 = OpFSub %10 %225 %226 +%218 = OpCompositeConstruct %11 %221 %224 %227 +%228 = OpMatrixTimesScalar %11 %134 %17 +%229 = OpMatrixTimesScalar %11 %134 %58 +%230 = OpMatrixTimesVector %10 %135 %130 +%231 = OpVectorTimesMatrix %3 %136 %135 +%232 = OpMatrixTimesMatrix %11 %135 %137 OpReturn OpFunctionEnd -%229 = OpFunction %2 None %97 -%228 = OpLabel -OpBranch %230 -%230 = OpLabel -%231 = OpNot %6 %21 -%232 = OpNot %115 %116 -%233 = OpNot %118 %119 -%234 = OpNot %121 %123 -%235 = OpBitwiseOr %6 %62 %21 -%236 = OpBitwiseOr %115 %117 %116 -%237 = OpBitwiseOr %118 %120 %119 -%238 = OpBitwiseOr %121 %122 %123 -%239 = OpBitwiseAnd %6 %62 %21 -%240 = OpBitwiseAnd %115 %117 %116 -%241 = OpBitwiseAnd %118 %120 %119 -%242 = OpBitwiseAnd %121 %122 %123 -%243 = OpBitwiseXor %6 %62 %21 -%244 = OpBitwiseXor %115 %117 %116 -%245 = OpBitwiseXor %118 %120 %119 -%246 = OpBitwiseXor %121 %122 %123 -%247 = OpShiftLeftLogical %6 %62 %116 -%248 = OpShiftLeftLogical %115 %117 %116 -%249 = OpShiftLeftLogical %118 %120 %128 -%250 = OpShiftLeftLogical %121 %122 %123 -%251 = OpShiftRightArithmetic %6 %62 %116 -%252 = OpShiftRightLogical %115 %117 %116 -%253 = OpShiftRightArithmetic %118 %120 %128 -%254 = OpShiftRightLogical %121 %122 %123 +%234 = OpFunction %2 None %104 +%233 = OpLabel +OpBranch %235 +%235 = OpLabel +%236 = OpNot %6 %23 +%237 = OpNot %16 %122 +%238 = OpNot %124 %125 +%239 = OpNot %15 %128 +%240 = OpBitwiseOr %6 %64 %23 +%241 = OpBitwiseOr %16 %123 %122 +%242 = OpBitwiseOr %124 %126 %125 +%243 = OpBitwiseOr %15 %127 %128 +%244 = OpBitwiseAnd %6 %64 %23 +%245 = OpBitwiseAnd %16 %123 %122 +%246 = OpBitwiseAnd %124 %126 %125 +%247 = OpBitwiseAnd %15 %127 %128 +%248 = OpBitwiseXor %6 %64 %23 +%249 = OpBitwiseXor %16 %123 %122 +%250 = OpBitwiseXor %124 %126 %125 +%251 = OpBitwiseXor %15 %127 %128 +%252 = OpShiftLeftLogical %6 %64 %122 +%253 = OpShiftLeftLogical %16 %123 %122 +%254 = OpShiftLeftLogical %124 %126 %133 +%255 = OpShiftLeftLogical %15 %127 %128 +%256 = OpShiftRightArithmetic %6 %64 %122 +%257 = OpShiftRightLogical %16 %123 %122 +%258 = OpShiftRightArithmetic %124 %126 %133 +%259 = OpShiftRightLogical %15 %127 %128 OpReturn OpFunctionEnd -%256 = OpFunction %2 None %97 -%255 = OpLabel -OpBranch %257 -%257 = OpLabel -%258 = OpIEqual %8 %62 %21 -%259 = OpIEqual %8 %117 %116 -%260 = OpFOrdEqual %8 %53 %15 -%261 = OpIEqual %98 %120 %119 -%262 = OpIEqual %90 %122 %123 -%263 = OpFOrdEqual %7 %124 %125 -%264 = OpINotEqual %8 %62 %21 -%265 = OpINotEqual %8 %117 %116 -%266 = OpFOrdNotEqual %8 %53 %15 -%267 = OpINotEqual %98 %120 %119 -%268 = OpINotEqual %90 %122 %123 -%269 = OpFOrdNotEqual %7 %124 %125 -%270 = OpSLessThan %8 %62 %21 -%271 = OpULessThan %8 %117 %116 -%272 = OpFOrdLessThan %8 %53 %15 -%273 = OpSLessThan %98 %120 %119 -%274 = OpULessThan %90 %122 %123 -%275 = OpFOrdLessThan %7 %124 %125 -%276 = OpSLessThanEqual %8 %62 %21 -%277 = OpULessThanEqual %8 %117 %116 -%278 = OpFOrdLessThanEqual %8 %53 %15 -%279 = OpSLessThanEqual %98 %120 %119 -%280 = OpULessThanEqual %90 %122 %123 -%281 = OpFOrdLessThanEqual %7 %124 %125 -%282 = OpSGreaterThan %8 %62 %21 -%283 = OpUGreaterThan %8 %117 %116 -%284 = OpFOrdGreaterThan %8 %53 %15 -%285 = OpSGreaterThan %98 %120 %119 -%286 = OpUGreaterThan %90 %122 %123 -%287 = OpFOrdGreaterThan %7 %124 %125 -%288 = OpSGreaterThanEqual %8 %62 %21 -%289 = OpUGreaterThanEqual %8 %117 %116 -%290 = OpFOrdGreaterThanEqual %8 %53 %15 -%291 = OpSGreaterThanEqual %98 %120 %119 -%292 = OpUGreaterThanEqual %90 %122 %123 -%293 = OpFOrdGreaterThanEqual %7 %124 %125 +%261 = OpFunction %2 None %104 +%260 = OpLabel +OpBranch %262 +%262 = OpLabel +%263 = OpIEqual %8 %64 %23 +%264 = OpIEqual %8 %123 %122 +%265 = OpFOrdEqual %8 %58 %17 +%266 = OpIEqual %105 %126 %125 +%267 = OpIEqual %97 %127 %128 +%268 = OpFOrdEqual %7 %129 %130 +%269 = OpINotEqual %8 %64 %23 +%270 = OpINotEqual %8 %123 %122 +%271 = OpFOrdNotEqual %8 %58 %17 +%272 = OpINotEqual %105 %126 %125 +%273 = OpINotEqual %97 %127 %128 +%274 = OpFOrdNotEqual %7 %129 %130 +%275 = OpSLessThan %8 %64 %23 +%276 = OpULessThan %8 %123 %122 +%277 = OpFOrdLessThan %8 %58 %17 +%278 = OpSLessThan %105 %126 %125 +%279 = OpULessThan %97 %127 %128 +%280 = OpFOrdLessThan %7 %129 %130 +%281 = OpSLessThanEqual %8 %64 %23 +%282 = OpULessThanEqual %8 %123 %122 +%283 = OpFOrdLessThanEqual %8 %58 %17 +%284 = OpSLessThanEqual %105 %126 %125 +%285 = OpULessThanEqual %97 %127 %128 +%286 = OpFOrdLessThanEqual %7 %129 %130 +%287 = OpSGreaterThan %8 %64 %23 +%288 = OpUGreaterThan %8 %123 %122 +%289 = OpFOrdGreaterThan %8 %58 %17 +%290 = OpSGreaterThan %105 %126 %125 +%291 = OpUGreaterThan %97 %127 %128 +%292 = OpFOrdGreaterThan %7 %129 %130 +%293 = OpSGreaterThanEqual %8 %64 %23 +%294 = OpUGreaterThanEqual %8 %123 %122 +%295 = OpFOrdGreaterThanEqual %8 %58 %17 +%296 = OpSGreaterThanEqual %105 %126 %125 +%297 = OpUGreaterThanEqual %97 %127 %128 +%298 = OpFOrdGreaterThanEqual %7 %129 %130 OpReturn OpFunctionEnd -%295 = OpFunction %2 None %97 -%294 = OpLabel -%297 = OpVariable %298 Function %299 -%300 = OpVariable %301 Function %296 -OpBranch %302 -%302 = OpLabel -OpStore %297 %21 -%303 = OpLoad %6 %297 -%304 = OpIAdd %6 %303 %21 -OpStore %297 %304 -%305 = OpLoad %6 %297 -%306 = OpISub %6 %305 %21 -OpStore %297 %306 -%307 = OpLoad %6 %297 -%308 = OpLoad %6 %297 -%309 = OpIMul %6 %308 %307 -OpStore %297 %309 -%310 = OpLoad %6 %297 -%311 = OpLoad %6 %297 -%312 = OpSDiv %6 %311 %310 -OpStore %297 %312 -%313 = OpLoad %6 %297 -%314 = OpSRem %6 %313 %21 -OpStore %297 %314 -%315 = OpLoad %6 %297 -%316 = OpBitwiseAnd %6 %315 %27 -OpStore %297 %316 -%317 = OpLoad %6 %297 -%318 = OpBitwiseOr %6 %317 %27 -OpStore %297 %318 -%319 = OpLoad %6 %297 -%320 = OpBitwiseXor %6 %319 %27 -OpStore %297 %320 -%321 = OpLoad %6 %297 -%322 = OpShiftLeftLogical %6 %321 %117 -OpStore %297 %322 -%323 = OpLoad %6 %297 -%324 = OpShiftRightArithmetic %6 %323 %116 -OpStore %297 %324 -%325 = OpLoad %6 %297 -%326 = OpIAdd %6 %325 %21 -OpStore %297 %326 -%327 = OpLoad %6 %297 -%328 = OpISub %6 %327 %21 -OpStore %297 %328 -%330 = OpAccessChain %329 %300 %21 -%331 = OpLoad %6 %330 -%332 = OpIAdd %6 %331 %21 -%333 = OpAccessChain %329 %300 %21 -OpStore %333 %332 -%334 = OpAccessChain %329 %300 %21 -%335 = OpLoad %6 %334 -%336 = OpISub %6 %335 %21 -%337 = OpAccessChain %329 %300 %21 -OpStore %337 %336 +%300 = OpFunction %2 None %104 +%299 = OpLabel +%302 = OpVariable %303 Function %304 +%305 = OpVariable %306 Function %301 +OpBranch %307 +%307 = OpLabel +OpStore %302 %23 +%308 = OpLoad %6 %302 +%309 = OpIAdd %6 %308 %23 +OpStore %302 %309 +%310 = OpLoad %6 %302 +%311 = OpISub %6 %310 %23 +OpStore %302 %311 +%312 = OpLoad %6 %302 +%313 = OpLoad %6 %302 +%314 = OpIMul %6 %313 %312 +OpStore %302 %314 +%315 = OpLoad %6 %302 +%316 = OpLoad %6 %302 +%317 = OpSDiv %6 %316 %315 +OpStore %302 %317 +%318 = OpLoad %6 %302 +%319 = OpSRem %6 %318 %23 +OpStore %302 %319 +%320 = OpLoad %6 %302 +%321 = OpBitwiseAnd %6 %320 %29 +OpStore %302 %321 +%322 = OpLoad %6 %302 +%323 = OpBitwiseOr %6 %322 %29 +OpStore %302 %323 +%324 = OpLoad %6 %302 +%325 = OpBitwiseXor %6 %324 %29 +OpStore %302 %325 +%326 = OpLoad %6 %302 +%327 = OpShiftLeftLogical %6 %326 %123 +OpStore %302 %327 +%328 = OpLoad %6 %302 +%329 = OpShiftRightArithmetic %6 %328 %122 +OpStore %302 %329 +%330 = OpLoad %6 %302 +%331 = OpIAdd %6 %330 %23 +OpStore %302 %331 +%332 = OpLoad %6 %302 +%333 = OpISub %6 %332 %23 +OpStore %302 %333 +%335 = OpAccessChain %334 %305 %23 +%336 = OpLoad %6 %335 +%337 = OpIAdd %6 %336 %23 +%338 = OpAccessChain %334 %305 %23 +OpStore %338 %337 +%339 = OpAccessChain %334 %305 %23 +%340 = OpLoad %6 %339 +%341 = OpISub %6 %340 %23 +%342 = OpAccessChain %334 %305 %23 +OpStore %342 %341 OpReturn OpFunctionEnd -%339 = OpFunction %2 None %97 -%338 = OpLabel -OpBranch %340 -%340 = OpLabel -%341 = OpSNegate %6 %21 -%342 = OpSNegate %6 %21 -%343 = OpSNegate %6 %342 -%344 = OpSNegate %6 %21 -%345 = OpSNegate %6 %344 -%346 = OpSNegate %6 %21 -%347 = OpSNegate %6 %346 -%348 = OpSNegate %6 %21 -%349 = OpSNegate %6 %348 +%344 = OpFunction %2 None %104 +%343 = OpLabel +OpBranch %345 +%345 = OpLabel +%346 = OpSNegate %6 %23 +%347 = OpSNegate %6 %23 +%348 = OpSNegate %6 %347 +%349 = OpSNegate %6 %23 %350 = OpSNegate %6 %349 -%351 = OpSNegate %6 %21 +%351 = OpSNegate %6 %23 %352 = OpSNegate %6 %351 -%353 = OpSNegate %6 %352 +%353 = OpSNegate %6 %23 %354 = OpSNegate %6 %353 -%355 = OpSNegate %6 %21 -%356 = OpSNegate %6 %355 +%355 = OpSNegate %6 %354 +%356 = OpSNegate %6 %23 %357 = OpSNegate %6 %356 %358 = OpSNegate %6 %357 %359 = OpSNegate %6 %358 -%360 = OpSNegate %6 %21 +%360 = OpSNegate %6 %23 %361 = OpSNegate %6 %360 %362 = OpSNegate %6 %361 %363 = OpSNegate %6 %362 %364 = OpSNegate %6 %363 +%365 = OpSNegate %6 %23 +%366 = OpSNegate %6 %365 +%367 = OpSNegate %6 %366 +%368 = OpSNegate %6 %367 +%369 = OpSNegate %6 %368 OpReturn OpFunctionEnd -%366 = OpFunction %2 None %97 -%365 = OpLabel -OpBranch %368 -%368 = OpLabel -%369 = OpFunctionCall %3 %24 -%370 = OpFunctionCall %3 %52 -%371 = OpFunctionCall %10 %87 %367 -%372 = OpFunctionCall %2 %96 -%373 = OpFunctionCall %2 %114 -%374 = OpFunctionCall %2 %229 -%375 = OpFunctionCall %2 %256 -%376 = OpFunctionCall %2 %295 +%374 = OpFunction %2 None %104 +%370 = OpLabel +%373 = OpLoad %15 %371 +OpBranch %376 +%376 = OpLabel +%377 = OpFunctionCall %3 %26 +%378 = OpCompositeExtract %16 %373 0 +%379 = OpConvertUToF %4 %378 +%380 = OpCompositeExtract %16 %373 1 +%381 = OpBitcast %6 %380 +%382 = OpFunctionCall %3 %56 %379 %381 +%383 = OpFunctionCall %10 %94 %375 +%384 = OpFunctionCall %2 %103 +%385 = OpFunctionCall %2 %121 +%386 = OpFunctionCall %2 %234 +%387 = OpFunctionCall %2 %261 +%388 = OpFunctionCall %2 %300 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl b/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl index 365fa3470e..5a8e54159a 100644 --- a/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl +++ b/naga/tests/out/wgsl/210-bevy-2d-shader.vert.wgsl @@ -34,11 +34,11 @@ fn main_1() { v_Uv = _e10; let _e11 = Vertex_Position_1; let _e12 = global_2.size; - position = (_e11 * vec3(_e12.x, _e12.y, 1.0)); + position = (_e11 * vec3(_e12.x, _e12.y, 1f)); let _e20 = global.ViewProj; let _e21 = global_1.Model; let _e23 = position; - gl_Position = ((_e20 * _e21) * vec4(_e23.x, _e23.y, _e23.z, 1.0)); + gl_Position = ((_e20 * _e21) * vec4(_e23.x, _e23.y, _e23.z, 1f)); return; } diff --git a/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl b/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl index f7932979b5..f929543ebf 100644 --- a/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl +++ b/naga/tests/out/wgsl/210-bevy-shader.vert.wgsl @@ -28,18 +28,18 @@ var gl_Position: vec4; fn main_1() { let _e10 = global_1.Model; let _e11 = Vertex_Normal_1; - v_Normal = (_e10 * vec4(_e11.x, _e11.y, _e11.z, 1.0)).xyz; + v_Normal = (_e10 * vec4(_e11.x, _e11.y, _e11.z, 1f)).xyz; let _e19 = global_1.Model; let _e29 = Vertex_Normal_1; v_Normal = (mat3x3(_e19[0].xyz, _e19[1].xyz, _e19[2].xyz) * _e29); let _e31 = global_1.Model; let _e32 = Vertex_Position_1; - v_Position = (_e31 * vec4(_e32.x, _e32.y, _e32.z, 1.0)).xyz; + v_Position = (_e31 * vec4(_e32.x, _e32.y, _e32.z, 1f)).xyz; let _e40 = Vertex_Uv_1; v_Uv = _e40; let _e42 = global.ViewProj; let _e43 = v_Position; - gl_Position = (_e42 * vec4(_e43.x, _e43.y, _e43.z, 1.0)); + gl_Position = (_e42 * vec4(_e43.x, _e43.y, _e43.z, 1f)); return; } diff --git a/naga/tests/out/wgsl/246-collatz.comp.wgsl b/naga/tests/out/wgsl/246-collatz.comp.wgsl index 5d1ea64833..cd89fd831a 100644 --- a/naga/tests/out/wgsl/246-collatz.comp.wgsl +++ b/naga/tests/out/wgsl/246-collatz.comp.wgsl @@ -19,7 +19,7 @@ fn collatz_iterations(n: u32) -> u32 { { let _e14 = n_1; let _e15 = f32(_e14); - if ((_e15 - (floor((_e15 / 2.0)) * 2.0)) == 0.0) { + if ((_e15 - (floor((_e15 / 2f)) * 2f)) == 0f) { { let _e25 = n_1; n_1 = (_e25 / 2u); diff --git a/naga/tests/out/wgsl/277-casting.frag.wgsl b/naga/tests/out/wgsl/277-casting.frag.wgsl index 87761aff4e..c9ef2be74a 100644 --- a/naga/tests/out/wgsl/277-casting.frag.wgsl +++ b/naga/tests/out/wgsl/277-casting.frag.wgsl @@ -1,5 +1,5 @@ fn main_1() { - var a: f32 = 1.0; + var a: f32 = 1f; return; } diff --git a/naga/tests/out/wgsl/280-matrix-cast.frag.wgsl b/naga/tests/out/wgsl/280-matrix-cast.frag.wgsl index 7d432ee496..6cc18567cd 100644 --- a/naga/tests/out/wgsl/280-matrix-cast.frag.wgsl +++ b/naga/tests/out/wgsl/280-matrix-cast.frag.wgsl @@ -1,5 +1,5 @@ fn main_1() { - var a: mat4x4 = mat4x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); + var a: mat4x4 = mat4x4(vec4(1f, 0f, 0f, 0f), vec4(0f, 1f, 0f, 0f), vec4(0f, 0f, 1f, 0f), vec4(0f, 0f, 0f, 1f)); } diff --git a/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl b/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl index d749d5a1f4..820ab6194c 100644 --- a/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl +++ b/naga/tests/out/wgsl/800-out-of-bounds-panic.vert.wgsl @@ -25,10 +25,10 @@ fn main_1() { let _e9 = global.view_matrix; let _e10 = global_1.world_matrix; let _e12 = position_1; - gl_Position = ((_e9 * _e10) * vec4(_e12.x, _e12.y, 0.0, 1.0)); + gl_Position = ((_e9 * _e10) * vec4(_e12.x, _e12.y, 0f, 1f)); let _e20 = gl_Position; let _e22 = gl_Position; - gl_Position.z = ((_e20.z + _e22.w) / 2.0); + gl_Position.z = ((_e20.z + _e22.w) / 2f); return; } diff --git a/naga/tests/out/wgsl/900-implicit-conversions.frag.wgsl b/naga/tests/out/wgsl/900-implicit-conversions.frag.wgsl index 9f8620fdda..2c468dd929 100644 --- a/naga/tests/out/wgsl/900-implicit-conversions.frag.wgsl +++ b/naga/tests/out/wgsl/900-implicit-conversions.frag.wgsl @@ -55,9 +55,9 @@ fn implicit_dims_3(v_6: vec4) { } fn main_1() { - exact_1(1); - implicit(1.0); - implicit_dims_2(vec3(1.0)); + exact_1(1i); + implicit(1f); + implicit_dims_2(vec3(1f)); return; } diff --git a/naga/tests/out/wgsl/901-lhs-field-select.frag.wgsl b/naga/tests/out/wgsl/901-lhs-field-select.frag.wgsl index 341ef150e1..ae45360074 100644 --- a/naga/tests/out/wgsl/901-lhs-field-select.frag.wgsl +++ b/naga/tests/out/wgsl/901-lhs-field-select.frag.wgsl @@ -1,7 +1,7 @@ fn main_1() { - var a: vec4 = vec4(1.0); + var a: vec4 = vec4(1f); - a.x = 2.0; + a.x = 2f; return; } diff --git a/naga/tests/out/wgsl/931-constant-emitting.frag.wgsl b/naga/tests/out/wgsl/931-constant-emitting.frag.wgsl index ba5d223ef7..ac59a0c3ef 100644 --- a/naga/tests/out/wgsl/931-constant-emitting.frag.wgsl +++ b/naga/tests/out/wgsl/931-constant-emitting.frag.wgsl @@ -1,7 +1,7 @@ -const constant: i32 = 10; +const constant: i32 = 10i; fn function() -> f32 { - return 0.0; + return 0f; } fn main_1() { diff --git a/naga/tests/out/wgsl/932-for-loop-if.frag.wgsl b/naga/tests/out/wgsl/932-for-loop-if.frag.wgsl index ad1fdd34ee..bf6a281b49 100644 --- a/naga/tests/out/wgsl/932-for-loop-if.frag.wgsl +++ b/naga/tests/out/wgsl/932-for-loop-if.frag.wgsl @@ -1,16 +1,16 @@ fn main_1() { - var i: i32 = 0; + var i: i32 = 0i; loop { let _e2 = i; - if !((_e2 < 1)) { + if !((_e2 < 1i)) { break; } { } continuing { let _e6 = i; - i = (_e6 + 1); + i = (_e6 + 1i); } } return; diff --git a/naga/tests/out/wgsl/abstract-types-const.wgsl b/naga/tests/out/wgsl/abstract-types-const.wgsl index 538be44df7..195247bbbc 100644 --- a/naga/tests/out/wgsl/abstract-types-const.wgsl +++ b/naga/tests/out/wgsl/abstract-types-const.wgsl @@ -5,51 +5,51 @@ struct S { } const xvupaiai: vec2 = vec2(42u, 43u); -const xvfpaiai: vec2 = vec2(44.0, 45.0); +const xvfpaiai: vec2 = vec2(44f, 45f); const xvupuai: vec2 = vec2(42u, 43u); const xvupaiu: vec2 = vec2(42u, 43u); const xvuuai: vec2 = vec2(42u, 43u); const xvuaiu: vec2 = vec2(42u, 43u); -const xmfpaiaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const xmfpafaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const xmfpaiafaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const xmfpaiaiafai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const xmfpaiaiaiaf: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const imfpaiaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const imfpafaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const imfpafafafaf: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -const ivispai: vec2 = vec2(1); -const ivfspaf: vec2 = vec2(1.0); -const ivis_ai: vec2 = vec2(1); +const xmfpaiaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const xmfpafaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const xmfpaiafaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const xmfpaiaiafai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const xmfpaiaiaiaf: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const imfpaiaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const imfpafaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const imfpafafafaf: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +const ivispai: vec2 = vec2(1i); +const ivfspaf: vec2 = vec2(1f); +const ivis_ai: vec2 = vec2(1i); const ivus_ai: vec2 = vec2(1u); -const ivfs_ai: vec2 = vec2(1.0); -const ivfs_af: vec2 = vec2(1.0); -const iafafaf: array = array(1.0, 2.0); -const iafaiai: array = array(1.0, 2.0); -const iafpafaf: array = array(1.0, 2.0); -const iafpaiaf: array = array(1.0, 2.0); -const iafpafai: array = array(1.0, 2.0); -const xafpafaf: array = array(1.0, 2.0); -const s_f_i_u: S = S(1.0, 1, 1u); -const s_f_iai: S = S(1.0, 1, 1u); -const s_fai_u: S = S(1.0, 1, 1u); -const s_faiai: S = S(1.0, 1, 1u); -const saf_i_u: S = S(1.0, 1, 1u); -const saf_iai: S = S(1.0, 1, 1u); -const safai_u: S = S(1.0, 1, 1u); -const safaiai: S = S(1.0, 1, 1u); -const ivfr_f_f: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivfr_f_af: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivfraf_f: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivfraf_af: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivf_fr_f: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivf_fraf: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivf_afr_f: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivf_afraf: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivfr_f_ai: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivfrai_f: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivfrai_ai: vec3 = vec3(vec2(1.0, 2.0), 3.0); -const ivf_frai: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivf_air_f: vec3 = vec3(1.0, vec2(2.0, 3.0)); -const ivf_airai: vec3 = vec3(1.0, vec2(2.0, 3.0)); +const ivfs_ai: vec2 = vec2(1f); +const ivfs_af: vec2 = vec2(1f); +const iafafaf: array = array(1f, 2f); +const iafaiai: array = array(1f, 2f); +const iafpafaf: array = array(1f, 2f); +const iafpaiaf: array = array(1f, 2f); +const iafpafai: array = array(1f, 2f); +const xafpafaf: array = array(1f, 2f); +const s_f_i_u: S = S(1f, 1i, 1u); +const s_f_iai: S = S(1f, 1i, 1u); +const s_fai_u: S = S(1f, 1i, 1u); +const s_faiai: S = S(1f, 1i, 1u); +const saf_i_u: S = S(1f, 1i, 1u); +const saf_iai: S = S(1f, 1i, 1u); +const safai_u: S = S(1f, 1i, 1u); +const safaiai: S = S(1f, 1i, 1u); +const ivfr_f_f: vec3 = vec3(vec2(1f, 2f), 3f); +const ivfr_f_af: vec3 = vec3(vec2(1f, 2f), 3f); +const ivfraf_f: vec3 = vec3(vec2(1f, 2f), 3f); +const ivfraf_af: vec3 = vec3(vec2(1f, 2f), 3f); +const ivf_fr_f: vec3 = vec3(1f, vec2(2f, 3f)); +const ivf_fraf: vec3 = vec3(1f, vec2(2f, 3f)); +const ivf_afr_f: vec3 = vec3(1f, vec2(2f, 3f)); +const ivf_afraf: vec3 = vec3(1f, vec2(2f, 3f)); +const ivfr_f_ai: vec3 = vec3(vec2(1f, 2f), 3f); +const ivfrai_f: vec3 = vec3(vec2(1f, 2f), 3f); +const ivfrai_ai: vec3 = vec3(vec2(1f, 2f), 3f); +const ivf_frai: vec3 = vec3(1f, vec2(2f, 3f)); +const ivf_air_f: vec3 = vec3(1f, vec2(2f, 3f)); +const ivf_airai: vec3 = vec3(1f, vec2(2f, 3f)); diff --git a/naga/tests/out/wgsl/abstract-types-operators.wgsl b/naga/tests/out/wgsl/abstract-types-operators.wgsl new file mode 100644 index 0000000000..a0278712ad --- /dev/null +++ b/naga/tests/out/wgsl/abstract-types-operators.wgsl @@ -0,0 +1,68 @@ +const plus_fafaf_1: f32 = 3f; +const plus_fafai_1: f32 = 3f; +const plus_faf_f_1: f32 = 3f; +const plus_faiaf_1: f32 = 3f; +const plus_faiai_1: f32 = 3f; +const plus_fai_f_1: f32 = 3f; +const plus_f_faf_1: f32 = 3f; +const plus_f_fai_1: f32 = 3f; +const plus_f_f_f_1: f32 = 3f; +const plus_iaiai_1: i32 = 3i; +const plus_iai_i_1: i32 = 3i; +const plus_i_iai_1: i32 = 3i; +const plus_i_i_i_1: i32 = 3i; +const plus_uaiai_1: u32 = 3u; +const plus_uai_u_1: u32 = 3u; +const plus_u_uai_1: u32 = 3u; +const plus_u_u_u_1: u32 = 3u; + +fn runtime_values() { + var f: f32 = 42f; + var i: i32 = 43i; + var u: u32 = 44u; + var plus_fafaf: f32 = 3f; + var plus_fafai: f32 = 3f; + var plus_faf_f: f32; + var plus_faiaf: f32 = 3f; + var plus_faiai: f32 = 3f; + var plus_fai_f: f32; + var plus_f_faf: f32; + var plus_f_fai: f32; + var plus_f_f_f: f32; + var plus_iaiai: i32 = 3i; + var plus_iai_i: i32; + var plus_i_iai: i32; + var plus_i_i_i: i32; + var plus_uaiai: u32 = 3u; + var plus_uai_u: u32; + var plus_u_uai: u32; + var plus_u_u_u: u32; + + let _e8 = f; + plus_faf_f = (1f + _e8); + let _e14 = f; + plus_fai_f = (1f + _e14); + let _e18 = f; + plus_f_faf = (_e18 + 2f); + let _e22 = f; + plus_f_fai = (_e22 + 2f); + let _e26 = f; + let _e27 = f; + plus_f_f_f = (_e26 + _e27); + let _e31 = i; + plus_iai_i = (1i + _e31); + let _e35 = i; + plus_i_iai = (_e35 + 2i); + let _e39 = i; + let _e40 = i; + plus_i_i_i = (_e39 + _e40); + let _e44 = u; + plus_uai_u = (1u + _e44); + let _e48 = u; + plus_u_uai = (_e48 + 2u); + let _e52 = u; + let _e53 = u; + plus_u_u_u = (_e52 + _e53); + return; +} + diff --git a/naga/tests/out/wgsl/abstract-types-var.wgsl b/naga/tests/out/wgsl/abstract-types-var.wgsl index ae95ff2e82..0533f19442 100644 --- a/naga/tests/out/wgsl/abstract-types-var.wgsl +++ b/naga/tests/out/wgsl/abstract-types-var.wgsl @@ -1,62 +1,62 @@ -var xvipaiai_1: vec2 = vec2(42, 43); +var xvipaiai_1: vec2 = vec2(42i, 43i); var xvupaiai_1: vec2 = vec2(44u, 45u); -var xvfpaiai_1: vec2 = vec2(46.0, 47.0); +var xvfpaiai_1: vec2 = vec2(46f, 47f); var xvupuai_2: vec2 = vec2(42u, 43u); var xvupaiu_2: vec2 = vec2(42u, 43u); var xvuuai_2: vec2 = vec2(42u, 43u); var xvuaiu_2: vec2 = vec2(42u, 43u); -var xmfpaiaiaiai_1: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -var xmfpafaiaiai_1: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -var xmfpaiafaiai_1: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -var xmfpaiaiafai_1: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -var xmfpaiaiaiaf_1: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); -var xvispai_1: vec2 = vec2(1); -var xvfspaf_1: vec2 = vec2(1.0); -var xvis_ai_1: vec2 = vec2(1); +var xmfpaiaiaiai_1: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +var xmfpafaiaiai_1: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +var xmfpaiafaiai_1: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +var xmfpaiaiafai_1: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +var xmfpaiaiaiaf_1: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); +var xvispai_1: vec2 = vec2(1i); +var xvfspaf_1: vec2 = vec2(1f); +var xvis_ai_1: vec2 = vec2(1i); var xvus_ai_1: vec2 = vec2(1u); -var xvfs_ai_1: vec2 = vec2(1.0); -var xvfs_af_1: vec2 = vec2(1.0); -var xafafaf_1: array = array(1.0, 2.0); -var xafaiai_1: array = array(1.0, 2.0); -var xafpaiai_1: array = array(1, 2); -var xafpaiaf_1: array = array(1.0, 2.0); -var xafpafai_1: array = array(1.0, 2.0); -var xafpafaf_1: array = array(1.0, 2.0); +var xvfs_ai_1: vec2 = vec2(1f); +var xvfs_af_1: vec2 = vec2(1f); +var xafafaf_1: array = array(1f, 2f); +var xafaiai_1: array = array(1f, 2f); +var xafpaiai_1: array = array(1i, 2i); +var xafpaiaf_1: array = array(1f, 2f); +var xafpafai_1: array = array(1f, 2f); +var xafpafaf_1: array = array(1f, 2f); fn all_constant_arguments() { - var xvipaiai: vec2 = vec2(42, 43); + var xvipaiai: vec2 = vec2(42i, 43i); var xvupaiai: vec2 = vec2(44u, 45u); - var xvfpaiai: vec2 = vec2(46.0, 47.0); + var xvfpaiai: vec2 = vec2(46f, 47f); var xvupuai: vec2 = vec2(42u, 43u); var xvupaiu: vec2 = vec2(42u, 43u); var xvuuai: vec2 = vec2(42u, 43u); var xvuaiu: vec2 = vec2(42u, 43u); - var xmfpaiaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpafaiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpaiafaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpaiaiafai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpaiaiaiaf: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfp_faiaiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpai_faiai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpaiai_fai: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xmfpaiaiai_f: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var xvispai: vec2 = vec2(1); - var xvfspaf: vec2 = vec2(1.0); - var xvis_ai: vec2 = vec2(1); + var xmfpaiaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpafaiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpaiafaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpaiaiafai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpaiaiaiaf: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfp_faiaiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpai_faiai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpaiai_fai: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xmfpaiaiai_f: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var xvispai: vec2 = vec2(1i); + var xvfspaf: vec2 = vec2(1f); + var xvis_ai: vec2 = vec2(1i); var xvus_ai: vec2 = vec2(1u); - var xvfs_ai: vec2 = vec2(1.0); - var xvfs_af: vec2 = vec2(1.0); - var xafafaf: array = array(1.0, 2.0); - var xaf_faf: array = array(1.0, 2.0); - var xafaf_f: array = array(1.0, 2.0); - var xafaiai: array = array(1.0, 2.0); - var xai_iai: array = array(1, 2); - var xaiai_i: array = array(1, 2); - var xaipaiai: array = array(1, 2); - var xafpaiai: array = array(1.0, 2.0); - var xafpaiaf: array = array(1.0, 2.0); - var xafpafai: array = array(1.0, 2.0); - var xafpafaf: array = array(1.0, 2.0); + var xvfs_ai: vec2 = vec2(1f); + var xvfs_af: vec2 = vec2(1f); + var xafafaf: array = array(1f, 2f); + var xaf_faf: array = array(1f, 2f); + var xafaf_f: array = array(1f, 2f); + var xafaiai: array = array(1f, 2f); + var xai_iai: array = array(1i, 2i); + var xaiai_i: array = array(1i, 2i); + var xaipaiai: array = array(1i, 2i); + var xafpaiai: array = array(1f, 2f); + var xafpaiaf: array = array(1f, 2f); + var xafpafai: array = array(1f, 2f); + var xafpafaf: array = array(1f, 2f); } @@ -94,37 +94,37 @@ fn mixed_constant_and_runtime_arguments() { let _e15 = u; xvuaiu_1 = vec2(42u, _e15); let _e19 = f; - xmfp_faiaiai_1 = mat2x2(vec2(_e19, 2.0), vec2(3.0, 4.0)); + xmfp_faiaiai_1 = mat2x2(vec2(_e19, 2f), vec2(3f, 4f)); let _e27 = f; - xmfpai_faiai_1 = mat2x2(vec2(1.0, _e27), vec2(3.0, 4.0)); + xmfpai_faiai_1 = mat2x2(vec2(1f, _e27), vec2(3f, 4f)); let _e35 = f; - xmfpaiai_fai_1 = mat2x2(vec2(1.0, 2.0), vec2(_e35, 4.0)); + xmfpaiai_fai_1 = mat2x2(vec2(1f, 2f), vec2(_e35, 4f)); let _e43 = f; - xmfpaiaiai_f_1 = mat2x2(vec2(1.0, 2.0), vec2(3.0, _e43)); + xmfpaiaiai_f_1 = mat2x2(vec2(1f, 2f), vec2(3f, _e43)); let _e51 = f; - xaf_faf_1 = array(_e51, 2.0); + xaf_faf_1 = array(_e51, 2f); let _e55 = f; - xafaf_f_1 = array(1.0, _e55); + xafaf_f_1 = array(1f, _e55); let _e59 = f; - xaf_fai = array(_e59, 2.0); + xaf_fai = array(_e59, 2f); let _e63 = f; - xafai_f = array(1.0, _e63); + xafai_f = array(1f, _e63); let _e67 = i; - xai_iai_1 = array(_e67, 2); + xai_iai_1 = array(_e67, 2i); let _e71 = i; - xaiai_i_1 = array(1, _e71); + xaiai_i_1 = array(1i, _e71); let _e75 = f; - xafp_faf = array(_e75, 2.0); + xafp_faf = array(_e75, 2f); let _e79 = f; - xafpaf_f = array(1.0, _e79); + xafpaf_f = array(1f, _e79); let _e83 = f; - xafp_fai = array(_e83, 2.0); + xafp_fai = array(_e83, 2f); let _e87 = f; - xafpai_f = array(1.0, _e87); + xafpai_f = array(1f, _e87); let _e91 = i; - xaip_iai = array(_e91, 2); + xaip_iai = array(_e91, 2i); let _e95 = i; - xaipai_i = array(1, _e95); + xaipai_i = array(1i, _e95); return; } diff --git a/naga/tests/out/wgsl/access.wgsl b/naga/tests/out/wgsl/access.wgsl index e6904bd62d..1409e80b11 100644 --- a/naga/tests/out/wgsl/access.wgsl +++ b/naga/tests/out/wgsl/access.wgsl @@ -25,7 +25,7 @@ struct MatCx2InArray { am: array, 2>, } -var global_const: GlobalConst = GlobalConst(0u, vec3(0u, 0u, 0u), 0); +var global_const: GlobalConst = GlobalConst(0u, vec3(0u, 0u, 0u), 0i); @group(0) @binding(0) var bar: Bar; @group(0) @binding(1) @@ -36,11 +36,11 @@ var qux: vec2; var nested_mat_cx2_: MatCx2InArray; fn test_matrix_within_struct_accesses() { - var idx: i32 = 1; - var t: Baz = Baz(mat3x2(vec2(1.0), vec2(2.0), vec2(3.0))); + var idx: i32 = 1i; + var t: Baz = Baz(mat3x2(vec2(1f), vec2(2f), vec2(3f))); let _e3 = idx; - idx = (_e3 - 1); + idx = (_e3 - 1i); let l0_ = baz.m; let l1_ = baz.m[0]; let _e14 = idx; @@ -54,28 +54,28 @@ fn test_matrix_within_struct_accesses() { let _e38 = idx; let l6_ = baz.m[_e36][_e38]; let _e51 = idx; - idx = (_e51 + 1); - t.m = mat3x2(vec2(6.0), vec2(5.0), vec2(4.0)); - t.m[0] = vec2(9.0); + idx = (_e51 + 1i); + t.m = mat3x2(vec2(6f), vec2(5f), vec2(4f)); + t.m[0] = vec2(9f); let _e66 = idx; - t.m[_e66] = vec2(90.0); - t.m[0][1] = 10.0; + t.m[_e66] = vec2(90f); + t.m[0][1] = 10f; let _e76 = idx; - t.m[0][_e76] = 20.0; + t.m[0][_e76] = 20f; let _e80 = idx; - t.m[_e80][1] = 30.0; + t.m[_e80][1] = 30f; let _e85 = idx; let _e87 = idx; - t.m[_e85][_e87] = 40.0; + t.m[_e85][_e87] = 40f; return; } fn test_matrix_within_array_within_struct_accesses() { - var idx_1: i32 = 1; + var idx_1: i32 = 1i; var t_1: MatCx2InArray = MatCx2InArray(array, 2>()); let _e3 = idx_1; - idx_1 = (_e3 - 1); + idx_1 = (_e3 - 1i); let l0_1 = nested_mat_cx2_.am; let l1_1 = nested_mat_cx2_.am[0]; let l2_1 = nested_mat_cx2_.am[0][0]; @@ -90,20 +90,20 @@ fn test_matrix_within_array_within_struct_accesses() { let _e48 = idx_1; let l7_ = nested_mat_cx2_.am[0][_e46][_e48]; let _e55 = idx_1; - idx_1 = (_e55 + 1); + idx_1 = (_e55 + 1i); t_1.am = array, 2>(); - t_1.am[0] = mat4x2(vec2(8.0), vec2(7.0), vec2(6.0), vec2(5.0)); - t_1.am[0][0] = vec2(9.0); + t_1.am[0] = mat4x2(vec2(8f), vec2(7f), vec2(6f), vec2(5f)); + t_1.am[0][0] = vec2(9f); let _e77 = idx_1; - t_1.am[0][_e77] = vec2(90.0); - t_1.am[0][0][1] = 10.0; + t_1.am[0][_e77] = vec2(90f); + t_1.am[0][0][1] = 10f; let _e89 = idx_1; - t_1.am[0][0][_e89] = 20.0; + t_1.am[0][0][_e89] = 20f; let _e94 = idx_1; - t_1.am[0][_e94][1] = 30.0; + t_1.am[0][_e94][1] = 30f; let _e100 = idx_1; let _e102 = idx_1; - t_1.am[0][_e100][_e102] = 40.0; + t_1.am[0][_e100][_e102] = 40f; return; } @@ -122,17 +122,17 @@ fn assign_through_ptr_fn(p: ptr) { } fn assign_array_through_ptr_fn(foo_2: ptr, 2>>) { - (*foo_2) = array, 2>(vec4(1.0), vec4(2.0)); + (*foo_2) = array, 2>(vec4(1f), vec4(2f)); return; } @vertex fn foo_vert(@builtin(vertex_index) vi: u32) -> @builtin(position) vec4 { - var foo: f32 = 0.0; + var foo: f32 = 0f; var c2_: array; let baz_1 = foo; - foo = 1.0; + foo = 1f; test_matrix_within_struct_accesses(); test_matrix_within_array_within_struct_accesses(); let _matrix = bar._matrix; @@ -142,27 +142,27 @@ fn foo_vert(@builtin(vertex_index) vi: u32) -> @builtin(position) vec4 { let c = qux; let data_pointer = (&bar.data[0].value); let _e33 = read_from_private((&foo)); - c2_ = array(a_1, i32(b), 3, 4, 5); - c2_[(vi + 1u)] = 42; + c2_ = array(a_1, i32(b), 3i, 4i, 5i); + c2_[(vi + 1u)] = 42i; let value = c2_[vi]; let _e47 = test_arr_as_arg(array, 5>()); - return vec4((_matrix * vec4(vec4(value))), 2.0); + return vec4((_matrix * vec4(vec4(value))), 2f); } @fragment fn foo_frag() -> @location(0) vec4 { - bar._matrix[1][2] = 1.0; - bar._matrix = mat4x3(vec3(0.0), vec3(1.0), vec3(2.0), vec3(3.0)); + bar._matrix[1][2] = 1f; + bar._matrix = mat4x3(vec3(0f), vec3(1f), vec3(2f), vec3(3f)); bar.arr = array, 2>(vec2(0u), vec2(1u)); - bar.data[1].value = 1; + bar.data[1].value = 1i; qux = vec2(); - return vec4(0.0); + return vec4(0f); } @compute @workgroup_size(1, 1, 1) fn assign_through_ptr() { var val: u32 = 33u; - var arr: array, 2> = array, 2>(vec4(6.0), vec4(7.0)); + var arr: array, 2> = array, 2>(vec4(6f), vec4(7f)); assign_through_ptr_fn((&val)); assign_array_through_ptr_fn((&arr)); diff --git a/naga/tests/out/wgsl/array-in-function-return-type.wgsl b/naga/tests/out/wgsl/array-in-function-return-type.wgsl index 2d5b1e84aa..2beacd3ff4 100644 --- a/naga/tests/out/wgsl/array-in-function-return-type.wgsl +++ b/naga/tests/out/wgsl/array-in-function-return-type.wgsl @@ -1,9 +1,9 @@ fn ret_array() -> array { - return array(1.0, 2.0); + return array(1f, 2f); } @fragment fn main() -> @location(0) vec4 { let _e0 = ret_array(); - return vec4(_e0[0], _e0[1], 0.0, 1.0); + return vec4(_e0[0], _e0[1], 0f, 1f); } diff --git a/naga/tests/out/wgsl/atomicCompareExchange.wgsl b/naga/tests/out/wgsl/atomicCompareExchange.wgsl index 5f98c61969..17bd5144b1 100644 --- a/naga/tests/out/wgsl/atomicCompareExchange.wgsl +++ b/naga/tests/out/wgsl/atomicCompareExchange.wgsl @@ -30,7 +30,7 @@ fn test_atomic_compare_exchange_i32_() { } { let _e14 = old; - let new_ = bitcast((bitcast(_e14) + 1.0)); + let new_ = bitcast((bitcast(_e14) + 1f)); let _e20 = i; let _e22 = old; let _e23 = atomicCompareExchangeWeak((&arr_i32_[_e20]), _e22, new_); @@ -72,7 +72,7 @@ fn test_atomic_compare_exchange_u32_() { } { let _e14 = old_1; - let new_1 = bitcast((bitcast(_e14) + 1.0)); + let new_1 = bitcast((bitcast(_e14) + 1f)); let _e20 = i_1; let _e22 = old_1; let _e23 = atomicCompareExchangeWeak((&arr_u32_[_e20]), _e22, new_1); diff --git a/naga/tests/out/wgsl/atomicOps.wgsl b/naga/tests/out/wgsl/atomicOps.wgsl index dcffe38e14..be102e6833 100644 --- a/naga/tests/out/wgsl/atomicOps.wgsl +++ b/naga/tests/out/wgsl/atomicOps.wgsl @@ -16,13 +16,13 @@ var workgroup_struct: Struct; @compute @workgroup_size(2, 1, 1) fn cs_main(@builtin(local_invocation_id) id: vec3) { atomicStore((&storage_atomic_scalar), 1u); - atomicStore((&storage_atomic_arr[1]), 1); + atomicStore((&storage_atomic_arr[1]), 1i); atomicStore((&storage_struct.atomic_scalar), 1u); - atomicStore((&storage_struct.atomic_arr[1]), 1); + atomicStore((&storage_struct.atomic_arr[1]), 1i); atomicStore((&workgroup_atomic_scalar), 1u); - atomicStore((&workgroup_atomic_arr[1]), 1); + atomicStore((&workgroup_atomic_arr[1]), 1i); atomicStore((&workgroup_struct.atomic_scalar), 1u); - atomicStore((&workgroup_struct.atomic_arr[1]), 1); + atomicStore((&workgroup_struct.atomic_arr[1]), 1i); workgroupBarrier(); let l0_ = atomicLoad((&storage_atomic_scalar)); let l1_ = atomicLoad((&storage_atomic_arr[1])); @@ -34,74 +34,74 @@ fn cs_main(@builtin(local_invocation_id) id: vec3) { let l7_ = atomicLoad((&workgroup_struct.atomic_arr[1])); workgroupBarrier(); let _e51 = atomicAdd((&storage_atomic_scalar), 1u); - let _e55 = atomicAdd((&storage_atomic_arr[1]), 1); + let _e55 = atomicAdd((&storage_atomic_arr[1]), 1i); let _e59 = atomicAdd((&storage_struct.atomic_scalar), 1u); - let _e64 = atomicAdd((&storage_struct.atomic_arr[1]), 1); + let _e64 = atomicAdd((&storage_struct.atomic_arr[1]), 1i); let _e67 = atomicAdd((&workgroup_atomic_scalar), 1u); - let _e71 = atomicAdd((&workgroup_atomic_arr[1]), 1); + let _e71 = atomicAdd((&workgroup_atomic_arr[1]), 1i); let _e75 = atomicAdd((&workgroup_struct.atomic_scalar), 1u); - let _e80 = atomicAdd((&workgroup_struct.atomic_arr[1]), 1); + let _e80 = atomicAdd((&workgroup_struct.atomic_arr[1]), 1i); workgroupBarrier(); let _e83 = atomicSub((&storage_atomic_scalar), 1u); - let _e87 = atomicSub((&storage_atomic_arr[1]), 1); + let _e87 = atomicSub((&storage_atomic_arr[1]), 1i); let _e91 = atomicSub((&storage_struct.atomic_scalar), 1u); - let _e96 = atomicSub((&storage_struct.atomic_arr[1]), 1); + let _e96 = atomicSub((&storage_struct.atomic_arr[1]), 1i); let _e99 = atomicSub((&workgroup_atomic_scalar), 1u); - let _e103 = atomicSub((&workgroup_atomic_arr[1]), 1); + let _e103 = atomicSub((&workgroup_atomic_arr[1]), 1i); let _e107 = atomicSub((&workgroup_struct.atomic_scalar), 1u); - let _e112 = atomicSub((&workgroup_struct.atomic_arr[1]), 1); + let _e112 = atomicSub((&workgroup_struct.atomic_arr[1]), 1i); workgroupBarrier(); let _e115 = atomicMax((&storage_atomic_scalar), 1u); - let _e119 = atomicMax((&storage_atomic_arr[1]), 1); + let _e119 = atomicMax((&storage_atomic_arr[1]), 1i); let _e123 = atomicMax((&storage_struct.atomic_scalar), 1u); - let _e128 = atomicMax((&storage_struct.atomic_arr[1]), 1); + let _e128 = atomicMax((&storage_struct.atomic_arr[1]), 1i); let _e131 = atomicMax((&workgroup_atomic_scalar), 1u); - let _e135 = atomicMax((&workgroup_atomic_arr[1]), 1); + let _e135 = atomicMax((&workgroup_atomic_arr[1]), 1i); let _e139 = atomicMax((&workgroup_struct.atomic_scalar), 1u); - let _e144 = atomicMax((&workgroup_struct.atomic_arr[1]), 1); + let _e144 = atomicMax((&workgroup_struct.atomic_arr[1]), 1i); workgroupBarrier(); let _e147 = atomicMin((&storage_atomic_scalar), 1u); - let _e151 = atomicMin((&storage_atomic_arr[1]), 1); + let _e151 = atomicMin((&storage_atomic_arr[1]), 1i); let _e155 = atomicMin((&storage_struct.atomic_scalar), 1u); - let _e160 = atomicMin((&storage_struct.atomic_arr[1]), 1); + let _e160 = atomicMin((&storage_struct.atomic_arr[1]), 1i); let _e163 = atomicMin((&workgroup_atomic_scalar), 1u); - let _e167 = atomicMin((&workgroup_atomic_arr[1]), 1); + let _e167 = atomicMin((&workgroup_atomic_arr[1]), 1i); let _e171 = atomicMin((&workgroup_struct.atomic_scalar), 1u); - let _e176 = atomicMin((&workgroup_struct.atomic_arr[1]), 1); + let _e176 = atomicMin((&workgroup_struct.atomic_arr[1]), 1i); workgroupBarrier(); let _e179 = atomicAnd((&storage_atomic_scalar), 1u); - let _e183 = atomicAnd((&storage_atomic_arr[1]), 1); + let _e183 = atomicAnd((&storage_atomic_arr[1]), 1i); let _e187 = atomicAnd((&storage_struct.atomic_scalar), 1u); - let _e192 = atomicAnd((&storage_struct.atomic_arr[1]), 1); + let _e192 = atomicAnd((&storage_struct.atomic_arr[1]), 1i); let _e195 = atomicAnd((&workgroup_atomic_scalar), 1u); - let _e199 = atomicAnd((&workgroup_atomic_arr[1]), 1); + let _e199 = atomicAnd((&workgroup_atomic_arr[1]), 1i); let _e203 = atomicAnd((&workgroup_struct.atomic_scalar), 1u); - let _e208 = atomicAnd((&workgroup_struct.atomic_arr[1]), 1); + let _e208 = atomicAnd((&workgroup_struct.atomic_arr[1]), 1i); workgroupBarrier(); let _e211 = atomicOr((&storage_atomic_scalar), 1u); - let _e215 = atomicOr((&storage_atomic_arr[1]), 1); + let _e215 = atomicOr((&storage_atomic_arr[1]), 1i); let _e219 = atomicOr((&storage_struct.atomic_scalar), 1u); - let _e224 = atomicOr((&storage_struct.atomic_arr[1]), 1); + let _e224 = atomicOr((&storage_struct.atomic_arr[1]), 1i); let _e227 = atomicOr((&workgroup_atomic_scalar), 1u); - let _e231 = atomicOr((&workgroup_atomic_arr[1]), 1); + let _e231 = atomicOr((&workgroup_atomic_arr[1]), 1i); let _e235 = atomicOr((&workgroup_struct.atomic_scalar), 1u); - let _e240 = atomicOr((&workgroup_struct.atomic_arr[1]), 1); + let _e240 = atomicOr((&workgroup_struct.atomic_arr[1]), 1i); workgroupBarrier(); let _e243 = atomicXor((&storage_atomic_scalar), 1u); - let _e247 = atomicXor((&storage_atomic_arr[1]), 1); + let _e247 = atomicXor((&storage_atomic_arr[1]), 1i); let _e251 = atomicXor((&storage_struct.atomic_scalar), 1u); - let _e256 = atomicXor((&storage_struct.atomic_arr[1]), 1); + let _e256 = atomicXor((&storage_struct.atomic_arr[1]), 1i); let _e259 = atomicXor((&workgroup_atomic_scalar), 1u); - let _e263 = atomicXor((&workgroup_atomic_arr[1]), 1); + let _e263 = atomicXor((&workgroup_atomic_arr[1]), 1i); let _e267 = atomicXor((&workgroup_struct.atomic_scalar), 1u); - let _e272 = atomicXor((&workgroup_struct.atomic_arr[1]), 1); + let _e272 = atomicXor((&workgroup_struct.atomic_arr[1]), 1i); let _e275 = atomicExchange((&storage_atomic_scalar), 1u); - let _e279 = atomicExchange((&storage_atomic_arr[1]), 1); + let _e279 = atomicExchange((&storage_atomic_arr[1]), 1i); let _e283 = atomicExchange((&storage_struct.atomic_scalar), 1u); - let _e288 = atomicExchange((&storage_struct.atomic_arr[1]), 1); + let _e288 = atomicExchange((&storage_struct.atomic_arr[1]), 1i); let _e291 = atomicExchange((&workgroup_atomic_scalar), 1u); - let _e295 = atomicExchange((&workgroup_atomic_arr[1]), 1); + let _e295 = atomicExchange((&workgroup_atomic_arr[1]), 1i); let _e299 = atomicExchange((&workgroup_struct.atomic_scalar), 1u); - let _e304 = atomicExchange((&workgroup_struct.atomic_arr[1]), 1); + let _e304 = atomicExchange((&workgroup_struct.atomic_arr[1]), 1i); return; } diff --git a/naga/tests/out/wgsl/bevy-pbr.frag.wgsl b/naga/tests/out/wgsl/bevy-pbr.frag.wgsl index c40b6dd73d..81d69d0736 100644 --- a/naga/tests/out/wgsl/bevy-pbr.frag.wgsl +++ b/naga/tests/out/wgsl/bevy-pbr.frag.wgsl @@ -48,9 +48,9 @@ struct FragmentOutput { @location(0) o_Target: vec4, } -const MAX_POINT_LIGHTS: i32 = 10; -const MAX_DIRECTIONAL_LIGHTS: i32 = 1; -const PI: f32 = 3.1415927; +const MAX_POINT_LIGHTS: i32 = 10i; +const MAX_DIRECTIONAL_LIGHTS: i32 = 1i; +const PI: f32 = 3.1415927f; var v_WorldPosition_1: vec3; var v_WorldNormal_1: vec3; @@ -125,13 +125,13 @@ fn getDistanceAttenuation(distanceSquare: f32, inverseRangeSquared: f32) -> f32 let _e50 = factor; let _e56 = factor; let _e57 = factor; - smoothFactor = clamp((1.0 - (_e56 * _e57)), 0.0, 1.0); + smoothFactor = clamp((1f - (_e56 * _e57)), 0f, 1f); let _e64 = smoothFactor; let _e65 = smoothFactor; attenuation = (_e64 * _e65); let _e68 = attenuation; let _e73 = distanceSquare_1; - return ((_e68 * 1.0) / max(_e73, 0.001)); + return ((_e68 * 1f) / max(_e73, 0.001f)); } fn D_GGX(roughness: f32, NoH: f32, h: vec3) -> f32 { @@ -146,7 +146,7 @@ fn D_GGX(roughness: f32, NoH: f32, h: vec3) -> f32 { NoH_1 = NoH; let _e46 = NoH_1; let _e47 = NoH_1; - oneMinusNoHSquared = (1.0 - (_e46 * _e47)); + oneMinusNoHSquared = (1f - (_e46 * _e47)); let _e51 = NoH_1; let _e52 = roughness_1; a = (_e51 * _e52); @@ -157,7 +157,7 @@ fn D_GGX(roughness: f32, NoH: f32, h: vec3) -> f32 { k = (_e55 / (_e56 + (_e57 * _e58))); let _e63 = k; let _e64 = k; - d = ((_e63 * _e64) * 0.31830987); + d = ((_e63 * _e64) * 0.31830987f); let _e71 = d; return _e71; } @@ -203,7 +203,7 @@ fn V_SmithGGXCorrelated(roughness_2: f32, NoV: f32, NoL: f32) -> f32 { lambdaL = (_e72 * sqrt((((_e82 - (_e83 * _e84)) * _e87) + _e89))); let _e95 = lambdaV; let _e96 = lambdaL; - v = (0.5 / (_e95 + _e96)); + v = (0.5f / (_e95 + _e96)); let _e100 = v; return _e100; } @@ -217,7 +217,7 @@ fn F_Schlick(f0_: vec3, f90_: f32, VoH: f32) -> vec3 { let _e45 = f90_1; let _e49 = VoH_1; let _e52 = VoH_1; - let _e54 = pow5_((1.0 - _e52)); + let _e54 = pow5_((1f - _e52)); return (f0_ + ((vec3(_e45) - f0_) * _e54)); } @@ -234,7 +234,7 @@ fn F_Schlick_1(f0_1: f32, f90_2: f32, VoH_2: f32) -> f32 { let _e48 = f0_2; let _e51 = VoH_3; let _e54 = VoH_3; - let _e56 = pow5_((1.0 - _e54)); + let _e56 = pow5_((1f - _e54)); return (_e46 + ((_e47 - _e48) * _e56)); } @@ -247,7 +247,7 @@ fn fresnel(f0_3: vec3, LoH: f32) -> vec3 { LoH_1 = LoH; let _e49 = f0_4; let _e62 = f0_4; - f90_4 = clamp(dot(_e62, vec3(16.5)), 0.0, 1.0); + f90_4 = clamp(dot(_e62, vec3(16.5f)), 0f, 1f); let _e75 = f0_4; let _e76 = f90_4; let _e77 = LoH_1; @@ -310,26 +310,26 @@ fn Fd_Burley(roughness_6: f32, NoV_4: f32, NoL_4: f32, LoH_4: f32) -> f32 { let _e50 = roughness_7; let _e52 = LoH_5; let _e54 = LoH_5; - f90_5 = (0.5 + (((2.0 * _e50) * _e52) * _e54)); + f90_5 = (0.5f + (((2f * _e50) * _e52) * _e54)); let _e62 = f90_5; let _e63 = NoL_5; - let _e64 = F_Schlick_1(1.0, _e62, _e63); + let _e64 = F_Schlick_1(1f, _e62, _e63); lightScatter = _e64; let _e70 = f90_5; let _e71 = NoV_5; - let _e72 = F_Schlick_1(1.0, _e70, _e71); + let _e72 = F_Schlick_1(1f, _e70, _e71); viewScatter = _e72; let _e74 = lightScatter; let _e75 = viewScatter; - return ((_e74 * _e75) * 0.31830987); + return ((_e74 * _e75) * 0.31830987f); } fn EnvBRDFApprox(f0_7: vec3, perceptual_roughness: f32, NoV_6: f32) -> vec3 { var f0_8: vec3; var perceptual_roughness_1: f32; var NoV_7: f32; - var c0_: vec4 = vec4(-1.0, -0.0275, -0.572, 0.022); - var c1_: vec4 = vec4(1.0, 0.0425, 1.04, -0.04); + var c0_: vec4 = vec4(-1f, -0.0275f, -0.572f, 0.022f); + var c1_: vec4 = vec4(1f, 0.0425f, 1.04f, -0.04f); var r: vec4; var a004_: f32; var AB: vec2; @@ -351,10 +351,10 @@ fn EnvBRDFApprox(f0_7: vec3, perceptual_roughness: f32, NoV_6: f32) -> vec3 let _e94 = NoV_7; let _e98 = r; let _e101 = r; - a004_ = ((min((_e83.x * _e85.x), exp2((-9.28 * _e94))) * _e98.x) + _e101.y); + a004_ = ((min((_e83.x * _e85.x), exp2((-9.28f * _e94))) * _e98.x) + _e101.y); let _e109 = a004_; let _e112 = r; - AB = ((vec2(-1.04, 1.04) * vec2(_e109)) + _e112.zw); + AB = ((vec2(-1.04f, 1.04f) * vec2(_e109)) + _e112.zw); let _e116 = f0_8; let _e117 = AB; let _e121 = AB; @@ -367,7 +367,7 @@ fn perceptualRoughnessToRoughness(perceptualRoughness: f32) -> f32 { perceptualRoughness_1 = perceptualRoughness; let _e45 = perceptualRoughness_1; - clampedPerceptualRoughness = clamp(_e45, 0.089, 1.0); + clampedPerceptualRoughness = clamp(_e45, 0.089f, 1f); let _e50 = clampedPerceptualRoughness; let _e51 = clampedPerceptualRoughness; return (_e50 * _e51); @@ -379,7 +379,7 @@ fn reinhard(color: vec3) -> vec3 { color_1 = color; let _e42 = color_1; let _e45 = color_1; - return (_e42 / (vec3(1.0) + _e45)); + return (_e42 / (vec3(1f) + _e45)); } fn reinhard_extended(color_2: vec3, max_white: f32) -> vec3 { @@ -393,10 +393,10 @@ fn reinhard_extended(color_2: vec3, max_white: f32) -> vec3 { let _e47 = color_3; let _e48 = max_white_1; let _e49 = max_white_1; - numerator = (_e44 * (vec3(1.0) + (_e47 / vec3((_e48 * _e49))))); + numerator = (_e44 * (vec3(1f) + (_e47 / vec3((_e48 * _e49))))); let _e56 = numerator; let _e59 = color_3; - return (_e56 / (vec3(1.0) + _e59)); + return (_e56 / (vec3(1f) + _e59)); } fn luminance(v_1: vec3) -> f32 { @@ -404,7 +404,7 @@ fn luminance(v_1: vec3) -> f32 { v_2 = v_1; let _e47 = v_2; - return dot(_e47, vec3(0.2126, 0.7152, 0.0722)); + return dot(_e47, vec3(0.2126f, 0.7152f, 0.0722f)); } fn change_luminance(c_in: vec3, l_out: f32) -> vec3 { @@ -434,7 +434,7 @@ fn reinhard_luminance(color_4: vec3) -> vec3 { l_old = _e44; let _e46 = l_old; let _e48 = l_old; - l_new = (_e46 / (1.0 + _e48)); + l_new = (_e46 / (1f + _e48)); let _e54 = color_5; let _e55 = l_new; let _e56 = change_luminance(_e54, _e55); @@ -457,10 +457,10 @@ fn reinhard_extended_luminance(color_6: vec3, max_white_l: f32) -> vec3, V_ let _e116 = centerToRay; let _e120 = centerToRay; let _e121 = centerToRay; - closestPoint = (_e95 + (_e96 * clamp((_e112 * inverseSqrt(dot(_e120, _e121))), 0.0, 1.0))); + closestPoint = (_e95 + (_e96 * clamp((_e112 * inverseSqrt(dot(_e120, _e121))), 0f, 1f))); let _e133 = closestPoint; let _e134 = closestPoint; let _e138 = closestPoint; @@ -547,7 +547,7 @@ fn point_light(light: PointLight, roughness_8: f32, NdotV: f32, N: vec3, V_ let _e153 = a_1; let _e154 = radius; let _e157 = LspecLengthInverse; - normalizationFactor = (_e143 / clamp((_e153 + ((_e154 * 0.5) * _e157)), 0.0, 1.0)); + normalizationFactor = (_e143 / clamp((_e153 + ((_e154 * 0.5f) * _e157)), 0f, 1f)); let _e165 = normalizationFactor; let _e166 = normalizationFactor; specularIntensity_2 = (_e165 * _e166); @@ -563,17 +563,17 @@ fn point_light(light: PointLight, roughness_8: f32, NdotV: f32, N: vec3, V_ let _e184 = L; let _e190 = N_1; let _e191 = L; - NoL_6 = clamp(dot(_e190, _e191), 0.0, 1.0); + NoL_6 = clamp(dot(_e190, _e191), 0f, 1f); let _e199 = N_1; let _e200 = H; let _e206 = N_1; let _e207 = H; - NoH_4 = clamp(dot(_e206, _e207), 0.0, 1.0); + NoH_4 = clamp(dot(_e206, _e207), 0f, 1f); let _e215 = L; let _e216 = H; let _e222 = L; let _e223 = H; - LoH_6 = clamp(dot(_e222, _e223), 0.0, 1.0); + LoH_6 = clamp(dot(_e222, _e223), 0f, 1f); let _e237 = F0_1; let _e238 = roughness_9; let _e239 = H; @@ -595,17 +595,17 @@ fn point_light(light: PointLight, roughness_8: f32, NdotV: f32, N: vec3, V_ let _e260 = L; let _e266 = N_1; let _e267 = L; - NoL_6 = clamp(dot(_e266, _e267), 0.0, 1.0); + NoL_6 = clamp(dot(_e266, _e267), 0f, 1f); let _e274 = N_1; let _e275 = H; let _e281 = N_1; let _e282 = H; - NoH_4 = clamp(dot(_e281, _e282), 0.0, 1.0); + NoH_4 = clamp(dot(_e281, _e282), 0f, 1f); let _e289 = L; let _e290 = H; let _e296 = L; let _e297 = H; - LoH_6 = clamp(dot(_e296, _e297), 0.0, 1.0); + LoH_6 = clamp(dot(_e296, _e297), 0f, 1f); let _e302 = diffuseColor_1; let _e307 = roughness_9; let _e308 = NdotV_1; @@ -636,7 +636,7 @@ fn dir_light(light_2: DirectionalLight, roughness_10: f32, NdotV_2: f32, normal: var NoH_5: f32; var LoH_7: f32; var diffuse_1: vec3; - var specularIntensity_3: f32 = 1.0; + var specularIntensity_3: f32 = 1f; var specular_2: vec3; light_3 = light_2; @@ -658,17 +658,17 @@ fn dir_light(light_2: DirectionalLight, roughness_10: f32, NdotV_2: f32, normal: let _e71 = incident_light; let _e77 = normal_1; let _e78 = incident_light; - NoL_7 = clamp(dot(_e77, _e78), 0.0, 1.0); + NoL_7 = clamp(dot(_e77, _e78), 0f, 1f); let _e86 = normal_1; let _e87 = half_vector; let _e93 = normal_1; let _e94 = half_vector; - NoH_5 = clamp(dot(_e93, _e94), 0.0, 1.0); + NoH_5 = clamp(dot(_e93, _e94), 0f, 1f); let _e102 = incident_light; let _e103 = half_vector; let _e109 = incident_light; let _e110 = half_vector; - LoH_7 = clamp(dot(_e109, _e110), 0.0, 1.0); + LoH_7 = clamp(dot(_e109, _e110), 0f, 1f); let _e116 = diffuseColor_3; let _e121 = roughness_11; let _e122 = NdotV_3; @@ -713,9 +713,9 @@ fn main_1() { var F0_4: vec3; var diffuseColor_4: vec3; var R_4: vec3; - var light_accum: vec3 = vec3(0.0); - var i: i32 = 0; - var i_1: i32 = 0; + var light_accum: vec3 = vec3(0f); + var i: i32 = 0i; + var i_1: i32 = 0i; var diffuse_ambient: vec3; var specular_ambient: vec3; @@ -785,7 +785,7 @@ fn main_1() { let _e123 = textureSample(StandardMaterial_normal_map, StandardMaterial_normal_map_sampler, _e122); let _e131 = v_Uv_1; let _e132 = textureSample(StandardMaterial_normal_map, StandardMaterial_normal_map_sampler, _e131); - N_2 = (_e120 * normalize(((_e132.xyz * 2.0) - vec3(1.0)))); + N_2 = (_e120 * normalize(((_e132.xyz * 2f) - vec3(1f)))); let _e142 = v_Uv_1; let _e143 = textureSample(StandardMaterial_occlusion_texture, StandardMaterial_occlusion_texture_sampler, _e142); occlusion = _e143.x; @@ -808,16 +808,16 @@ fn main_1() { let _e178 = V_3; let _e183 = N_2; let _e184 = V_3; - NdotV_4 = max(dot(_e183, _e184), 0.001); + NdotV_4 = max(dot(_e183, _e184), 0.001f); let _e190 = global_6.reflectance; let _e192 = global_6.reflectance; let _e195 = metallic; let _e199 = output_color; let _e201 = metallic; - F0_4 = (vec3((((0.16 * _e190) * _e192) * (1.0 - _e195))) + (_e199.xyz * vec3(_e201))); + F0_4 = (vec3((((0.16f * _e190) * _e192) * (1f - _e195))) + (_e199.xyz * vec3(_e201))); let _e206 = output_color; let _e209 = metallic; - diffuseColor_4 = (_e206.xyz * vec3((1.0 - _e209))); + diffuseColor_4 = (_e206.xyz * vec3((1f - _e209))); let _e214 = V_3; let _e217 = V_3; let _e219 = N_2; @@ -846,7 +846,7 @@ fn main_1() { } continuing { let _e236 = i; - i = (_e236 + 1); + i = (_e236 + 1i); } } loop { @@ -873,12 +873,12 @@ fn main_1() { } continuing { let _e273 = i_1; - i_1 = (_e273 + 1); + i_1 = (_e273 + 1i); } } let _e302 = diffuseColor_4; let _e304 = NdotV_4; - let _e305 = EnvBRDFApprox(_e302, 1.0, _e304); + let _e305 = EnvBRDFApprox(_e302, 1f, _e304); diffuse_ambient = _e305; let _e310 = F0_4; let _e311 = perceptual_roughness_2; diff --git a/naga/tests/out/wgsl/bevy-pbr.vert.wgsl b/naga/tests/out/wgsl/bevy-pbr.vert.wgsl index ac13dcdfdc..71cf8d2fe6 100644 --- a/naga/tests/out/wgsl/bevy-pbr.vert.wgsl +++ b/naga/tests/out/wgsl/bevy-pbr.vert.wgsl @@ -33,7 +33,7 @@ fn main_1() { let _e12 = global_1.Model; let _e13 = Vertex_Position_1; - world_position = (_e12 * vec4(_e13.x, _e13.y, _e13.z, 1.0)); + world_position = (_e12 * vec4(_e13.x, _e13.y, _e13.z, 1f)); let _e21 = world_position; v_WorldPosition = _e21.xyz; let _e23 = global_1.Model; diff --git a/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl b/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl index 3a3b116643..4b2f079206 100644 --- a/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl +++ b/naga/tests/out/wgsl/binding-arrays.dynamic.wgsl @@ -5,7 +5,7 @@ var global_1: binding_array; var global_2: vec4; fn function() { - let _e8 = textureSampleLevel(global[1], global_1[1], vec2(0.5, 0.5), 0.0); + let _e8 = textureSampleLevel(global[1i], global_1[1i], vec2(0.5f, 0.5f), 0f); global_2 = _e8; return; } diff --git a/naga/tests/out/wgsl/binding-arrays.static.wgsl b/naga/tests/out/wgsl/binding-arrays.static.wgsl index ff969359f0..bf87a16844 100644 --- a/naga/tests/out/wgsl/binding-arrays.static.wgsl +++ b/naga/tests/out/wgsl/binding-arrays.static.wgsl @@ -5,7 +5,7 @@ var global_1: binding_array; var global_2: vec4; fn function() { - let _e8 = textureSampleLevel(global[1], global_1[1], vec2(0.5, 0.5), 0.0); + let _e8 = textureSampleLevel(global[1i], global_1[1i], vec2(0.5f, 0.5f), 0f); global_2 = _e8; return; } diff --git a/naga/tests/out/wgsl/binding-arrays.wgsl b/naga/tests/out/wgsl/binding-arrays.wgsl index c7a01fc5c3..86bcfc1bff 100644 --- a/naga/tests/out/wgsl/binding-arrays.wgsl +++ b/naga/tests/out/wgsl/binding-arrays.wgsl @@ -29,13 +29,13 @@ var uni: UniformIndex; fn main(fragment_in: FragmentIn) -> @location(0) vec4 { var u1_: u32 = 0u; var u2_: vec2 = vec2(0u); - var v1_: f32 = 0.0; - var v4_: vec4 = vec4(0.0); + var v1_: f32 = 0f; + var v4_: vec4 = vec4(0f); let uniform_index = uni.index; let non_uniform_index = fragment_in.index; - let uv = vec2(0.0); - let pix = vec2(0); + let uv = vec2(0f); + let pix = vec2(0i); let _e21 = textureDimensions(texture_array_unbounded[0]); let _e22 = u2_; u2_ = (_e22 + _e21); @@ -54,22 +54,22 @@ fn main(fragment_in: FragmentIn) -> @location(0) vec4 { let _e52 = textureGather(0, texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv); let _e53 = v4_; v4_ = (_e53 + _e52); - let _e60 = textureGatherCompare(texture_array_depth[0], samp_comp[0], uv, 0.0); + let _e60 = textureGatherCompare(texture_array_depth[0], samp_comp[0], uv, 0f); let _e61 = v4_; v4_ = (_e61 + _e60); - let _e68 = textureGatherCompare(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0.0); + let _e68 = textureGatherCompare(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0f); let _e69 = v4_; v4_ = (_e69 + _e68); - let _e76 = textureGatherCompare(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0.0); + let _e76 = textureGatherCompare(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0f); let _e77 = v4_; v4_ = (_e77 + _e76); - let _e82 = textureLoad(texture_array_unbounded[0], pix, 0); + let _e82 = textureLoad(texture_array_unbounded[0], pix, 0i); let _e83 = v4_; v4_ = (_e83 + _e82); - let _e88 = textureLoad(texture_array_unbounded[uniform_index], pix, 0); + let _e88 = textureLoad(texture_array_unbounded[uniform_index], pix, 0i); let _e89 = v4_; v4_ = (_e89 + _e88); - let _e94 = textureLoad(texture_array_unbounded[non_uniform_index], pix, 0); + let _e94 = textureLoad(texture_array_unbounded[non_uniform_index], pix, 0i); let _e95 = v4_; v4_ = (_e95 + _e94); let _e99 = textureNumLayers(texture_array_2darray[0]); @@ -108,31 +108,31 @@ fn main(fragment_in: FragmentIn) -> @location(0) vec4 { let _e160 = textureSample(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv); let _e161 = v4_; v4_ = (_e161 + _e160); - let _e168 = textureSampleBias(texture_array_bounded[0], samp[0], uv, 0.0); + let _e168 = textureSampleBias(texture_array_bounded[0], samp[0], uv, 0f); let _e169 = v4_; v4_ = (_e169 + _e168); - let _e176 = textureSampleBias(texture_array_bounded[uniform_index], samp[uniform_index], uv, 0.0); + let _e176 = textureSampleBias(texture_array_bounded[uniform_index], samp[uniform_index], uv, 0f); let _e177 = v4_; v4_ = (_e177 + _e176); - let _e184 = textureSampleBias(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, 0.0); + let _e184 = textureSampleBias(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, 0f); let _e185 = v4_; v4_ = (_e185 + _e184); - let _e192 = textureSampleCompare(texture_array_depth[0], samp_comp[0], uv, 0.0); + let _e192 = textureSampleCompare(texture_array_depth[0], samp_comp[0], uv, 0f); let _e193 = v1_; v1_ = (_e193 + _e192); - let _e200 = textureSampleCompare(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0.0); + let _e200 = textureSampleCompare(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0f); let _e201 = v1_; v1_ = (_e201 + _e200); - let _e208 = textureSampleCompare(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0.0); + let _e208 = textureSampleCompare(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0f); let _e209 = v1_; v1_ = (_e209 + _e208); - let _e216 = textureSampleCompareLevel(texture_array_depth[0], samp_comp[0], uv, 0.0); + let _e216 = textureSampleCompareLevel(texture_array_depth[0], samp_comp[0], uv, 0f); let _e217 = v1_; v1_ = (_e217 + _e216); - let _e224 = textureSampleCompareLevel(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0.0); + let _e224 = textureSampleCompareLevel(texture_array_depth[uniform_index], samp_comp[uniform_index], uv, 0f); let _e225 = v1_; v1_ = (_e225 + _e224); - let _e232 = textureSampleCompareLevel(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0.0); + let _e232 = textureSampleCompareLevel(texture_array_depth[non_uniform_index], samp_comp[non_uniform_index], uv, 0f); let _e233 = v1_; v1_ = (_e233 + _e232); let _e239 = textureSampleGrad(texture_array_bounded[0], samp[0], uv, uv, uv); @@ -144,13 +144,13 @@ fn main(fragment_in: FragmentIn) -> @location(0) vec4 { let _e253 = textureSampleGrad(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, uv, uv); let _e254 = v4_; v4_ = (_e254 + _e253); - let _e261 = textureSampleLevel(texture_array_bounded[0], samp[0], uv, 0.0); + let _e261 = textureSampleLevel(texture_array_bounded[0], samp[0], uv, 0f); let _e262 = v4_; v4_ = (_e262 + _e261); - let _e269 = textureSampleLevel(texture_array_bounded[uniform_index], samp[uniform_index], uv, 0.0); + let _e269 = textureSampleLevel(texture_array_bounded[uniform_index], samp[uniform_index], uv, 0f); let _e270 = v4_; v4_ = (_e270 + _e269); - let _e277 = textureSampleLevel(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, 0.0); + let _e277 = textureSampleLevel(texture_array_bounded[non_uniform_index], samp[non_uniform_index], uv, 0f); let _e278 = v4_; v4_ = (_e278 + _e277); let _e282 = v4_; diff --git a/naga/tests/out/wgsl/bitcast.wgsl b/naga/tests/out/wgsl/bitcast.wgsl index a426c26ca0..1f36ce5e66 100644 --- a/naga/tests/out/wgsl/bitcast.wgsl +++ b/naga/tests/out/wgsl/bitcast.wgsl @@ -1,14 +1,14 @@ @compute @workgroup_size(1, 1, 1) fn main() { - var i2_: vec2 = vec2(0); - var i3_: vec3 = vec3(0); - var i4_: vec4 = vec4(0); + var i2_: vec2 = vec2(0i); + var i3_: vec3 = vec3(0i); + var i4_: vec4 = vec4(0i); var u2_: vec2 = vec2(0u); var u3_: vec3 = vec3(0u); var u4_: vec4 = vec4(0u); - var f2_: vec2 = vec2(0.0); - var f3_: vec3 = vec3(0.0); - var f4_: vec4 = vec4(0.0); + var f2_: vec2 = vec2(0f); + var f3_: vec3 = vec3(0f); + var f4_: vec4 = vec4(0f); let _e27 = i2_; u2_ = bitcast>(_e27); diff --git a/naga/tests/out/wgsl/bits.wgsl b/naga/tests/out/wgsl/bits.wgsl index fb4f396a52..05915549ad 100644 --- a/naga/tests/out/wgsl/bits.wgsl +++ b/naga/tests/out/wgsl/bits.wgsl @@ -1,15 +1,15 @@ @compute @workgroup_size(1, 1, 1) fn main() { - var i: i32 = 0; - var i2_: vec2 = vec2(0); - var i3_: vec3 = vec3(0); - var i4_: vec4 = vec4(0); + var i: i32 = 0i; + var i2_: vec2 = vec2(0i); + var i3_: vec3 = vec3(0i); + var i4_: vec4 = vec4(0i); var u: u32 = 0u; var u2_: vec2 = vec2(0u); var u3_: vec3 = vec3(0u); var u4_: vec4 = vec4(0u); - var f2_: vec2 = vec2(0.0); - var f4_: vec4 = vec4(0.0); + var f2_: vec2 = vec2(0f); + var f4_: vec4 = vec4(0f); let _e28 = f4_; u = pack4x8snorm(_e28); diff --git a/naga/tests/out/wgsl/bits_glsl.frag.wgsl b/naga/tests/out/wgsl/bits_glsl.frag.wgsl index 597d5aa1c5..e8365dd1ee 100644 --- a/naga/tests/out/wgsl/bits_glsl.frag.wgsl +++ b/naga/tests/out/wgsl/bits_glsl.frag.wgsl @@ -1,14 +1,14 @@ fn main_1() { - var i: i32 = 0; - var i2_: vec2 = vec2(0); - var i3_: vec3 = vec3(0); - var i4_: vec4 = vec4(0); + var i: i32 = 0i; + var i2_: vec2 = vec2(0i); + var i3_: vec3 = vec3(0i); + var i4_: vec4 = vec4(0i); var u: u32 = 0u; var u2_: vec2 = vec2(0u); var u3_: vec3 = vec3(0u); var u4_: vec4 = vec4(0u); - var f2_: vec2 = vec2(0.0); - var f4_: vec4 = vec4(0.0); + var f2_: vec2 = vec2(0f); + var f4_: vec4 = vec4(0f); let _e33 = f4_; u = pack4x8snorm(_e33); diff --git a/naga/tests/out/wgsl/boids.wgsl b/naga/tests/out/wgsl/boids.wgsl index b87d3ed91d..ee28ca6786 100644 --- a/naga/tests/out/wgsl/boids.wgsl +++ b/naga/tests/out/wgsl/boids.wgsl @@ -30,11 +30,11 @@ var particlesDst: Particles; fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { var vPos: vec2; var vVel: vec2; - var cMass: vec2 = vec2(0.0, 0.0); - var cVel: vec2 = vec2(0.0, 0.0); - var colVel: vec2 = vec2(0.0, 0.0); - var cMassCount: i32 = 0; - var cVelCount: i32 = 0; + var cMass: vec2 = vec2(0f, 0f); + var cVel: vec2 = vec2(0f, 0f); + var colVel: vec2 = vec2(0f, 0f); + var cMassCount: i32 = 0i; + var cVelCount: i32 = 0i; var pos: vec2; var vel: vec2; var i: u32 = 0u; @@ -70,7 +70,7 @@ fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { let _e61 = pos; cMass = (_e60 + _e61); let _e63 = cMassCount; - cMassCount = (_e63 + 1); + cMassCount = (_e63 + 1i); } let _e66 = pos; let _e67 = vPos; @@ -89,7 +89,7 @@ fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { let _e86 = vel; cVel = (_e85 + _e86); let _e88 = cVelCount; - cVelCount = (_e88 + 1); + cVelCount = (_e88 + 1i); } continuing { let _e91 = i; @@ -97,14 +97,14 @@ fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { } } let _e94 = cMassCount; - if (_e94 > 0) { + if (_e94 > 0i) { let _e97 = cMass; let _e98 = cMassCount; let _e102 = vPos; cMass = ((_e97 / vec2(f32(_e98))) - _e102); } let _e104 = cVelCount; - if (_e104 > 0) { + if (_e104 > 0i) { let _e107 = cVel; let _e108 = cVelCount; cVel = (_e107 / vec2(f32(_e108))); @@ -119,26 +119,26 @@ fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { vVel = (((_e112 + (_e113 * _e116)) + (_e119 * _e122)) + (_e125 * _e128)); let _e131 = vVel; let _e133 = vVel; - vVel = (normalize(_e131) * clamp(length(_e133), 0.0, 0.1)); + vVel = (normalize(_e131) * clamp(length(_e133), 0f, 0.1f)); let _e139 = vPos; let _e140 = vVel; let _e143 = params.deltaT; vPos = (_e139 + (_e140 * _e143)); let _e147 = vPos.x; - if (_e147 < -1.0) { - vPos.x = 1.0; + if (_e147 < -1f) { + vPos.x = 1f; } let _e153 = vPos.x; - if (_e153 > 1.0) { - vPos.x = -1.0; + if (_e153 > 1f) { + vPos.x = -1f; } let _e159 = vPos.y; - if (_e159 < -1.0) { - vPos.y = 1.0; + if (_e159 < -1f) { + vPos.y = 1f; } let _e165 = vPos.y; - if (_e165 > 1.0) { - vPos.y = -1.0; + if (_e165 > 1f) { + vPos.y = -1f; } let _e174 = vPos; particlesDst.particles[index].pos = _e174; diff --git a/naga/tests/out/wgsl/bool-select.frag.wgsl b/naga/tests/out/wgsl/bool-select.frag.wgsl index f34c54243d..747ff677a2 100644 --- a/naga/tests/out/wgsl/bool-select.frag.wgsl +++ b/naga/tests/out/wgsl/bool-select.frag.wgsl @@ -12,7 +12,7 @@ fn TevPerCompGT(a: f32, b: f32) -> f32 { b_1 = b; let _e5 = a_1; let _e6 = b_1; - return select(0.0, 1.0, (_e5 > _e6)); + return select(0f, 1f, (_e5 > _e6)); } fn TevPerCompGT_1(a_2: vec3, b_2: vec3) -> vec3 { @@ -23,16 +23,16 @@ fn TevPerCompGT_1(a_2: vec3, b_2: vec3) -> vec3 { b_3 = b_2; let _e7 = a_3; let _e8 = b_3; - return select(vec3(0.0), vec3(1.0), (_e7 > _e8)); + return select(vec3(0f), vec3(1f), (_e7 > _e8)); } fn main_1() { let _e1 = o_color; - let _e11 = TevPerCompGT_1(vec3(3.0), vec3(5.0)); + let _e11 = TevPerCompGT_1(vec3(3f), vec3(5f)); o_color.x = _e11.x; o_color.y = _e11.y; o_color.z = _e11.z; - let _e23 = TevPerCompGT(3.0, 5.0); + let _e23 = TevPerCompGT(3f, 5f); o_color.w = _e23; return; } diff --git a/naga/tests/out/wgsl/buffer.frag.wgsl b/naga/tests/out/wgsl/buffer.frag.wgsl index 43bcceb0d5..349d062e74 100644 --- a/naga/tests/out/wgsl/buffer.frag.wgsl +++ b/naga/tests/out/wgsl/buffer.frag.wgsl @@ -17,7 +17,7 @@ fn main_1() { let _e9 = testBuffer.data[0]; a = _e9; - testBuffer.data[1] = 2u; + testBuffer.data[1i] = 2u; let _e19 = testBufferReadOnly.data[0]; b = _e19; return; diff --git a/naga/tests/out/wgsl/clamp-splat.vert.wgsl b/naga/tests/out/wgsl/clamp-splat.vert.wgsl index 6b5fe96de2..5dcc28e979 100644 --- a/naga/tests/out/wgsl/clamp-splat.vert.wgsl +++ b/naga/tests/out/wgsl/clamp-splat.vert.wgsl @@ -7,8 +7,8 @@ var gl_Position: vec4; fn main_1() { let _e5 = a_pos_1; - let _e10 = clamp(_e5, vec2(0.0), vec2(1.0)); - gl_Position = vec4(_e10.x, _e10.y, 0.0, 1.0); + let _e10 = clamp(_e5, vec2(0f), vec2(1f)); + gl_Position = vec4(_e10.x, _e10.y, 0f, 1f); return; } diff --git a/naga/tests/out/wgsl/const-exprs.wgsl b/naga/tests/out/wgsl/const-exprs.wgsl index 66cf2a745f..20a43e2044 100644 --- a/naga/tests/out/wgsl/const-exprs.wgsl +++ b/naga/tests/out/wgsl/const-exprs.wgsl @@ -1,36 +1,38 @@ const TWO: u32 = 2u; -const THREE: i32 = 3; -const FOUR: i32 = 4; -const FOUR_ALIAS: i32 = 4; -const TEST_CONSTANT_ADDITION: i32 = 8; -const TEST_CONSTANT_ALIAS_ADDITION: i32 = 8; -const PI: f32 = 3.141; -const phi_sun: f32 = 6.282; -const DIV: vec4 = vec4(0.44444445, 0.0, 0.0, 0.0); -const TEXTURE_KIND_REGULAR: i32 = 0; -const TEXTURE_KIND_WARP: i32 = 1; -const TEXTURE_KIND_SKY: i32 = 2; +const THREE: i32 = 3i; +const FOUR: i32 = 4i; +const FOUR_ALIAS: i32 = 4i; +const TEST_CONSTANT_ADDITION: i32 = 8i; +const TEST_CONSTANT_ALIAS_ADDITION: i32 = 8i; +const PI: f32 = 3.141f; +const phi_sun: f32 = 6.282f; +const DIV: vec4 = vec4(0.44444445f, 0f, 0f, 0f); +const TEXTURE_KIND_REGULAR: i32 = 0i; +const TEXTURE_KIND_WARP: i32 = 1i; +const TEXTURE_KIND_SKY: i32 = 2i; +const add_vec: vec2 = vec2(4f, 5f); +const compare_vec: vec2 = vec2(true, false); fn swizzle_of_compose() { - var out: vec4 = vec4(4, 3, 2, 1); + var out: vec4 = vec4(4i, 3i, 2i, 1i); } fn index_of_compose() { - var out_1: i32 = 2; + var out_1: i32 = 2i; } fn compose_three_deep() { - var out_2: i32 = 6; + var out_2: i32 = 6i; } fn non_constant_initializers() { - var w: i32 = 30; + var w: i32 = 30i; var x: i32; var y: i32; - var z: i32 = 70; + var z: i32 = 70i; var out_3: vec4; let _e2 = w; @@ -46,17 +48,17 @@ fn non_constant_initializers() { } fn splat_of_constant() { - var out_4: vec4 = vec4(-4, -4, -4, -4); + var out_4: vec4 = vec4(-4i, -4i, -4i, -4i); } fn compose_of_constant() { - var out_5: vec4 = vec4(-4, -4, -4, -4); + var out_5: vec4 = vec4(-4i, -4i, -4i, -4i); } fn compose_of_splat() { - var x_1: vec4 = vec4(2.0, 1.0, 1.0, 1.0); + var x_1: vec4 = vec4(2f, 1f, 1f, 1f); } diff --git a/naga/tests/out/wgsl/constant-array-size.frag.wgsl b/naga/tests/out/wgsl/constant-array-size.frag.wgsl index f4baa8c129..46697cb7c2 100644 --- a/naga/tests/out/wgsl/constant-array-size.frag.wgsl +++ b/naga/tests/out/wgsl/constant-array-size.frag.wgsl @@ -2,14 +2,14 @@ struct Data { vecs: array, 42>, } -const NUM_VECS: i32 = 42; +const NUM_VECS: i32 = 42i; @group(1) @binding(0) var global: Data; fn function() -> vec4 { - var sum: vec4 = vec4(0.0); - var i: i32 = 0; + var sum: vec4 = vec4(0f); + var i: i32 = 0i; loop { let _e9 = i; @@ -24,7 +24,7 @@ fn function() -> vec4 { } continuing { let _e12 = i; - i = (_e12 + 1); + i = (_e12 + 1i); } } let _e20 = sum; diff --git a/naga/tests/out/wgsl/constructors.wgsl b/naga/tests/out/wgsl/constructors.wgsl index a52fb00217..a8f62dfecd 100644 --- a/naga/tests/out/wgsl/constructors.wgsl +++ b/naga/tests/out/wgsl/constructors.wgsl @@ -3,9 +3,9 @@ struct Foo { b: i32, } -const const2_: vec3 = vec3(0.0, 1.0, 2.0); -const const3_: mat2x2 = mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0)); -const const4_: array, 1> = array, 1>(mat2x2(vec2(0.0, 1.0), vec2(2.0, 3.0))); +const const2_: vec3 = vec3(0f, 1f, 2f); +const const3_: mat2x2 = mat2x2(vec2(0f, 1f), vec2(2f, 3f)); +const const4_: array, 1> = array, 1>(mat2x2(vec2(0f, 1f), vec2(2f, 3f))); const cz0_: bool = bool(); const cz1_: i32 = i32(); const cz2_: u32 = u32(); @@ -14,19 +14,19 @@ const cz4_: vec2 = vec2(); const cz5_: mat2x2 = mat2x2(); const cz6_: array = array(); const cz7_: Foo = Foo(); -const cp3_: array = array(0, 1, 2, 3); +const cp3_: array = array(0i, 1i, 2i, 3i); @compute @workgroup_size(1, 1, 1) fn main() { var foo: Foo; - foo = Foo(vec4(1.0), 1); - let m0_ = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); - let m1_ = mat4x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); + foo = Foo(vec4(1f), 1i); + let m0_ = mat2x2(vec2(1f, 0f), vec2(0f, 1f)); + let m1_ = mat4x4(vec4(1f, 0f, 0f, 0f), vec4(0f, 1f, 0f, 0f), vec4(0f, 0f, 1f, 0f), vec4(0f, 0f, 0f, 1f)); let cit0_ = vec2(0u); - let cit1_ = mat2x2(vec2(0.0), vec2(0.0)); - let cit2_ = array(0, 1, 2, 3); + let cit1_ = mat2x2(vec2(0f), vec2(0f)); + let cit2_ = array(0i, 1i, 2i, 3i); let ic0_ = bool(bool()); let ic4_ = vec2(0u, 0u); - let ic5_ = mat2x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); + let ic5_ = mat2x3(vec3(0f, 0f, 0f), vec3(0f, 0f, 0f)); } diff --git a/naga/tests/out/wgsl/control-flow.wgsl b/naga/tests/out/wgsl/control-flow.wgsl index 2872406d76..dcc3f90365 100644 --- a/naga/tests/out/wgsl/control-flow.wgsl +++ b/naga/tests/out/wgsl/control-flow.wgsl @@ -7,7 +7,7 @@ fn switch_default_break(i: i32) { } fn switch_case_break() { - switch 0 { + switch 0i { case 0: { break; } @@ -36,28 +36,28 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { storageBarrier(); workgroupBarrier(); - switch 1 { + switch 1i { default: { - pos = 1; + pos = 1i; } } let _e4 = pos; switch _e4 { case 1: { - pos = 0; + pos = 0i; break; } case 2: { - pos = 1; + pos = 1i; } case 3, 4: { - pos = 2; + pos = 2i; } case 5: { - pos = 3; + pos = 3i; } case default, 6: { - pos = 4; + pos = 4i; } } switch 0u { @@ -69,22 +69,22 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { let _e11 = pos; switch _e11 { case 1: { - pos = 0; + pos = 0i; break; } case 2: { - pos = 1; + pos = 1i; return; } case 3: { - pos = 2; + pos = 2i; return; } case 4: { return; } default: { - pos = 3; + pos = 3i; return; } } diff --git a/naga/tests/out/wgsl/declarations.frag.wgsl b/naga/tests/out/wgsl/declarations.frag.wgsl index bfe6da8e2d..c0c0236ad6 100644 --- a/naga/tests/out/wgsl/declarations.frag.wgsl +++ b/naga/tests/out/wgsl/declarations.frag.wgsl @@ -38,8 +38,8 @@ var array_2d: array, 2>; var array_toomanyd: array, 2>, 2>, 2>, 2>, 2>, 2>; fn main_1() { - var positions: array, 2> = array, 2>(vec3(-1.0, 1.0, 0.0), vec3(-1.0, -1.0, 0.0)); - var strct: TestStruct = TestStruct(1.0, 2.0); + var positions: array, 2> = array, 2>(vec3(-1f, 1f, 0f), vec3(-1f, -1f, 0f)); + var strct: TestStruct = TestStruct(1f, 2f); var from_input_array: vec4; var a_1: f32; var b: f32; @@ -50,7 +50,7 @@ fn main_1() { a_1 = _e41; let _e57 = array_toomanyd[0][0][0][0][0][0][0]; b = _e57; - out_array[0] = vec4(2.0); + out_array[0i] = vec4(2f); return; } diff --git a/naga/tests/out/wgsl/double-math-functions.frag.wgsl b/naga/tests/out/wgsl/double-math-functions.frag.wgsl index dfb171eeec..914af92d24 100644 --- a/naga/tests/out/wgsl/double-math-functions.frag.wgsl +++ b/naga/tests/out/wgsl/double-math-functions.frag.wgsl @@ -2,7 +2,7 @@ fn main_1() { var a: vec4 = vec4(1.0lf); var b: vec4 = vec4(2.0lf); var m: mat4x4; - var i: i32 = 5; + var i: i32 = 5i; var ceilOut: vec4; var roundOut: vec4; var floorOut: vec4; @@ -92,7 +92,7 @@ fn main_1() { let _e150 = a; let _e152 = i; ldexpOut = ldexp(_e150.x, _e152); - smoothStepScalar = f64(smoothstep(0.0, 1.0, 0.5)); + smoothStepScalar = f64(smoothstep(0f, 1f, 0.5f)); smoothStepVector = smoothstep(vec4(0.0lf), vec4(1.0lf), vec4(0.5lf)); smoothStepMixed = smoothstep(vec4(0.0lf), vec4(1.0lf), vec4(0.5lf)); return; diff --git a/naga/tests/out/wgsl/dualsource.wgsl b/naga/tests/out/wgsl/dualsource.wgsl index 8d03f244a9..505159bb45 100644 --- a/naga/tests/out/wgsl/dualsource.wgsl +++ b/naga/tests/out/wgsl/dualsource.wgsl @@ -5,8 +5,8 @@ struct FragmentOutput { @fragment fn main(@builtin(position) position: vec4) -> FragmentOutput { - var color: vec4 = vec4(0.4, 0.3, 0.2, 0.1); - var mask: vec4 = vec4(0.9, 0.8, 0.7, 0.6); + var color: vec4 = vec4(0.4f, 0.3f, 0.2f, 0.1f); + var mask: vec4 = vec4(0.9f, 0.8f, 0.7f, 0.6f); let _e13 = color; let _e14 = mask; diff --git a/naga/tests/out/wgsl/empty-global-name.wgsl b/naga/tests/out/wgsl/empty-global-name.wgsl index 5114003beb..1be54db130 100644 --- a/naga/tests/out/wgsl/empty-global-name.wgsl +++ b/naga/tests/out/wgsl/empty-global-name.wgsl @@ -7,7 +7,7 @@ var unnamed: type_1; fn function() { let _e3 = unnamed.member; - unnamed.member = (_e3 + 1); + unnamed.member = (_e3 + 1i); return; } diff --git a/naga/tests/out/wgsl/expressions.frag.wgsl b/naga/tests/out/wgsl/expressions.frag.wgsl index c3817d8d78..0ba5962ab2 100644 --- a/naga/tests/out/wgsl/expressions.frag.wgsl +++ b/naga/tests/out/wgsl/expressions.frag.wgsl @@ -29,13 +29,13 @@ fn testBinOpVecFloat(a: vec4, b: f32) { a_1 = a; b_1 = b; let _e5 = a_1; - v = (_e5 * 2.0); + v = (_e5 * 2f); let _e8 = a_1; - v = (_e8 / vec4(2.0)); + v = (_e8 / vec4(2f)); let _e12 = a_1; - v = (_e12 + vec4(2.0)); + v = (_e12 + vec4(2f)); let _e16 = a_1; - v = (_e16 - vec4(2.0)); + v = (_e16 - vec4(2f)); return; } @@ -268,29 +268,29 @@ fn testUnaryOpMat(a_16: mat3x3) { let _e3 = a_17; v_8 = -(_e3); let _e5 = a_17; - let _e7 = vec3(1.0); + let _e7 = vec3(1f); let _e9 = (_e5 - mat3x3(_e7, _e7, _e7)); a_17 = _e9; v_8 = _e9; let _e10 = a_17; - let _e12 = vec3(1.0); + let _e12 = vec3(1f); a_17 = (_e10 - mat3x3(_e12, _e12, _e12)); v_8 = _e10; return; } fn testStructConstructor() { - var tree: BST = BST(1); + var tree: BST = BST(1i); } fn testNonScalarToScalarConstructor() { - var f: f32 = 1.0; + var f: f32 = 1f; } fn testArrayConstructor() { - var tree_1: array = array(0.0); + var tree_1: array = array(0f); } @@ -386,7 +386,7 @@ fn testLength() { fn testConstantLength(a_24: array) { var a_25: array; - var len_1: i32 = 4; + var len_1: i32 = 4i; a_25 = a_24; } @@ -408,15 +408,15 @@ fn testSwizzleWrites(a_27: vec3) { a_28 = a_27; let _e6 = a_28; - a_28.z = 3.0; - a_28.x = 4.0; + a_28.z = 3f; + a_28.x = 4f; let _e14 = a_28; let _e16 = a_28; - let _e19 = (_e16.xy * 5.0); + let _e19 = (_e16.xy * 5f); a_28.x = _e19.x; a_28.y = _e19.y; let _e24 = a_28; - let _e28 = (_e24.zy + vec2(1.0)); + let _e28 = (_e24.zy + vec2(1f)); a_28.z = _e28.x; a_28.y = _e28.y; return; @@ -431,10 +431,10 @@ fn main_1() { let _e8 = local_6; global = _e8; let _e9 = o_color; - o_color.x = 1.0; - o_color.y = 1.0; - o_color.z = 1.0; - o_color.w = 1.0; + o_color.x = 1f; + o_color.y = 1f; + o_color.z = 1f; + o_color.w = 1f; return; } diff --git a/naga/tests/out/wgsl/extra.wgsl b/naga/tests/out/wgsl/extra.wgsl index b6cfaea7d3..25f894e7f5 100644 --- a/naga/tests/out/wgsl/extra.wgsl +++ b/naga/tests/out/wgsl/extra.wgsl @@ -16,6 +16,6 @@ fn main(in: FragmentIn) -> @location(0) vec4 { if (in.primitive_index == _e4) { return in.color; } else { - return vec4((vec3(1.0) - in.color.xyz), in.color.w); + return vec4((vec3(1f) - in.color.xyz), in.color.w); } } diff --git a/naga/tests/out/wgsl/fma.frag.wgsl b/naga/tests/out/wgsl/fma.frag.wgsl index 8708539786..57d11c1d24 100644 --- a/naga/tests/out/wgsl/fma.frag.wgsl +++ b/naga/tests/out/wgsl/fma.frag.wgsl @@ -33,10 +33,10 @@ fn Fma(d: ptr, m: Mat4x3_, s: f32) { fn main_1() { let _e1 = o_color; - o_color.x = 1.0; - o_color.y = 1.0; - o_color.z = 1.0; - o_color.w = 1.0; + o_color.x = 1f; + o_color.y = 1f; + o_color.z = 1f; + o_color.w = 1f; return; } diff --git a/naga/tests/out/wgsl/fragment-output.wgsl b/naga/tests/out/wgsl/fragment-output.wgsl index f478faa70f..1a17003979 100644 --- a/naga/tests/out/wgsl/fragment-output.wgsl +++ b/naga/tests/out/wgsl/fragment-output.wgsl @@ -20,11 +20,11 @@ struct FragmentOutputVec2Scalar { fn main_vec4vec3_() -> FragmentOutputVec4Vec3_ { var output: FragmentOutputVec4Vec3_; - output.vec4f = vec4(0.0); - output.vec4i = vec4(0); + output.vec4f = vec4(0f); + output.vec4i = vec4(0i); output.vec4u = vec4(0u); - output.vec3f = vec3(0.0); - output.vec3i = vec3(0); + output.vec3f = vec3(0f); + output.vec3i = vec3(0i); output.vec3u = vec3(0u); let _e19 = output; return _e19; @@ -34,11 +34,11 @@ fn main_vec4vec3_() -> FragmentOutputVec4Vec3_ { fn main_vec2scalar() -> FragmentOutputVec2Scalar { var output_1: FragmentOutputVec2Scalar; - output_1.vec2f = vec2(0.0); - output_1.vec2i = vec2(0); + output_1.vec2f = vec2(0f); + output_1.vec2i = vec2(0i); output_1.vec2u = vec2(0u); - output_1.scalarf = 0.0; - output_1.scalari = 0; + output_1.scalarf = 0f; + output_1.scalari = 0i; output_1.scalaru = 0u; let _e16 = output_1; return _e16; diff --git a/naga/tests/out/wgsl/functions.wgsl b/naga/tests/out/wgsl/functions.wgsl index f48a864461..79f000ce22 100644 --- a/naga/tests/out/wgsl/functions.wgsl +++ b/naga/tests/out/wgsl/functions.wgsl @@ -1,18 +1,18 @@ fn test_fma() -> vec2 { - let a = vec2(2.0, 2.0); - let b = vec2(0.5, 0.5); - let c = vec2(0.5, 0.5); + let a = vec2(2f, 2f); + let b = vec2(0.5f, 0.5f); + let c = vec2(0.5f, 0.5f); return fma(a, b, c); } fn test_integer_dot_product() -> i32 { - let a_2_ = vec2(1); - let b_2_ = vec2(1); + let a_2_ = vec2(1i); + let b_2_ = vec2(1i); let c_2_ = dot(a_2_, b_2_); let a_3_ = vec3(1u); let b_3_ = vec3(1u); let c_3_ = dot(a_3_, b_3_); - let c_4_ = dot(vec4(4), vec4(2)); + let c_4_ = dot(vec4(4i), vec4(2i)); return c_4_; } diff --git a/naga/tests/out/wgsl/global-constant-array.frag.wgsl b/naga/tests/out/wgsl/global-constant-array.frag.wgsl index d6d4bfb61a..bdb509dc35 100644 --- a/naga/tests/out/wgsl/global-constant-array.frag.wgsl +++ b/naga/tests/out/wgsl/global-constant-array.frag.wgsl @@ -1,4 +1,4 @@ -const array_: array = array(1.0, 2.0); +const array_: array = array(1f, 2f); var i: u32; diff --git a/naga/tests/out/wgsl/globals.wgsl b/naga/tests/out/wgsl/globals.wgsl index 562533156e..229d40ccf6 100644 --- a/naga/tests/out/wgsl/globals.wgsl +++ b/naga/tests/out/wgsl/globals.wgsl @@ -27,26 +27,26 @@ fn test_msl_packed_vec3_as_arg(arg: vec3) { } fn test_msl_packed_vec3_() { - var idx: i32 = 1; + var idx: i32 = 1i; - alignment.v3_ = vec3(1.0); - alignment.v3_.x = 1.0; - alignment.v3_.x = 2.0; + alignment.v3_ = vec3(1f); + alignment.v3_.x = 1f; + alignment.v3_.x = 2f; let _e16 = idx; - alignment.v3_[_e16] = 3.0; + alignment.v3_[_e16] = 3f; let data = alignment; let l0_ = data.v3_; let l1_ = data.v3_.zx; test_msl_packed_vec3_as_arg(data.v3_); let mvm0_ = (data.v3_ * mat3x3()); let mvm1_ = (mat3x3() * data.v3_); - let svm0_ = (data.v3_ * 2.0); - let svm1_ = (2.0 * data.v3_); + let svm0_ = (data.v3_ * 2f); + let svm1_ = (2f * data.v3_); } @compute @workgroup_size(1, 1, 1) fn main() { - var Foo: f32 = 1.0; + var Foo: f32 = 1f; var at: bool = true; test_msl_packed_vec3_(); @@ -64,7 +64,7 @@ fn main() { wg[3] = _e37; let _e43 = alignment.v3_.x; wg[2] = _e43; - alignment.v1_ = 4.0; + alignment.v1_ = 4f; wg[1] = f32(arrayLength((&dummy))); atomicStore((&at_1), 2u); return; diff --git a/naga/tests/out/wgsl/image.wgsl b/naga/tests/out/wgsl/image.wgsl index 062d377139..008b4c20c1 100644 --- a/naga/tests/out/wgsl/image.wgsl +++ b/naga/tests/out/wgsl/image.wgsl @@ -46,18 +46,18 @@ var image_cube_depth: texture_depth_cube; @compute @workgroup_size(16, 1, 1) fn main(@builtin(local_invocation_id) local_id: vec3) { let dim = textureDimensions(image_storage_src); - let itc = (vec2((dim * local_id.xy)) % vec2(10, 20)); + let itc = (vec2((dim * local_id.xy)) % vec2(10i, 20i)); let value1_ = textureLoad(image_mipmapped_src, itc, i32(local_id.z)); let value2_ = textureLoad(image_multisampled_src, itc, i32(local_id.z)); let value4_ = textureLoad(image_storage_src, itc); - let value5_ = textureLoad(image_array_src, itc, local_id.z, (i32(local_id.z) + 1)); - let value6_ = textureLoad(image_array_src, itc, i32(local_id.z), (i32(local_id.z) + 1)); + let value5_ = textureLoad(image_array_src, itc, local_id.z, (i32(local_id.z) + 1i)); + let value6_ = textureLoad(image_array_src, itc, i32(local_id.z), (i32(local_id.z) + 1i)); let value7_ = textureLoad(image_1d_src, i32(local_id.x), i32(local_id.z)); let value1u = textureLoad(image_mipmapped_src, vec2(itc), i32(local_id.z)); let value2u = textureLoad(image_multisampled_src, vec2(itc), i32(local_id.z)); let value4u = textureLoad(image_storage_src, vec2(itc)); - let value5u = textureLoad(image_array_src, vec2(itc), local_id.z, (i32(local_id.z) + 1)); - let value6u = textureLoad(image_array_src, vec2(itc), i32(local_id.z), (i32(local_id.z) + 1)); + let value5u = textureLoad(image_array_src, vec2(itc), local_id.z, (i32(local_id.z) + 1i)); + let value6u = textureLoad(image_array_src, vec2(itc), i32(local_id.z), (i32(local_id.z) + 1i)); let value7u = textureLoad(image_1d_src, u32(local_id.x), i32(local_id.z)); textureStore(image_dst, itc.x, ((((value1_ + value2_) + value4_) + value5_) + value6_)); textureStore(image_dst, u32(itc.x), ((((value1u + value2u) + value4u) + value5u) + value6u)); @@ -67,7 +67,7 @@ fn main(@builtin(local_invocation_id) local_id: vec3) { @compute @workgroup_size(16, 1, 1) fn depth_load(@builtin(local_invocation_id) local_id_1: vec3) { let dim_1 = textureDimensions(image_storage_src); - let itc_1 = (vec2((dim_1 * local_id_1.xy)) % vec2(10, 20)); + let itc_1 = (vec2((dim_1 * local_id_1.xy)) % vec2(10i, 20i)); let val = textureLoad(image_depth_multisampled_src, itc_1, i32(local_id_1.z)); textureStore(image_dst, itc_1.x, vec4(u32(val))); return; @@ -78,15 +78,15 @@ fn queries() -> @builtin(position) vec4 { let dim_1d = textureDimensions(image_1d); let dim_1d_lod = textureDimensions(image_1d, i32(dim_1d)); let dim_2d = textureDimensions(image_2d); - let dim_2d_lod = textureDimensions(image_2d, 1); + let dim_2d_lod = textureDimensions(image_2d, 1i); let dim_2d_array = textureDimensions(image_2d_array); - let dim_2d_array_lod = textureDimensions(image_2d_array, 1); + let dim_2d_array_lod = textureDimensions(image_2d_array, 1i); let dim_cube = textureDimensions(image_cube); - let dim_cube_lod = textureDimensions(image_cube, 1); + let dim_cube_lod = textureDimensions(image_cube, 1i); let dim_cube_array = textureDimensions(image_cube_array); - let dim_cube_array_lod = textureDimensions(image_cube_array, 1); + let dim_cube_array_lod = textureDimensions(image_cube_array, 1i); let dim_3d = textureDimensions(image_3d); - let dim_3d_lod = textureDimensions(image_3d, 1); + let dim_3d_lod = textureDimensions(image_3d, 1i); let dim_2s_ms = textureDimensions(image_aa); let sum = ((((((((((dim_1d + dim_2d.y) + dim_2d_lod.y) + dim_2d_array.y) + dim_2d_array_lod.y) + dim_cube.y) + dim_cube_lod.y) + dim_cube_array.y) + dim_cube_array_lod.y) + dim_3d.z) + dim_3d_lod.z); return vec4(f32(sum)); @@ -110,72 +110,72 @@ fn levels_queries() -> @builtin(position) vec4 { fn texture_sample() -> @location(0) vec4 { var a: vec4; - let tc = vec2(0.5); - let tc3_ = vec3(0.5); + let tc = vec2(0.5f); + let tc3_ = vec3(0.5f); let _e9 = textureSample(image_1d, sampler_reg, tc.x); let _e10 = a; a = (_e10 + _e9); let _e14 = textureSample(image_2d, sampler_reg, tc); let _e15 = a; a = (_e15 + _e14); - let _e19 = textureSample(image_2d, sampler_reg, tc, vec2(3, 1)); + let _e19 = textureSample(image_2d, sampler_reg, tc, vec2(3i, 1i)); let _e20 = a; a = (_e20 + _e19); - let _e24 = textureSampleLevel(image_2d, sampler_reg, tc, 2.3); + let _e24 = textureSampleLevel(image_2d, sampler_reg, tc, 2.3f); let _e25 = a; a = (_e25 + _e24); - let _e29 = textureSampleLevel(image_2d, sampler_reg, tc, 2.3, vec2(3, 1)); + let _e29 = textureSampleLevel(image_2d, sampler_reg, tc, 2.3f, vec2(3i, 1i)); let _e30 = a; a = (_e30 + _e29); - let _e35 = textureSampleBias(image_2d, sampler_reg, tc, 2.0, vec2(3, 1)); + let _e35 = textureSampleBias(image_2d, sampler_reg, tc, 2f, vec2(3i, 1i)); let _e36 = a; a = (_e36 + _e35); let _e41 = textureSample(image_2d_array, sampler_reg, tc, 0u); let _e42 = a; a = (_e42 + _e41); - let _e47 = textureSample(image_2d_array, sampler_reg, tc, 0u, vec2(3, 1)); + let _e47 = textureSample(image_2d_array, sampler_reg, tc, 0u, vec2(3i, 1i)); let _e48 = a; a = (_e48 + _e47); - let _e53 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, 2.3); + let _e53 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, 2.3f); let _e54 = a; a = (_e54 + _e53); - let _e59 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, 2.3, vec2(3, 1)); + let _e59 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, 2.3f, vec2(3i, 1i)); let _e60 = a; a = (_e60 + _e59); - let _e66 = textureSampleBias(image_2d_array, sampler_reg, tc, 0u, 2.0, vec2(3, 1)); + let _e66 = textureSampleBias(image_2d_array, sampler_reg, tc, 0u, 2f, vec2(3i, 1i)); let _e67 = a; a = (_e67 + _e66); - let _e72 = textureSample(image_2d_array, sampler_reg, tc, 0); + let _e72 = textureSample(image_2d_array, sampler_reg, tc, 0i); let _e73 = a; a = (_e73 + _e72); - let _e78 = textureSample(image_2d_array, sampler_reg, tc, 0, vec2(3, 1)); + let _e78 = textureSample(image_2d_array, sampler_reg, tc, 0i, vec2(3i, 1i)); let _e79 = a; a = (_e79 + _e78); - let _e84 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0, 2.3); + let _e84 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0i, 2.3f); let _e85 = a; a = (_e85 + _e84); - let _e90 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0, 2.3, vec2(3, 1)); + let _e90 = textureSampleLevel(image_2d_array, sampler_reg, tc, 0i, 2.3f, vec2(3i, 1i)); let _e91 = a; a = (_e91 + _e90); - let _e97 = textureSampleBias(image_2d_array, sampler_reg, tc, 0, 2.0, vec2(3, 1)); + let _e97 = textureSampleBias(image_2d_array, sampler_reg, tc, 0i, 2f, vec2(3i, 1i)); let _e98 = a; a = (_e98 + _e97); let _e103 = textureSample(image_cube_array, sampler_reg, tc3_, 0u); let _e104 = a; a = (_e104 + _e103); - let _e109 = textureSampleLevel(image_cube_array, sampler_reg, tc3_, 0u, 2.3); + let _e109 = textureSampleLevel(image_cube_array, sampler_reg, tc3_, 0u, 2.3f); let _e110 = a; a = (_e110 + _e109); - let _e116 = textureSampleBias(image_cube_array, sampler_reg, tc3_, 0u, 2.0); + let _e116 = textureSampleBias(image_cube_array, sampler_reg, tc3_, 0u, 2f); let _e117 = a; a = (_e117 + _e116); - let _e122 = textureSample(image_cube_array, sampler_reg, tc3_, 0); + let _e122 = textureSample(image_cube_array, sampler_reg, tc3_, 0i); let _e123 = a; a = (_e123 + _e122); - let _e128 = textureSampleLevel(image_cube_array, sampler_reg, tc3_, 0, 2.3); + let _e128 = textureSampleLevel(image_cube_array, sampler_reg, tc3_, 0i, 2.3f); let _e129 = a; a = (_e129 + _e128); - let _e135 = textureSampleBias(image_cube_array, sampler_reg, tc3_, 0, 2.0); + let _e135 = textureSampleBias(image_cube_array, sampler_reg, tc3_, 0i, 2f); let _e136 = a; a = (_e136 + _e135); let _e138 = a; @@ -186,30 +186,30 @@ fn texture_sample() -> @location(0) vec4 { fn texture_sample_comparison() -> @location(0) f32 { var a_1: f32; - let tc_1 = vec2(0.5); - let tc3_1 = vec3(0.5); - let _e8 = textureSampleCompare(image_2d_depth, sampler_cmp, tc_1, 0.5); + let tc_1 = vec2(0.5f); + let tc3_1 = vec3(0.5f); + let _e8 = textureSampleCompare(image_2d_depth, sampler_cmp, tc_1, 0.5f); let _e9 = a_1; a_1 = (_e9 + _e8); - let _e14 = textureSampleCompare(image_2d_array_depth, sampler_cmp, tc_1, 0u, 0.5); + let _e14 = textureSampleCompare(image_2d_array_depth, sampler_cmp, tc_1, 0u, 0.5f); let _e15 = a_1; a_1 = (_e15 + _e14); - let _e20 = textureSampleCompare(image_2d_array_depth, sampler_cmp, tc_1, 0, 0.5); + let _e20 = textureSampleCompare(image_2d_array_depth, sampler_cmp, tc_1, 0i, 0.5f); let _e21 = a_1; a_1 = (_e21 + _e20); - let _e25 = textureSampleCompare(image_cube_depth, sampler_cmp, tc3_1, 0.5); + let _e25 = textureSampleCompare(image_cube_depth, sampler_cmp, tc3_1, 0.5f); let _e26 = a_1; a_1 = (_e26 + _e25); - let _e30 = textureSampleCompareLevel(image_2d_depth, sampler_cmp, tc_1, 0.5); + let _e30 = textureSampleCompareLevel(image_2d_depth, sampler_cmp, tc_1, 0.5f); let _e31 = a_1; a_1 = (_e31 + _e30); - let _e36 = textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc_1, 0u, 0.5); + let _e36 = textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc_1, 0u, 0.5f); let _e37 = a_1; a_1 = (_e37 + _e36); - let _e42 = textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc_1, 0, 0.5); + let _e42 = textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc_1, 0i, 0.5f); let _e43 = a_1; a_1 = (_e43 + _e42); - let _e47 = textureSampleCompareLevel(image_cube_depth, sampler_cmp, tc3_1, 0.5); + let _e47 = textureSampleCompareLevel(image_cube_depth, sampler_cmp, tc3_1, 0.5f); let _e48 = a_1; a_1 = (_e48 + _e47); let _e50 = a_1; @@ -218,11 +218,11 @@ fn texture_sample_comparison() -> @location(0) f32 { @fragment fn gather() -> @location(0) vec4 { - let tc_2 = vec2(0.5); + let tc_2 = vec2(0.5f); let s2d = textureGather(1, image_2d, sampler_reg, tc_2); - let s2d_offset = textureGather(3, image_2d, sampler_reg, tc_2, vec2(3, 1)); - let s2d_depth = textureGatherCompare(image_2d_depth, sampler_cmp, tc_2, 0.5); - let s2d_depth_offset = textureGatherCompare(image_2d_depth, sampler_cmp, tc_2, 0.5, vec2(3, 1)); + let s2d_offset = textureGather(3, image_2d, sampler_reg, tc_2, vec2(3i, 1i)); + let s2d_depth = textureGatherCompare(image_2d_depth, sampler_cmp, tc_2, 0.5f); + let s2d_depth_offset = textureGatherCompare(image_2d_depth, sampler_cmp, tc_2, 0.5f, vec2(3i, 1i)); let u = textureGather(0, image_2d_u32_, sampler_reg, tc_2); let i = textureGather(0, image_2d_i32_, sampler_reg, tc_2); let f = (vec4(u) + vec4(i)); @@ -231,7 +231,7 @@ fn gather() -> @location(0) vec4 { @fragment fn depth_no_comparison() -> @location(0) vec4 { - let tc_3 = vec2(0.5); + let tc_3 = vec2(0.5f); let s2d_1 = textureSample(image_2d_depth, sampler_reg, tc_3); let s2d_gather = textureGather(image_2d_depth, sampler_reg, tc_3); return (vec4(s2d_1) + s2d_gather); diff --git a/naga/tests/out/wgsl/images.frag.wgsl b/naga/tests/out/wgsl/images.frag.wgsl index 2edcb9c0ea..e7eada96e8 100644 --- a/naga/tests/out/wgsl/images.frag.wgsl +++ b/naga/tests/out/wgsl/images.frag.wgsl @@ -24,7 +24,7 @@ fn testImg1D(coord: i32) { let _e10 = textureDimensions(img1D); size = i32(_e10); let _e17 = coord_1; - textureStore(img1D, _e17, vec4(2.0)); + textureStore(img1D, _e17, vec4(2f)); let _e22 = coord_1; let _e23 = textureLoad(img1D, _e22); c = _e23; @@ -44,7 +44,7 @@ fn testImg1DArray(coord_2: vec2) { let _e20 = textureLoad(img1DArray, _e17.x, _e17.y); c_1 = _e20; let _e26 = coord_3; - textureStore(img1DArray, _e26.x, _e26.y, vec4(2.0)); + textureStore(img1DArray, _e26.x, _e26.y, vec4(2f)); return; } @@ -60,7 +60,7 @@ fn testImg2D(coord_4: vec2) { let _e16 = textureLoad(img2D, _e15); c_2 = _e16; let _e22 = coord_5; - textureStore(img2D, _e22, vec4(2.0)); + textureStore(img2D, _e22, vec4(2f)); return; } @@ -77,7 +77,7 @@ fn testImg2DArray(coord_6: vec3) { let _e22 = textureLoad(img2DArray, _e19.xy, _e19.z); c_3 = _e22; let _e28 = coord_7; - textureStore(img2DArray, _e28.xy, _e28.z, vec4(2.0)); + textureStore(img2DArray, _e28.xy, _e28.z, vec4(2f)); return; } @@ -93,7 +93,7 @@ fn testImg3D(coord_8: vec3) { let _e16 = textureLoad(img3D, _e15); c_4 = _e16; let _e22 = coord_9; - textureStore(img3D, _e22, vec4(2.0)); + textureStore(img3D, _e22, vec4(2f)); return; } @@ -119,7 +119,7 @@ fn testImgWriteOnly(coord_12: vec2) { let _e10 = textureDimensions(img2D); size_6 = vec2(vec2(_e10)); let _e18 = coord_13; - textureStore(imgWriteOnly, _e18, vec4(2.0)); + textureStore(imgWriteOnly, _e18, vec4(2f)); return; } diff --git a/naga/tests/out/wgsl/interface.wgsl b/naga/tests/out/wgsl/interface.wgsl index 96713aae95..1f46278ab8 100644 --- a/naga/tests/out/wgsl/interface.wgsl +++ b/naga/tests/out/wgsl/interface.wgsl @@ -22,13 +22,13 @@ var output: array; @vertex fn vertex(@builtin(vertex_index) vertex_index: u32, @builtin(instance_index) instance_index: u32, @location(10) @interpolate(flat) color: u32) -> VertexOutput { let tmp: u32 = ((vertex_index + instance_index) + color); - return VertexOutput(vec4(1.0), f32(tmp)); + return VertexOutput(vec4(1f), f32(tmp)); } @fragment fn fragment(in: VertexOutput, @builtin(front_facing) front_facing: bool, @builtin(sample_index) sample_index: u32, @builtin(sample_mask) sample_mask: u32) -> FragmentOutput { let mask: u32 = (sample_mask & (1u << sample_index)); - let color_1: f32 = select(0.0, 1.0, front_facing); + let color_1: f32 = select(0f, 1f, front_facing); return FragmentOutput(in._varying, mask, color_1); } @@ -43,5 +43,5 @@ fn vertex_two_structs(in1_: Input1_, in2_: Input2_) -> @builtin(position) @invar var index: u32 = 2u; let _e8: u32 = index; - return vec4(f32(in1_.index), f32(in2_.index), f32(_e8), 0.0); + return vec4(f32(in1_.index), f32(in2_.index), f32(_e8), 0f); } diff --git a/naga/tests/out/wgsl/interpolate.wgsl b/naga/tests/out/wgsl/interpolate.wgsl index e2c4ce28b4..402e60cef5 100644 --- a/naga/tests/out/wgsl/interpolate.wgsl +++ b/naga/tests/out/wgsl/interpolate.wgsl @@ -13,14 +13,14 @@ struct FragmentInput { fn vert_main() -> FragmentInput { var out: FragmentInput; - out.position = vec4(2.0, 4.0, 5.0, 6.0); + out.position = vec4(2f, 4f, 5f, 6f); out._flat = 8u; - out._linear = 27.0; - out.linear_centroid = vec2(64.0, 125.0); - out.linear_sample = vec3(216.0, 343.0, 512.0); - out.perspective = vec4(729.0, 1000.0, 1331.0, 1728.0); - out.perspective_centroid = 2197.0; - out.perspective_sample = 2744.0; + out._linear = 27f; + out.linear_centroid = vec2(64f, 125f); + out.linear_sample = vec3(216f, 343f, 512f); + out.perspective = vec4(729f, 1000f, 1331f, 1728f); + out.perspective_centroid = 2197f; + out.perspective_sample = 2744f; let _e30 = out; return _e30; } diff --git a/naga/tests/out/wgsl/lexical-scopes.wgsl b/naga/tests/out/wgsl/lexical-scopes.wgsl index f3756b61bf..e787f96b10 100644 --- a/naga/tests/out/wgsl/lexical-scopes.wgsl +++ b/naga/tests/out/wgsl/lexical-scopes.wgsl @@ -21,11 +21,11 @@ fn loopLexicalScope(a_2: bool) { } fn forLexicalScope(a_3: f32) { - var a_4: i32 = 0; + var a_4: i32 = 0i; loop { let _e3 = a_4; - if (_e3 < 1) { + if (_e3 < 1i) { } else { break; } @@ -33,7 +33,7 @@ fn forLexicalScope(a_3: f32) { } continuing { let _e8 = a_4; - a_4 = (_e8 + 1); + a_4 = (_e8 + 1i); } } return; @@ -41,7 +41,7 @@ fn forLexicalScope(a_3: f32) { fn whileLexicalScope(a_5: i32) { loop { - if (a_5 > 2) { + if (a_5 > 2i) { } else { break; } @@ -60,6 +60,6 @@ fn switchLexicalScope(a_6: i32) { default: { } } - let test = (a_6 == 2); + let test = (a_6 == 2i); } diff --git a/naga/tests/out/wgsl/local-var-init-in-loop.comp.wgsl b/naga/tests/out/wgsl/local-var-init-in-loop.comp.wgsl index 7675a54cef..a4bb55437a 100644 --- a/naga/tests/out/wgsl/local-var-init-in-loop.comp.wgsl +++ b/naga/tests/out/wgsl/local-var-init-in-loop.comp.wgsl @@ -1,22 +1,22 @@ fn main_1() { - var sum: vec4 = vec4(0.0); - var i: i32 = 0; + var sum: vec4 = vec4(0f); + var i: i32 = 0i; var a: vec4; loop { let _e6 = i; - if !((_e6 < 4)) { + if !((_e6 < 4i)) { break; } { - a = vec4(1.0); + a = vec4(1f); let _e17 = sum; let _e18 = a; sum = (_e17 + _e18); } continuing { let _e10 = i; - i = (_e10 + 1); + i = (_e10 + 1i); } } return; diff --git a/naga/tests/out/wgsl/long-form-matrix.frag.wgsl b/naga/tests/out/wgsl/long-form-matrix.frag.wgsl index cadfe936c4..c69439159a 100644 --- a/naga/tests/out/wgsl/long-form-matrix.frag.wgsl +++ b/naga/tests/out/wgsl/long-form-matrix.frag.wgsl @@ -1,12 +1,12 @@ fn main_1() { - var splat: mat2x2 = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); - var normal: mat2x2 = mat2x2(vec2(1.0, 1.0), vec2(2.0, 2.0)); - var from_matrix: mat2x4 = mat2x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0)); - var a: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var b: mat2x2 = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); - var c: mat3x3 = mat3x3(vec3(1.0, 2.0, 3.0), vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0)); - var d: mat3x3 = mat3x3(vec3(2.0, 2.0, 1.0), vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0)); - var e: mat4x4 = mat4x4(vec4(2.0, 2.0, 1.0, 1.0), vec4(1.0, 1.0, 2.0, 2.0), vec4(1.0, 1.0, 1.0, 1.0), vec4(1.0, 1.0, 1.0, 1.0)); + var splat: mat2x2 = mat2x2(vec2(1f, 0f), vec2(0f, 1f)); + var normal: mat2x2 = mat2x2(vec2(1f, 1f), vec2(2f, 2f)); + var from_matrix: mat2x4 = mat2x4(vec4(1f, 0f, 0f, 0f), vec4(0f, 1f, 0f, 0f)); + var a: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var b: mat2x2 = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); + var c: mat3x3 = mat3x3(vec3(1f, 2f, 3f), vec3(1f, 1f, 1f), vec3(1f, 1f, 1f)); + var d: mat3x3 = mat3x3(vec3(2f, 2f, 1f), vec3(1f, 1f, 1f), vec3(1f, 1f, 1f)); + var e: mat4x4 = mat4x4(vec4(2f, 2f, 1f, 1f), vec4(1f, 1f, 2f, 2f), vec4(1f, 1f, 1f, 1f), vec4(1f, 1f, 1f, 1f)); } diff --git a/naga/tests/out/wgsl/math-functions.frag.wgsl b/naga/tests/out/wgsl/math-functions.frag.wgsl index 0e3b5c3844..b01c3322ae 100644 --- a/naga/tests/out/wgsl/math-functions.frag.wgsl +++ b/naga/tests/out/wgsl/math-functions.frag.wgsl @@ -1,8 +1,8 @@ fn main_1() { - var a: vec4 = vec4(1.0); - var b: vec4 = vec4(2.0); + var a: vec4 = vec4(1f); + var b: vec4 = vec4(2f); var m: mat4x4; - var i: i32 = 5; + var i: i32 = 5i; var ceilOut: vec4; var roundOut: vec4; var floorOut: vec4; @@ -155,9 +155,9 @@ fn main_1() { let _e235 = a; let _e237 = a; deg = degrees(_e237.x); - smoothStepScalar = smoothstep(0.0, 1.0, 0.5); - smoothStepVector = smoothstep(vec4(0.0), vec4(1.0), vec4(0.5)); - smoothStepMixed = smoothstep(vec4(0.0), vec4(1.0), vec4(0.5)); + smoothStepScalar = smoothstep(0f, 1f, 0.5f); + smoothStepVector = smoothstep(vec4(0f), vec4(1f), vec4(0.5f)); + smoothStepMixed = smoothstep(vec4(0f), vec4(1f), vec4(0.5f)); return; } diff --git a/naga/tests/out/wgsl/math-functions.wgsl b/naga/tests/out/wgsl/math-functions.wgsl index e6742fd31e..92f391038d 100644 --- a/naga/tests/out/wgsl/math-functions.wgsl +++ b/naga/tests/out/wgsl/math-functions.wgsl @@ -1,47 +1,47 @@ @fragment fn main() { - let v = vec4(0.0); - let a = degrees(1.0); - let b = radians(1.0); + let v = vec4(0f); + let a = degrees(1f); + let b = radians(1f); let c = degrees(v); let d = radians(v); let e = saturate(v); - let g = refract(v, v, 1.0); - let sign_a = sign(-1); - let sign_b = sign(vec4(-1)); - let sign_c = sign(-1.0); - let sign_d = sign(vec4(-1.0)); + let g = refract(v, v, 1f); + let sign_a = sign(-1i); + let sign_b = sign(vec4(-1i)); + let sign_c = sign(-1f); + let sign_d = sign(vec4(-1f)); let const_dot = dot(vec2(), vec2()); let first_leading_bit_abs = firstLeadingBit(abs(0u)); - let flb_a = firstLeadingBit(-1); - let flb_b = firstLeadingBit(vec2(-1)); + let flb_a = firstLeadingBit(-1i); + let flb_b = firstLeadingBit(vec2(-1i)); let flb_c = firstLeadingBit(vec2(1u)); - let ftb_a = firstTrailingBit(-1); + let ftb_a = firstTrailingBit(-1i); let ftb_b = firstTrailingBit(1u); - let ftb_c = firstTrailingBit(vec2(-1)); + let ftb_c = firstTrailingBit(vec2(-1i)); let ftb_d = firstTrailingBit(vec2(1u)); let ctz_a = countTrailingZeros(0u); - let ctz_b = countTrailingZeros(0); + let ctz_b = countTrailingZeros(0i); let ctz_c = countTrailingZeros(4294967295u); - let ctz_d = countTrailingZeros(-1); + let ctz_d = countTrailingZeros(-1i); let ctz_e = countTrailingZeros(vec2(0u)); - let ctz_f = countTrailingZeros(vec2(0)); + let ctz_f = countTrailingZeros(vec2(0i)); let ctz_g = countTrailingZeros(vec2(1u)); - let ctz_h = countTrailingZeros(vec2(1)); - let clz_a = countLeadingZeros(-1); + let ctz_h = countTrailingZeros(vec2(1i)); + let clz_a = countLeadingZeros(-1i); let clz_b = countLeadingZeros(1u); - let clz_c = countLeadingZeros(vec2(-1)); + let clz_c = countLeadingZeros(vec2(-1i)); let clz_d = countLeadingZeros(vec2(1u)); - let lde_a = ldexp(1.0, 2); - let lde_b = ldexp(vec2(1.0, 2.0), vec2(3, 4)); - let modf_a = modf(1.5); - let modf_b = modf(1.5).fract; - let modf_c = modf(1.5).whole; - let modf_d = modf(vec2(1.5, 1.5)); - let modf_e = modf(vec4(1.5, 1.5, 1.5, 1.5)).whole.x; - let modf_f = modf(vec2(1.5, 1.5)).fract.y; - let frexp_a = frexp(1.5); - let frexp_b = frexp(1.5).fract; - let frexp_c = frexp(1.5).exp; - let frexp_d = frexp(vec4(1.5, 1.5, 1.5, 1.5)).exp.x; + let lde_a = ldexp(1f, 2i); + let lde_b = ldexp(vec2(1f, 2f), vec2(3i, 4i)); + let modf_a = modf(1.5f); + let modf_b = modf(1.5f).fract; + let modf_c = modf(1.5f).whole; + let modf_d = modf(vec2(1.5f, 1.5f)); + let modf_e = modf(vec4(1.5f, 1.5f, 1.5f, 1.5f)).whole.x; + let modf_f = modf(vec2(1.5f, 1.5f)).fract.y; + let frexp_a = frexp(1.5f); + let frexp_b = frexp(1.5f).fract; + let frexp_c = frexp(1.5f).exp; + let frexp_d = frexp(vec4(1.5f, 1.5f, 1.5f, 1.5f)).exp.x; } diff --git a/naga/tests/out/wgsl/module-scope.wgsl b/naga/tests/out/wgsl/module-scope.wgsl index b746ff37ca..48e3325e53 100644 --- a/naga/tests/out/wgsl/module-scope.wgsl +++ b/naga/tests/out/wgsl/module-scope.wgsl @@ -2,7 +2,7 @@ struct S { x: i32, } -const Value: i32 = 1; +const Value: i32 = 1i; @group(0) @binding(0) var Texture: texture_2d; @@ -14,12 +14,12 @@ fn statement() { } fn returns() -> S { - return S(1); + return S(1i); } fn call() { statement(); let _e0 = returns(); - let s = textureSample(Texture, Sampler, vec2(1.0)); + let s = textureSample(Texture, Sampler, vec2(1f)); } diff --git a/naga/tests/out/wgsl/operators.wgsl b/naga/tests/out/wgsl/operators.wgsl index 95621e32e2..dbf39556de 100644 --- a/naga/tests/out/wgsl/operators.wgsl +++ b/naga/tests/out/wgsl/operators.wgsl @@ -1,35 +1,35 @@ -const v_f32_one: vec4 = vec4(1.0, 1.0, 1.0, 1.0); -const v_f32_zero: vec4 = vec4(0.0, 0.0, 0.0, 0.0); -const v_f32_half: vec4 = vec4(0.5, 0.5, 0.5, 0.5); -const v_i32_one: vec4 = vec4(1, 1, 1, 1); +const v_f32_one: vec4 = vec4(1f, 1f, 1f, 1f); +const v_f32_zero: vec4 = vec4(0f, 0f, 0f, 0f); +const v_f32_half: vec4 = vec4(0.5f, 0.5f, 0.5f, 0.5f); +const v_i32_one: vec4 = vec4(1i, 1i, 1i, 1i); fn builtins() -> vec4 { - let s1_ = select(0, 1, true); + let s1_ = select(0i, 1i, true); let s2_ = select(v_f32_zero, v_f32_one, true); let s3_ = select(v_f32_one, v_f32_zero, vec4(false, false, false, false)); let m1_ = mix(v_f32_zero, v_f32_one, v_f32_half); - let m2_ = mix(v_f32_zero, v_f32_one, 0.1); - let b1_ = bitcast(1); + let m2_ = mix(v_f32_zero, v_f32_one, 0.1f); + let b1_ = bitcast(1i); let b2_ = bitcast>(v_i32_one); - let v_i32_zero = vec4(0, 0, 0, 0); + let v_i32_zero = vec4(0i, 0i, 0i, 0i); return (((((vec4((vec4(s1_) + v_i32_zero)) + s2_) + m1_) + m2_) + vec4(b1_)) + b2_); } -fn splat() -> vec4 { - let a_2 = (((vec2(1.0) + vec2(2.0)) - vec2(3.0)) / vec2(4.0)); - let b = (vec4(5) % vec4(2)); +fn splat(m: f32, n: i32) -> vec4 { + let a_2 = (((vec2(2f) + vec2(m)) - vec2(4f)) / vec2(8f)); + let b = (vec4(n) % vec4(2i)); return (a_2.xyxy + vec4(b)); } fn splat_assignment() -> vec2 { - var a: vec2 = vec2(2.0); + var a: vec2 = vec2(2f); let _e4 = a; - a = (_e4 + vec2(1.0)); + a = (_e4 + vec2(1f)); let _e8 = a; - a = (_e8 - vec2(3.0)); + a = (_e8 - vec2(3f)); let _e12 = a; - a = (_e12 / vec2(4.0)); + a = (_e12 / vec2(4f)); let _e15 = a; return _e15; } @@ -51,155 +51,155 @@ fn logical() { } fn arithmetic() { - let neg0_1 = -(1.0); - let neg1_1 = -(vec2(1)); - let neg2_ = -(vec2(1.0)); - let add0_ = (2 + 1); + let neg0_1 = -(1f); + let neg1_1 = -(vec2(1i)); + let neg2_ = -(vec2(1f)); + let add0_ = (2i + 1i); let add1_ = (2u + 1u); - let add2_ = (2.0 + 1.0); - let add3_ = (vec2(2) + vec2(1)); + let add2_ = (2f + 1f); + let add3_ = (vec2(2i) + vec2(1i)); let add4_ = (vec3(2u) + vec3(1u)); - let add5_ = (vec4(2.0) + vec4(1.0)); - let sub0_ = (2 - 1); + let add5_ = (vec4(2f) + vec4(1f)); + let sub0_ = (2i - 1i); let sub1_ = (2u - 1u); - let sub2_ = (2.0 - 1.0); - let sub3_ = (vec2(2) - vec2(1)); + let sub2_ = (2f - 1f); + let sub3_ = (vec2(2i) - vec2(1i)); let sub4_ = (vec3(2u) - vec3(1u)); - let sub5_ = (vec4(2.0) - vec4(1.0)); - let mul0_ = (2 * 1); + let sub5_ = (vec4(2f) - vec4(1f)); + let mul0_ = (2i * 1i); let mul1_ = (2u * 1u); - let mul2_ = (2.0 * 1.0); - let mul3_ = (vec2(2) * vec2(1)); + let mul2_ = (2f * 1f); + let mul3_ = (vec2(2i) * vec2(1i)); let mul4_ = (vec3(2u) * vec3(1u)); - let mul5_ = (vec4(2.0) * vec4(1.0)); - let div0_ = (2 / 1); + let mul5_ = (vec4(2f) * vec4(1f)); + let div0_ = (2i / 1i); let div1_ = (2u / 1u); - let div2_ = (2.0 / 1.0); - let div3_ = (vec2(2) / vec2(1)); + let div2_ = (2f / 1f); + let div3_ = (vec2(2i) / vec2(1i)); let div4_ = (vec3(2u) / vec3(1u)); - let div5_ = (vec4(2.0) / vec4(1.0)); - let rem0_ = (2 % 1); + let div5_ = (vec4(2f) / vec4(1f)); + let rem0_ = (2i % 1i); let rem1_ = (2u % 1u); - let rem2_ = (2.0 % 1.0); - let rem3_ = (vec2(2) % vec2(1)); + let rem2_ = (2f % 1f); + let rem3_ = (vec2(2i) % vec2(1i)); let rem4_ = (vec3(2u) % vec3(1u)); - let rem5_ = (vec4(2.0) % vec4(1.0)); + let rem5_ = (vec4(2f) % vec4(1f)); { - let add0_1 = (vec2(2) + vec2(1)); - let add1_1 = (vec2(2) + vec2(1)); + let add0_1 = (vec2(2i) + vec2(1i)); + let add1_1 = (vec2(2i) + vec2(1i)); let add2_1 = (vec2(2u) + vec2(1u)); let add3_1 = (vec2(2u) + vec2(1u)); - let add4_1 = (vec2(2.0) + vec2(1.0)); - let add5_1 = (vec2(2.0) + vec2(1.0)); - let sub0_1 = (vec2(2) - vec2(1)); - let sub1_1 = (vec2(2) - vec2(1)); + let add4_1 = (vec2(2f) + vec2(1f)); + let add5_1 = (vec2(2f) + vec2(1f)); + let sub0_1 = (vec2(2i) - vec2(1i)); + let sub1_1 = (vec2(2i) - vec2(1i)); let sub2_1 = (vec2(2u) - vec2(1u)); let sub3_1 = (vec2(2u) - vec2(1u)); - let sub4_1 = (vec2(2.0) - vec2(1.0)); - let sub5_1 = (vec2(2.0) - vec2(1.0)); - let mul0_1 = (vec2(2) * 1); - let mul1_1 = (2 * vec2(1)); + let sub4_1 = (vec2(2f) - vec2(1f)); + let sub5_1 = (vec2(2f) - vec2(1f)); + let mul0_1 = (vec2(2i) * 1i); + let mul1_1 = (2i * vec2(1i)); let mul2_1 = (vec2(2u) * 1u); let mul3_1 = (2u * vec2(1u)); - let mul4_1 = (vec2(2.0) * 1.0); - let mul5_1 = (2.0 * vec2(1.0)); - let div0_1 = (vec2(2) / vec2(1)); - let div1_1 = (vec2(2) / vec2(1)); + let mul4_1 = (vec2(2f) * 1f); + let mul5_1 = (2f * vec2(1f)); + let div0_1 = (vec2(2i) / vec2(1i)); + let div1_1 = (vec2(2i) / vec2(1i)); let div2_1 = (vec2(2u) / vec2(1u)); let div3_1 = (vec2(2u) / vec2(1u)); - let div4_1 = (vec2(2.0) / vec2(1.0)); - let div5_1 = (vec2(2.0) / vec2(1.0)); - let rem0_1 = (vec2(2) % vec2(1)); - let rem1_1 = (vec2(2) % vec2(1)); + let div4_1 = (vec2(2f) / vec2(1f)); + let div5_1 = (vec2(2f) / vec2(1f)); + let rem0_1 = (vec2(2i) % vec2(1i)); + let rem1_1 = (vec2(2i) % vec2(1i)); let rem2_1 = (vec2(2u) % vec2(1u)); let rem3_1 = (vec2(2u) % vec2(1u)); - let rem4_1 = (vec2(2.0) % vec2(1.0)); - let rem5_1 = (vec2(2.0) % vec2(1.0)); + let rem4_1 = (vec2(2f) % vec2(1f)); + let rem5_1 = (vec2(2f) % vec2(1f)); } let add = (mat3x3() + mat3x3()); let sub = (mat3x3() - mat3x3()); - let mul_scalar0_ = (mat3x3() * 1.0); - let mul_scalar1_ = (2.0 * mat3x3()); - let mul_vector0_ = (mat4x3() * vec4(1.0)); - let mul_vector1_ = (vec3(2.0) * mat4x3()); + let mul_scalar0_ = (mat3x3() * 1f); + let mul_scalar1_ = (2f * mat3x3()); + let mul_vector0_ = (mat4x3() * vec4(1f)); + let mul_vector1_ = (vec3(2f) * mat4x3()); let mul = (mat4x3() * mat3x4()); } fn bit() { - let flip0_ = ~(1); + let flip0_ = ~(1i); let flip1_ = ~(1u); - let flip2_ = ~(vec2(1)); + let flip2_ = ~(vec2(1i)); let flip3_ = ~(vec3(1u)); - let or0_ = (2 | 1); + let or0_ = (2i | 1i); let or1_ = (2u | 1u); - let or2_ = (vec2(2) | vec2(1)); + let or2_ = (vec2(2i) | vec2(1i)); let or3_ = (vec3(2u) | vec3(1u)); - let and0_ = (2 & 1); + let and0_ = (2i & 1i); let and1_ = (2u & 1u); - let and2_ = (vec2(2) & vec2(1)); + let and2_ = (vec2(2i) & vec2(1i)); let and3_ = (vec3(2u) & vec3(1u)); - let xor0_ = (2 ^ 1); + let xor0_ = (2i ^ 1i); let xor1_ = (2u ^ 1u); - let xor2_ = (vec2(2) ^ vec2(1)); + let xor2_ = (vec2(2i) ^ vec2(1i)); let xor3_ = (vec3(2u) ^ vec3(1u)); - let shl0_ = (2 << 1u); + let shl0_ = (2i << 1u); let shl1_ = (2u << 1u); - let shl2_ = (vec2(2) << vec2(1u)); + let shl2_ = (vec2(2i) << vec2(1u)); let shl3_ = (vec3(2u) << vec3(1u)); - let shr0_ = (2 >> 1u); + let shr0_ = (2i >> 1u); let shr1_ = (2u >> 1u); - let shr2_ = (vec2(2) >> vec2(1u)); + let shr2_ = (vec2(2i) >> vec2(1u)); let shr3_ = (vec3(2u) >> vec3(1u)); } fn comparison() { - let eq0_ = (2 == 1); + let eq0_ = (2i == 1i); let eq1_ = (2u == 1u); - let eq2_ = (2.0 == 1.0); - let eq3_ = (vec2(2) == vec2(1)); + let eq2_ = (2f == 1f); + let eq3_ = (vec2(2i) == vec2(1i)); let eq4_ = (vec3(2u) == vec3(1u)); - let eq5_ = (vec4(2.0) == vec4(1.0)); - let neq0_ = (2 != 1); + let eq5_ = (vec4(2f) == vec4(1f)); + let neq0_ = (2i != 1i); let neq1_ = (2u != 1u); - let neq2_ = (2.0 != 1.0); - let neq3_ = (vec2(2) != vec2(1)); + let neq2_ = (2f != 1f); + let neq3_ = (vec2(2i) != vec2(1i)); let neq4_ = (vec3(2u) != vec3(1u)); - let neq5_ = (vec4(2.0) != vec4(1.0)); - let lt0_ = (2 < 1); + let neq5_ = (vec4(2f) != vec4(1f)); + let lt0_ = (2i < 1i); let lt1_ = (2u < 1u); - let lt2_ = (2.0 < 1.0); - let lt3_ = (vec2(2) < vec2(1)); + let lt2_ = (2f < 1f); + let lt3_ = (vec2(2i) < vec2(1i)); let lt4_ = (vec3(2u) < vec3(1u)); - let lt5_ = (vec4(2.0) < vec4(1.0)); - let lte0_ = (2 <= 1); + let lt5_ = (vec4(2f) < vec4(1f)); + let lte0_ = (2i <= 1i); let lte1_ = (2u <= 1u); - let lte2_ = (2.0 <= 1.0); - let lte3_ = (vec2(2) <= vec2(1)); + let lte2_ = (2f <= 1f); + let lte3_ = (vec2(2i) <= vec2(1i)); let lte4_ = (vec3(2u) <= vec3(1u)); - let lte5_ = (vec4(2.0) <= vec4(1.0)); - let gt0_ = (2 > 1); + let lte5_ = (vec4(2f) <= vec4(1f)); + let gt0_ = (2i > 1i); let gt1_ = (2u > 1u); - let gt2_ = (2.0 > 1.0); - let gt3_ = (vec2(2) > vec2(1)); + let gt2_ = (2f > 1f); + let gt3_ = (vec2(2i) > vec2(1i)); let gt4_ = (vec3(2u) > vec3(1u)); - let gt5_ = (vec4(2.0) > vec4(1.0)); - let gte0_ = (2 >= 1); + let gt5_ = (vec4(2f) > vec4(1f)); + let gte0_ = (2i >= 1i); let gte1_ = (2u >= 1u); - let gte2_ = (2.0 >= 1.0); - let gte3_ = (vec2(2) >= vec2(1)); + let gte2_ = (2f >= 1f); + let gte3_ = (vec2(2i) >= vec2(1i)); let gte4_ = (vec3(2u) >= vec3(1u)); - let gte5_ = (vec4(2.0) >= vec4(1.0)); + let gte5_ = (vec4(2f) >= vec4(1f)); } fn assignment() { var a_1: i32; var vec0_: vec3 = vec3(); - a_1 = 1; + a_1 = 1i; let _e5 = a_1; - a_1 = (_e5 + 1); + a_1 = (_e5 + 1i); let _e7 = a_1; - a_1 = (_e7 - 1); + a_1 = (_e7 - 1i); let _e9 = a_1; let _e10 = a_1; a_1 = (_e10 * _e9); @@ -207,44 +207,44 @@ fn assignment() { let _e13 = a_1; a_1 = (_e13 / _e12); let _e15 = a_1; - a_1 = (_e15 % 1); + a_1 = (_e15 % 1i); let _e17 = a_1; - a_1 = (_e17 & 0); + a_1 = (_e17 & 0i); let _e19 = a_1; - a_1 = (_e19 | 0); + a_1 = (_e19 | 0i); let _e21 = a_1; - a_1 = (_e21 ^ 0); + a_1 = (_e21 ^ 0i); let _e23 = a_1; a_1 = (_e23 << 2u); let _e25 = a_1; a_1 = (_e25 >> 1u); let _e28 = a_1; - a_1 = (_e28 + 1); + a_1 = (_e28 + 1i); let _e31 = a_1; - a_1 = (_e31 - 1); - let _e37 = vec0_[1]; - vec0_[1] = (_e37 + 1); - let _e41 = vec0_[1]; - vec0_[1] = (_e41 - 1); + a_1 = (_e31 - 1i); + let _e37 = vec0_[1i]; + vec0_[1i] = (_e37 + 1i); + let _e41 = vec0_[1i]; + vec0_[1i] = (_e41 - 1i); return; } fn negation_avoids_prefix_decrement() { - let p0_ = -(1); - let p1_ = -(-(1)); - let p2_ = -(-(1)); - let p3_ = -(-(1)); - let p4_ = -(-(-(1))); - let p5_ = -(-(-(-(1)))); - let p6_ = -(-(-(-(-(1))))); - let p7_ = -(-(-(-(-(1))))); + let p0_ = -(1i); + let p1_ = -(-(1i)); + let p2_ = -(-(1i)); + let p3_ = -(-(1i)); + let p4_ = -(-(-(1i))); + let p5_ = -(-(-(-(1i)))); + let p6_ = -(-(-(-(-(1i))))); + let p7_ = -(-(-(-(-(1i))))); } @compute @workgroup_size(1, 1, 1) -fn main() { - let _e0 = builtins(); - let _e1 = splat(); - let _e6 = bool_cast(vec3(1.0, 1.0, 1.0)); +fn main(@builtin(workgroup_id) id: vec3) { + let _e1 = builtins(); + let _e6 = splat(f32(id.x), i32(id.y)); + let _e11 = bool_cast(vec3(1f, 1f, 1f)); logical(); arithmetic(); bit(); diff --git a/naga/tests/out/wgsl/padding.wgsl b/naga/tests/out/wgsl/padding.wgsl index 9893747ca7..62a5c7d567 100644 --- a/naga/tests/out/wgsl/padding.wgsl +++ b/naga/tests/out/wgsl/padding.wgsl @@ -29,5 +29,5 @@ fn vertex() -> @builtin(position) vec4 { let _e4 = input1_.b; let _e8 = input2_.b; let _e12 = input3_.b; - return (((vec4(1.0) * _e4) * _e8) * _e12); + return (((vec4(1f) * _e4) * _e8) * _e12); } diff --git a/naga/tests/out/wgsl/pointers.wgsl b/naga/tests/out/wgsl/pointers.wgsl index 5269e16f7a..310f53cf08 100644 --- a/naga/tests/out/wgsl/pointers.wgsl +++ b/naga/tests/out/wgsl/pointers.wgsl @@ -9,7 +9,7 @@ fn f() { var v: vec2; let px = (&v.x); - (*px) = 10; + (*px) = 10i; return; } diff --git a/naga/tests/out/wgsl/prepostfix.frag.wgsl b/naga/tests/out/wgsl/prepostfix.frag.wgsl index 3a98925a90..d2c59a0dd9 100644 --- a/naga/tests/out/wgsl/prepostfix.frag.wgsl +++ b/naga/tests/out/wgsl/prepostfix.frag.wgsl @@ -1,16 +1,16 @@ fn main_1() { var scalar_target: i32; - var scalar: i32 = 1; + var scalar: i32 = 1i; var vec_target: vec2; var vec: vec2 = vec2(1u); var mat_target: mat4x3; - var mat: mat4x3 = mat4x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, 0.0)); + var mat: mat4x3 = mat4x3(vec3(1f, 0f, 0f), vec3(0f, 1f, 0f), vec3(0f, 0f, 1f), vec3(0f, 0f, 0f)); let _e3 = scalar; - scalar = (_e3 + 1); + scalar = (_e3 + 1i); scalar_target = _e3; let _e6 = scalar; - let _e8 = (_e6 - 1); + let _e8 = (_e6 - 1i); scalar = _e8; scalar_target = _e8; let _e14 = vec; @@ -21,11 +21,11 @@ fn main_1() { vec = _e21; vec_target = _e21; let _e32 = mat; - let _e34 = vec3(1.0); + let _e34 = vec3(1f); mat = (_e32 + mat4x3(_e34, _e34, _e34, _e34)); mat_target = _e32; let _e37 = mat; - let _e39 = vec3(1.0); + let _e39 = vec3(1f); let _e41 = (_e37 - mat4x3(_e39, _e39, _e39, _e39)); mat = _e41; mat_target = _e41; diff --git a/naga/tests/out/wgsl/quad-vert.wgsl b/naga/tests/out/wgsl/quad-vert.wgsl index df7c6d0001..28a2317e91 100644 --- a/naga/tests/out/wgsl/quad-vert.wgsl +++ b/naga/tests/out/wgsl/quad-vert.wgsl @@ -12,14 +12,14 @@ struct VertexOutput { var v_uv: vec2; var a_uv_1: vec2; -var perVertexStruct: gl_PerVertex = gl_PerVertex(vec4(0.0, 0.0, 0.0, 1.0), 1.0, array(), array()); +var perVertexStruct: gl_PerVertex = gl_PerVertex(vec4(0f, 0f, 0f, 1f), 1f, array(), array()); var a_pos_1: vec2; fn main_1() { let _e6 = a_uv_1; v_uv = _e6; let _e7 = a_pos_1; - perVertexStruct.gl_Position = vec4(_e7.x, _e7.y, 0.0, 1.0); + perVertexStruct.gl_Position = vec4(_e7.x, _e7.y, 0f, 1f); return; } diff --git a/naga/tests/out/wgsl/quad.wgsl b/naga/tests/out/wgsl/quad.wgsl index 3a92981d95..05e5c0e7b9 100644 --- a/naga/tests/out/wgsl/quad.wgsl +++ b/naga/tests/out/wgsl/quad.wgsl @@ -3,7 +3,7 @@ struct VertexOutput { @builtin(position) position: vec4, } -const c_scale: f32 = 1.2; +const c_scale: f32 = 1.2f; @group(0) @binding(0) var u_texture: texture_2d; @@ -12,13 +12,13 @@ var u_sampler: sampler; @vertex fn vert_main(@location(0) pos: vec2, @location(1) uv: vec2) -> VertexOutput { - return VertexOutput(uv, vec4((c_scale * pos), 0.0, 1.0)); + return VertexOutput(uv, vec4((c_scale * pos), 0f, 1f)); } @fragment fn frag_main(@location(0) uv_1: vec2) -> @location(0) vec4 { let color = textureSample(u_texture, u_sampler, uv_1); - if (color.w == 0.0) { + if (color.w == 0f) { discard; } let premultiplied = (color.w * color); @@ -27,5 +27,5 @@ fn frag_main(@location(0) uv_1: vec2) -> @location(0) vec4 { @fragment fn fs_extra() -> @location(0) vec4 { - return vec4(0.0, 0.5, 0.0, 0.5); + return vec4(0f, 0.5f, 0f, 0.5f); } diff --git a/naga/tests/out/wgsl/quad_glsl.frag.wgsl b/naga/tests/out/wgsl/quad_glsl.frag.wgsl index e90e5640d3..9de0a19c4b 100644 --- a/naga/tests/out/wgsl/quad_glsl.frag.wgsl +++ b/naga/tests/out/wgsl/quad_glsl.frag.wgsl @@ -6,7 +6,7 @@ var v_uv_1: vec2; var o_color: vec4; fn main_1() { - o_color = vec4(1.0, 1.0, 1.0, 1.0); + o_color = vec4(1f, 1f, 1f, 1f); return; } diff --git a/naga/tests/out/wgsl/quad_glsl.vert.wgsl b/naga/tests/out/wgsl/quad_glsl.vert.wgsl index 1cec36afaf..5c5ee71041 100644 --- a/naga/tests/out/wgsl/quad_glsl.vert.wgsl +++ b/naga/tests/out/wgsl/quad_glsl.vert.wgsl @@ -3,7 +3,7 @@ struct VertexOutput { @builtin(position) member: vec4, } -const c_scale: f32 = 1.2; +const c_scale: f32 = 1.2f; var a_pos_1: vec2; var a_uv_1: vec2; @@ -15,7 +15,7 @@ fn main_1() { v_uv = _e4; let _e6 = a_pos_1; let _e8 = (c_scale * _e6); - gl_Position = vec4(_e8.x, _e8.y, 0.0, 1.0); + gl_Position = vec4(_e8.x, _e8.y, 0f, 1f); return; } diff --git a/naga/tests/out/wgsl/sampler-functions.frag.wgsl b/naga/tests/out/wgsl/sampler-functions.frag.wgsl index 39e51e93de..3530629088 100644 --- a/naga/tests/out/wgsl/sampler-functions.frag.wgsl +++ b/naga/tests/out/wgsl/sampler-functions.frag.wgsl @@ -1,6 +1,6 @@ fn CalcShadowPCF1_(T_P_t_TextureDepth: texture_depth_2d, S_P_t_TextureDepth: sampler_comparison, t_ProjCoord: vec3) -> f32 { var t_ProjCoord_1: vec3; - var t_Res: f32 = 0.0; + var t_Res: f32 = 0f; t_ProjCoord_1 = t_ProjCoord; let _e6 = t_Res; @@ -8,7 +8,7 @@ fn CalcShadowPCF1_(T_P_t_TextureDepth: texture_depth_2d, S_P_t_TextureDepth: sam let _e9 = t_ProjCoord_1; let _e10 = _e9.xyz; let _e13 = textureSampleCompare(T_P_t_TextureDepth, S_P_t_TextureDepth, _e10.xy, _e10.z); - t_Res = (_e6 + (_e13 * 0.2)); + t_Res = (_e6 + (_e13 * 0.2f)); let _e19 = t_Res; return _e19; } diff --git a/naga/tests/out/wgsl/samplers.frag.wgsl b/naga/tests/out/wgsl/samplers.frag.wgsl index 11565d1f5a..4306e6683f 100644 --- a/naga/tests/out/wgsl/samplers.frag.wgsl +++ b/naga/tests/out/wgsl/samplers.frag.wgsl @@ -37,119 +37,119 @@ fn testTex1D(coord: f32) { var c: vec4; coord_1 = coord; - let _e20 = textureDimensions(tex1D, 0); + let _e20 = textureDimensions(tex1D, 0i); size1D = i32(_e20); let _e25 = coord_1; let _e26 = textureSample(tex1D, samp, _e25); c = _e26; let _e29 = coord_1; - let _e31 = textureSampleBias(tex1D, samp, _e29, 2.0); + let _e31 = textureSampleBias(tex1D, samp, _e29, 2f); c = _e31; let _e35 = coord_1; - let _e38 = textureSampleGrad(tex1D, samp, _e35, 4.0, 4.0); + let _e38 = textureSampleGrad(tex1D, samp, _e35, 4f, 4f); c = _e38; let _e43 = coord_1; - let _e47 = textureSampleGrad(tex1D, samp, _e43, 4.0, 4.0, 5); + let _e47 = textureSampleGrad(tex1D, samp, _e43, 4f, 4f, 5i); c = _e47; let _e50 = coord_1; - let _e52 = textureSampleLevel(tex1D, samp, _e50, 3.0); + let _e52 = textureSampleLevel(tex1D, samp, _e50, 3f); c = _e52; let _e56 = coord_1; - let _e59 = textureSampleLevel(tex1D, samp, _e56, 3.0, 5); + let _e59 = textureSampleLevel(tex1D, samp, _e56, 3f, 5i); c = _e59; let _e62 = coord_1; - let _e64 = textureSample(tex1D, samp, _e62, 5); + let _e64 = textureSample(tex1D, samp, _e62, 5i); c = _e64; let _e68 = coord_1; - let _e71 = textureSampleBias(tex1D, samp, _e68, 2.0, 5); + let _e71 = textureSampleBias(tex1D, samp, _e68, 2f, 5i); c = _e71; let _e72 = coord_1; let _e75 = coord_1; - let _e77 = vec2(_e75, 6.0); + let _e77 = vec2(_e75, 6f); let _e81 = textureSample(tex1D, samp, (_e77.x / _e77.y)); c = _e81; let _e82 = coord_1; let _e87 = coord_1; - let _e91 = vec4(_e87, 0.0, 0.0, 6.0); + let _e91 = vec4(_e87, 0f, 0f, 6f); let _e97 = textureSample(tex1D, samp, (_e91.xyz / vec3(_e91.w)).x); c = _e97; let _e98 = coord_1; let _e102 = coord_1; - let _e104 = vec2(_e102, 6.0); - let _e109 = textureSampleBias(tex1D, samp, (_e104.x / _e104.y), 2.0); + let _e104 = vec2(_e102, 6f); + let _e109 = textureSampleBias(tex1D, samp, (_e104.x / _e104.y), 2f); c = _e109; let _e110 = coord_1; let _e116 = coord_1; - let _e120 = vec4(_e116, 0.0, 0.0, 6.0); - let _e127 = textureSampleBias(tex1D, samp, (_e120.xyz / vec3(_e120.w)).x, 2.0); + let _e120 = vec4(_e116, 0f, 0f, 6f); + let _e127 = textureSampleBias(tex1D, samp, (_e120.xyz / vec3(_e120.w)).x, 2f); c = _e127; let _e128 = coord_1; let _e133 = coord_1; - let _e135 = vec2(_e133, 6.0); - let _e141 = textureSampleGrad(tex1D, samp, (_e135.x / _e135.y), 4.0, 4.0); + let _e135 = vec2(_e133, 6f); + let _e141 = textureSampleGrad(tex1D, samp, (_e135.x / _e135.y), 4f, 4f); c = _e141; let _e142 = coord_1; let _e149 = coord_1; - let _e153 = vec4(_e149, 0.0, 0.0, 6.0); - let _e161 = textureSampleGrad(tex1D, samp, (_e153.xyz / vec3(_e153.w)).x, 4.0, 4.0); + let _e153 = vec4(_e149, 0f, 0f, 6f); + let _e161 = textureSampleGrad(tex1D, samp, (_e153.xyz / vec3(_e153.w)).x, 4f, 4f); c = _e161; let _e162 = coord_1; let _e168 = coord_1; - let _e170 = vec2(_e168, 6.0); - let _e177 = textureSampleGrad(tex1D, samp, (_e170.x / _e170.y), 4.0, 4.0, 5); + let _e170 = vec2(_e168, 6f); + let _e177 = textureSampleGrad(tex1D, samp, (_e170.x / _e170.y), 4f, 4f, 5i); c = _e177; let _e178 = coord_1; let _e186 = coord_1; - let _e190 = vec4(_e186, 0.0, 0.0, 6.0); - let _e199 = textureSampleGrad(tex1D, samp, (_e190.xyz / vec3(_e190.w)).x, 4.0, 4.0, 5); + let _e190 = vec4(_e186, 0f, 0f, 6f); + let _e199 = textureSampleGrad(tex1D, samp, (_e190.xyz / vec3(_e190.w)).x, 4f, 4f, 5i); c = _e199; let _e200 = coord_1; let _e204 = coord_1; - let _e206 = vec2(_e204, 6.0); - let _e211 = textureSampleLevel(tex1D, samp, (_e206.x / _e206.y), 3.0); + let _e206 = vec2(_e204, 6f); + let _e211 = textureSampleLevel(tex1D, samp, (_e206.x / _e206.y), 3f); c = _e211; let _e212 = coord_1; let _e218 = coord_1; - let _e222 = vec4(_e218, 0.0, 0.0, 6.0); - let _e229 = textureSampleLevel(tex1D, samp, (_e222.xyz / vec3(_e222.w)).x, 3.0); + let _e222 = vec4(_e218, 0f, 0f, 6f); + let _e229 = textureSampleLevel(tex1D, samp, (_e222.xyz / vec3(_e222.w)).x, 3f); c = _e229; let _e230 = coord_1; let _e235 = coord_1; - let _e237 = vec2(_e235, 6.0); - let _e243 = textureSampleLevel(tex1D, samp, (_e237.x / _e237.y), 3.0, 5); + let _e237 = vec2(_e235, 6f); + let _e243 = textureSampleLevel(tex1D, samp, (_e237.x / _e237.y), 3f, 5i); c = _e243; let _e244 = coord_1; let _e251 = coord_1; - let _e255 = vec4(_e251, 0.0, 0.0, 6.0); - let _e263 = textureSampleLevel(tex1D, samp, (_e255.xyz / vec3(_e255.w)).x, 3.0, 5); + let _e255 = vec4(_e251, 0f, 0f, 6f); + let _e263 = textureSampleLevel(tex1D, samp, (_e255.xyz / vec3(_e255.w)).x, 3f, 5i); c = _e263; let _e264 = coord_1; let _e268 = coord_1; - let _e270 = vec2(_e268, 6.0); - let _e275 = textureSample(tex1D, samp, (_e270.x / _e270.y), 5); + let _e270 = vec2(_e268, 6f); + let _e275 = textureSample(tex1D, samp, (_e270.x / _e270.y), 5i); c = _e275; let _e276 = coord_1; let _e282 = coord_1; - let _e286 = vec4(_e282, 0.0, 0.0, 6.0); - let _e293 = textureSample(tex1D, samp, (_e286.xyz / vec3(_e286.w)).x, 5); + let _e286 = vec4(_e282, 0f, 0f, 6f); + let _e293 = textureSample(tex1D, samp, (_e286.xyz / vec3(_e286.w)).x, 5i); c = _e293; let _e294 = coord_1; let _e299 = coord_1; - let _e301 = vec2(_e299, 6.0); - let _e307 = textureSampleBias(tex1D, samp, (_e301.x / _e301.y), 2.0, 5); + let _e301 = vec2(_e299, 6f); + let _e307 = textureSampleBias(tex1D, samp, (_e301.x / _e301.y), 2f, 5i); c = _e307; let _e308 = coord_1; let _e315 = coord_1; - let _e319 = vec4(_e315, 0.0, 0.0, 6.0); - let _e327 = textureSampleBias(tex1D, samp, (_e319.xyz / vec3(_e319.w)).x, 2.0, 5); + let _e319 = vec4(_e315, 0f, 0f, 6f); + let _e327 = textureSampleBias(tex1D, samp, (_e319.xyz / vec3(_e319.w)).x, 2f, 5i); c = _e327; let _e328 = coord_1; let _e331 = coord_1; - let _e334 = textureLoad(tex1D, i32(_e331), 3); + let _e334 = textureLoad(tex1D, i32(_e331), 3i); c = _e334; let _e335 = coord_1; let _e339 = coord_1; - let _e343 = textureLoad(tex1D, i32(_e339), 3); + let _e343 = textureLoad(tex1D, i32(_e339), 3i); c = _e343; return; } @@ -160,42 +160,42 @@ fn testTex1DArray(coord_2: vec2) { var c_1: vec4; coord_3 = coord_2; - let _e20 = textureDimensions(tex1DArray, 0); + let _e20 = textureDimensions(tex1DArray, 0i); let _e21 = textureNumLayers(tex1DArray); size1DArray = vec2(vec2(_e20, _e21)); let _e27 = coord_3; let _e31 = textureSample(tex1DArray, samp, _e27.x, i32(_e27.y)); c_1 = _e31; let _e34 = coord_3; - let _e39 = textureSampleBias(tex1DArray, samp, _e34.x, i32(_e34.y), 2.0); + let _e39 = textureSampleBias(tex1DArray, samp, _e34.x, i32(_e34.y), 2f); c_1 = _e39; let _e43 = coord_3; - let _e49 = textureSampleGrad(tex1DArray, samp, _e43.x, i32(_e43.y), 4.0, 4.0); + let _e49 = textureSampleGrad(tex1DArray, samp, _e43.x, i32(_e43.y), 4f, 4f); c_1 = _e49; let _e54 = coord_3; - let _e61 = textureSampleGrad(tex1DArray, samp, _e54.x, i32(_e54.y), 4.0, 4.0, 5); + let _e61 = textureSampleGrad(tex1DArray, samp, _e54.x, i32(_e54.y), 4f, 4f, 5i); c_1 = _e61; let _e64 = coord_3; - let _e69 = textureSampleLevel(tex1DArray, samp, _e64.x, i32(_e64.y), 3.0); + let _e69 = textureSampleLevel(tex1DArray, samp, _e64.x, i32(_e64.y), 3f); c_1 = _e69; let _e73 = coord_3; - let _e79 = textureSampleLevel(tex1DArray, samp, _e73.x, i32(_e73.y), 3.0, 5); + let _e79 = textureSampleLevel(tex1DArray, samp, _e73.x, i32(_e73.y), 3f, 5i); c_1 = _e79; let _e82 = coord_3; - let _e87 = textureSample(tex1DArray, samp, _e82.x, i32(_e82.y), 5); + let _e87 = textureSample(tex1DArray, samp, _e82.x, i32(_e82.y), 5i); c_1 = _e87; let _e91 = coord_3; - let _e97 = textureSampleBias(tex1DArray, samp, _e91.x, i32(_e91.y), 2.0, 5); + let _e97 = textureSampleBias(tex1DArray, samp, _e91.x, i32(_e91.y), 2f, 5i); c_1 = _e97; let _e98 = coord_3; let _e101 = coord_3; let _e102 = vec2(_e101); - let _e106 = textureLoad(tex1DArray, _e102.x, _e102.y, 3); + let _e106 = textureLoad(tex1DArray, _e102.x, _e102.y, 3i); c_1 = _e106; let _e107 = coord_3; let _e111 = coord_3; let _e112 = vec2(_e111); - let _e117 = textureLoad(tex1DArray, _e112.x, _e112.y, 3); + let _e117 = textureLoad(tex1DArray, _e112.x, _e112.y, 3i); c_1 = _e117; return; } @@ -206,119 +206,119 @@ fn testTex2D(coord_4: vec2) { var c_2: vec4; coord_5 = coord_4; - let _e20 = textureDimensions(tex2D, 0); + let _e20 = textureDimensions(tex2D, 0i); size2D = vec2(_e20); let _e25 = coord_5; let _e26 = textureSample(tex2D, samp, _e25); c_2 = _e26; let _e29 = coord_5; - let _e31 = textureSampleBias(tex2D, samp, _e29, 2.0); + let _e31 = textureSampleBias(tex2D, samp, _e29, 2f); c_2 = _e31; let _e37 = coord_5; - let _e42 = textureSampleGrad(tex2D, samp, _e37, vec2(4.0), vec2(4.0)); + let _e42 = textureSampleGrad(tex2D, samp, _e37, vec2(4f), vec2(4f)); c_2 = _e42; let _e50 = coord_5; - let _e57 = textureSampleGrad(tex2D, samp, _e50, vec2(4.0), vec2(4.0), vec2(5)); + let _e57 = textureSampleGrad(tex2D, samp, _e50, vec2(4f), vec2(4f), vec2(5i)); c_2 = _e57; let _e60 = coord_5; - let _e62 = textureSampleLevel(tex2D, samp, _e60, 3.0); + let _e62 = textureSampleLevel(tex2D, samp, _e60, 3f); c_2 = _e62; let _e67 = coord_5; - let _e71 = textureSampleLevel(tex2D, samp, _e67, 3.0, vec2(5)); + let _e71 = textureSampleLevel(tex2D, samp, _e67, 3f, vec2(5i)); c_2 = _e71; let _e75 = coord_5; - let _e78 = textureSample(tex2D, samp, _e75, vec2(5)); + let _e78 = textureSample(tex2D, samp, _e75, vec2(5i)); c_2 = _e78; let _e83 = coord_5; - let _e87 = textureSampleBias(tex2D, samp, _e83, 2.0, vec2(5)); + let _e87 = textureSampleBias(tex2D, samp, _e83, 2f, vec2(5i)); c_2 = _e87; let _e88 = coord_5; let _e93 = coord_5; - let _e97 = vec3(_e93.x, _e93.y, 6.0); + let _e97 = vec3(_e93.x, _e93.y, 6f); let _e102 = textureSample(tex2D, samp, (_e97.xy / vec2(_e97.z))); c_2 = _e102; let _e103 = coord_5; let _e109 = coord_5; - let _e114 = vec4(_e109.x, _e109.y, 0.0, 6.0); + let _e114 = vec4(_e109.x, _e109.y, 0f, 6f); let _e120 = textureSample(tex2D, samp, (_e114.xyz / vec3(_e114.w)).xy); c_2 = _e120; let _e121 = coord_5; let _e127 = coord_5; - let _e131 = vec3(_e127.x, _e127.y, 6.0); - let _e137 = textureSampleBias(tex2D, samp, (_e131.xy / vec2(_e131.z)), 2.0); + let _e131 = vec3(_e127.x, _e127.y, 6f); + let _e137 = textureSampleBias(tex2D, samp, (_e131.xy / vec2(_e131.z)), 2f); c_2 = _e137; let _e138 = coord_5; let _e145 = coord_5; - let _e150 = vec4(_e145.x, _e145.y, 0.0, 6.0); - let _e157 = textureSampleBias(tex2D, samp, (_e150.xyz / vec3(_e150.w)).xy, 2.0); + let _e150 = vec4(_e145.x, _e145.y, 0f, 6f); + let _e157 = textureSampleBias(tex2D, samp, (_e150.xyz / vec3(_e150.w)).xy, 2f); c_2 = _e157; let _e158 = coord_5; let _e167 = coord_5; - let _e171 = vec3(_e167.x, _e167.y, 6.0); - let _e180 = textureSampleGrad(tex2D, samp, (_e171.xy / vec2(_e171.z)), vec2(4.0), vec2(4.0)); + let _e171 = vec3(_e167.x, _e167.y, 6f); + let _e180 = textureSampleGrad(tex2D, samp, (_e171.xy / vec2(_e171.z)), vec2(4f), vec2(4f)); c_2 = _e180; let _e181 = coord_5; let _e191 = coord_5; - let _e196 = vec4(_e191.x, _e191.y, 0.0, 6.0); - let _e206 = textureSampleGrad(tex2D, samp, (_e196.xyz / vec3(_e196.w)).xy, vec2(4.0), vec2(4.0)); + let _e196 = vec4(_e191.x, _e191.y, 0f, 6f); + let _e206 = textureSampleGrad(tex2D, samp, (_e196.xyz / vec3(_e196.w)).xy, vec2(4f), vec2(4f)); c_2 = _e206; let _e207 = coord_5; let _e218 = coord_5; - let _e222 = vec3(_e218.x, _e218.y, 6.0); - let _e233 = textureSampleGrad(tex2D, samp, (_e222.xy / vec2(_e222.z)), vec2(4.0), vec2(4.0), vec2(5)); + let _e222 = vec3(_e218.x, _e218.y, 6f); + let _e233 = textureSampleGrad(tex2D, samp, (_e222.xy / vec2(_e222.z)), vec2(4f), vec2(4f), vec2(5i)); c_2 = _e233; let _e234 = coord_5; let _e246 = coord_5; - let _e251 = vec4(_e246.x, _e246.y, 0.0, 6.0); - let _e263 = textureSampleGrad(tex2D, samp, (_e251.xyz / vec3(_e251.w)).xy, vec2(4.0), vec2(4.0), vec2(5)); + let _e251 = vec4(_e246.x, _e246.y, 0f, 6f); + let _e263 = textureSampleGrad(tex2D, samp, (_e251.xyz / vec3(_e251.w)).xy, vec2(4f), vec2(4f), vec2(5i)); c_2 = _e263; let _e264 = coord_5; let _e270 = coord_5; - let _e274 = vec3(_e270.x, _e270.y, 6.0); - let _e280 = textureSampleLevel(tex2D, samp, (_e274.xy / vec2(_e274.z)), 3.0); + let _e274 = vec3(_e270.x, _e270.y, 6f); + let _e280 = textureSampleLevel(tex2D, samp, (_e274.xy / vec2(_e274.z)), 3f); c_2 = _e280; let _e281 = coord_5; let _e288 = coord_5; - let _e293 = vec4(_e288.x, _e288.y, 0.0, 6.0); - let _e300 = textureSampleLevel(tex2D, samp, (_e293.xyz / vec3(_e293.w)).xy, 3.0); + let _e293 = vec4(_e288.x, _e288.y, 0f, 6f); + let _e300 = textureSampleLevel(tex2D, samp, (_e293.xyz / vec3(_e293.w)).xy, 3f); c_2 = _e300; let _e301 = coord_5; let _e309 = coord_5; - let _e313 = vec3(_e309.x, _e309.y, 6.0); - let _e321 = textureSampleLevel(tex2D, samp, (_e313.xy / vec2(_e313.z)), 3.0, vec2(5)); + let _e313 = vec3(_e309.x, _e309.y, 6f); + let _e321 = textureSampleLevel(tex2D, samp, (_e313.xy / vec2(_e313.z)), 3f, vec2(5i)); c_2 = _e321; let _e322 = coord_5; let _e331 = coord_5; - let _e336 = vec4(_e331.x, _e331.y, 0.0, 6.0); - let _e345 = textureSampleLevel(tex2D, samp, (_e336.xyz / vec3(_e336.w)).xy, 3.0, vec2(5)); + let _e336 = vec4(_e331.x, _e331.y, 0f, 6f); + let _e345 = textureSampleLevel(tex2D, samp, (_e336.xyz / vec3(_e336.w)).xy, 3f, vec2(5i)); c_2 = _e345; let _e346 = coord_5; let _e353 = coord_5; - let _e357 = vec3(_e353.x, _e353.y, 6.0); - let _e364 = textureSample(tex2D, samp, (_e357.xy / vec2(_e357.z)), vec2(5)); + let _e357 = vec3(_e353.x, _e353.y, 6f); + let _e364 = textureSample(tex2D, samp, (_e357.xy / vec2(_e357.z)), vec2(5i)); c_2 = _e364; let _e365 = coord_5; let _e373 = coord_5; - let _e378 = vec4(_e373.x, _e373.y, 0.0, 6.0); - let _e386 = textureSample(tex2D, samp, (_e378.xyz / vec3(_e378.w)).xy, vec2(5)); + let _e378 = vec4(_e373.x, _e373.y, 0f, 6f); + let _e386 = textureSample(tex2D, samp, (_e378.xyz / vec3(_e378.w)).xy, vec2(5i)); c_2 = _e386; let _e387 = coord_5; let _e395 = coord_5; - let _e399 = vec3(_e395.x, _e395.y, 6.0); - let _e407 = textureSampleBias(tex2D, samp, (_e399.xy / vec2(_e399.z)), 2.0, vec2(5)); + let _e399 = vec3(_e395.x, _e395.y, 6f); + let _e407 = textureSampleBias(tex2D, samp, (_e399.xy / vec2(_e399.z)), 2f, vec2(5i)); c_2 = _e407; let _e408 = coord_5; let _e417 = coord_5; - let _e422 = vec4(_e417.x, _e417.y, 0.0, 6.0); - let _e431 = textureSampleBias(tex2D, samp, (_e422.xyz / vec3(_e422.w)).xy, 2.0, vec2(5)); + let _e422 = vec4(_e417.x, _e417.y, 0f, 6f); + let _e431 = textureSampleBias(tex2D, samp, (_e422.xyz / vec3(_e422.w)).xy, 2f, vec2(5i)); c_2 = _e431; let _e432 = coord_5; let _e435 = coord_5; - let _e438 = textureLoad(tex2D, vec2(_e435), 3); + let _e438 = textureLoad(tex2D, vec2(_e435), 3i); c_2 = _e438; let _e439 = coord_5; let _e444 = coord_5; - let _e449 = textureLoad(tex2D, vec2(_e444), 3); + let _e449 = textureLoad(tex2D, vec2(_e444), 3i); c_2 = _e449; return; } @@ -329,73 +329,73 @@ fn testTex2DShadow(coord_6: vec2) { var d: f32; coord_7 = coord_6; - let _e20 = textureDimensions(tex2DShadow, 0); + let _e20 = textureDimensions(tex2DShadow, 0i); size2DShadow = vec2(_e20); let _e24 = coord_7; let _e29 = coord_7; - let _e33 = vec3(_e29.x, _e29.y, 1.0); + let _e33 = vec3(_e29.x, _e29.y, 1f); let _e36 = textureSampleCompare(tex2DShadow, sampShadow, _e33.xy, _e33.z); d = _e36; let _e37 = coord_7; let _e46 = coord_7; - let _e50 = vec3(_e46.x, _e46.y, 1.0); + let _e50 = vec3(_e46.x, _e46.y, 1f); let _e57 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e50.xy, _e50.z); d = _e57; let _e58 = coord_7; let _e69 = coord_7; - let _e73 = vec3(_e69.x, _e69.y, 1.0); - let _e82 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e73.xy, _e73.z, vec2(5)); + let _e73 = vec3(_e69.x, _e69.y, 1f); + let _e82 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e73.xy, _e73.z, vec2(5i)); d = _e82; let _e83 = coord_7; let _e89 = coord_7; - let _e93 = vec3(_e89.x, _e89.y, 1.0); + let _e93 = vec3(_e89.x, _e89.y, 1f); let _e97 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e93.xy, _e93.z); d = _e97; let _e98 = coord_7; let _e106 = coord_7; - let _e110 = vec3(_e106.x, _e106.y, 1.0); - let _e116 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e110.xy, _e110.z, vec2(5)); + let _e110 = vec3(_e106.x, _e106.y, 1f); + let _e116 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e110.xy, _e110.z, vec2(5i)); d = _e116; let _e117 = coord_7; let _e124 = coord_7; - let _e128 = vec3(_e124.x, _e124.y, 1.0); - let _e133 = textureSampleCompare(tex2DShadow, sampShadow, _e128.xy, _e128.z, vec2(5)); + let _e128 = vec3(_e124.x, _e124.y, 1f); + let _e133 = textureSampleCompare(tex2DShadow, sampShadow, _e128.xy, _e128.z, vec2(5i)); d = _e133; let _e134 = coord_7; let _e140 = coord_7; - let _e145 = vec4(_e140.x, _e140.y, 1.0, 6.0); + let _e145 = vec4(_e140.x, _e140.y, 1f, 6f); let _e149 = (_e145.xyz / vec3(_e145.w)); let _e152 = textureSampleCompare(tex2DShadow, sampShadow, _e149.xy, _e149.z); d = _e152; let _e153 = coord_7; let _e163 = coord_7; - let _e168 = vec4(_e163.x, _e163.y, 1.0, 6.0); + let _e168 = vec4(_e163.x, _e163.y, 1f, 6f); let _e176 = (_e168.xyz / vec3(_e168.w)); let _e179 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e176.xy, _e176.z); d = _e179; let _e180 = coord_7; let _e192 = coord_7; - let _e197 = vec4(_e192.x, _e192.y, 1.0, 6.0); + let _e197 = vec4(_e192.x, _e192.y, 1f, 6f); let _e207 = (_e197.xyz / vec3(_e197.w)); - let _e210 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e207.xy, _e207.z, vec2(5)); + let _e210 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e207.xy, _e207.z, vec2(5i)); d = _e210; let _e211 = coord_7; let _e218 = coord_7; - let _e223 = vec4(_e218.x, _e218.y, 1.0, 6.0); + let _e223 = vec4(_e218.x, _e218.y, 1f, 6f); let _e228 = (_e223.xyz / vec3(_e223.w)); let _e231 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e228.xy, _e228.z); d = _e231; let _e232 = coord_7; let _e241 = coord_7; - let _e246 = vec4(_e241.x, _e241.y, 1.0, 6.0); + let _e246 = vec4(_e241.x, _e241.y, 1f, 6f); let _e253 = (_e246.xyz / vec3(_e246.w)); - let _e256 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e253.xy, _e253.z, vec2(5)); + let _e256 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e253.xy, _e253.z, vec2(5i)); d = _e256; let _e257 = coord_7; let _e265 = coord_7; - let _e270 = vec4(_e265.x, _e265.y, 1.0, 6.0); + let _e270 = vec4(_e265.x, _e265.y, 1f, 6f); let _e276 = (_e270.xyz / vec3(_e270.w)); - let _e279 = textureSampleCompare(tex2DShadow, sampShadow, _e276.xy, _e276.z, vec2(5)); + let _e279 = textureSampleCompare(tex2DShadow, sampShadow, _e276.xy, _e276.z, vec2(5i)); d = _e279; return; } @@ -406,42 +406,42 @@ fn testTex2DArray(coord_8: vec3) { var c_3: vec4; coord_9 = coord_8; - let _e20 = textureDimensions(tex2DArray, 0); + let _e20 = textureDimensions(tex2DArray, 0i); let _e23 = textureNumLayers(tex2DArray); size2DArray = vec3(vec3(_e20.x, _e20.y, _e23)); let _e29 = coord_9; let _e33 = textureSample(tex2DArray, samp, _e29.xy, i32(_e29.z)); c_3 = _e33; let _e36 = coord_9; - let _e41 = textureSampleBias(tex2DArray, samp, _e36.xy, i32(_e36.z), 2.0); + let _e41 = textureSampleBias(tex2DArray, samp, _e36.xy, i32(_e36.z), 2f); c_3 = _e41; let _e47 = coord_9; - let _e55 = textureSampleGrad(tex2DArray, samp, _e47.xy, i32(_e47.z), vec2(4.0), vec2(4.0)); + let _e55 = textureSampleGrad(tex2DArray, samp, _e47.xy, i32(_e47.z), vec2(4f), vec2(4f)); c_3 = _e55; let _e63 = coord_9; - let _e73 = textureSampleGrad(tex2DArray, samp, _e63.xy, i32(_e63.z), vec2(4.0), vec2(4.0), vec2(5)); + let _e73 = textureSampleGrad(tex2DArray, samp, _e63.xy, i32(_e63.z), vec2(4f), vec2(4f), vec2(5i)); c_3 = _e73; let _e76 = coord_9; - let _e81 = textureSampleLevel(tex2DArray, samp, _e76.xy, i32(_e76.z), 3.0); + let _e81 = textureSampleLevel(tex2DArray, samp, _e76.xy, i32(_e76.z), 3f); c_3 = _e81; let _e86 = coord_9; - let _e93 = textureSampleLevel(tex2DArray, samp, _e86.xy, i32(_e86.z), 3.0, vec2(5)); + let _e93 = textureSampleLevel(tex2DArray, samp, _e86.xy, i32(_e86.z), 3f, vec2(5i)); c_3 = _e93; let _e97 = coord_9; - let _e103 = textureSample(tex2DArray, samp, _e97.xy, i32(_e97.z), vec2(5)); + let _e103 = textureSample(tex2DArray, samp, _e97.xy, i32(_e97.z), vec2(5i)); c_3 = _e103; let _e108 = coord_9; - let _e115 = textureSampleBias(tex2DArray, samp, _e108.xy, i32(_e108.z), 2.0, vec2(5)); + let _e115 = textureSampleBias(tex2DArray, samp, _e108.xy, i32(_e108.z), 2f, vec2(5i)); c_3 = _e115; let _e116 = coord_9; let _e119 = coord_9; let _e120 = vec3(_e119); - let _e124 = textureLoad(tex2DArray, _e120.xy, _e120.z, 3); + let _e124 = textureLoad(tex2DArray, _e120.xy, _e120.z, 3i); c_3 = _e124; let _e125 = coord_9; let _e130 = coord_9; let _e131 = vec3(_e130); - let _e137 = textureLoad(tex2DArray, _e131.xy, _e131.z, 3); + let _e137 = textureLoad(tex2DArray, _e131.xy, _e131.z, 3i); c_3 = _e137; return; } @@ -452,28 +452,28 @@ fn testTex2DArrayShadow(coord_10: vec3) { var d_1: f32; coord_11 = coord_10; - let _e20 = textureDimensions(tex2DArrayShadow, 0); + let _e20 = textureDimensions(tex2DArrayShadow, 0i); let _e23 = textureNumLayers(tex2DArrayShadow); size2DArrayShadow = vec3(vec3(_e20.x, _e20.y, _e23)); let _e28 = coord_11; let _e34 = coord_11; - let _e39 = vec4(_e34.x, _e34.y, _e34.z, 1.0); + let _e39 = vec4(_e34.x, _e34.y, _e34.z, 1f); let _e44 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e39.xy, i32(_e39.z), _e39.w); d_1 = _e44; let _e45 = coord_11; let _e55 = coord_11; - let _e60 = vec4(_e55.x, _e55.y, _e55.z, 1.0); + let _e60 = vec4(_e55.x, _e55.y, _e55.z, 1f); let _e69 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e60.xy, i32(_e60.z), _e60.w); d_1 = _e69; let _e70 = coord_11; let _e82 = coord_11; - let _e87 = vec4(_e82.x, _e82.y, _e82.z, 1.0); - let _e98 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e87.xy, i32(_e87.z), _e87.w, vec2(5)); + let _e87 = vec4(_e82.x, _e82.y, _e82.z, 1f); + let _e98 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, _e87.xy, i32(_e87.z), _e87.w, vec2(5i)); d_1 = _e98; let _e99 = coord_11; let _e107 = coord_11; - let _e112 = vec4(_e107.x, _e107.y, _e107.z, 1.0); - let _e119 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e112.xy, i32(_e112.z), _e112.w, vec2(5)); + let _e112 = vec4(_e107.x, _e107.y, _e107.z, 1f); + let _e119 = textureSampleCompare(tex2DArrayShadow, sampShadow, _e112.xy, i32(_e112.z), _e112.w, vec2(5i)); d_1 = _e119; return; } @@ -484,19 +484,19 @@ fn testTexCube(coord_12: vec3) { var c_4: vec4; coord_13 = coord_12; - let _e20 = textureDimensions(texCube, 0); + let _e20 = textureDimensions(texCube, 0i); sizeCube = vec2(_e20); let _e25 = coord_13; let _e26 = textureSample(texCube, samp, _e25); c_4 = _e26; let _e29 = coord_13; - let _e31 = textureSampleBias(texCube, samp, _e29, 2.0); + let _e31 = textureSampleBias(texCube, samp, _e29, 2f); c_4 = _e31; let _e37 = coord_13; - let _e42 = textureSampleGrad(texCube, samp, _e37, vec3(4.0), vec3(4.0)); + let _e42 = textureSampleGrad(texCube, samp, _e37, vec3(4f), vec3(4f)); c_4 = _e42; let _e45 = coord_13; - let _e47 = textureSampleLevel(texCube, samp, _e45, 3.0); + let _e47 = textureSampleLevel(texCube, samp, _e45, 3f); c_4 = _e47; return; } @@ -507,16 +507,16 @@ fn testTexCubeShadow(coord_14: vec3) { var d_2: f32; coord_15 = coord_14; - let _e20 = textureDimensions(texCubeShadow, 0); + let _e20 = textureDimensions(texCubeShadow, 0i); sizeCubeShadow = vec2(_e20); let _e24 = coord_15; let _e30 = coord_15; - let _e35 = vec4(_e30.x, _e30.y, _e30.z, 1.0); + let _e35 = vec4(_e30.x, _e30.y, _e30.z, 1f); let _e38 = textureSampleCompare(texCubeShadow, sampShadow, _e35.xyz, _e35.w); d_2 = _e38; let _e39 = coord_15; let _e49 = coord_15; - let _e54 = vec4(_e49.x, _e49.y, _e49.z, 1.0); + let _e54 = vec4(_e49.x, _e49.y, _e49.z, 1f); let _e61 = textureSampleCompareLevel(texCubeShadow, sampShadow, _e54.xyz, _e54.w); d_2 = _e61; return; @@ -528,20 +528,20 @@ fn testTexCubeArray(coord_16: vec4) { var c_5: vec4; coord_17 = coord_16; - let _e20 = textureDimensions(texCubeArray, 0); + let _e20 = textureDimensions(texCubeArray, 0i); let _e23 = textureNumLayers(texCubeArray); sizeCubeArray = vec3(vec3(_e20.x, _e20.y, _e23)); let _e29 = coord_17; let _e33 = textureSample(texCubeArray, samp, _e29.xyz, i32(_e29.w)); c_5 = _e33; let _e36 = coord_17; - let _e41 = textureSampleBias(texCubeArray, samp, _e36.xyz, i32(_e36.w), 2.0); + let _e41 = textureSampleBias(texCubeArray, samp, _e36.xyz, i32(_e36.w), 2f); c_5 = _e41; let _e47 = coord_17; - let _e55 = textureSampleGrad(texCubeArray, samp, _e47.xyz, i32(_e47.w), vec3(4.0), vec3(4.0)); + let _e55 = textureSampleGrad(texCubeArray, samp, _e47.xyz, i32(_e47.w), vec3(4f), vec3(4f)); c_5 = _e55; let _e58 = coord_17; - let _e63 = textureSampleLevel(texCubeArray, samp, _e58.xyz, i32(_e58.w), 3.0); + let _e63 = textureSampleLevel(texCubeArray, samp, _e58.xyz, i32(_e58.w), 3f); c_5 = _e63; return; } @@ -552,11 +552,11 @@ fn testTexCubeArrayShadow(coord_18: vec4) { var d_3: f32; coord_19 = coord_18; - let _e20 = textureDimensions(texCubeArrayShadow, 0); + let _e20 = textureDimensions(texCubeArrayShadow, 0i); let _e23 = textureNumLayers(texCubeArrayShadow); sizeCubeArrayShadow = vec3(vec3(_e20.x, _e20.y, _e23)); let _e30 = coord_19; - let _e35 = textureSampleCompare(texCubeArrayShadow, sampShadow, _e30.xyz, i32(_e30.w), 1.0); + let _e35 = textureSampleCompare(texCubeArrayShadow, sampShadow, _e30.xyz, i32(_e30.w), 1f); d_3 = _e35; return; } @@ -567,79 +567,79 @@ fn testTex3D(coord_20: vec3) { var c_6: vec4; coord_21 = coord_20; - let _e20 = textureDimensions(tex3D, 0); + let _e20 = textureDimensions(tex3D, 0i); size3D = vec3(_e20); let _e25 = coord_21; let _e26 = textureSample(tex3D, samp, _e25); c_6 = _e26; let _e29 = coord_21; - let _e31 = textureSampleBias(tex3D, samp, _e29, 2.0); + let _e31 = textureSampleBias(tex3D, samp, _e29, 2f); c_6 = _e31; let _e32 = coord_21; let _e38 = coord_21; - let _e43 = vec4(_e38.x, _e38.y, _e38.z, 6.0); + let _e43 = vec4(_e38.x, _e38.y, _e38.z, 6f); let _e48 = textureSample(tex3D, samp, (_e43.xyz / vec3(_e43.w))); c_6 = _e48; let _e49 = coord_21; let _e56 = coord_21; - let _e61 = vec4(_e56.x, _e56.y, _e56.z, 6.0); - let _e67 = textureSampleBias(tex3D, samp, (_e61.xyz / vec3(_e61.w)), 2.0); + let _e61 = vec4(_e56.x, _e56.y, _e56.z, 6f); + let _e67 = textureSampleBias(tex3D, samp, (_e61.xyz / vec3(_e61.w)), 2f); c_6 = _e67; let _e68 = coord_21; let _e76 = coord_21; - let _e81 = vec4(_e76.x, _e76.y, _e76.z, 6.0); - let _e88 = textureSample(tex3D, samp, (_e81.xyz / vec3(_e81.w)), vec3(5)); + let _e81 = vec4(_e76.x, _e76.y, _e76.z, 6f); + let _e88 = textureSample(tex3D, samp, (_e81.xyz / vec3(_e81.w)), vec3(5i)); c_6 = _e88; let _e89 = coord_21; let _e98 = coord_21; - let _e103 = vec4(_e98.x, _e98.y, _e98.z, 6.0); - let _e111 = textureSampleBias(tex3D, samp, (_e103.xyz / vec3(_e103.w)), 2.0, vec3(5)); + let _e103 = vec4(_e98.x, _e98.y, _e98.z, 6f); + let _e111 = textureSampleBias(tex3D, samp, (_e103.xyz / vec3(_e103.w)), 2f, vec3(5i)); c_6 = _e111; let _e112 = coord_21; let _e119 = coord_21; - let _e124 = vec4(_e119.x, _e119.y, _e119.z, 6.0); - let _e130 = textureSampleLevel(tex3D, samp, (_e124.xyz / vec3(_e124.w)), 3.0); + let _e124 = vec4(_e119.x, _e119.y, _e119.z, 6f); + let _e130 = textureSampleLevel(tex3D, samp, (_e124.xyz / vec3(_e124.w)), 3f); c_6 = _e130; let _e131 = coord_21; let _e140 = coord_21; - let _e145 = vec4(_e140.x, _e140.y, _e140.z, 6.0); - let _e153 = textureSampleLevel(tex3D, samp, (_e145.xyz / vec3(_e145.w)), 3.0, vec3(5)); + let _e145 = vec4(_e140.x, _e140.y, _e140.z, 6f); + let _e153 = textureSampleLevel(tex3D, samp, (_e145.xyz / vec3(_e145.w)), 3f, vec3(5i)); c_6 = _e153; let _e154 = coord_21; let _e164 = coord_21; - let _e169 = vec4(_e164.x, _e164.y, _e164.z, 6.0); - let _e178 = textureSampleGrad(tex3D, samp, (_e169.xyz / vec3(_e169.w)), vec3(4.0), vec3(4.0)); + let _e169 = vec4(_e164.x, _e164.y, _e164.z, 6f); + let _e178 = textureSampleGrad(tex3D, samp, (_e169.xyz / vec3(_e169.w)), vec3(4f), vec3(4f)); c_6 = _e178; let _e179 = coord_21; let _e191 = coord_21; - let _e196 = vec4(_e191.x, _e191.y, _e191.z, 6.0); - let _e207 = textureSampleGrad(tex3D, samp, (_e196.xyz / vec3(_e196.w)), vec3(4.0), vec3(4.0), vec3(5)); + let _e196 = vec4(_e191.x, _e191.y, _e191.z, 6f); + let _e207 = textureSampleGrad(tex3D, samp, (_e196.xyz / vec3(_e196.w)), vec3(4f), vec3(4f), vec3(5i)); c_6 = _e207; let _e213 = coord_21; - let _e218 = textureSampleGrad(tex3D, samp, _e213, vec3(4.0), vec3(4.0)); + let _e218 = textureSampleGrad(tex3D, samp, _e213, vec3(4f), vec3(4f)); c_6 = _e218; let _e226 = coord_21; - let _e233 = textureSampleGrad(tex3D, samp, _e226, vec3(4.0), vec3(4.0), vec3(5)); + let _e233 = textureSampleGrad(tex3D, samp, _e226, vec3(4f), vec3(4f), vec3(5i)); c_6 = _e233; let _e236 = coord_21; - let _e238 = textureSampleLevel(tex3D, samp, _e236, 3.0); + let _e238 = textureSampleLevel(tex3D, samp, _e236, 3f); c_6 = _e238; let _e243 = coord_21; - let _e247 = textureSampleLevel(tex3D, samp, _e243, 3.0, vec3(5)); + let _e247 = textureSampleLevel(tex3D, samp, _e243, 3f, vec3(5i)); c_6 = _e247; let _e251 = coord_21; - let _e254 = textureSample(tex3D, samp, _e251, vec3(5)); + let _e254 = textureSample(tex3D, samp, _e251, vec3(5i)); c_6 = _e254; let _e259 = coord_21; - let _e263 = textureSampleBias(tex3D, samp, _e259, 2.0, vec3(5)); + let _e263 = textureSampleBias(tex3D, samp, _e259, 2f, vec3(5i)); c_6 = _e263; let _e264 = coord_21; let _e267 = coord_21; - let _e270 = textureLoad(tex3D, vec3(_e267), 3); + let _e270 = textureLoad(tex3D, vec3(_e267), 3i); c_6 = _e270; let _e271 = coord_21; let _e276 = coord_21; - let _e281 = textureLoad(tex3D, vec3(_e276), 3); + let _e281 = textureLoad(tex3D, vec3(_e276), 3i); c_6 = _e281; return; } @@ -654,7 +654,7 @@ fn testTex2DMS(coord_22: vec2) { size2DMS = vec2(_e18); let _e22 = coord_23; let _e25 = coord_23; - let _e28 = textureLoad(tex2DMS, vec2(_e25), 3); + let _e28 = textureLoad(tex2DMS, vec2(_e25), 3i); c_7 = _e28; return; } @@ -671,7 +671,7 @@ fn testTex2DMSArray(coord_24: vec3) { let _e26 = coord_25; let _e29 = coord_25; let _e30 = vec3(_e29); - let _e34 = textureLoad(tex2DMSArray, _e30.xy, _e30.z, 3); + let _e34 = textureLoad(tex2DMSArray, _e30.xy, _e30.z, 3i); c_8 = _e34; return; } diff --git a/naga/tests/out/wgsl/shadow.wgsl b/naga/tests/out/wgsl/shadow.wgsl index b768fab2f1..e9d5bbf1be 100644 --- a/naga/tests/out/wgsl/shadow.wgsl +++ b/naga/tests/out/wgsl/shadow.wgsl @@ -20,7 +20,7 @@ struct Light { color: vec4, } -const c_ambient: vec3 = vec3(0.05, 0.05, 0.05); +const c_ambient: vec3 = vec3(0.05f, 0.05f, 0.05f); const c_max_lights: u32 = 10u; @group(0) @binding(0) @@ -37,12 +37,12 @@ var t_shadow: texture_depth_2d_array; var sampler_shadow: sampler_comparison; fn fetch_shadow(light_id: u32, homogeneous_coords: vec4) -> f32 { - if (homogeneous_coords.w <= 0.0) { - return 1.0; + if (homogeneous_coords.w <= 0f) { + return 1f; } - let flip_correction = vec2(0.5, -0.5); - let proj_correction = (1.0 / homogeneous_coords.w); - let light_local = (((homogeneous_coords.xy * flip_correction) * proj_correction) + vec2(0.5, 0.5)); + let flip_correction = vec2(0.5f, -0.5f); + let proj_correction = (1f / homogeneous_coords.w); + let light_local = (((homogeneous_coords.xy * flip_correction) * proj_correction) + vec2(0.5f, 0.5f)); let _e24 = textureSampleCompareLevel(t_shadow, sampler_shadow, light_local, i32(light_id), (homogeneous_coords.z * proj_correction)); return _e24; } @@ -81,7 +81,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { let _e19 = i; let _e23 = fetch_shadow(_e19, (light.proj * in.world_position)); let light_dir = normalize((light.pos.xyz - in.world_position.xyz)); - let diffuse = max(0.0, dot(normal_1, light_dir)); + let diffuse = max(0f, dot(normal_1, light_dir)); let _e37 = color; color = (_e37 + ((_e23 * diffuse) * light.color.xyz)); } @@ -92,7 +92,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { } let _e42 = color; let _e47 = u_entity.color; - return (vec4(_e42, 1.0) * _e47); + return (vec4(_e42, 1f) * _e47); } @fragment @@ -114,7 +114,7 @@ fn fs_main_without_storage(in_1: VertexOutput) -> @location(0) vec4 { let _e19 = i_1; let _e23 = fetch_shadow(_e19, (light_1.proj * in_1.world_position)); let light_dir_1 = normalize((light_1.pos.xyz - in_1.world_position.xyz)); - let diffuse_1 = max(0.0, dot(normal_2, light_dir_1)); + let diffuse_1 = max(0f, dot(normal_2, light_dir_1)); let _e37 = color_1; color_1 = (_e37 + ((_e23 * diffuse_1) * light_1.color.xyz)); } @@ -125,5 +125,5 @@ fn fs_main_without_storage(in_1: VertexOutput) -> @location(0) vec4 { } let _e42 = color_1; let _e47 = u_entity.color; - return (vec4(_e42, 1.0) * _e47); + return (vec4(_e42, 1f) * _e47); } diff --git a/naga/tests/out/wgsl/skybox.wgsl b/naga/tests/out/wgsl/skybox.wgsl index 73d4da78a4..c10801d0e7 100644 --- a/naga/tests/out/wgsl/skybox.wgsl +++ b/naga/tests/out/wgsl/skybox.wgsl @@ -20,11 +20,11 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput { var tmp1_: i32; var tmp2_: i32; - tmp1_ = (i32(vertex_index) / 2); - tmp2_ = (i32(vertex_index) & 1); + tmp1_ = (i32(vertex_index) / 2i); + tmp2_ = (i32(vertex_index) & 1i); let _e9 = tmp1_; let _e15 = tmp2_; - let pos = vec4(((f32(_e9) * 4.0) - 1.0), ((f32(_e15) * 4.0) - 1.0), 0.0, 1.0); + let pos = vec4(((f32(_e9) * 4f) - 1f), ((f32(_e15) * 4f) - 1f), 0f, 1f); let _e27 = r_data.view[0]; let _e32 = r_data.view[1]; let _e37 = r_data.view[2]; diff --git a/naga/tests/out/wgsl/struct-layout.wgsl b/naga/tests/out/wgsl/struct-layout.wgsl index 1f058384c4..b1569bde3e 100644 --- a/naga/tests/out/wgsl/struct-layout.wgsl +++ b/naga/tests/out/wgsl/struct-layout.wgsl @@ -20,12 +20,12 @@ var needs_padding_storage: NeedsPadding; @fragment fn no_padding_frag(input: NoPadding) -> @location(0) vec4 { - return vec4(0.0); + return vec4(0f); } @vertex fn no_padding_vert(input_1: NoPadding) -> @builtin(position) vec4 { - return vec4(0.0); + return vec4(0f); } @compute @workgroup_size(16, 1, 1) @@ -41,12 +41,12 @@ fn no_padding_comp() { @fragment fn needs_padding_frag(input_2: NeedsPadding) -> @location(0) vec4 { - return vec4(0.0); + return vec4(0f); } @vertex fn needs_padding_vert(input_3: NeedsPadding) -> @builtin(position) vec4 { - return vec4(0.0); + return vec4(0f); } @compute @workgroup_size(16, 1, 1) diff --git a/naga/tests/out/wgsl/texture-arg.wgsl b/naga/tests/out/wgsl/texture-arg.wgsl index 6edf0250e1..0ad02e43f5 100644 --- a/naga/tests/out/wgsl/texture-arg.wgsl +++ b/naga/tests/out/wgsl/texture-arg.wgsl @@ -4,7 +4,7 @@ var Texture: texture_2d; var Sampler: sampler; fn test(Passed_Texture: texture_2d, Passed_Sampler: sampler) -> vec4 { - let _e5 = textureSample(Passed_Texture, Passed_Sampler, vec2(0.0, 0.0)); + let _e5 = textureSample(Passed_Texture, Passed_Sampler, vec2(0f, 0f)); return _e5; } diff --git a/naga/tests/out/wgsl/type-alias.wgsl b/naga/tests/out/wgsl/type-alias.wgsl index fea2dec108..fe3cf79037 100644 --- a/naga/tests/out/wgsl/type-alias.wgsl +++ b/naga/tests/out/wgsl/type-alias.wgsl @@ -1,10 +1,10 @@ fn main() { - let a = vec3(0.0, 0.0, 0.0); - let c = vec3(0.0); - let b = vec3(vec2(0.0), 0.0); - let d = vec3(vec2(0.0), 0.0); + let a = vec3(0f, 0f, 0f); + let c = vec3(0f); + let b = vec3(vec2(0f), 0f); + let d = vec3(vec2(0f), 0f); let e = vec3(d); - let f = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + let f = mat2x2(vec2(1f, 2f), vec2(3f, 4f)); let g = mat3x3(a, a, a); } diff --git a/naga/tests/out/wgsl/workgroup-uniform-load.wgsl b/naga/tests/out/wgsl/workgroup-uniform-load.wgsl index 727ced8d6e..be85b033b9 100644 --- a/naga/tests/out/wgsl/workgroup-uniform-load.wgsl +++ b/naga/tests/out/wgsl/workgroup-uniform-load.wgsl @@ -6,7 +6,7 @@ var arr_i32_: array; fn test_workgroupUniformLoad(@builtin(workgroup_id) workgroup_id: vec3) { let x = (&arr_i32_[workgroup_id.x]); let _e4 = workgroupUniformLoad(x); - if (_e4 > 10) { + if (_e4 > 10i) { workgroupBarrier(); return; } else { diff --git a/naga/tests/snapshots.rs b/naga/tests/snapshots.rs index c201b206a2..6b934de55b 100644 --- a/naga/tests/snapshots.rs +++ b/naga/tests/snapshots.rs @@ -798,6 +798,10 @@ fn convert_wgsl() { "abstract-types-var", Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::WGSL, ), + ( + "abstract-types-operators", + Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::WGSL, + ), ]; for &(name, targets) in inputs.iter() { diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 00db6aba61..e46c91ab9c 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -1136,7 +1136,7 @@ impl crate::Adapter for super::Adapter { Some(crate::SurfaceCapabilities { formats, present_modes: if cfg!(windows) { - vec![wgt::PresentMode::Fifo, wgt::PresentMode::Mailbox] + vec![wgt::PresentMode::Fifo, wgt::PresentMode::Immediate] } else { vec![wgt::PresentMode::Fifo] //TODO }, diff --git a/wgpu-hal/src/gles/wgl.rs b/wgpu-hal/src/gles/wgl.rs index 6e68607286..a09a50330d 100644 --- a/wgpu-hal/src/gles/wgl.rs +++ b/wgpu-hal/src/gles/wgl.rs @@ -744,7 +744,7 @@ impl crate::Surface for Surface { } let vsync = match config.present_mode { - wgt::PresentMode::Mailbox => false, + wgt::PresentMode::Immediate => false, wgt::PresentMode::Fifo => true, _ => { log::error!("unsupported present mode: {:?}", config.present_mode);