diff --git a/src/front/glsl/builtins.rs b/src/front/glsl/builtins.rs index db30c0ba48..b12b5e753f 100644 --- a/src/front/glsl/builtins.rs +++ b/src/front/glsl/builtins.rs @@ -1789,7 +1789,7 @@ impl MacroCall { true => { let offset_arg = args[num_args]; num_args += 1; - match ctx.eval_constant(offset_arg, meta) { + match ctx.lift_up_const_expression(offset_arg) { Ok(v) => Some(v), Err(e) => { frontend.errors.push(e); diff --git a/src/front/glsl/context.rs b/src/front/glsl/context.rs index 94e28dfa16..f1709e4eb2 100644 --- a/src/front/glsl/context.rs +++ b/src/front/glsl/context.rs @@ -71,15 +71,17 @@ pub struct Context<'a> { pub symbol_table: crate::front::SymbolTable, pub samplers: FastHashMap, Handle>, + pub const_typifier: Typifier, pub typifier: Typifier, emitter: Emitter, stmt_ctx: Option, pub body: Block, pub module: &'a mut crate::Module, + pub is_const: bool, } impl<'a> Context<'a> { - pub fn new(frontend: &Frontend, module: &'a mut crate::Module) -> Result { + pub fn new(frontend: &Frontend, module: &'a mut crate::Module, is_const: bool) -> Result { let mut this = Context { expressions: Arena::new(), locals: Arena::new(), @@ -91,11 +93,13 @@ impl<'a> Context<'a> { symbol_table: crate::front::SymbolTable::default(), samplers: FastHashMap::default(), + const_typifier: Typifier::new(), typifier: Typifier::new(), emitter: Emitter::default(), stmt_ctx: Some(StmtContext::new()), body: Block::new(), module, + is_const: false, }; this.emit_start(); @@ -103,6 +107,7 @@ impl<'a> Context<'a> { for &(ref name, lookup) in frontend.global_variables.iter() { this.add_global(name, lookup)? } + this.is_const = is_const; Ok(this) } @@ -237,15 +242,43 @@ impl<'a> Context<'a> { } pub fn add_expression(&mut self, expr: Expression, meta: Span) -> Result> { - let needs_pre_emit = expr.needs_pre_emit(); - if needs_pre_emit { - self.emit_end(); - } - let handle = self.expressions.append(expr, meta); - if needs_pre_emit { - self.emit_start(); + let mut append = |arena: &mut Arena, expr: Expression, span| { + let is_running = self.emitter.is_running(); + let needs_pre_emit = expr.needs_pre_emit(); + if is_running && needs_pre_emit { + self.body.extend(self.emitter.finish(arena)); + } + let h = arena.append(expr, span); + if is_running && needs_pre_emit { + self.emitter.start(arena); + } + h + }; + + let (expressions, const_expressions) = if self.is_const { + (&mut self.module.const_expressions, None) + } else { + (&mut self.expressions, Some(&self.module.const_expressions)) + }; + + let mut eval = crate::proc::ConstantEvaluator { + types: &mut self.module.types, + constants: &self.module.constants, + expressions, + const_expressions, + append: (!self.is_const).then_some(&mut append), + }; + + let res = eval.try_eval_and_append(&expr, meta).map_err(|e| Error { + kind: e.into(), + meta, + }); + + match res { + Ok(expr) => Ok(expr), + Err(e) if self.is_const => Err(e), + Err(_) => Ok(append(&mut self.expressions, expr, meta)), } - Ok(handle) } /// Add variable to current scope @@ -509,13 +542,16 @@ impl<'a> Context<'a> { let handle = match *kind { HirExprKind::Access { base, index } => { - let (index, index_meta) = - self.lower_expect_inner(stmt, frontend, index, ExprPos::Rhs)?; + let (index, _) = self.lower_expect_inner(stmt, frontend, index, ExprPos::Rhs)?; let maybe_constant_index = match pos { // Don't try to generate `AccessIndex` if in a LHS position, since it // wouldn't produce a pointer. ExprPos::Lhs => None, - _ => self.eval_constant(index, index_meta).ok(), + _ => self + .module + .to_ctx() + .eval_expr_to_u32_from(index, &self.expressions) + .ok(), }; let base = self @@ -528,15 +564,7 @@ impl<'a> Context<'a> { .0; let pointer = maybe_constant_index - .and_then(|const_expr| { - Some(self.add_expression( - Expression::AccessIndex { - base, - index: self.module.to_ctx().eval_expr_to_u32(const_expr).ok()?, - }, - meta, - )) - }) + .map(|index| self.add_expression(Expression::AccessIndex { base, index }, meta)) .unwrap_or_else(|| { self.add_expression(Expression::Access { base, index }, meta) })?; @@ -578,8 +606,8 @@ impl<'a> Context<'a> { self.typifier_grow(left, left_meta)?; self.typifier_grow(right, right_meta)?; - let left_inner = self.typifier.get(left, &self.module.types); - let right_inner = self.typifier.get(right, &self.module.types); + let left_inner = self.get_type(left); + let right_inner = self.get_type(right); match (left_inner, right_inner) { ( @@ -1006,7 +1034,13 @@ impl<'a> Context<'a> { _ if var.load => { self.add_expression(Expression::Load { pointer: var.expr }, meta)? } - ExprPos::Rhs => var.expr, + ExprPos::Rhs => { + if let Some((constant, _)) = self.is_const.then_some(var.constant).flatten() { + self.add_expression(Expression::Constant(constant), meta)? + } else { + var.expr + } + } }, HirExprKind::Call(ref call) if pos != ExprPos::Lhs => { let maybe_expr = frontend.function_or_constructor_call( diff --git a/src/front/glsl/functions.rs b/src/front/glsl/functions.rs index c6ec997064..952f56df2e 100644 --- a/src/front/glsl/functions.rs +++ b/src/front/glsl/functions.rs @@ -531,10 +531,8 @@ impl Frontend { } // Check if the passed arguments require any special variations - let mut variations = builtin_required_variations( - args.iter() - .map(|&(expr, _)| ctx.typifier.get(expr, &ctx.module.types)), - ); + let mut variations = + builtin_required_variations(args.iter().map(|&(expr, _)| ctx.get_type(expr))); // Initiate the declaration if it wasn't previously initialized and inject builtins let declaration = self.lookup_function.entry(name.clone()).or_insert_with(|| { @@ -592,7 +590,7 @@ impl Frontend { ctx.typifier_grow(call_argument.0, call_argument.1)?; let overload_param_ty = &ctx.module.types[*overload_parameter].inner; - let call_arg_ty = ctx.typifier.get(call_argument.0, &ctx.module.types); + let call_arg_ty = ctx.get_type(call_argument.0); log::trace!( "Testing parameter {}\n\tOverload = {:?}\n\tCall = {:?}", @@ -937,7 +935,7 @@ impl Frontend { ctx.typifier_grow(call_argument.0, call_argument.1)?; let overload_param_ty = &ctx.module.types[parameter_ty].inner; - let call_arg_ty = ctx.typifier.get(call_argument.0, &ctx.module.types); + let call_arg_ty = ctx.get_type(call_argument.0); let needs_conversion = call_arg_ty != overload_param_ty; let arg_scalar_comps = scalar_components(call_arg_ty); diff --git a/src/front/glsl/parser.rs b/src/front/glsl/parser.rs index 075dce17e0..3913576688 100644 --- a/src/front/glsl/parser.rs +++ b/src/front/glsl/parser.rs @@ -166,7 +166,7 @@ impl<'source> ParsingContext<'source> { let mut module = Module::default(); // Body and expression arena for global initialization - let mut ctx = Context::new(frontend, &mut module)?; + let mut ctx = Context::new(frontend, &mut module, false)?; while self.peek(frontend).is_some() { self.parse_external_declaration(frontend, &mut ctx)?; @@ -220,13 +220,13 @@ impl<'source> ParsingContext<'source> { frontend: &mut Frontend, module: &mut Module, ) -> Result<(Handle, Span)> { - let mut ctx = Context::new(frontend, module)?; + let mut ctx = Context::new(frontend, module, true)?; let mut stmt_ctx = ctx.stmt_ctx(); let expr = self.parse_conditional(frontend, &mut ctx, &mut stmt_ctx, None)?; let (root, meta) = ctx.lower_expect(stmt_ctx, frontend, expr, ExprPos::Rhs)?; - Ok((ctx.eval_constant(root, meta)?, meta)) + Ok((root, meta)) } } diff --git a/src/front/glsl/parser/declarations.rs b/src/front/glsl/parser/declarations.rs index b2ac895825..a91f15c9ed 100644 --- a/src/front/glsl/parser/declarations.rs +++ b/src/front/glsl/parser/declarations.rs @@ -221,9 +221,15 @@ impl<'source> ParsingContext<'source> { // returns Ok(None) rather than an error if there is not one self.parse_array_specifier(frontend, ctx.ctx, &mut meta, &mut ty)?; + let is_global_const = + ctx.qualifiers.storage.0 == StorageQualifier::Const && ctx.external; + let init = self .bump_if(frontend, TokenValue::Assign) .map::, _>(|_| { + let prev_const = ctx.ctx.is_const; + ctx.ctx.is_const = is_global_const; + let (mut expr, init_meta) = self.parse_initializer(frontend, ty, ctx.ctx)?; let scalar_components = scalar_components(&ctx.ctx.module.types[ty].inner); @@ -232,32 +238,26 @@ impl<'source> ParsingContext<'source> { .implicit_conversion(&mut expr, init_meta, kind, width)?; } + ctx.ctx.is_const = prev_const; + meta.subsume(init_meta); - Ok((expr, init_meta)) + Ok(expr) }) .transpose()?; - let is_const = ctx.qualifiers.storage.0 == StorageQualifier::Const; - let maybe_const_expr = if ctx.external { - if let Some((root, meta)) = init { - match ctx.ctx.eval_constant(root, meta) { - Ok(res) => Some(res), - // If the declaration is external (global scope) and is constant qualified - // then the initializer must be a constant expression - Err(err) if is_const => return Err(err), - _ => None, - } - } else { - None - } + let maybe_const_expr = if is_global_const { + init + } else if ctx.external { + init.and_then(|expr| ctx.ctx.lift_up_const_expression(expr).ok()) } else { None + // init.filter(|expr| ctx.ctx.expressions.is_const(*expr)) }; let pointer = ctx.add_var(frontend, ty, name, maybe_const_expr, meta)?; - if let Some((value, _)) = init.filter(|_| maybe_const_expr.is_none()) { + if let Some(value) = init.filter(|_| maybe_const_expr.is_none()) { ctx.ctx.emit_restart(); ctx.ctx.body.push(Statement::Store { pointer, value }, meta); } @@ -317,7 +317,7 @@ impl<'source> ParsingContext<'source> { let result = ty.map(|ty| FunctionResult { ty, binding: None }); - let mut context = Context::new(frontend, ctx.module)?; + let mut context = Context::new(frontend, ctx.module, false)?; self.parse_function_args(frontend, &mut context)?; diff --git a/src/front/glsl/types.rs b/src/front/glsl/types.rs index a8bb047e47..ffa879506e 100644 --- a/src/front/glsl/types.rs +++ b/src/front/glsl/types.rs @@ -241,14 +241,36 @@ impl Context<'_> { pub(crate) fn typifier_grow(&mut self, expr: Handle, meta: Span) -> Result<()> { let resolve_ctx = ResolveContext::with_locals(self.module, &self.locals, &self.arguments); - self.typifier - .grow(expr, &self.expressions, &resolve_ctx) + let typifier = if self.is_const { + &mut self.const_typifier + } else { + &mut self.typifier + }; + + let expressions = if self.is_const { + &self.module.const_expressions + } else { + &self.expressions + }; + + typifier + .grow(expr, expressions, &resolve_ctx) .map_err(|error| Error { kind: ErrorKind::SemanticError(format!("Can't resolve type: {error:?}").into()), meta, }) } + pub(crate) fn get_type(&self, expr: Handle) -> &TypeInner { + let typifier = if self.is_const { + &self.const_typifier + } else { + &self.typifier + }; + + typifier.get(expr, &self.module.types) + } + /// Gets the type for the result of the `expr` expression /// /// Automatically grows the [`typifier`] to `expr` so calling @@ -262,7 +284,7 @@ impl Context<'_> { meta: Span, ) -> Result<&TypeInner> { self.typifier_grow(expr, meta)?; - Ok(self.typifier.get(expr, &self.module.types)) + Ok(self.get_type(expr)) } /// Gets the type handle for the result of the `expr` expression @@ -286,7 +308,14 @@ impl Context<'_> { meta: Span, ) -> Result> { self.typifier_grow(expr, meta)?; - Ok(self.typifier.register_type(expr, &mut self.module.types)) + + let typifier = if self.is_const { + &mut self.const_typifier + } else { + &mut self.typifier + }; + + Ok(typifier.register_type(expr, &mut self.module.types)) } /// Invalidates the cached type resolution for `expr` forcing a recomputation @@ -297,7 +326,13 @@ impl Context<'_> { ) -> Result<()> { let resolve_ctx = ResolveContext::with_locals(self.module, &self.locals, &self.arguments); - self.typifier + let typifier = if self.is_const { + &mut self.const_typifier + } else { + &mut self.typifier + }; + + typifier .invalidate(expr, &self.expressions, &resolve_ctx) .map_err(|error| Error { kind: ErrorKind::SemanticError(format!("Can't resolve type: {error:?}").into()), @@ -305,30 +340,36 @@ impl Context<'_> { }) } - pub(crate) fn eval_constant( + pub(crate) fn lift_up_const_expression( &mut self, - root: Handle, - meta: Span, + expr: Handle, ) -> Result> { - let mut solver = crate::proc::ConstantEvaluator { - types: &mut self.module.types, - expressions: &mut self.module.const_expressions, - constants: &mut self.module.constants, - const_expressions: Some(&self.expressions), - append: None::< - Box< - dyn FnMut( - &mut crate::Arena, - Expression, - Span, - ) -> Handle, - >, - >, - }; - - solver.eval(root).map_err(|e| Error { - kind: e.into(), - meta, + let meta = self.expressions.get_span(expr); + Ok(match self.expressions[expr] { + ref expr @ (Expression::Literal(_) + | Expression::Constant(_) + | Expression::ZeroValue(_)) => self.module.const_expressions.append(expr.clone(), meta), + Expression::Compose { ty, ref components } => { + let mut components = components.clone(); + for component in &mut components { + *component = self.lift_up_const_expression(*component)?; + } + self.module + .const_expressions + .append(Expression::Compose { ty, components }, meta) + } + Expression::Splat { size, value } => { + let value = self.lift_up_const_expression(value)?; + self.module + .const_expressions + .append(Expression::Splat { size, value }, meta) + } + _ => { + return Err(Error { + kind: ErrorKind::SemanticError("Expression is not const-expression".into()), + meta, + }) + } }) } } diff --git a/src/front/glsl/variables.rs b/src/front/glsl/variables.rs index 2a9c8cfcc1..d8cee27751 100644 --- a/src/front/glsl/variables.rs +++ b/src/front/glsl/variables.rs @@ -637,7 +637,7 @@ impl Frontend { LocalVariable { name: decl.name.clone(), ty: decl.ty, - init: None, + init: decl.init, }, decl.meta, ); diff --git a/src/proc/constant_evaluator.rs b/src/proc/constant_evaluator.rs index 3e8fa3330d..1d390dfc66 100644 --- a/src/proc/constant_evaluator.rs +++ b/src/proc/constant_evaluator.rs @@ -81,12 +81,6 @@ pub enum ConstantEvaluatorError { NotImplemented(String), } -#[derive(Clone, Copy)] -pub enum ExprType { - Regular, - Constant, -} - // Access // AccessIndex // Splat @@ -238,145 +232,6 @@ impl<'a, F: FnMut(&mut Arena, Expression, Span) -> Handle, - ) -> Result, ConstantEvaluatorError> { - self.eval_impl(expr, ExprType::Regular, true) - } - - pub fn eval_impl( - &mut self, - expr: Handle, - expr_type: ExprType, - top_level: bool, - ) -> Result, ConstantEvaluatorError> { - let expressions = match expr_type { - ExprType::Regular => self.const_expressions.unwrap(), - ExprType::Constant => self.expressions, - }; - let span = expressions.get_span(expr); - match expressions[expr] { - ref expression @ (Expression::Literal(_) | Expression::ZeroValue(_)) => match expr_type - { - ExprType::Regular => Ok(self.register_constant(expression.clone(), span)), - ExprType::Constant => Ok(expr), - }, - Expression::Compose { ty, ref components } => match expr_type { - ExprType::Regular => { - let mut components = components.clone(); - for component in &mut components { - *component = self.eval_impl(*component, expr_type, false)?; - } - Ok(self.register_constant(Expression::Compose { ty, components }, span)) - } - ExprType::Constant => Ok(expr), - }, - Expression::Constant(constant) => { - if top_level { - match expr_type { - ExprType::Regular => { - Ok(self.register_constant(Expression::Constant(constant), span)) - } - ExprType::Constant => Ok(expr), - } - } else { - self.eval_impl(self.constants[constant].init, ExprType::Constant, false) - } - } - Expression::AccessIndex { base, index } => { - let base = self.eval_impl(base, expr_type, false)?; - - self.access(base, index as usize, span) - } - Expression::Access { base, index } => { - let base = self.eval_impl(base, expr_type, false)?; - let index = self.eval_impl(index, expr_type, false)?; - - self.access(base, self.constant_index(index)?, span) - } - Expression::Splat { size, value } => { - let value = self.eval_impl(value, expr_type, false)?; - - self.splat(value, size, span) - } - Expression::Swizzle { - size, - vector: src_vector, - pattern, - } => { - let src_constant = self.eval_impl(src_vector, expr_type, false)?; - - self.swizzle(size, span, src_constant, pattern) - } - Expression::Unary { expr, op } => { - let expr_constant = self.eval_impl(expr, expr_type, false)?; - - self.unary_op(op, expr_constant, span) - } - Expression::Binary { left, right, op } => { - let left_constant = self.eval_impl(left, expr_type, false)?; - let right_constant = self.eval_impl(right, expr_type, false)?; - - self.binary_op(op, left_constant, right_constant, span) - } - Expression::Math { - fun, - arg, - arg1, - arg2, - arg3, - } => { - let arg = self.eval_impl(arg, expr_type, false)?; - let arg1 = arg1 - .map(|arg| self.eval_impl(arg, expr_type, false)) - .transpose()?; - let arg2 = arg2 - .map(|arg| self.eval_impl(arg, expr_type, false)) - .transpose()?; - let arg3 = arg3 - .map(|arg| self.eval_impl(arg, expr_type, false)) - .transpose()?; - - self.math(arg, arg1, arg2, arg3, fun, span) - } - Expression::As { - convert, - expr, - kind, - } => { - let expr_constant = self.eval_impl(expr, expr_type, false)?; - - match convert { - Some(width) => self.cast(expr_constant, kind, width, span), - None => Err(ConstantEvaluatorError::Bitcast), - } - } - Expression::ArrayLength(expr) => { - let array = self.eval_impl(expr, expr_type, false)?; - - self.array_length(array, span) - } - - Expression::Load { .. } => Err(ConstantEvaluatorError::Load), - Expression::Select { .. } => Err(ConstantEvaluatorError::Select), - Expression::LocalVariable(_) => Err(ConstantEvaluatorError::LocalVariable), - Expression::Derivative { .. } => Err(ConstantEvaluatorError::Derivative), - Expression::Relational { .. } => Err(ConstantEvaluatorError::Relational), - Expression::CallResult { .. } => Err(ConstantEvaluatorError::Call), - Expression::WorkGroupUniformLoadResult { .. } => unreachable!(), - Expression::AtomicResult { .. } => Err(ConstantEvaluatorError::Atomic), - Expression::FunctionArgument(_) => Err(ConstantEvaluatorError::FunctionArg), - Expression::GlobalVariable(_) => Err(ConstantEvaluatorError::GlobalVariable), - Expression::ImageSample { .. } - | Expression::ImageLoad { .. } - | Expression::ImageQuery { .. } => Err(ConstantEvaluatorError::ImageExpression), - Expression::RayQueryProceedResult | Expression::RayQueryGetIntersection { .. } => { - Err(ConstantEvaluatorError::RayQueryExpression) - } - } - } - fn splat( &mut self, value: Handle, diff --git a/tests/out/wgsl/246-collatz-comp.wgsl b/tests/out/wgsl/246-collatz-comp.wgsl index e92cf8127c..e79d619649 100644 --- a/tests/out/wgsl/246-collatz-comp.wgsl +++ b/tests/out/wgsl/246-collatz-comp.wgsl @@ -11,25 +11,24 @@ fn collatz_iterations(n: u32) -> u32 { var i: u32; n_1 = n; - i = u32(0); + i = 0u; loop { let _e7 = n_1; - if !((_e7 != u32(1))) { + if !((_e7 != 1u)) { break; } { let _e14 = n_1; let _e15 = f32(_e14); - let _e17 = f32(2); - if ((_e15 - (floor((_e15 / _e17)) * _e17)) == f32(0)) { + if ((_e15 - (floor((_e15 / 2.0)) * 2.0)) == 0.0) { { let _e25 = n_1; - n_1 = (_e25 / u32(2)); + n_1 = (_e25 / 2u); } } else { { let _e30 = n_1; - n_1 = ((u32(3) * _e30) + u32(1)); + n_1 = ((3u * _e30) + 1u); } } let _e36 = i; diff --git a/tests/out/wgsl/277-casting-frag.wgsl b/tests/out/wgsl/277-casting-frag.wgsl index 26a3db792d..84c50ddd45 100644 --- a/tests/out/wgsl/277-casting-frag.wgsl +++ b/tests/out/wgsl/277-casting-frag.wgsl @@ -1,7 +1,7 @@ fn main_1() { var a: f32; - a = f32(1); + a = 1.0; return; } diff --git a/tests/out/wgsl/280-matrix-cast-frag.wgsl b/tests/out/wgsl/280-matrix-cast-frag.wgsl index 316d936518..ad9f85b74e 100644 --- a/tests/out/wgsl/280-matrix-cast-frag.wgsl +++ b/tests/out/wgsl/280-matrix-cast-frag.wgsl @@ -1,8 +1,7 @@ fn main_1() { var a: mat4x4; - let _e1 = f32(1); - a = mat4x4(vec4(_e1, 0.0, 0.0, 0.0), vec4(0.0, _e1, 0.0, 0.0), vec4(0.0, 0.0, _e1, 0.0), vec4(0.0, 0.0, 0.0, _e1)); + a = 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)); return; } diff --git a/tests/out/wgsl/900-implicit-conversions-frag.wgsl b/tests/out/wgsl/900-implicit-conversions-frag.wgsl index 58ed87e1ea..dc4855efa5 100644 --- a/tests/out/wgsl/900-implicit-conversions-frag.wgsl +++ b/tests/out/wgsl/900-implicit-conversions-frag.wgsl @@ -56,8 +56,8 @@ fn implicit_dims_3(v_6: vec4) { fn main_1() { exact_1(1); - implicit(f32(1u)); - implicit_dims_2(vec3(vec3(1))); + implicit(1.0); + implicit_dims_2(vec3(1.0, 1.0, 1.0)); return; } diff --git a/tests/out/wgsl/bevy-pbr-frag.wgsl b/tests/out/wgsl/bevy-pbr-frag.wgsl index 85bbafd042..73501b99f4 100644 --- a/tests/out/wgsl/bevy-pbr-frag.wgsl +++ b/tests/out/wgsl/bevy-pbr-frag.wgsl @@ -157,9 +157,9 @@ fn D_GGX(roughness: f32, NoH: f32, h: vec3) -> f32 { k = (_e55 / (_e56 + (_e57 * _e58))); let _e63 = k; let _e64 = k; - d = ((_e63 * _e64) * (1.0 / PI)); - let _e70 = d; - return _e70; + d = ((_e63 * _e64) * 0.31830987); + let _e71 = d; + return _e71; } fn V_SmithGGXCorrelated(roughness_2: f32, NoV: f32, NoL: f32) -> f32 { @@ -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((50.0 * 0.33))), 0.0, 1.0); + f90_4 = clamp(dot(_e62, vec3(16.5)), 0.0, 1.0); let _e75 = f0_4; let _e76 = f90_4; let _e77 = LoH_1; @@ -321,7 +321,7 @@ fn Fd_Burley(roughness_6: f32, NoV_4: f32, NoL_4: f32, LoH_4: f32) -> f32 { viewScatter = _e72; let _e74 = lightScatter; let _e75 = viewScatter; - return ((_e74 * _e75) * (1.0 / PI)); + return ((_e74 * _e75) * 0.31830987); } fn EnvBRDFApprox(f0_7: vec3, perceptual_roughness: f32, NoV_6: f32) -> vec3 { @@ -337,8 +337,8 @@ fn EnvBRDFApprox(f0_7: vec3, perceptual_roughness: f32, NoV_6: f32) -> vec3 f0_8 = f0_7; perceptual_roughness_1 = perceptual_roughness; NoV_7 = NoV_6; - c0_ = vec4(-(1.0), -(0.0275), -(0.572), 0.022); - c1_ = vec4(1.0, 0.0425, 1.04, -(0.04)); + c0_ = vec4(-1.0, -0.0275, -0.572, 0.022); + c1_ = vec4(1.0, 0.0425, 1.04, -0.04); let _e62 = perceptual_roughness_1; let _e64 = c0_; let _e66 = c1_; @@ -353,10 +353,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.28 * _e94))) * _e98.x) + _e101.y); let _e109 = a004_; let _e112 = r; - AB = ((vec2(-(1.04), 1.04) * vec2(_e109)) + _e112.zw); + AB = ((vec2(-1.04, 1.04) * vec2(_e109)) + _e112.zw); let _e116 = f0_8; let _e117 = AB; let _e121 = AB; @@ -934,6 +934,6 @@ fn main(@location(0) v_WorldPosition: vec3, @location(1) v_WorldNormal: vec v_WorldTangent_1 = v_WorldTangent; gl_FrontFacing = param; main_1(); - let _e72 = o_Target; - return FragmentOutput(_e72); + let _e69 = o_Target; + return FragmentOutput(_e69); } diff --git a/tests/out/wgsl/bits_glsl-frag.wgsl b/tests/out/wgsl/bits_glsl-frag.wgsl index d81c3319d7..13f2a9925e 100644 --- a/tests/out/wgsl/bits_glsl-frag.wgsl +++ b/tests/out/wgsl/bits_glsl-frag.wgsl @@ -14,10 +14,10 @@ fn main_1() { i2_ = vec2(0); i3_ = vec3(0); i4_ = vec4(0); - u = u32(0); - u2_ = vec2(u32(0)); - u3_ = vec3(u32(0)); - u4_ = vec4(u32(0)); + u = 0u; + u2_ = vec2(0u); + u3_ = vec3(0u); + u4_ = vec4(0u); f2_ = vec2(0.0); f4_ = vec4(0.0); let _e33 = f4_; @@ -42,44 +42,44 @@ fn main_1() { f2_ = unpack2x16float(_e60); let _e66 = i; let _e67 = i; - i = insertBits(_e66, _e67, u32(5), u32(10)); + i = insertBits(_e66, _e67, 5u, 10u); let _e77 = i2_; let _e78 = i2_; - i2_ = insertBits(_e77, _e78, u32(5), u32(10)); + i2_ = insertBits(_e77, _e78, 5u, 10u); let _e88 = i3_; let _e89 = i3_; - i3_ = insertBits(_e88, _e89, u32(5), u32(10)); + i3_ = insertBits(_e88, _e89, 5u, 10u); let _e99 = i4_; let _e100 = i4_; - i4_ = insertBits(_e99, _e100, u32(5), u32(10)); + i4_ = insertBits(_e99, _e100, 5u, 10u); let _e110 = u; let _e111 = u; - u = insertBits(_e110, _e111, u32(5), u32(10)); + u = insertBits(_e110, _e111, 5u, 10u); let _e121 = u2_; let _e122 = u2_; - u2_ = insertBits(_e121, _e122, u32(5), u32(10)); + u2_ = insertBits(_e121, _e122, 5u, 10u); let _e132 = u3_; let _e133 = u3_; - u3_ = insertBits(_e132, _e133, u32(5), u32(10)); + u3_ = insertBits(_e132, _e133, 5u, 10u); let _e143 = u4_; let _e144 = u4_; - u4_ = insertBits(_e143, _e144, u32(5), u32(10)); + u4_ = insertBits(_e143, _e144, 5u, 10u); let _e153 = i; - i = extractBits(_e153, u32(5), u32(10)); + i = extractBits(_e153, 5u, 10u); let _e162 = i2_; - i2_ = extractBits(_e162, u32(5), u32(10)); + i2_ = extractBits(_e162, 5u, 10u); let _e171 = i3_; - i3_ = extractBits(_e171, u32(5), u32(10)); + i3_ = extractBits(_e171, 5u, 10u); let _e180 = i4_; - i4_ = extractBits(_e180, u32(5), u32(10)); + i4_ = extractBits(_e180, 5u, 10u); let _e189 = u; - u = extractBits(_e189, u32(5), u32(10)); + u = extractBits(_e189, 5u, 10u); let _e198 = u2_; - u2_ = extractBits(_e198, u32(5), u32(10)); + u2_ = extractBits(_e198, 5u, 10u); let _e207 = u3_; - u3_ = extractBits(_e207, u32(5), u32(10)); + u3_ = extractBits(_e207, 5u, 10u); let _e216 = u4_; - u4_ = extractBits(_e216, u32(5), u32(10)); + u4_ = extractBits(_e216, 5u, 10u); let _e223 = i; i = firstTrailingBit(_e223); let _e226 = i2_; diff --git a/tests/out/wgsl/buffer-frag.wgsl b/tests/out/wgsl/buffer-frag.wgsl index 4f561b4273..a02d8accb3 100644 --- a/tests/out/wgsl/buffer-frag.wgsl +++ b/tests/out/wgsl/buffer-frag.wgsl @@ -23,8 +23,8 @@ fn main_1() { let _e12 = testBuffer.data[0]; a = _e12; - testBuffer.data[1] = u32(2); - testBufferWriteOnly.data[1] = u32(2); + testBuffer.data[1] = 2u; + testBufferWriteOnly.data[1] = 2u; let _e27 = testBufferReadOnly.data[0]; b = _e27; return; diff --git a/tests/out/wgsl/constant-array-size-frag.wgsl b/tests/out/wgsl/constant-array-size-frag.wgsl index 1aff03c79c..18da4f7cd9 100644 --- a/tests/out/wgsl/constant-array-size-frag.wgsl +++ b/tests/out/wgsl/constant-array-size-frag.wgsl @@ -11,7 +11,7 @@ fn function() -> vec4 { var sum: vec4; var i: i32; - sum = vec4(f32(0)); + sum = vec4(0.0); i = 0; loop { let _e9 = i; diff --git a/tests/out/wgsl/declarations-frag.wgsl b/tests/out/wgsl/declarations-frag.wgsl index e8136fa59e..c82acd1e70 100644 --- a/tests/out/wgsl/declarations-frag.wgsl +++ b/tests/out/wgsl/declarations-frag.wgsl @@ -34,8 +34,8 @@ fn main_1() { var a_1: f32; var b: f32; - positions = array, 2>(vec3(-(1.0), 1.0, 0.0), vec3(-(1.0), -(1.0), 0.0)); - strct = TestStruct(f32(1), f32(2)); + positions = array, 2>(vec3(-1.0, 1.0, 0.0), vec3(-1.0, -1.0, 0.0)); + strct = TestStruct(1.0, 2.0); let _e35 = in_array_2[1]; from_input_array = _e35; let _e41 = array_2d[0][0]; diff --git a/tests/out/wgsl/expressions-frag.wgsl b/tests/out/wgsl/expressions-frag.wgsl index 1a1a6fd3b3..8a9776947c 100644 --- a/tests/out/wgsl/expressions-frag.wgsl +++ b/tests/out/wgsl/expressions-frag.wgsl @@ -14,7 +14,7 @@ struct FragmentOutput { @location(0) o_color: vec4, } -const strct: TestStruct = TestStruct(array, 2>(vec4(0u, 0u, 0u, 0u), vec4(1u, 1u, 1u, 1u))); +const strct: TestStruct = TestStruct(array, 2>(vec4(0u), vec4(1u))); var global: f32; @group(0) @binding(0) @@ -289,7 +289,7 @@ fn testStructConstructor() { fn testNonScalarToScalarConstructor() { var f: f32; - f = f32(mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0))[0].x); + f = 1.0; return; } @@ -308,7 +308,7 @@ fn testNonImplicitCastVectorCast() { var a_18: u32; var b_16: vec4; - a_18 = u32(1); + a_18 = 1u; let _e3 = a_18; b_16 = vec4(i32(_e3)); return; @@ -332,7 +332,7 @@ fn ternary(a_20: bool) { a_21 = a_20; let _e3 = a_21; if _e3 { - local = u32(0); + local = 0u; } else { local = 1u; } @@ -342,7 +342,7 @@ fn ternary(a_20: bool) { if _e10 { local_1 = 0u; } else { - local_1 = u32(1); + local_1 = 1u; } let _e15 = local_1; c_1 = _e15; @@ -354,7 +354,7 @@ fn ternary(a_20: bool) { if _e19 { local_2 = 2u; } else { - local_2 = u32(3); + local_2 = 3u; } let _e24 = local_2; local_3 = _e24; @@ -364,7 +364,7 @@ fn ternary(a_20: bool) { let _e27 = local_3; local_4 = _e27; } else { - local_4 = u32(5); + local_4 = 5u; } let _e31 = local_4; nested = _e31; @@ -396,7 +396,7 @@ fn testConstantLength(a_24: array) { var len_1: i32; a_25 = a_24; - len_1 = i32(4u); + len_1 = 4; return; } @@ -417,18 +417,17 @@ fn testSwizzleWrites(a_27: vec3) { a_28 = a_27; let _e6 = a_28; - let _e11 = vec2(3.0, 4.0); - a_28.z = _e11.x; - a_28.x = _e11.y; + a_28.z = 3.0; + a_28.x = 4.0; + let _e14 = a_28; let _e16 = a_28; - let _e18 = a_28; - let _e21 = (_e18.xy * 5.0); - a_28.x = _e21.x; - a_28.y = _e21.y; - let _e26 = a_28; - let _e30 = (_e26.zy + vec2(1.0)); - a_28.z = _e30.x; - a_28.y = _e30.y; + let _e19 = (_e16.xy * 5.0); + a_28.x = _e19.x; + a_28.y = _e19.y; + let _e24 = a_28; + let _e28 = (_e24.zy + vec2(1.0)); + a_28.z = _e28.x; + a_28.y = _e28.y; return; } @@ -441,17 +440,16 @@ fn main_1() { let _e8 = local_6; global = _e8; let _e9 = o_color; - let _e12 = vec4(1.0); - o_color.x = _e12.x; - o_color.y = _e12.y; - o_color.z = _e12.z; - o_color.w = _e12.w; + o_color.x = 1.0; + o_color.y = 1.0; + o_color.z = 1.0; + o_color.w = 1.0; return; } @fragment fn main() -> FragmentOutput { main_1(); - let _e17 = o_color; - return FragmentOutput(_e17); + let _e9 = o_color; + return FragmentOutput(_e9); } diff --git a/tests/out/wgsl/fma-frag.wgsl b/tests/out/wgsl/fma-frag.wgsl index 56677056f7..8708539786 100644 --- a/tests/out/wgsl/fma-frag.wgsl +++ b/tests/out/wgsl/fma-frag.wgsl @@ -33,11 +33,10 @@ fn Fma(d: ptr, m: Mat4x3_, s: f32) { fn main_1() { let _e1 = o_color; - let _e4 = vec4(1.0); - o_color.x = _e4.x; - o_color.y = _e4.y; - o_color.z = _e4.z; - o_color.w = _e4.w; + o_color.x = 1.0; + o_color.y = 1.0; + o_color.z = 1.0; + o_color.w = 1.0; return; } diff --git a/tests/out/wgsl/images-frag.wgsl b/tests/out/wgsl/images-frag.wgsl index 8b77c3e94d..2edcb9c0ea 100644 --- a/tests/out/wgsl/images-frag.wgsl +++ b/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(f32(2))); + textureStore(img1D, _e17, vec4(2.0)); 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(f32(2))); + textureStore(img1DArray, _e26.x, _e26.y, vec4(2.0)); 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(f32(2))); + textureStore(img2D, _e22, vec4(2.0)); 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(f32(2))); + textureStore(img2DArray, _e28.xy, _e28.z, vec4(2.0)); 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(f32(2))); + textureStore(img3D, _e22, vec4(2.0)); 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(f32(2))); + textureStore(imgWriteOnly, _e18, vec4(2.0)); return; } diff --git a/tests/out/wgsl/long-form-matrix-frag.wgsl b/tests/out/wgsl/long-form-matrix-frag.wgsl index f335452e1f..7cc26f1ff4 100644 --- a/tests/out/wgsl/long-form-matrix-frag.wgsl +++ b/tests/out/wgsl/long-form-matrix-frag.wgsl @@ -8,29 +8,14 @@ fn main_1() { var d: mat3x3; var e: mat4x4; - let _e1 = f32(1); - splat = mat2x2(vec2(_e1, 0.0), vec2(0.0, _e1)); - let _e9 = vec2(f32(1)); - let _e12 = vec2(f32(2)); - normal = mat2x2(vec2(_e9.x, _e9.y), vec2(_e12.x, _e12.y)); - let _e26 = mat3x3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0)); - from_matrix = mat2x4(vec4(_e26[0].x, _e26[0].y, _e26[0].z, 0.0), vec4(_e26[1].x, _e26[1].y, _e26[1].z, 0.0)); - a = mat2x2(vec2(f32(1), f32(2)), vec2(f32(3), f32(4))); - let _e58 = vec2(f32(2), f32(3)); - b = mat2x2(vec2(f32(1), _e58.x), vec2(_e58.y, f32(4))); - let _e73 = vec3(f32(1)); - let _e76 = vec3(f32(1)); - c = mat3x3(vec3(f32(1), f32(2), f32(3)), vec3(_e73.x, _e73.y, _e73.z), vec3(_e76.x, _e76.y, _e76.z)); - let _e93 = vec2(f32(2)); - let _e97 = vec3(f32(1)); - let _e100 = vec3(f32(1)); - d = mat3x3(vec3(_e93.x, _e93.y, f32(1)), vec3(_e97.x, _e97.y, _e97.z), vec3(_e100.x, _e100.y, _e100.z)); - let _e117 = vec2(f32(2)); - let _e120 = vec4(f32(1)); - let _e123 = vec2(f32(2)); - let _e126 = vec4(f32(1)); - let _e129 = vec4(f32(1)); - e = mat4x4(vec4(_e117.x, _e117.y, _e120.x, _e120.y), vec4(_e120.z, _e120.w, _e123.x, _e123.y), vec4(_e126.x, _e126.y, _e126.z, _e126.w), vec4(_e129.x, _e129.y, _e129.z, _e129.w)); + splat = mat2x2(vec2(1.0, 0.0), vec2(0.0, 1.0)); + normal = mat2x2(vec2(1.0, 1.0), vec2(2.0, 2.0)); + from_matrix = mat2x4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0)); + a = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + b = mat2x2(vec2(1.0, 2.0), vec2(3.0, 4.0)); + c = mat3x3(vec3(1.0, 2.0, 3.0), vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0)); + d = mat3x3(vec3(2.0, 2.0, 1.0), vec3(1.0, 1.0, 1.0), vec3(1.0, 1.0, 1.0)); + e = 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)); return; } diff --git a/tests/out/wgsl/prepostfix-frag.wgsl b/tests/out/wgsl/prepostfix-frag.wgsl index 296a8151eb..5b8f1bfb6e 100644 --- a/tests/out/wgsl/prepostfix-frag.wgsl +++ b/tests/out/wgsl/prepostfix-frag.wgsl @@ -14,7 +14,7 @@ fn main_1() { let _e8 = (_e6 - 1); scalar = _e8; scalar_target = _e8; - vec = vec2(u32(1)); + vec = vec2(1u); let _e14 = vec; vec = (_e14 - vec2(1u)); vec_target = _e14; @@ -22,8 +22,7 @@ fn main_1() { let _e21 = (_e18 + vec2(1u)); vec = _e21; vec_target = _e21; - let _e24 = f32(1); - mat = mat4x3(vec3(_e24, 0.0, 0.0), vec3(0.0, _e24, 0.0), vec3(0.0, 0.0, _e24), vec3(0.0, 0.0, 0.0)); + mat = 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)); let _e32 = mat; let _e34 = vec3(1.0); mat = (_e32 + mat4x3(_e34, _e34, _e34, _e34)); diff --git a/tests/out/wgsl/quad_glsl-vert.wgsl b/tests/out/wgsl/quad_glsl-vert.wgsl index b8d52e04c9..1cec36afaf 100644 --- a/tests/out/wgsl/quad_glsl-vert.wgsl +++ b/tests/out/wgsl/quad_glsl-vert.wgsl @@ -14,8 +14,8 @@ fn main_1() { let _e4 = a_uv_1; v_uv = _e4; let _e6 = a_pos_1; - let _e7 = (c_scale * _e6); - gl_Position = vec4(_e7.x, _e7.y, 0.0, 1.0); + let _e8 = (c_scale * _e6); + gl_Position = vec4(_e8.x, _e8.y, 0.0, 1.0); return; } @@ -24,7 +24,7 @@ fn main(@location(0) a_pos: vec2, @location(1) a_uv: vec2) -> VertexOu a_pos_1 = a_pos; a_uv_1 = a_uv; main_1(); - let _e14 = v_uv; - let _e16 = gl_Position; - return VertexOutput(_e14, _e16); + let _e13 = v_uv; + let _e15 = gl_Position; + return VertexOutput(_e13, _e15); } diff --git a/tests/out/wgsl/sampler-functions-frag.wgsl b/tests/out/wgsl/sampler-functions-frag.wgsl index 89a5c35dc4..7b2b01772f 100644 --- a/tests/out/wgsl/sampler-functions-frag.wgsl +++ b/tests/out/wgsl/sampler-functions-frag.wgsl @@ -9,7 +9,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 * (1.0 / 5.0))); + t_Res = (_e6 + (_e13 * 0.2)); let _e19 = t_Res; return _e19; } diff --git a/tests/out/wgsl/samplers-frag.wgsl b/tests/out/wgsl/samplers-frag.wgsl index 96b6626522..1009fd5cd8 100644 --- a/tests/out/wgsl/samplers-frag.wgsl +++ b/tests/out/wgsl/samplers-frag.wgsl @@ -65,92 +65,76 @@ fn testTex1D(coord: f32) { c = _e71; let _e72 = coord_1; let _e75 = coord_1; - let _e77 = vec2(_e75, 6.0); - 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 _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); - 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); - 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); - 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); - c = _e161; + let _e79 = textureSample(tex1D, samp, (_e75 / 6.0)); + c = _e79; + let _e80 = coord_1; + let _e85 = coord_1; + let _e95 = textureSample(tex1D, samp, (vec3(_e85, 0.0, 0.0) / vec3(6.0)).x); + c = _e95; + let _e96 = coord_1; + let _e100 = coord_1; + let _e105 = textureSampleBias(tex1D, samp, (_e100 / 6.0), 2.0); + c = _e105; + let _e106 = coord_1; + let _e112 = coord_1; + let _e123 = textureSampleBias(tex1D, samp, (vec3(_e112, 0.0, 0.0) / vec3(6.0)).x, 2.0); + c = _e123; + let _e124 = coord_1; + let _e129 = coord_1; + let _e135 = textureSampleGrad(tex1D, samp, (_e129 / 6.0), 4.0, 4.0); + c = _e135; + let _e136 = coord_1; + let _e143 = coord_1; + let _e155 = textureSampleGrad(tex1D, samp, (vec3(_e143, 0.0, 0.0) / vec3(6.0)).x, 4.0, 4.0); + c = _e155; + let _e156 = coord_1; 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); - c = _e177; + let _e169 = textureSampleGrad(tex1D, samp, (_e162 / 6.0), 4.0, 4.0, 5); + c = _e169; + let _e170 = coord_1; 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); - 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); - 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); - 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); - 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); - c = _e263; - let _e264 = coord_1; + let _e191 = textureSampleGrad(tex1D, samp, (vec3(_e178, 0.0, 0.0) / vec3(6.0)).x, 4.0, 4.0, 5); + c = _e191; + let _e192 = coord_1; + let _e196 = coord_1; + let _e201 = textureSampleLevel(tex1D, samp, (_e196 / 6.0), 3.0); + c = _e201; + let _e202 = coord_1; + let _e208 = coord_1; + let _e219 = textureSampleLevel(tex1D, samp, (vec3(_e208, 0.0, 0.0) / vec3(6.0)).x, 3.0); + c = _e219; + let _e220 = coord_1; + let _e225 = coord_1; + let _e231 = textureSampleLevel(tex1D, samp, (_e225 / 6.0), 3.0, 5); + c = _e231; + let _e232 = coord_1; + let _e239 = coord_1; + let _e251 = textureSampleLevel(tex1D, samp, (vec3(_e239, 0.0, 0.0) / vec3(6.0)).x, 3.0, 5); + c = _e251; + let _e252 = coord_1; + let _e256 = coord_1; + let _e261 = textureSample(tex1D, samp, (_e256 / 6.0), 5); + c = _e261; + let _e262 = coord_1; let _e268 = coord_1; - let _e270 = vec2(_e268, 6.0); - let _e275 = textureSample(tex1D, samp, (_e270.x / _e270.y), 5); - 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); - c = _e293; - let _e294 = coord_1; + let _e279 = textureSample(tex1D, samp, (vec3(_e268, 0.0, 0.0) / vec3(6.0)).x, 5); + c = _e279; + let _e280 = coord_1; + let _e285 = coord_1; + let _e291 = textureSampleBias(tex1D, samp, (_e285 / 6.0), 2.0, 5); + c = _e291; + let _e292 = coord_1; let _e299 = coord_1; - let _e301 = vec2(_e299, 6.0); - let _e307 = textureSampleBias(tex1D, samp, (_e301.x / _e301.y), 2.0, 5); - c = _e307; - let _e308 = coord_1; + let _e311 = textureSampleBias(tex1D, samp, (vec3(_e299, 0.0, 0.0) / vec3(6.0)).x, 2.0, 5); + c = _e311; + let _e312 = 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 _e318 = textureLoad(tex1D, i32(_e315), 3); + c = _e318; + let _e319 = coord_1; + let _e323 = coord_1; + let _e327 = textureLoad(tex1D, i32(_e323), 3); c = _e327; - let _e328 = coord_1; - let _e331 = coord_1; - let _e334 = textureLoad(tex1D, i32(_e331), 3); - c = _e334; - let _e335 = coord_1; - let _e339 = coord_1; - let _e343 = textureLoad(tex1D, i32(_e339), 3); - c = _e343; return; } @@ -218,99 +202,83 @@ fn testTex2D(coord_4: vec2) { let _e42 = textureSampleGrad(tex2D, samp, _e37, vec2(4.0), vec2(4.0)); c_2 = _e42; let _e50 = coord_5; - let _e57 = textureSampleGrad(tex2D, samp, _e50, vec2(4.0), vec2(4.0), vec2(5, 5)); + let _e57 = textureSampleGrad(tex2D, samp, _e50, vec2(4.0), vec2(4.0), vec2(5)); c_2 = _e57; let _e60 = coord_5; let _e62 = textureSampleLevel(tex2D, samp, _e60, 3.0); c_2 = _e62; let _e67 = coord_5; - let _e71 = textureSampleLevel(tex2D, samp, _e67, 3.0, vec2(5, 5)); + let _e71 = textureSampleLevel(tex2D, samp, _e67, 3.0, vec2(5)); c_2 = _e71; let _e75 = coord_5; - let _e78 = textureSample(tex2D, samp, _e75, vec2(5, 5)); + let _e78 = textureSample(tex2D, samp, _e75, vec2(5)); c_2 = _e78; let _e83 = coord_5; - let _e87 = textureSampleBias(tex2D, samp, _e83, 2.0, vec2(5, 5)); + let _e87 = textureSampleBias(tex2D, samp, _e83, 2.0, vec2(5)); c_2 = _e87; let _e88 = coord_5; let _e93 = coord_5; - let _e97 = vec3(_e93.x, _e93.y, 6.0); - let _e102 = textureSample(tex2D, samp, (_e97.xy / vec2(_e97.z))); + let _e102 = textureSample(tex2D, samp, (vec2(_e93.x, _e93.y) / vec2(6.0))); c_2 = _e102; let _e103 = coord_5; let _e109 = coord_5; - let _e114 = vec4(_e109.x, _e109.y, 0.0, 6.0); - let _e120 = textureSample(tex2D, samp, (_e114.xyz / vec3(_e114.w)).xy); + let _e120 = textureSample(tex2D, samp, (vec3(_e109.x, _e109.y, 0.0) / vec3(6.0)).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 _e137 = textureSampleBias(tex2D, samp, (vec2(_e127.x, _e127.y) / vec2(6.0)), 2.0); 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 _e157 = textureSampleBias(tex2D, samp, (vec3(_e145.x, _e145.y, 0.0) / vec3(6.0)).xy, 2.0); 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 _e180 = textureSampleGrad(tex2D, samp, (vec2(_e167.x, _e167.y) / vec2(6.0)), vec2(4.0), vec2(4.0)); 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 _e206 = textureSampleGrad(tex2D, samp, (vec3(_e191.x, _e191.y, 0.0) / vec3(6.0)).xy, vec2(4.0), vec2(4.0)); 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, 5)); + let _e233 = textureSampleGrad(tex2D, samp, (vec2(_e218.x, _e218.y) / vec2(6.0)), vec2(4.0), vec2(4.0), vec2(5)); 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, 5)); + let _e263 = textureSampleGrad(tex2D, samp, (vec3(_e246.x, _e246.y, 0.0) / vec3(6.0)).xy, vec2(4.0), vec2(4.0), vec2(5)); 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 _e280 = textureSampleLevel(tex2D, samp, (vec2(_e270.x, _e270.y) / vec2(6.0)), 3.0); 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 _e300 = textureSampleLevel(tex2D, samp, (vec3(_e288.x, _e288.y, 0.0) / vec3(6.0)).xy, 3.0); 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, 5)); + let _e321 = textureSampleLevel(tex2D, samp, (vec2(_e309.x, _e309.y) / vec2(6.0)), 3.0, vec2(5)); 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, 5)); + let _e345 = textureSampleLevel(tex2D, samp, (vec3(_e331.x, _e331.y, 0.0) / vec3(6.0)).xy, 3.0, vec2(5)); 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, 5)); + let _e364 = textureSample(tex2D, samp, (vec2(_e353.x, _e353.y) / vec2(6.0)), vec2(5)); 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, 5)); + let _e386 = textureSample(tex2D, samp, (vec3(_e373.x, _e373.y, 0.0) / vec3(6.0)).xy, vec2(5)); 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, 5)); + let _e407 = textureSampleBias(tex2D, samp, (vec2(_e395.x, _e395.y) / vec2(6.0)), 2.0, vec2(5)); 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, 5)); + let _e431 = textureSampleBias(tex2D, samp, (vec3(_e417.x, _e417.y, 0.0) / vec3(6.0)).xy, 2.0, vec2(5)); c_2 = _e431; let _e432 = coord_5; let _e435 = coord_5; @@ -333,70 +301,58 @@ fn testTex2DShadow(coord_6: vec2) { size2DShadow = vec2(_e20); let _e24 = coord_7; let _e29 = coord_7; - let _e33 = vec3(_e29.x, _e29.y, 1.0); - let _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 _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, 5)); - d = _e82; - let _e83 = coord_7; - let _e89 = coord_7; - let _e93 = vec3(_e89.x, _e89.y, 1.0); - 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, 5)); - 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, 5)); - d = _e133; + let _e35 = textureSampleCompare(tex2DShadow, sampShadow, vec2(_e29.x, _e29.y), 1.0); + d = _e35; + let _e36 = coord_7; + let _e45 = coord_7; + let _e55 = textureSampleCompareLevel(tex2DShadow, sampShadow, vec2(_e45.x, _e45.y), 1.0); + d = _e55; + let _e56 = coord_7; + let _e67 = coord_7; + let _e79 = textureSampleCompareLevel(tex2DShadow, sampShadow, vec2(_e67.x, _e67.y), 1.0, vec2(5)); + d = _e79; + let _e80 = coord_7; + let _e86 = coord_7; + let _e93 = textureSampleCompareLevel(tex2DShadow, sampShadow, vec2(_e86.x, _e86.y), 1.0); + d = _e93; + let _e94 = coord_7; + let _e102 = coord_7; + let _e111 = textureSampleCompareLevel(tex2DShadow, sampShadow, vec2(_e102.x, _e102.y), 1.0, vec2(5)); + d = _e111; + let _e112 = coord_7; + let _e119 = coord_7; + let _e127 = textureSampleCompare(tex2DShadow, sampShadow, vec2(_e119.x, _e119.y), 1.0, vec2(5)); + d = _e127; + let _e128 = coord_7; let _e134 = coord_7; - let _e140 = coord_7; - let _e145 = vec4(_e140.x, _e140.y, 1.0, 6.0); - 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 _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 _e207 = (_e197.xyz / vec3(_e197.w)); - let _e210 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e207.xy, _e207.z, vec2(5, 5)); - d = _e210; - let _e211 = coord_7; - let _e218 = coord_7; - let _e223 = vec4(_e218.x, _e218.y, 1.0, 6.0); - 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 _e253 = (_e246.xyz / vec3(_e246.w)); - let _e256 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e253.xy, _e253.z, vec2(5, 5)); - d = _e256; - let _e257 = coord_7; - let _e265 = coord_7; - let _e270 = vec4(_e265.x, _e265.y, 1.0, 6.0); - let _e276 = (_e270.xyz / vec3(_e270.w)); - let _e279 = textureSampleCompare(tex2DShadow, sampShadow, _e276.xy, _e276.z, vec2(5, 5)); - d = _e279; + let _e143 = (vec3(_e134.x, _e134.y, 1.0) / vec3(6.0)); + let _e146 = textureSampleCompare(tex2DShadow, sampShadow, _e143.xy, _e143.z); + d = _e146; + let _e147 = coord_7; + let _e157 = coord_7; + let _e170 = (vec3(_e157.x, _e157.y, 1.0) / vec3(6.0)); + let _e173 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e170.xy, _e170.z); + d = _e173; + let _e174 = coord_7; + let _e186 = coord_7; + let _e201 = (vec3(_e186.x, _e186.y, 1.0) / vec3(6.0)); + let _e204 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e201.xy, _e201.z, vec2(5)); + d = _e204; + let _e205 = coord_7; + let _e212 = coord_7; + let _e222 = (vec3(_e212.x, _e212.y, 1.0) / vec3(6.0)); + let _e225 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e222.xy, _e222.z); + d = _e225; + let _e226 = coord_7; + let _e235 = coord_7; + let _e247 = (vec3(_e235.x, _e235.y, 1.0) / vec3(6.0)); + let _e250 = textureSampleCompareLevel(tex2DShadow, sampShadow, _e247.xy, _e247.z, vec2(5)); + d = _e250; + let _e251 = coord_7; + let _e259 = coord_7; + let _e270 = (vec3(_e259.x, _e259.y, 1.0) / vec3(6.0)); + let _e273 = textureSampleCompare(tex2DShadow, sampShadow, _e270.xy, _e270.z, vec2(5)); + d = _e273; return; } @@ -419,19 +375,19 @@ fn testTex2DArray(coord_8: vec3) { let _e55 = textureSampleGrad(tex2DArray, samp, _e47.xy, i32(_e47.z), vec2(4.0), vec2(4.0)); 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, 5)); + let _e73 = textureSampleGrad(tex2DArray, samp, _e63.xy, i32(_e63.z), vec2(4.0), vec2(4.0), vec2(5)); c_3 = _e73; let _e76 = coord_9; let _e81 = textureSampleLevel(tex2DArray, samp, _e76.xy, i32(_e76.z), 3.0); c_3 = _e81; let _e86 = coord_9; - let _e93 = textureSampleLevel(tex2DArray, samp, _e86.xy, i32(_e86.z), 3.0, vec2(5, 5)); + let _e93 = textureSampleLevel(tex2DArray, samp, _e86.xy, i32(_e86.z), 3.0, vec2(5)); c_3 = _e93; let _e97 = coord_9; - let _e103 = textureSample(tex2DArray, samp, _e97.xy, i32(_e97.z), vec2(5, 5)); + let _e103 = textureSample(tex2DArray, samp, _e97.xy, i32(_e97.z), vec2(5)); c_3 = _e103; let _e108 = coord_9; - let _e115 = textureSampleBias(tex2DArray, samp, _e108.xy, i32(_e108.z), 2.0, vec2(5, 5)); + let _e115 = textureSampleBias(tex2DArray, samp, _e108.xy, i32(_e108.z), 2.0, vec2(5)); c_3 = _e115; let _e116 = coord_9; let _e119 = coord_9; @@ -457,24 +413,20 @@ fn testTex2DArrayShadow(coord_10: vec3) { size2DArrayShadow = vec3(vec3(_e20.x, _e20.y, _e23)); let _e28 = coord_11; let _e34 = coord_11; - let _e39 = vec4(_e34.x, _e34.y, _e34.z, 1.0); - let _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 _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, 5)); - 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, 5)); - d_1 = _e119; + let _e42 = textureSampleCompare(tex2DArrayShadow, sampShadow, vec2(_e34.x, _e34.y), i32(_e34.z), 1.0); + d_1 = _e42; + let _e43 = coord_11; + let _e53 = coord_11; + let _e65 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, vec2(_e53.x, _e53.y), i32(_e53.z), 1.0); + d_1 = _e65; + let _e66 = coord_11; + let _e78 = coord_11; + let _e92 = textureSampleCompareLevel(tex2DArrayShadow, sampShadow, vec2(_e78.x, _e78.y), i32(_e78.z), 1.0, vec2(5)); + d_1 = _e92; + let _e93 = coord_11; + let _e101 = coord_11; + let _e111 = textureSampleCompare(tex2DArrayShadow, sampShadow, vec2(_e101.x, _e101.y), i32(_e101.z), 1.0, vec2(5)); + d_1 = _e111; return; } @@ -511,14 +463,12 @@ fn testTexCubeShadow(coord_14: vec3) { sizeCubeShadow = vec2(_e20); let _e24 = coord_15; let _e30 = coord_15; - let _e35 = vec4(_e30.x, _e30.y, _e30.z, 1.0); - let _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 _e61 = textureSampleCompareLevel(texCubeShadow, sampShadow, _e54.xyz, _e54.w); - d_2 = _e61; + let _e37 = textureSampleCompare(texCubeShadow, sampShadow, vec3(_e30.x, _e30.y, _e30.z), 1.0); + d_2 = _e37; + let _e38 = coord_15; + let _e48 = coord_15; + let _e59 = textureSampleCompareLevel(texCubeShadow, sampShadow, vec3(_e48.x, _e48.y, _e48.z), 1.0); + d_2 = _e59; return; } @@ -577,61 +527,53 @@ fn testTex3D(coord_20: vec3) { c_6 = _e31; let _e32 = coord_21; let _e38 = coord_21; - let _e43 = vec4(_e38.x, _e38.y, _e38.z, 6.0); - let _e48 = textureSample(tex3D, samp, (_e43.xyz / vec3(_e43.w))); + let _e48 = textureSample(tex3D, samp, (vec3(_e38.x, _e38.y, _e38.z) / vec3(6.0))); 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 _e67 = textureSampleBias(tex3D, samp, (vec3(_e56.x, _e56.y, _e56.z) / vec3(6.0)), 2.0); 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, 5, 5)); + let _e88 = textureSample(tex3D, samp, (vec3(_e76.x, _e76.y, _e76.z) / vec3(6.0)), vec3(5)); 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, 5, 5)); + let _e111 = textureSampleBias(tex3D, samp, (vec3(_e98.x, _e98.y, _e98.z) / vec3(6.0)), 2.0, vec3(5)); 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 _e130 = textureSampleLevel(tex3D, samp, (vec3(_e119.x, _e119.y, _e119.z) / vec3(6.0)), 3.0); 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, 5, 5)); + let _e153 = textureSampleLevel(tex3D, samp, (vec3(_e140.x, _e140.y, _e140.z) / vec3(6.0)), 3.0, vec3(5)); 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 _e178 = textureSampleGrad(tex3D, samp, (vec3(_e164.x, _e164.y, _e164.z) / vec3(6.0)), vec3(4.0), vec3(4.0)); 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, 5, 5)); + let _e207 = textureSampleGrad(tex3D, samp, (vec3(_e191.x, _e191.y, _e191.z) / vec3(6.0)), vec3(4.0), vec3(4.0), vec3(5)); c_6 = _e207; let _e213 = coord_21; let _e218 = textureSampleGrad(tex3D, samp, _e213, vec3(4.0), vec3(4.0)); c_6 = _e218; let _e226 = coord_21; - let _e233 = textureSampleGrad(tex3D, samp, _e226, vec3(4.0), vec3(4.0), vec3(5, 5, 5)); + let _e233 = textureSampleGrad(tex3D, samp, _e226, vec3(4.0), vec3(4.0), vec3(5)); c_6 = _e233; let _e236 = coord_21; let _e238 = textureSampleLevel(tex3D, samp, _e236, 3.0); c_6 = _e238; let _e243 = coord_21; - let _e247 = textureSampleLevel(tex3D, samp, _e243, 3.0, vec3(5, 5, 5)); + let _e247 = textureSampleLevel(tex3D, samp, _e243, 3.0, vec3(5)); c_6 = _e247; let _e251 = coord_21; - let _e254 = textureSample(tex3D, samp, _e251, vec3(5, 5, 5)); + let _e254 = textureSample(tex3D, samp, _e251, vec3(5)); c_6 = _e254; let _e259 = coord_21; - let _e263 = textureSampleBias(tex3D, samp, _e259, 2.0, vec3(5, 5, 5)); + let _e263 = textureSampleBias(tex3D, samp, _e259, 2.0, vec3(5)); c_6 = _e263; let _e264 = coord_21; let _e267 = coord_21;