From b7d1f4c6cfbad437c1fd23b3fe53cfb3cc69cbda Mon Sep 17 00:00:00 2001 From: Jamie Nicol Date: Tue, 25 Feb 2025 14:23:44 +0000 Subject: [PATCH] [naga spv-out] Ensure loops generated by SPIRV backend are bounded (#7080) If it is undefined behaviour for loops to be infinite, then, when encountering an infinite loop, downstream compilers are able to make certain optimizations that may be unsafe. For example, omitting bounds checks. To prevent this, we must ensure that any loops emitted by our backends are provably bounded. We already do this for both the MSL and HLSL backends. This patch makes us do so for SPIRV as well. The construct used is the same as for HLSL and MSL backends: use a vec2 to emulate a 64-bit counter, which is incremented every iteration and breaks after 2^64 iterations. While the implementation is fairly verbose for the SPIRV backend, the logic is simple enough. The one point of note is that SPIRV requires `OpVariable` instructions with a `Function` storage class to be located at the start of the first block of the function. We therefore remember the IDs generated for each loop counter variable in a function whilst generating the function body's code. The instructions to declare these variables are then emitted in `Function::to_words()` prior to emitting the function's body. As this may negatively impact shader performance, this workaround can be disabled using the same mechanism as for other backends: eg calling Device::create_shader_module_trusted() and setting the ShaderRuntimeChecks::force_loop_bounding flag to false. --- CHANGELOG.md | 11 + naga/src/back/spv/block.rs | 153 +++ naga/src/back/spv/mod.rs | 10 + naga/src/back/spv/writer.rs | 33 + .../tests/out/spv/6220-break-from-loop.spvasm | 50 +- .../spv/atomicCompareExchange-int64.spvasm | 312 +++-- .../out/spv/atomicCompareExchange.spvasm | 326 +++-- naga/tests/out/spv/boids.spvasm | 464 ++++--- naga/tests/out/spv/break-if.spvasm | 224 ++-- naga/tests/out/spv/collatz.spvasm | 132 +- naga/tests/out/spv/control-flow.spvasm | 491 ++++--- .../out/spv/debug-symbol-large-source.spvasm | 1184 +++++++++-------- naga/tests/out/spv/debug-symbol-simple.spvasm | 94 +- .../tests/out/spv/debug-symbol-terrain.spvasm | 1184 +++++++++-------- .../out/spv/overrides-ray-query.main.spvasm | 45 +- naga/tests/out/spv/ray-query.spvasm | 347 ++--- naga/tests/out/spv/shadow.spvasm | 318 +++-- naga/tests/snapshots.rs | 1 + wgpu-hal/src/vulkan/adapter.rs | 1 + wgpu-hal/src/vulkan/device.rs | 4 + 20 files changed, 3052 insertions(+), 2332 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 160f99a356..634f037f7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -117,6 +117,17 @@ pub enum PollError { By @cwfitzgerald in [#6942](https://github.com/gfx-rs/wgpu/pull/6942). By @cwfitzgerald in [#7030](https://github.com/gfx-rs/wgpu/pull/7030). +#### Naga + +##### Ensure loops generated by SPIR-V and HLSL Naga backends are bounded + +Make sure that all loops in shaders generated by these naga backends are bounded +to avoid undefined behaviour due to infinite loops. Note that this may have a +performance cost. As with the existing implementation for the MSL backend this +can be disabled by using `Device::create_shader_module_trusted()`. + +By @jamienicol in [#6929](https://github.com/gfx-rs/wgpu/pull/6929) and [#7080](https://github.com/gfx-rs/wgpu/pull/7080). + ### New Features #### General diff --git a/naga/src/back/spv/block.rs b/naga/src/back/spv/block.rs index 6b26c1c2aa..4f07dea3e2 100644 --- a/naga/src/back/spv/block.rs +++ b/naga/src/back/spv/block.rs @@ -261,6 +261,155 @@ impl Writer { } impl BlockContext<'_> { + /// Generates code to ensure that a loop is bounded. Should be called immediately + /// after adding the OpLoopMerge instruction to `block`. This function will + /// [`consume()`](crate::back::spv::Function::consume) `block` and append its + /// instructions to a new [`Block`], which will be returned to the caller for it to + /// consumed prior to writing the loop body. + /// + /// Additionally this function will populate [`force_loop_bounding_vars`](crate::back::spv::Function::force_loop_bounding_vars), + /// ensuring that [`Function::to_words()`](crate::back::spv::Function::to_words) will + /// declare the required variables. + /// + /// See [`crate::back::msl::Writer::gen_force_bounded_loop_statements`] for details + /// of why this is required. + fn write_force_bounded_loop_instructions(&mut self, mut block: Block, merge_id: Word) -> Block { + let uint_type_id = self.writer.get_uint_type_id(); + let uint2_type_id = self.writer.get_uint2_type_id(); + let uint2_ptr_type_id = self + .writer + .get_uint2_pointer_type_id(spirv::StorageClass::Function); + let bool_type_id = self.writer.get_bool_type_id(); + let bool2_type_id = self.writer.get_bool2_type_id(); + let zero_uint_const_id = self.writer.get_constant_scalar(crate::Literal::U32(0)); + let zero_uint2_const_id = self.writer.get_constant_composite( + LookupType::Local(LocalType::Numeric(NumericType::Vector { + size: crate::VectorSize::Bi, + scalar: crate::Scalar::U32, + })), + &[zero_uint_const_id, zero_uint_const_id], + ); + let one_uint_const_id = self.writer.get_constant_scalar(crate::Literal::U32(1)); + let max_uint_const_id = self + .writer + .get_constant_scalar(crate::Literal::U32(u32::MAX)); + let max_uint2_const_id = self.writer.get_constant_composite( + LookupType::Local(LocalType::Numeric(NumericType::Vector { + size: crate::VectorSize::Bi, + scalar: crate::Scalar::U32, + })), + &[max_uint_const_id, max_uint_const_id], + ); + + let loop_counter_var_id = self.gen_id(); + if self.writer.flags.contains(WriterFlags::DEBUG) { + self.writer + .debugs + .push(Instruction::name(loop_counter_var_id, "loop_bound")); + } + let var = super::LocalVariable { + id: loop_counter_var_id, + instruction: Instruction::variable( + uint2_ptr_type_id, + loop_counter_var_id, + spirv::StorageClass::Function, + Some(zero_uint2_const_id), + ), + }; + self.function.force_loop_bounding_vars.push(var); + + let break_if_block = self.gen_id(); + + self.function + .consume(block, Instruction::branch(break_if_block)); + block = Block::new(break_if_block); + + // Load the current loop counter value from its variable. We use a vec2 to + // simulate a 64-bit counter. + let load_id = self.gen_id(); + block.body.push(Instruction::load( + uint2_type_id, + load_id, + loop_counter_var_id, + None, + )); + + // If both the high and low u32s have reached u32::MAX then break. ie + // if (all(eq(loop_counter, vec2(u32::MAX)))) { break; } + let eq_id = self.gen_id(); + block.body.push(Instruction::binary( + spirv::Op::IEqual, + bool2_type_id, + eq_id, + max_uint2_const_id, + load_id, + )); + let all_eq_id = self.gen_id(); + block.body.push(Instruction::relational( + spirv::Op::All, + bool_type_id, + all_eq_id, + eq_id, + )); + + let inc_counter_block_id = self.gen_id(); + block.body.push(Instruction::selection_merge( + inc_counter_block_id, + spirv::SelectionControl::empty(), + )); + self.function.consume( + block, + Instruction::branch_conditional(all_eq_id, merge_id, inc_counter_block_id), + ); + block = Block::new(inc_counter_block_id); + + // To simulate a 64-bit counter we always increment the low u32, and increment + // the high u32 when the low u32 overflows. ie + // counter += vec2(select(0u, 1u, counter.y == u32::MAX), 1u); + let low_id = self.gen_id(); + block.body.push(Instruction::composite_extract( + uint_type_id, + low_id, + load_id, + &[1], + )); + let low_overflow_id = self.gen_id(); + block.body.push(Instruction::binary( + spirv::Op::IEqual, + bool_type_id, + low_overflow_id, + low_id, + max_uint_const_id, + )); + let carry_bit_id = self.gen_id(); + block.body.push(Instruction::select( + uint_type_id, + carry_bit_id, + low_overflow_id, + one_uint_const_id, + zero_uint_const_id, + )); + let increment_id = self.gen_id(); + block.body.push(Instruction::composite_construct( + uint2_type_id, + increment_id, + &[carry_bit_id, one_uint_const_id], + )); + let result_id = self.gen_id(); + block.body.push(Instruction::binary( + spirv::Op::IAdd, + uint2_type_id, + result_id, + load_id, + increment_id, + )); + block + .body + .push(Instruction::store(loop_counter_var_id, result_id, None)); + + block + } + /// Cache an expression for a value. pub(super) fn cache_expression_value( &mut self, @@ -2558,6 +2707,10 @@ impl BlockContext<'_> { continuing_id, spirv::SelectionControl::NONE, )); + + if self.force_loop_bounding { + block = self.write_force_bounded_loop_instructions(block, merge_id); + } self.function.consume(block, Instruction::branch(body_id)); // We can ignore the `BlockExitDisposition` returned here because, diff --git a/naga/src/back/spv/mod.rs b/naga/src/back/spv/mod.rs index 5a1c90326a..bb2757766c 100644 --- a/naga/src/back/spv/mod.rs +++ b/naga/src/back/spv/mod.rs @@ -144,6 +144,8 @@ struct Function { signature: Option, parameters: Vec, variables: crate::FastHashMap, LocalVariable>, + /// List of local variables used as a counters to ensure that all loops are bounded. + force_loop_bounding_vars: Vec, /// A map taking an expression that yields a composite value (array, matrix) /// to the temporary variables we have spilled it to, if any. Spilling @@ -726,6 +728,8 @@ struct BlockContext<'w> { /// Tracks the constness of `Expression`s residing in `self.ir_function.expressions` expression_constness: ExpressionConstnessTracker, + + force_loop_bounding: bool, } impl BlockContext<'_> { @@ -779,6 +783,7 @@ pub struct Writer { flags: WriterFlags, bounds_check_policies: BoundsCheckPolicies, zero_initialize_workgroup_memory: ZeroInitializeWorkgroupMemoryMode, + force_loop_bounding: bool, void_type: Word, //TODO: convert most of these into vectors, addressable by handle indices lookup_type: crate::FastHashMap, @@ -882,6 +887,10 @@ pub struct Options<'a> { /// Dictates the way workgroup variables should be zero initialized pub zero_initialize_workgroup_memory: ZeroInitializeWorkgroupMemoryMode, + /// If set, loops will have code injected into them, forcing the compiler + /// to think the number of iterations is bounded. + pub force_loop_bounding: bool, + pub debug_info: Option>, } @@ -900,6 +909,7 @@ impl Default for Options<'_> { capabilities: None, bounds_check_policies: BoundsCheckPolicies::default(), zero_initialize_workgroup_memory: ZeroInitializeWorkgroupMemoryMode::Polyfill, + force_loop_bounding: true, debug_info: None, } } diff --git a/naga/src/back/spv/writer.rs b/naga/src/back/spv/writer.rs index cc0c227bec..f1ba07a386 100644 --- a/naga/src/back/spv/writer.rs +++ b/naga/src/back/spv/writer.rs @@ -32,6 +32,9 @@ impl Function { for local_var in self.variables.values() { local_var.instruction.to_words(sink); } + for local_var in self.force_loop_bounding_vars.iter() { + local_var.instruction.to_words(sink); + } for internal_var in self.spilled_composites.values() { internal_var.instruction.to_words(sink); } @@ -71,6 +74,7 @@ impl Writer { flags: options.flags, bounds_check_policies: options.bounds_check_policies, zero_initialize_workgroup_memory: options.zero_initialize_workgroup_memory, + force_loop_bounding: options.force_loop_bounding, void_type, lookup_type: crate::FastHashMap::default(), lookup_function: crate::FastHashMap::default(), @@ -111,6 +115,7 @@ impl Writer { flags: self.flags, bounds_check_policies: self.bounds_check_policies, zero_initialize_workgroup_memory: self.zero_initialize_workgroup_memory, + force_loop_bounding: self.force_loop_bounding, capabilities_available: take(&mut self.capabilities_available), binding_map: take(&mut self.binding_map), @@ -267,6 +272,14 @@ impl Writer { self.get_type_id(local_type.into()) } + pub(super) fn get_uint2_type_id(&mut self) -> Word { + let local_type = LocalType::Numeric(NumericType::Vector { + size: crate::VectorSize::Bi, + scalar: crate::Scalar::U32, + }); + self.get_type_id(local_type.into()) + } + pub(super) fn get_uint3_type_id(&mut self) -> Word { let local_type = LocalType::Numeric(NumericType::Vector { size: crate::VectorSize::Tri, @@ -283,6 +296,17 @@ impl Writer { self.get_type_id(local_type.into()) } + pub(super) fn get_uint2_pointer_type_id(&mut self, class: spirv::StorageClass) -> Word { + let local_type = LocalType::LocalPointer { + base: NumericType::Vector { + size: crate::VectorSize::Bi, + scalar: crate::Scalar::U32, + }, + class, + }; + self.get_type_id(local_type.into()) + } + pub(super) fn get_uint3_pointer_type_id(&mut self, class: spirv::StorageClass) -> Word { let local_type = LocalType::LocalPointer { base: NumericType::Vector { @@ -299,6 +323,14 @@ impl Writer { self.get_type_id(local_type.into()) } + pub(super) fn get_bool2_type_id(&mut self) -> Word { + let local_type = LocalType::Numeric(NumericType::Vector { + size: crate::VectorSize::Bi, + scalar: crate::Scalar::BOOL, + }); + self.get_type_id(local_type.into()) + } + pub(super) fn get_bool3_type_id(&mut self) -> Word { let local_type = LocalType::Numeric(NumericType::Vector { size: crate::VectorSize::Tri, @@ -839,6 +871,7 @@ impl Writer { // Steal the Writer's temp list for a bit. temp_list: std::mem::take(&mut self.temp_list), + force_loop_bounding: self.force_loop_bounding, writer: self, expression_constness: super::ExpressionConstnessTracker::from_arena( &ir_function.expressions, diff --git a/naga/tests/out/spv/6220-break-from-loop.spvasm b/naga/tests/out/spv/6220-break-from-loop.spvasm index 9dabbc2079..9a9ee787ab 100644 --- a/naga/tests/out/spv/6220-break-from-loop.spvasm +++ b/naga/tests/out/spv/6220-break-from-loop.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 26 +; Bound: 46 OpCapability Shader OpCapability Linkage %1 = OpExtInstImport "GLSL.std.450" @@ -13,31 +13,55 @@ OpMemoryModel Logical GLSL450 %8 = OpConstant %3 4 %9 = OpConstant %3 1 %11 = OpTypePointer Function %3 -%18 = OpTypeBool +%17 = OpTypeInt 32 0 +%18 = OpTypeVector %17 2 +%19 = OpTypePointer Function %18 +%20 = OpTypeBool +%21 = OpTypeVector %20 2 +%22 = OpConstant %17 0 +%23 = OpConstantComposite %18 %22 %22 +%24 = OpConstant %17 1 +%25 = OpConstant %17 4294967295 +%26 = OpConstantComposite %18 %25 %25 %5 = OpFunction %2 None %6 %4 = OpLabel %10 = OpVariable %11 Function %7 +%27 = OpVariable %19 Function %23 OpBranch %12 %12 = OpLabel OpBranch %13 %13 = OpLabel OpLoopMerge %14 %16 None +OpBranch %28 +%28 = OpLabel +%29 = OpLoad %18 %27 +%30 = OpIEqual %21 %26 %29 +%31 = OpAll %20 %30 +OpSelectionMerge %32 None +OpBranchConditional %31 %14 %32 +%32 = OpLabel +%33 = OpCompositeExtract %17 %29 1 +%34 = OpIEqual %20 %33 %25 +%35 = OpSelect %17 %34 %24 %22 +%36 = OpCompositeConstruct %18 %35 %24 +%37 = OpIAdd %18 %29 %36 +OpStore %27 %37 OpBranch %15 %15 = OpLabel -%17 = OpLoad %3 %10 -%19 = OpSLessThan %18 %17 %8 -OpSelectionMerge %20 None -OpBranchConditional %19 %20 %21 -%21 = OpLabel +%38 = OpLoad %3 %10 +%39 = OpSLessThan %20 %38 %8 +OpSelectionMerge %40 None +OpBranchConditional %39 %40 %41 +%41 = OpLabel OpBranch %14 -%20 = OpLabel -OpBranch %22 -%22 = OpLabel +%40 = OpLabel +OpBranch %42 +%42 = OpLabel OpBranch %14 %16 = OpLabel -%24 = OpLoad %3 %10 -%25 = OpIAdd %3 %24 %9 -OpStore %10 %25 +%44 = OpLoad %3 %10 +%45 = OpIAdd %3 %44 %9 +OpStore %10 %45 OpBranch %13 %14 = OpLabel OpReturn diff --git a/naga/tests/out/spv/atomicCompareExchange-int64.spvasm b/naga/tests/out/spv/atomicCompareExchange-int64.spvasm index f174ad3b38..2697eee855 100644 --- a/naga/tests/out/spv/atomicCompareExchange-int64.spvasm +++ b/naga/tests/out/spv/atomicCompareExchange-int64.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.0 ; Generator: rspirv -; Bound: 125 +; Bound: 175 OpCapability Shader OpCapability Int64Atomics OpCapability Int64 @@ -9,9 +9,9 @@ OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %19 "test_atomic_compare_exchange_i64" -OpEntryPoint GLCompute %77 "test_atomic_compare_exchange_u64" +OpEntryPoint GLCompute %105 "test_atomic_compare_exchange_u64" OpExecutionMode %19 LocalSize 1 1 1 -OpExecutionMode %77 LocalSize 1 1 1 +OpExecutionMode %105 LocalSize 1 1 1 OpDecorate %5 ArrayStride 8 OpDecorate %8 ArrayStride 8 OpMemberDecorate %10 0 Offset 0 @@ -53,153 +53,219 @@ OpMemberDecorate %16 0 Offset 0 %31 = OpConstantNull %4 %33 = OpTypePointer Function %9 %34 = OpConstantNull %9 -%47 = OpTypePointer StorageBuffer %4 -%51 = OpTypeInt 32 1 -%50 = OpConstant %51 1 -%52 = OpConstant %3 64 -%78 = OpTypePointer StorageBuffer %8 -%80 = OpConstant %7 10 -%83 = OpTypePointer Function %7 -%84 = OpConstantNull %7 -%86 = OpConstantNull %9 -%99 = OpTypePointer StorageBuffer %7 +%40 = OpTypeVector %3 2 +%41 = OpTypePointer Function %40 +%42 = OpTypeVector %9 2 +%43 = OpConstantComposite %40 %22 %22 +%44 = OpConstant %3 4294967295 +%45 = OpConstantComposite %40 %44 %44 +%64 = OpTypePointer StorageBuffer %4 +%68 = OpTypeInt 32 1 +%67 = OpConstant %68 1 +%69 = OpConstant %3 64 +%106 = OpTypePointer StorageBuffer %8 +%108 = OpConstant %7 10 +%111 = OpTypePointer Function %7 +%112 = OpConstantNull %7 +%114 = OpConstantNull %9 +%138 = OpTypePointer StorageBuffer %7 %19 = OpFunction %2 None %20 %18 = OpLabel %27 = OpVariable %28 Function %22 %29 = OpVariable %30 Function %31 %32 = OpVariable %33 Function %34 +%46 = OpVariable %41 Function %43 +%74 = OpVariable %41 Function %43 %23 = OpAccessChain %21 %12 %22 OpBranch %35 %35 = OpLabel OpBranch %36 %36 = OpLabel OpLoopMerge %37 %39 None +OpBranch %47 +%47 = OpLabel +%48 = OpLoad %40 %46 +%49 = OpIEqual %42 %45 %48 +%50 = OpAll %9 %49 +OpSelectionMerge %51 None +OpBranchConditional %50 %37 %51 +%51 = OpLabel +%52 = OpCompositeExtract %3 %48 1 +%53 = OpIEqual %9 %52 %44 +%54 = OpSelect %3 %53 %26 %22 +%55 = OpCompositeConstruct %40 %54 %26 +%56 = OpIAdd %40 %48 %55 +OpStore %46 %56 OpBranch %38 %38 = OpLabel -%40 = OpLoad %3 %27 -%41 = OpULessThan %9 %40 %6 -OpSelectionMerge %42 None -OpBranchConditional %41 %42 %43 -%43 = OpLabel -OpBranch %37 -%42 = OpLabel -OpBranch %44 -%44 = OpLabel -%46 = OpLoad %3 %27 -%48 = OpAccessChain %47 %23 %46 -%49 = OpAtomicLoad %4 %48 %50 %52 -OpStore %29 %49 -OpStore %32 %24 -OpBranch %53 -%53 = OpLabel -OpLoopMerge %54 %56 None -OpBranch %55 -%55 = OpLabel -%57 = OpLoad %9 %32 -%58 = OpLogicalNot %9 %57 +%57 = OpLoad %3 %27 +%58 = OpULessThan %9 %57 %6 OpSelectionMerge %59 None OpBranchConditional %58 %59 %60 %60 = OpLabel -OpBranch %54 +OpBranch %37 %59 = OpLabel OpBranch %61 %61 = OpLabel -%63 = OpLoad %4 %29 -%64 = OpIAdd %4 %63 %25 -%66 = OpLoad %3 %27 -%67 = OpLoad %4 %29 -%69 = OpAccessChain %47 %23 %66 -%70 = OpAtomicCompareExchange %4 %69 %50 %52 %52 %64 %67 -%71 = OpIEqual %9 %70 %67 -%68 = OpCompositeConstruct %10 %70 %71 -%72 = OpCompositeExtract %4 %68 0 -OpStore %29 %72 -%73 = OpCompositeExtract %9 %68 1 -OpStore %32 %73 +%63 = OpLoad %3 %27 +%65 = OpAccessChain %64 %23 %63 +%66 = OpAtomicLoad %4 %65 %67 %69 +OpStore %29 %66 +OpStore %32 %24 +OpBranch %70 +%70 = OpLabel +OpLoopMerge %71 %73 None +OpBranch %75 +%75 = OpLabel +%76 = OpLoad %40 %74 +%77 = OpIEqual %42 %45 %76 +%78 = OpAll %9 %77 +OpSelectionMerge %79 None +OpBranchConditional %78 %71 %79 +%79 = OpLabel +%80 = OpCompositeExtract %3 %76 1 +%81 = OpIEqual %9 %80 %44 +%82 = OpSelect %3 %81 %26 %22 +%83 = OpCompositeConstruct %40 %82 %26 +%84 = OpIAdd %40 %76 %83 +OpStore %74 %84 +OpBranch %72 +%72 = OpLabel +%85 = OpLoad %9 %32 +%86 = OpLogicalNot %9 %85 +OpSelectionMerge %87 None +OpBranchConditional %86 %87 %88 +%88 = OpLabel +OpBranch %71 +%87 = OpLabel +OpBranch %89 +%89 = OpLabel +%91 = OpLoad %4 %29 +%92 = OpIAdd %4 %91 %25 +%94 = OpLoad %3 %27 +%95 = OpLoad %4 %29 +%97 = OpAccessChain %64 %23 %94 +%98 = OpAtomicCompareExchange %4 %97 %67 %69 %69 %92 %95 +%99 = OpIEqual %9 %98 %95 +%96 = OpCompositeConstruct %10 %98 %99 +%100 = OpCompositeExtract %4 %96 0 +OpStore %29 %100 +%101 = OpCompositeExtract %9 %96 1 +OpStore %32 %101 +OpBranch %90 +%90 = OpLabel +OpBranch %73 +%73 = OpLabel +OpBranch %70 +%71 = OpLabel OpBranch %62 %62 = OpLabel -OpBranch %56 -%56 = OpLabel -OpBranch %53 -%54 = OpLabel -OpBranch %45 -%45 = OpLabel OpBranch %39 %39 = OpLabel -%74 = OpLoad %3 %27 -%75 = OpIAdd %3 %74 %26 -OpStore %27 %75 +%102 = OpLoad %3 %27 +%103 = OpIAdd %3 %102 %26 +OpStore %27 %103 OpBranch %36 %37 = OpLabel OpReturn OpFunctionEnd -%77 = OpFunction %2 None %20 -%76 = OpLabel -%81 = OpVariable %28 Function %22 -%82 = OpVariable %83 Function %84 -%85 = OpVariable %33 Function %86 -%79 = OpAccessChain %78 %15 %22 -OpBranch %87 -%87 = OpLabel -OpBranch %88 -%88 = OpLabel -OpLoopMerge %89 %91 None -OpBranch %90 -%90 = OpLabel -%92 = OpLoad %3 %81 -%93 = OpULessThan %9 %92 %6 -OpSelectionMerge %94 None -OpBranchConditional %93 %94 %95 -%95 = OpLabel -OpBranch %89 -%94 = OpLabel -OpBranch %96 -%96 = OpLabel -%98 = OpLoad %3 %81 -%100 = OpAccessChain %99 %79 %98 -%101 = OpAtomicLoad %7 %100 %50 %52 -OpStore %82 %101 -OpStore %85 %24 -OpBranch %102 -%102 = OpLabel -OpLoopMerge %103 %105 None -OpBranch %104 +%105 = OpFunction %2 None %20 %104 = OpLabel -%106 = OpLoad %9 %85 -%107 = OpLogicalNot %9 %106 -OpSelectionMerge %108 None -OpBranchConditional %107 %108 %109 -%109 = OpLabel -OpBranch %103 -%108 = OpLabel -OpBranch %110 -%110 = OpLabel -%112 = OpLoad %7 %82 -%113 = OpIAdd %7 %112 %80 -%115 = OpLoad %3 %81 -%116 = OpLoad %7 %82 -%118 = OpAccessChain %99 %79 %115 -%119 = OpAtomicCompareExchange %7 %118 %50 %52 %52 %113 %116 -%120 = OpIEqual %9 %119 %116 -%117 = OpCompositeConstruct %11 %119 %120 -%121 = OpCompositeExtract %7 %117 0 -OpStore %82 %121 -%122 = OpCompositeExtract %9 %117 1 -OpStore %85 %122 -OpBranch %111 -%111 = OpLabel -OpBranch %105 -%105 = OpLabel -OpBranch %102 -%103 = OpLabel -OpBranch %97 -%97 = OpLabel -OpBranch %91 -%91 = OpLabel -%123 = OpLoad %3 %81 -%124 = OpIAdd %3 %123 %26 -OpStore %81 %124 -OpBranch %88 -%89 = OpLabel +%109 = OpVariable %28 Function %22 +%110 = OpVariable %111 Function %112 +%113 = OpVariable %33 Function %114 +%120 = OpVariable %41 Function %43 +%145 = OpVariable %41 Function %43 +%107 = OpAccessChain %106 %15 %22 +OpBranch %115 +%115 = OpLabel +OpBranch %116 +%116 = OpLabel +OpLoopMerge %117 %119 None +OpBranch %121 +%121 = OpLabel +%122 = OpLoad %40 %120 +%123 = OpIEqual %42 %45 %122 +%124 = OpAll %9 %123 +OpSelectionMerge %125 None +OpBranchConditional %124 %117 %125 +%125 = OpLabel +%126 = OpCompositeExtract %3 %122 1 +%127 = OpIEqual %9 %126 %44 +%128 = OpSelect %3 %127 %26 %22 +%129 = OpCompositeConstruct %40 %128 %26 +%130 = OpIAdd %40 %122 %129 +OpStore %120 %130 +OpBranch %118 +%118 = OpLabel +%131 = OpLoad %3 %109 +%132 = OpULessThan %9 %131 %6 +OpSelectionMerge %133 None +OpBranchConditional %132 %133 %134 +%134 = OpLabel +OpBranch %117 +%133 = OpLabel +OpBranch %135 +%135 = OpLabel +%137 = OpLoad %3 %109 +%139 = OpAccessChain %138 %107 %137 +%140 = OpAtomicLoad %7 %139 %67 %69 +OpStore %110 %140 +OpStore %113 %24 +OpBranch %141 +%141 = OpLabel +OpLoopMerge %142 %144 None +OpBranch %146 +%146 = OpLabel +%147 = OpLoad %40 %145 +%148 = OpIEqual %42 %45 %147 +%149 = OpAll %9 %148 +OpSelectionMerge %150 None +OpBranchConditional %149 %142 %150 +%150 = OpLabel +%151 = OpCompositeExtract %3 %147 1 +%152 = OpIEqual %9 %151 %44 +%153 = OpSelect %3 %152 %26 %22 +%154 = OpCompositeConstruct %40 %153 %26 +%155 = OpIAdd %40 %147 %154 +OpStore %145 %155 +OpBranch %143 +%143 = OpLabel +%156 = OpLoad %9 %113 +%157 = OpLogicalNot %9 %156 +OpSelectionMerge %158 None +OpBranchConditional %157 %158 %159 +%159 = OpLabel +OpBranch %142 +%158 = OpLabel +OpBranch %160 +%160 = OpLabel +%162 = OpLoad %7 %110 +%163 = OpIAdd %7 %162 %108 +%165 = OpLoad %3 %109 +%166 = OpLoad %7 %110 +%168 = OpAccessChain %138 %107 %165 +%169 = OpAtomicCompareExchange %7 %168 %67 %69 %69 %163 %166 +%170 = OpIEqual %9 %169 %166 +%167 = OpCompositeConstruct %11 %169 %170 +%171 = OpCompositeExtract %7 %167 0 +OpStore %110 %171 +%172 = OpCompositeExtract %9 %167 1 +OpStore %113 %172 +OpBranch %161 +%161 = OpLabel +OpBranch %144 +%144 = OpLabel +OpBranch %141 +%142 = OpLabel +OpBranch %136 +%136 = OpLabel +OpBranch %119 +%119 = OpLabel +%173 = OpLoad %3 %109 +%174 = OpIAdd %3 %173 %26 +OpStore %109 %174 +OpBranch %116 +%117 = OpLabel OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/atomicCompareExchange.spvasm b/naga/tests/out/spv/atomicCompareExchange.spvasm index bfd4591d49..5e7c56c242 100644 --- a/naga/tests/out/spv/atomicCompareExchange.spvasm +++ b/naga/tests/out/spv/atomicCompareExchange.spvasm @@ -1,15 +1,15 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 124 +; Bound: 174 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %18 "test_atomic_compare_exchange_i32" -OpEntryPoint GLCompute %77 "test_atomic_compare_exchange_u32" +OpEntryPoint GLCompute %105 "test_atomic_compare_exchange_u32" OpExecutionMode %18 LocalSize 1 1 1 -OpExecutionMode %77 LocalSize 1 1 1 +OpExecutionMode %105 LocalSize 1 1 1 OpDecorate %5 ArrayStride 4 OpDecorate %7 ArrayStride 4 OpMemberDecorate %9 0 Offset 0 @@ -51,154 +51,220 @@ OpMemberDecorate %15 0 Offset 0 %31 = OpConstantNull %4 %33 = OpTypePointer Function %8 %34 = OpConstantNull %8 -%47 = OpTypePointer StorageBuffer %4 -%50 = OpConstant %4 1 -%51 = OpConstant %3 64 -%78 = OpTypePointer StorageBuffer %7 -%82 = OpConstantNull %3 -%84 = OpConstantNull %8 -%97 = OpTypePointer StorageBuffer %3 +%40 = OpTypeVector %3 2 +%41 = OpTypePointer Function %40 +%42 = OpTypeVector %8 2 +%43 = OpConstantComposite %40 %21 %21 +%44 = OpConstant %3 4294967295 +%45 = OpConstantComposite %40 %44 %44 +%64 = OpTypePointer StorageBuffer %4 +%67 = OpConstant %4 1 +%68 = OpConstant %3 64 +%106 = OpTypePointer StorageBuffer %7 +%110 = OpConstantNull %3 +%112 = OpConstantNull %8 +%136 = OpTypePointer StorageBuffer %3 %18 = OpFunction %2 None %19 %17 = OpLabel %27 = OpVariable %28 Function %21 %29 = OpVariable %30 Function %31 %32 = OpVariable %33 Function %34 +%46 = OpVariable %41 Function %43 +%73 = OpVariable %41 Function %43 %22 = OpAccessChain %20 %11 %21 OpBranch %35 %35 = OpLabel OpBranch %36 %36 = OpLabel OpLoopMerge %37 %39 None +OpBranch %47 +%47 = OpLabel +%48 = OpLoad %40 %46 +%49 = OpIEqual %42 %45 %48 +%50 = OpAll %8 %49 +OpSelectionMerge %51 None +OpBranchConditional %50 %37 %51 +%51 = OpLabel +%52 = OpCompositeExtract %3 %48 1 +%53 = OpIEqual %8 %52 %44 +%54 = OpSelect %3 %53 %26 %21 +%55 = OpCompositeConstruct %40 %54 %26 +%56 = OpIAdd %40 %48 %55 +OpStore %46 %56 OpBranch %38 %38 = OpLabel -%40 = OpLoad %3 %27 -%41 = OpULessThan %8 %40 %6 -OpSelectionMerge %42 None -OpBranchConditional %41 %42 %43 -%43 = OpLabel -OpBranch %37 -%42 = OpLabel -OpBranch %44 -%44 = OpLabel -%46 = OpLoad %3 %27 -%48 = OpAccessChain %47 %22 %46 -%49 = OpAtomicLoad %4 %48 %50 %51 -OpStore %29 %49 -OpStore %32 %23 -OpBranch %52 -%52 = OpLabel -OpLoopMerge %53 %55 None -OpBranch %54 -%54 = OpLabel -%56 = OpLoad %8 %32 -%57 = OpLogicalNot %8 %56 -OpSelectionMerge %58 None -OpBranchConditional %57 %58 %59 -%59 = OpLabel -OpBranch %53 -%58 = OpLabel -OpBranch %60 +%57 = OpLoad %3 %27 +%58 = OpULessThan %8 %57 %6 +OpSelectionMerge %59 None +OpBranchConditional %58 %59 %60 %60 = OpLabel -%62 = OpLoad %4 %29 -%63 = OpBitcast %24 %62 -%64 = OpFAdd %24 %63 %25 -%65 = OpBitcast %4 %64 -%66 = OpLoad %3 %27 -%67 = OpLoad %4 %29 -%69 = OpAccessChain %47 %22 %66 -%70 = OpAtomicCompareExchange %4 %69 %50 %51 %51 %65 %67 -%71 = OpIEqual %8 %70 %67 -%68 = OpCompositeConstruct %9 %70 %71 -%72 = OpCompositeExtract %4 %68 0 -OpStore %29 %72 -%73 = OpCompositeExtract %8 %68 1 -OpStore %32 %73 +OpBranch %37 +%59 = OpLabel OpBranch %61 %61 = OpLabel -OpBranch %55 -%55 = OpLabel -OpBranch %52 -%53 = OpLabel -OpBranch %45 -%45 = OpLabel +%63 = OpLoad %3 %27 +%65 = OpAccessChain %64 %22 %63 +%66 = OpAtomicLoad %4 %65 %67 %68 +OpStore %29 %66 +OpStore %32 %23 +OpBranch %69 +%69 = OpLabel +OpLoopMerge %70 %72 None +OpBranch %74 +%74 = OpLabel +%75 = OpLoad %40 %73 +%76 = OpIEqual %42 %45 %75 +%77 = OpAll %8 %76 +OpSelectionMerge %78 None +OpBranchConditional %77 %70 %78 +%78 = OpLabel +%79 = OpCompositeExtract %3 %75 1 +%80 = OpIEqual %8 %79 %44 +%81 = OpSelect %3 %80 %26 %21 +%82 = OpCompositeConstruct %40 %81 %26 +%83 = OpIAdd %40 %75 %82 +OpStore %73 %83 +OpBranch %71 +%71 = OpLabel +%84 = OpLoad %8 %32 +%85 = OpLogicalNot %8 %84 +OpSelectionMerge %86 None +OpBranchConditional %85 %86 %87 +%87 = OpLabel +OpBranch %70 +%86 = OpLabel +OpBranch %88 +%88 = OpLabel +%90 = OpLoad %4 %29 +%91 = OpBitcast %24 %90 +%92 = OpFAdd %24 %91 %25 +%93 = OpBitcast %4 %92 +%94 = OpLoad %3 %27 +%95 = OpLoad %4 %29 +%97 = OpAccessChain %64 %22 %94 +%98 = OpAtomicCompareExchange %4 %97 %67 %68 %68 %93 %95 +%99 = OpIEqual %8 %98 %95 +%96 = OpCompositeConstruct %9 %98 %99 +%100 = OpCompositeExtract %4 %96 0 +OpStore %29 %100 +%101 = OpCompositeExtract %8 %96 1 +OpStore %32 %101 +OpBranch %89 +%89 = OpLabel +OpBranch %72 +%72 = OpLabel +OpBranch %69 +%70 = OpLabel +OpBranch %62 +%62 = OpLabel OpBranch %39 %39 = OpLabel -%74 = OpLoad %3 %27 -%75 = OpIAdd %3 %74 %26 -OpStore %27 %75 +%102 = OpLoad %3 %27 +%103 = OpIAdd %3 %102 %26 +OpStore %27 %103 OpBranch %36 %37 = OpLabel OpReturn OpFunctionEnd -%77 = OpFunction %2 None %19 -%76 = OpLabel -%80 = OpVariable %28 Function %21 -%81 = OpVariable %28 Function %82 -%83 = OpVariable %33 Function %84 -%79 = OpAccessChain %78 %14 %21 -OpBranch %85 -%85 = OpLabel -OpBranch %86 -%86 = OpLabel -OpLoopMerge %87 %89 None -OpBranch %88 -%88 = OpLabel -%90 = OpLoad %3 %80 -%91 = OpULessThan %8 %90 %6 -OpSelectionMerge %92 None -OpBranchConditional %91 %92 %93 -%93 = OpLabel -OpBranch %87 -%92 = OpLabel -OpBranch %94 -%94 = OpLabel -%96 = OpLoad %3 %80 -%98 = OpAccessChain %97 %79 %96 -%99 = OpAtomicLoad %3 %98 %50 %51 -OpStore %81 %99 -OpStore %83 %23 -OpBranch %100 -%100 = OpLabel -OpLoopMerge %101 %103 None -OpBranch %102 -%102 = OpLabel -%104 = OpLoad %8 %83 -%105 = OpLogicalNot %8 %104 -OpSelectionMerge %106 None -OpBranchConditional %105 %106 %107 -%107 = OpLabel -OpBranch %101 -%106 = OpLabel -OpBranch %108 -%108 = OpLabel -%110 = OpLoad %3 %81 -%111 = OpBitcast %24 %110 -%112 = OpFAdd %24 %111 %25 -%113 = OpBitcast %3 %112 -%114 = OpLoad %3 %80 -%115 = OpLoad %3 %81 -%117 = OpAccessChain %97 %79 %114 -%118 = OpAtomicCompareExchange %3 %117 %50 %51 %51 %113 %115 -%119 = OpIEqual %8 %118 %115 -%116 = OpCompositeConstruct %10 %118 %119 -%120 = OpCompositeExtract %3 %116 0 -OpStore %81 %120 -%121 = OpCompositeExtract %8 %116 1 -OpStore %83 %121 -OpBranch %109 -%109 = OpLabel -OpBranch %103 -%103 = OpLabel -OpBranch %100 -%101 = OpLabel -OpBranch %95 -%95 = OpLabel -OpBranch %89 -%89 = OpLabel -%122 = OpLoad %3 %80 -%123 = OpIAdd %3 %122 %26 -OpStore %80 %123 -OpBranch %86 -%87 = OpLabel +%105 = OpFunction %2 None %19 +%104 = OpLabel +%108 = OpVariable %28 Function %21 +%109 = OpVariable %28 Function %110 +%111 = OpVariable %33 Function %112 +%118 = OpVariable %41 Function %43 +%143 = OpVariable %41 Function %43 +%107 = OpAccessChain %106 %14 %21 +OpBranch %113 +%113 = OpLabel +OpBranch %114 +%114 = OpLabel +OpLoopMerge %115 %117 None +OpBranch %119 +%119 = OpLabel +%120 = OpLoad %40 %118 +%121 = OpIEqual %42 %45 %120 +%122 = OpAll %8 %121 +OpSelectionMerge %123 None +OpBranchConditional %122 %115 %123 +%123 = OpLabel +%124 = OpCompositeExtract %3 %120 1 +%125 = OpIEqual %8 %124 %44 +%126 = OpSelect %3 %125 %26 %21 +%127 = OpCompositeConstruct %40 %126 %26 +%128 = OpIAdd %40 %120 %127 +OpStore %118 %128 +OpBranch %116 +%116 = OpLabel +%129 = OpLoad %3 %108 +%130 = OpULessThan %8 %129 %6 +OpSelectionMerge %131 None +OpBranchConditional %130 %131 %132 +%132 = OpLabel +OpBranch %115 +%131 = OpLabel +OpBranch %133 +%133 = OpLabel +%135 = OpLoad %3 %108 +%137 = OpAccessChain %136 %107 %135 +%138 = OpAtomicLoad %3 %137 %67 %68 +OpStore %109 %138 +OpStore %111 %23 +OpBranch %139 +%139 = OpLabel +OpLoopMerge %140 %142 None +OpBranch %144 +%144 = OpLabel +%145 = OpLoad %40 %143 +%146 = OpIEqual %42 %45 %145 +%147 = OpAll %8 %146 +OpSelectionMerge %148 None +OpBranchConditional %147 %140 %148 +%148 = OpLabel +%149 = OpCompositeExtract %3 %145 1 +%150 = OpIEqual %8 %149 %44 +%151 = OpSelect %3 %150 %26 %21 +%152 = OpCompositeConstruct %40 %151 %26 +%153 = OpIAdd %40 %145 %152 +OpStore %143 %153 +OpBranch %141 +%141 = OpLabel +%154 = OpLoad %8 %111 +%155 = OpLogicalNot %8 %154 +OpSelectionMerge %156 None +OpBranchConditional %155 %156 %157 +%157 = OpLabel +OpBranch %140 +%156 = OpLabel +OpBranch %158 +%158 = OpLabel +%160 = OpLoad %3 %109 +%161 = OpBitcast %24 %160 +%162 = OpFAdd %24 %161 %25 +%163 = OpBitcast %3 %162 +%164 = OpLoad %3 %108 +%165 = OpLoad %3 %109 +%167 = OpAccessChain %136 %107 %164 +%168 = OpAtomicCompareExchange %3 %167 %67 %68 %68 %163 %165 +%169 = OpIEqual %8 %168 %165 +%166 = OpCompositeConstruct %10 %168 %169 +%170 = OpCompositeExtract %3 %166 0 +OpStore %109 %170 +%171 = OpCompositeExtract %8 %166 1 +OpStore %111 %171 +OpBranch %159 +%159 = OpLabel +OpBranch %142 +%142 = OpLabel +OpBranch %139 +%140 = OpLabel +OpBranch %134 +%134 = OpLabel +OpBranch %117 +%117 = OpLabel +%172 = OpLoad %3 %108 +%173 = OpIAdd %3 %172 %26 +OpStore %108 %173 +OpBranch %114 +%115 = OpLabel OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/boids.spvasm b/naga/tests/out/spv/boids.spvasm index dafc86bfa3..eca75edd01 100644 --- a/naga/tests/out/spv/boids.spvasm +++ b/naga/tests/out/spv/boids.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.0 ; Generator: rspirv -; Bound: 209 +; Bound: 226 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" @@ -146,6 +146,7 @@ OpName %47 "cVelCount" OpName %48 "pos" OpName %50 "vel" OpName %52 "i" +OpName %77 "loop_bound" OpMemberDecorate %7 0 Offset 0 OpMemberDecorate %7 1 Offset 8 OpMemberDecorate %8 0 Offset 0 @@ -209,13 +210,19 @@ OpDecorate %21 BuiltIn GlobalInvocationId %60 = OpTypePointer StorageBuffer %9 %61 = OpTypePointer StorageBuffer %7 %62 = OpTypePointer StorageBuffer %6 -%88 = OpTypePointer Uniform %5 -%102 = OpConstant %4 2 -%116 = OpConstant %4 3 -%151 = OpConstant %4 4 -%157 = OpConstant %4 5 -%163 = OpConstant %4 6 -%180 = OpTypePointer Function %5 +%71 = OpTypeVector %4 2 +%72 = OpTypePointer Function %71 +%73 = OpTypeVector %56 2 +%74 = OpConstantComposite %71 %27 %27 +%75 = OpConstant %4 4294967295 +%76 = OpConstantComposite %71 %75 %75 +%105 = OpTypePointer Uniform %5 +%119 = OpConstant %4 2 +%133 = OpConstant %4 3 +%168 = OpConstant %4 4 +%174 = OpConstant %4 5 +%180 = OpConstant %4 6 +%197 = OpTypePointer Function %5 %24 = OpFunction %2 None %25 %20 = OpLabel %52 = OpVariable %53 Function %27 @@ -228,6 +235,7 @@ OpDecorate %21 BuiltIn GlobalInvocationId %50 = OpVariable %38 Function %51 %45 = OpVariable %46 Function %31 %42 = OpVariable %38 Function %30 +%77 = OpVariable %72 Function %74 %23 = OpLoad %11 %21 %28 = OpAccessChain %26 %14 %27 OpBranch %54 @@ -259,272 +267,286 @@ OpBranch %67 %67 = OpLabel OpLine %3 46 3 OpLoopMerge %68 %70 None +OpBranch %78 +%78 = OpLabel +%79 = OpLoad %71 %77 +%80 = OpIEqual %73 %76 %79 +%81 = OpAll %56 %80 +OpSelectionMerge %82 None +OpBranchConditional %81 %68 %82 +%82 = OpLabel +%83 = OpCompositeExtract %4 %79 1 +%84 = OpIEqual %56 %83 %75 +%85 = OpSelect %4 %84 %33 %27 +%86 = OpCompositeConstruct %71 %85 %33 +%87 = OpIAdd %71 %79 %86 +OpStore %77 %87 OpBranch %69 %69 = OpLabel OpLine %3 1 1 -%71 = OpLoad %4 %52 +%88 = OpLoad %4 %52 OpLine %3 47 8 -%72 = OpUGreaterThanEqual %56 %71 %13 +%89 = OpUGreaterThanEqual %56 %88 %13 OpLine %3 47 5 -OpSelectionMerge %73 None -OpBranchConditional %72 %74 %73 -%74 = OpLabel +OpSelectionMerge %90 None +OpBranchConditional %89 %91 %90 +%91 = OpLabel OpBranch %68 -%73 = OpLabel +%90 = OpLabel OpLine %3 50 8 -%75 = OpLoad %4 %52 -%76 = OpIEqual %56 %75 %55 +%92 = OpLoad %4 %52 +%93 = OpIEqual %56 %92 %55 OpLine %3 50 5 -OpSelectionMerge %77 None -OpBranchConditional %76 %78 %77 -%78 = OpLabel +OpSelectionMerge %94 None +OpBranchConditional %93 %95 %94 +%95 = OpLabel OpBranch %70 -%77 = OpLabel +%94 = OpLabel OpLine %3 54 11 -%79 = OpLoad %4 %52 -%80 = OpAccessChain %62 %17 %27 %79 %27 -%81 = OpLoad %6 %80 +%96 = OpLoad %4 %52 +%97 = OpAccessChain %62 %17 %27 %96 %27 +%98 = OpLoad %6 %97 OpLine %3 54 5 -OpStore %48 %81 +OpStore %48 %98 OpLine %3 55 11 -%82 = OpLoad %4 %52 -%83 = OpAccessChain %62 %17 %27 %82 %33 -%84 = OpLoad %6 %83 +%99 = OpLoad %4 %52 +%100 = OpAccessChain %62 %17 %27 %99 %33 +%101 = OpLoad %6 %100 OpLine %3 55 5 -OpStore %50 %84 +OpStore %50 %101 OpLine %3 57 8 -%85 = OpLoad %6 %48 -%86 = OpLoad %6 %37 -%87 = OpExtInst %5 %1 Distance %85 %86 +%102 = OpLoad %6 %48 +%103 = OpLoad %6 %37 +%104 = OpExtInst %5 %1 Distance %102 %103 OpLine %3 57 8 -%89 = OpAccessChain %88 %28 %33 -%90 = OpLoad %5 %89 -%91 = OpFOrdLessThan %56 %87 %90 +%106 = OpAccessChain %105 %28 %33 +%107 = OpLoad %5 %106 +%108 = OpFOrdLessThan %56 %104 %107 OpLine %3 57 5 -OpSelectionMerge %92 None -OpBranchConditional %91 %93 %92 -%93 = OpLabel +OpSelectionMerge %109 None +OpBranchConditional %108 %110 %109 +%110 = OpLabel OpLine %3 58 15 -%94 = OpLoad %6 %42 -%95 = OpLoad %6 %48 -%96 = OpFAdd %6 %94 %95 +%111 = OpLoad %6 %42 +%112 = OpLoad %6 %48 +%113 = OpFAdd %6 %111 %112 OpLine %3 58 7 -OpStore %42 %96 +OpStore %42 %113 OpLine %3 1 1 -%97 = OpLoad %12 %45 +%114 = OpLoad %12 %45 OpLine %3 59 20 -%98 = OpIAdd %12 %97 %32 +%115 = OpIAdd %12 %114 %32 OpLine %3 59 7 -OpStore %45 %98 -OpBranch %92 -%92 = OpLabel +OpStore %45 %115 +OpBranch %109 +%109 = OpLabel OpLine %3 61 8 -%99 = OpLoad %6 %48 -%100 = OpLoad %6 %37 -%101 = OpExtInst %5 %1 Distance %99 %100 +%116 = OpLoad %6 %48 +%117 = OpLoad %6 %37 +%118 = OpExtInst %5 %1 Distance %116 %117 OpLine %3 61 8 -%103 = OpAccessChain %88 %28 %102 -%104 = OpLoad %5 %103 -%105 = OpFOrdLessThan %56 %101 %104 +%120 = OpAccessChain %105 %28 %119 +%121 = OpLoad %5 %120 +%122 = OpFOrdLessThan %56 %118 %121 OpLine %3 61 5 -OpSelectionMerge %106 None -OpBranchConditional %105 %107 %106 -%107 = OpLabel +OpSelectionMerge %123 None +OpBranchConditional %122 %124 %123 +%124 = OpLabel OpLine %3 62 16 -%108 = OpLoad %6 %44 -%109 = OpLoad %6 %48 -%110 = OpLoad %6 %37 -%111 = OpFSub %6 %109 %110 -%112 = OpFSub %6 %108 %111 +%125 = OpLoad %6 %44 +%126 = OpLoad %6 %48 +%127 = OpLoad %6 %37 +%128 = OpFSub %6 %126 %127 +%129 = OpFSub %6 %125 %128 OpLine %3 62 7 -OpStore %44 %112 -OpBranch %106 -%106 = OpLabel +OpStore %44 %129 +OpBranch %123 +%123 = OpLabel OpLine %3 64 8 -%113 = OpLoad %6 %48 -%114 = OpLoad %6 %37 -%115 = OpExtInst %5 %1 Distance %113 %114 +%130 = OpLoad %6 %48 +%131 = OpLoad %6 %37 +%132 = OpExtInst %5 %1 Distance %130 %131 OpLine %3 64 8 -%117 = OpAccessChain %88 %28 %116 -%118 = OpLoad %5 %117 -%119 = OpFOrdLessThan %56 %115 %118 +%134 = OpAccessChain %105 %28 %133 +%135 = OpLoad %5 %134 +%136 = OpFOrdLessThan %56 %132 %135 OpLine %3 64 5 -OpSelectionMerge %120 None -OpBranchConditional %119 %121 %120 -%121 = OpLabel +OpSelectionMerge %137 None +OpBranchConditional %136 %138 %137 +%138 = OpLabel OpLine %3 65 14 -%122 = OpLoad %6 %43 -%123 = OpLoad %6 %50 -%124 = OpFAdd %6 %122 %123 +%139 = OpLoad %6 %43 +%140 = OpLoad %6 %50 +%141 = OpFAdd %6 %139 %140 OpLine %3 65 7 -OpStore %43 %124 +OpStore %43 %141 OpLine %3 1 1 -%125 = OpLoad %12 %47 +%142 = OpLoad %12 %47 OpLine %3 66 19 -%126 = OpIAdd %12 %125 %32 +%143 = OpIAdd %12 %142 %32 OpLine %3 66 7 -OpStore %47 %126 -OpBranch %120 -%120 = OpLabel +OpStore %47 %143 +OpBranch %137 +%137 = OpLabel OpBranch %70 %70 = OpLabel OpLine %3 1 1 -%127 = OpLoad %4 %52 +%144 = OpLoad %4 %52 OpLine %3 70 11 -%128 = OpIAdd %4 %127 %33 +%145 = OpIAdd %4 %144 %33 OpLine %3 70 7 -OpStore %52 %128 +OpStore %52 %145 OpBranch %67 %68 = OpLabel OpLine %3 1 1 -%129 = OpLoad %12 %45 +%146 = OpLoad %12 %45 OpLine %3 73 6 -%130 = OpSGreaterThan %56 %129 %31 +%147 = OpSGreaterThan %56 %146 %31 OpLine %3 73 3 -OpSelectionMerge %131 None -OpBranchConditional %130 %132 %131 -%132 = OpLabel +OpSelectionMerge %148 None +OpBranchConditional %147 %149 %148 +%149 = OpLabel OpLine %3 74 13 -%133 = OpLoad %6 %42 -%134 = OpLoad %12 %45 -%135 = OpConvertSToF %5 %134 -%136 = OpCompositeConstruct %6 %135 %135 -%137 = OpFDiv %6 %133 %136 -%138 = OpLoad %6 %37 -%139 = OpFSub %6 %137 %138 -OpLine %3 74 5 -OpStore %42 %139 -OpBranch %131 -%131 = OpLabel -OpLine %3 1 1 -%140 = OpLoad %12 %47 -OpLine %3 76 6 -%141 = OpSGreaterThan %56 %140 %31 -OpLine %3 76 3 -OpSelectionMerge %142 None -OpBranchConditional %141 %143 %142 -%143 = OpLabel -OpLine %3 77 12 -%144 = OpLoad %6 %43 -%145 = OpLoad %12 %47 -%146 = OpConvertSToF %5 %145 -%147 = OpCompositeConstruct %6 %146 %146 -%148 = OpFDiv %6 %144 %147 -OpLine %3 77 5 -OpStore %43 %148 -OpBranch %142 -%142 = OpLabel -OpLine %3 1 1 -%149 = OpLoad %6 %40 %150 = OpLoad %6 %42 -OpLine %3 80 10 -%152 = OpAccessChain %88 %28 %151 -%153 = OpLoad %5 %152 -%154 = OpVectorTimesScalar %6 %150 %153 -%155 = OpFAdd %6 %149 %154 -%156 = OpLoad %6 %44 -OpLine %3 80 10 -%158 = OpAccessChain %88 %28 %157 -%159 = OpLoad %5 %158 -%160 = OpVectorTimesScalar %6 %156 %159 -%161 = OpFAdd %6 %155 %160 -%162 = OpLoad %6 %43 -OpLine %3 80 10 -%164 = OpAccessChain %88 %28 %163 -%165 = OpLoad %5 %164 -%166 = OpVectorTimesScalar %6 %162 %165 -%167 = OpFAdd %6 %161 %166 -OpLine %3 80 3 -OpStore %40 %167 -OpLine %3 85 10 -%168 = OpLoad %6 %40 -%169 = OpExtInst %6 %1 Normalize %168 -%170 = OpLoad %6 %40 -%171 = OpExtInst %5 %1 Length %170 -OpLine %3 85 10 -%172 = OpExtInst %5 %1 FClamp %171 %29 %34 -%173 = OpVectorTimesScalar %6 %169 %172 -OpLine %3 85 3 -OpStore %40 %173 +%151 = OpLoad %12 %45 +%152 = OpConvertSToF %5 %151 +%153 = OpCompositeConstruct %6 %152 %152 +%154 = OpFDiv %6 %150 %153 +%155 = OpLoad %6 %37 +%156 = OpFSub %6 %154 %155 +OpLine %3 74 5 +OpStore %42 %156 +OpBranch %148 +%148 = OpLabel OpLine %3 1 1 -%174 = OpLoad %6 %37 -%175 = OpLoad %6 %40 -OpLine %3 88 10 -%176 = OpAccessChain %88 %28 %27 -%177 = OpLoad %5 %176 -%178 = OpVectorTimesScalar %6 %175 %177 -%179 = OpFAdd %6 %174 %178 -OpLine %3 88 3 -OpStore %37 %179 -OpLine %3 91 6 -%181 = OpAccessChain %180 %37 %27 +%157 = OpLoad %12 %47 +OpLine %3 76 6 +%158 = OpSGreaterThan %56 %157 %31 +OpLine %3 76 3 +OpSelectionMerge %159 None +OpBranchConditional %158 %160 %159 +%160 = OpLabel +OpLine %3 77 12 +%161 = OpLoad %6 %43 +%162 = OpLoad %12 %47 +%163 = OpConvertSToF %5 %162 +%164 = OpCompositeConstruct %6 %163 %163 +%165 = OpFDiv %6 %161 %164 +OpLine %3 77 5 +OpStore %43 %165 +OpBranch %159 +%159 = OpLabel +OpLine %3 1 1 +%166 = OpLoad %6 %40 +%167 = OpLoad %6 %42 +OpLine %3 80 10 +%169 = OpAccessChain %105 %28 %168 +%170 = OpLoad %5 %169 +%171 = OpVectorTimesScalar %6 %167 %170 +%172 = OpFAdd %6 %166 %171 +%173 = OpLoad %6 %44 +OpLine %3 80 10 +%175 = OpAccessChain %105 %28 %174 +%176 = OpLoad %5 %175 +%177 = OpVectorTimesScalar %6 %173 %176 +%178 = OpFAdd %6 %172 %177 +%179 = OpLoad %6 %43 +OpLine %3 80 10 +%181 = OpAccessChain %105 %28 %180 %182 = OpLoad %5 %181 -OpLine %3 91 6 -%183 = OpFOrdLessThan %56 %182 %35 -OpLine %3 91 3 -OpSelectionMerge %184 None -OpBranchConditional %183 %185 %184 -%185 = OpLabel -OpLine %3 92 5 -OpLine %3 92 5 -%186 = OpAccessChain %180 %37 %27 -OpStore %186 %36 -OpBranch %184 -%184 = OpLabel -OpLine %3 94 6 -%187 = OpAccessChain %180 %37 %27 -%188 = OpLoad %5 %187 -OpLine %3 94 6 -%189 = OpFOrdGreaterThan %56 %188 %36 -OpLine %3 94 3 -OpSelectionMerge %190 None -OpBranchConditional %189 %191 %190 -%191 = OpLabel -OpLine %3 95 5 -OpLine %3 95 5 -%192 = OpAccessChain %180 %37 %27 -OpStore %192 %35 -OpBranch %190 -%190 = OpLabel -OpLine %3 97 6 -%193 = OpAccessChain %180 %37 %33 +%183 = OpVectorTimesScalar %6 %179 %182 +%184 = OpFAdd %6 %178 %183 +OpLine %3 80 3 +OpStore %40 %184 +OpLine %3 85 10 +%185 = OpLoad %6 %40 +%186 = OpExtInst %6 %1 Normalize %185 +%187 = OpLoad %6 %40 +%188 = OpExtInst %5 %1 Length %187 +OpLine %3 85 10 +%189 = OpExtInst %5 %1 FClamp %188 %29 %34 +%190 = OpVectorTimesScalar %6 %186 %189 +OpLine %3 85 3 +OpStore %40 %190 +OpLine %3 1 1 +%191 = OpLoad %6 %37 +%192 = OpLoad %6 %40 +OpLine %3 88 10 +%193 = OpAccessChain %105 %28 %27 %194 = OpLoad %5 %193 -OpLine %3 97 6 -%195 = OpFOrdLessThan %56 %194 %35 -OpLine %3 97 3 -OpSelectionMerge %196 None -OpBranchConditional %195 %197 %196 -%197 = OpLabel -OpLine %3 98 5 -OpLine %3 98 5 -%198 = OpAccessChain %180 %37 %33 -OpStore %198 %36 -OpBranch %196 -%196 = OpLabel -OpLine %3 100 6 -%199 = OpAccessChain %180 %37 %33 -%200 = OpLoad %5 %199 -OpLine %3 100 6 -%201 = OpFOrdGreaterThan %56 %200 %36 -OpLine %3 100 3 -OpSelectionMerge %202 None -OpBranchConditional %201 %203 %202 -%203 = OpLabel -OpLine %3 101 5 -OpLine %3 101 5 -%204 = OpAccessChain %180 %37 %33 -OpStore %204 %35 -OpBranch %202 +%195 = OpVectorTimesScalar %6 %192 %194 +%196 = OpFAdd %6 %191 %195 +OpLine %3 88 3 +OpStore %37 %196 +OpLine %3 91 6 +%198 = OpAccessChain %197 %37 %27 +%199 = OpLoad %5 %198 +OpLine %3 91 6 +%200 = OpFOrdLessThan %56 %199 %35 +OpLine %3 91 3 +OpSelectionMerge %201 None +OpBranchConditional %200 %202 %201 %202 = OpLabel +OpLine %3 92 5 +OpLine %3 92 5 +%203 = OpAccessChain %197 %37 %27 +OpStore %203 %36 +OpBranch %201 +%201 = OpLabel +OpLine %3 94 6 +%204 = OpAccessChain %197 %37 %27 +%205 = OpLoad %5 %204 +OpLine %3 94 6 +%206 = OpFOrdGreaterThan %56 %205 %36 +OpLine %3 94 3 +OpSelectionMerge %207 None +OpBranchConditional %206 %208 %207 +%208 = OpLabel +OpLine %3 95 5 +OpLine %3 95 5 +%209 = OpAccessChain %197 %37 %27 +OpStore %209 %35 +OpBranch %207 +%207 = OpLabel +OpLine %3 97 6 +%210 = OpAccessChain %197 %37 %33 +%211 = OpLoad %5 %210 +OpLine %3 97 6 +%212 = OpFOrdLessThan %56 %211 %35 +OpLine %3 97 3 +OpSelectionMerge %213 None +OpBranchConditional %212 %214 %213 +%214 = OpLabel +OpLine %3 98 5 +OpLine %3 98 5 +%215 = OpAccessChain %197 %37 %33 +OpStore %215 %36 +OpBranch %213 +%213 = OpLabel +OpLine %3 100 6 +%216 = OpAccessChain %197 %37 %33 +%217 = OpLoad %5 %216 +OpLine %3 100 6 +%218 = OpFOrdGreaterThan %56 %217 %36 +OpLine %3 100 3 +OpSelectionMerge %219 None +OpBranchConditional %218 %220 %219 +%220 = OpLabel +OpLine %3 101 5 +OpLine %3 101 5 +%221 = OpAccessChain %197 %37 %33 +OpStore %221 %35 +OpBranch %219 +%219 = OpLabel OpLine %3 105 3 -%205 = OpLoad %6 %37 +%222 = OpLoad %6 %37 OpLine %3 105 3 -%206 = OpAccessChain %62 %19 %27 %55 %27 -OpStore %206 %205 +%223 = OpAccessChain %62 %19 %27 %55 %27 +OpStore %223 %222 OpLine %3 106 3 -%207 = OpLoad %6 %40 +%224 = OpLoad %6 %40 OpLine %3 106 3 -%208 = OpAccessChain %62 %19 %27 %55 %33 -OpStore %208 %207 +%225 = OpAccessChain %62 %19 %27 %55 %33 +OpStore %225 %224 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/break-if.spvasm b/naga/tests/out/spv/break-if.spvasm index 8c8c3edf49..d4d0c10925 100644 --- a/naga/tests/out/spv/break-if.spvasm +++ b/naga/tests/out/spv/break-if.spvasm @@ -1,34 +1,55 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 67 +; Bound: 117 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %65 "main" -OpExecutionMode %65 LocalSize 1 1 1 +OpEntryPoint GLCompute %115 "main" +OpExecutionMode %115 LocalSize 1 1 1 %2 = OpTypeVoid %3 = OpTypeBool %4 = OpTypeInt 32 0 %7 = OpTypeFunction %2 %8 = OpConstantTrue %3 -%17 = OpTypeFunction %2 %3 -%19 = OpTypePointer Function %3 -%20 = OpConstantNull %3 -%22 = OpConstantNull %3 -%36 = OpConstantNull %3 -%38 = OpConstantNull %3 -%50 = OpConstant %4 0 -%51 = OpConstant %4 1 -%52 = OpConstant %4 5 -%54 = OpTypePointer Function %4 +%14 = OpTypeVector %4 2 +%15 = OpTypePointer Function %14 +%16 = OpTypeVector %3 2 +%17 = OpConstant %4 0 +%18 = OpConstantComposite %14 %17 %17 +%19 = OpConstant %4 1 +%20 = OpConstant %4 4294967295 +%21 = OpConstantComposite %14 %20 %20 +%36 = OpTypeFunction %2 %3 +%38 = OpTypePointer Function %3 +%39 = OpConstantNull %3 +%41 = OpConstantNull %3 +%66 = OpConstantNull %3 +%68 = OpConstantNull %3 +%91 = OpConstant %4 5 +%93 = OpTypePointer Function %4 %6 = OpFunction %2 None %7 %5 = OpLabel +%22 = OpVariable %15 Function %18 OpBranch %9 %9 = OpLabel OpBranch %10 %10 = OpLabel OpLoopMerge %11 %13 None +OpBranch %23 +%23 = OpLabel +%24 = OpLoad %14 %22 +%25 = OpIEqual %16 %21 %24 +%26 = OpAll %3 %25 +OpSelectionMerge %27 None +OpBranchConditional %26 %11 %27 +%27 = OpLabel +%28 = OpCompositeExtract %4 %24 1 +%29 = OpIEqual %3 %28 %20 +%30 = OpSelect %4 %29 %19 %17 +%31 = OpCompositeConstruct %14 %30 %19 +%32 = OpIAdd %14 %24 %31 +OpStore %22 %32 OpBranch %12 %12 = OpLabel OpBranch %13 @@ -37,78 +58,123 @@ OpBranchConditional %8 %11 %10 %11 = OpLabel OpReturn OpFunctionEnd -%16 = OpFunction %2 None %17 -%15 = OpFunctionParameter %3 -%14 = OpLabel -%18 = OpVariable %19 Function %20 -%21 = OpVariable %19 Function %22 -OpBranch %23 -%23 = OpLabel -OpBranch %24 -%24 = OpLabel -OpLoopMerge %25 %27 None -OpBranch %26 -%26 = OpLabel -OpBranch %27 -%27 = OpLabel -OpStore %18 %15 -%28 = OpLoad %3 %18 -%29 = OpLogicalNotEqual %3 %15 %28 -OpStore %21 %29 -%30 = OpLoad %3 %21 -%31 = OpLogicalEqual %3 %15 %30 -OpBranchConditional %31 %25 %24 -%25 = OpLabel -OpReturn -OpFunctionEnd -%34 = OpFunction %2 None %17 -%33 = OpFunctionParameter %3 -%32 = OpLabel -%35 = OpVariable %19 Function %36 -%37 = OpVariable %19 Function %38 -OpBranch %39 -%39 = OpLabel -OpBranch %40 -%40 = OpLabel -OpLoopMerge %41 %43 None +%35 = OpFunction %2 None %36 +%34 = OpFunctionParameter %3 +%33 = OpLabel +%37 = OpVariable %38 Function %39 +%40 = OpVariable %38 Function %41 +%47 = OpVariable %15 Function %18 OpBranch %42 %42 = OpLabel -OpStore %35 %33 -%44 = OpLoad %3 %35 -%45 = OpLogicalNotEqual %3 %33 %44 -OpStore %37 %45 OpBranch %43 %43 = OpLabel -%46 = OpLoad %3 %37 -%47 = OpLogicalEqual %3 %33 %46 -OpBranchConditional %47 %41 %40 -%41 = OpLabel -OpReturn -OpFunctionEnd -%49 = OpFunction %2 None %7 +OpLoopMerge %44 %46 None +OpBranch %48 %48 = OpLabel -%53 = OpVariable %54 Function %50 -OpBranch %55 -%55 = OpLabel -OpBranch %56 -%56 = OpLabel -OpLoopMerge %57 %59 None -OpBranch %58 -%58 = OpLabel -%60 = OpLoad %4 %53 -%61 = OpIAdd %4 %60 %51 -OpStore %53 %61 -OpBranch %59 -%59 = OpLabel -%62 = OpLoad %4 %53 -%63 = OpIEqual %3 %62 %52 -OpBranchConditional %63 %57 %56 -%57 = OpLabel +%49 = OpLoad %14 %47 +%50 = OpIEqual %16 %21 %49 +%51 = OpAll %3 %50 +OpSelectionMerge %52 None +OpBranchConditional %51 %44 %52 +%52 = OpLabel +%53 = OpCompositeExtract %4 %49 1 +%54 = OpIEqual %3 %53 %20 +%55 = OpSelect %4 %54 %19 %17 +%56 = OpCompositeConstruct %14 %55 %19 +%57 = OpIAdd %14 %49 %56 +OpStore %47 %57 +OpBranch %45 +%45 = OpLabel +OpBranch %46 +%46 = OpLabel +OpStore %37 %34 +%58 = OpLoad %3 %37 +%59 = OpLogicalNotEqual %3 %34 %58 +OpStore %40 %59 +%60 = OpLoad %3 %40 +%61 = OpLogicalEqual %3 %34 %60 +OpBranchConditional %61 %44 %43 +%44 = OpLabel OpReturn OpFunctionEnd -%65 = OpFunction %2 None %7 -%64 = OpLabel -OpBranch %66 -%66 = OpLabel +%64 = OpFunction %2 None %36 +%63 = OpFunctionParameter %3 +%62 = OpLabel +%65 = OpVariable %38 Function %66 +%67 = OpVariable %38 Function %68 +%74 = OpVariable %15 Function %18 +OpBranch %69 +%69 = OpLabel +OpBranch %70 +%70 = OpLabel +OpLoopMerge %71 %73 None +OpBranch %75 +%75 = OpLabel +%76 = OpLoad %14 %74 +%77 = OpIEqual %16 %21 %76 +%78 = OpAll %3 %77 +OpSelectionMerge %79 None +OpBranchConditional %78 %71 %79 +%79 = OpLabel +%80 = OpCompositeExtract %4 %76 1 +%81 = OpIEqual %3 %80 %20 +%82 = OpSelect %4 %81 %19 %17 +%83 = OpCompositeConstruct %14 %82 %19 +%84 = OpIAdd %14 %76 %83 +OpStore %74 %84 +OpBranch %72 +%72 = OpLabel +OpStore %65 %63 +%85 = OpLoad %3 %65 +%86 = OpLogicalNotEqual %3 %63 %85 +OpStore %67 %86 +OpBranch %73 +%73 = OpLabel +%87 = OpLoad %3 %67 +%88 = OpLogicalEqual %3 %63 %87 +OpBranchConditional %88 %71 %70 +%71 = OpLabel +OpReturn +OpFunctionEnd +%90 = OpFunction %2 None %7 +%89 = OpLabel +%92 = OpVariable %93 Function %17 +%99 = OpVariable %15 Function %18 +OpBranch %94 +%94 = OpLabel +OpBranch %95 +%95 = OpLabel +OpLoopMerge %96 %98 None +OpBranch %100 +%100 = OpLabel +%101 = OpLoad %14 %99 +%102 = OpIEqual %16 %21 %101 +%103 = OpAll %3 %102 +OpSelectionMerge %104 None +OpBranchConditional %103 %96 %104 +%104 = OpLabel +%105 = OpCompositeExtract %4 %101 1 +%106 = OpIEqual %3 %105 %20 +%107 = OpSelect %4 %106 %19 %17 +%108 = OpCompositeConstruct %14 %107 %19 +%109 = OpIAdd %14 %101 %108 +OpStore %99 %109 +OpBranch %97 +%97 = OpLabel +%110 = OpLoad %4 %92 +%111 = OpIAdd %4 %110 %19 +OpStore %92 %111 +OpBranch %98 +%98 = OpLabel +%112 = OpLoad %4 %92 +%113 = OpIEqual %3 %112 %91 +OpBranchConditional %113 %96 %95 +%96 = OpLabel +OpReturn +OpFunctionEnd +%115 = OpFunction %2 None %7 +%114 = OpLabel +OpBranch %116 +%116 = OpLabel OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/collatz.spvasm b/naga/tests/out/spv/collatz.spvasm index cc670722ae..2b36b7b87c 100644 --- a/naga/tests/out/spv/collatz.spvasm +++ b/naga/tests/out/spv/collatz.spvasm @@ -1,13 +1,13 @@ ; SPIR-V ; Version: 1.0 ; Generator: rspirv -; Bound: 78 +; Bound: 95 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %67 "main" %64 -OpExecutionMode %67 LocalSize 1 1 1 +OpEntryPoint GLCompute %84 "main" %81 +OpExecutionMode %84 LocalSize 1 1 1 %3 = OpString "collatz.wgsl" OpSource Unknown 0 %3 "struct PrimeIndices { data: array @@ -55,14 +55,15 @@ OpName %29 "n_base" OpName %30 "collatz_iterations" OpName %34 "n" OpName %37 "i" -OpName %64 "global_id" -OpName %67 "main" +OpName %49 "loop_bound" +OpName %81 "global_id" +OpName %84 "main" OpDecorate %5 ArrayStride 4 OpMemberDecorate %6 0 Offset 0 OpDecorate %6 Block OpDecorate %8 DescriptorSet 0 OpDecorate %8 Binding 0 -OpDecorate %64 BuiltIn GlobalInvocationId +OpDecorate %81 BuiltIn GlobalInvocationId %2 = OpTypeVoid %4 = OpTypeInt 32 0 %5 = OpTypeRuntimeArray %4 @@ -79,11 +80,17 @@ OpDecorate %64 BuiltIn GlobalInvocationId %33 = OpConstant %4 3 %35 = OpTypePointer Function %4 %36 = OpConstantNull %4 -%65 = OpTypePointer Input %7 -%64 = OpVariable %65 Input -%68 = OpTypeFunction %2 -%70 = OpTypePointer StorageBuffer %5 -%72 = OpTypePointer StorageBuffer %4 +%43 = OpTypeVector %4 2 +%44 = OpTypePointer Function %43 +%45 = OpTypeVector %15 2 +%46 = OpConstantComposite %43 %16 %16 +%47 = OpConstant %4 4294967295 +%48 = OpConstantComposite %43 %47 %47 +%82 = OpTypePointer Input %7 +%81 = OpVariable %82 Input +%85 = OpTypeFunction %2 +%87 = OpTypePointer StorageBuffer %5 +%89 = OpTypePointer StorageBuffer %4 %10 = OpFunction %4 None %11 %12 = OpFunctionParameter %4 %13 = OpFunctionParameter %4 @@ -107,6 +114,7 @@ OpFunctionEnd %28 = OpLabel %34 = OpVariable %35 Function %36 %37 = OpVariable %35 Function %16 +%49 = OpVariable %44 Function %46 OpBranch %38 %38 = OpLabel OpLine %3 15 5 @@ -115,78 +123,92 @@ OpBranch %39 %39 = OpLabel OpLine %3 17 5 OpLoopMerge %40 %42 None +OpBranch %50 +%50 = OpLabel +%51 = OpLoad %43 %49 +%52 = OpIEqual %45 %48 %51 +%53 = OpAll %15 %52 +OpSelectionMerge %54 None +OpBranchConditional %53 %40 %54 +%54 = OpLabel +%55 = OpCompositeExtract %4 %51 1 +%56 = OpIEqual %15 %55 %47 +%57 = OpSelect %4 %56 %18 %16 +%58 = OpCompositeConstruct %43 %57 %18 +%59 = OpIAdd %43 %51 %58 +OpStore %49 %59 OpBranch %41 %41 = OpLabel OpLine %3 1 1 -%43 = OpLoad %4 %34 +%60 = OpLoad %4 %34 OpLine %3 17 11 -%44 = OpUGreaterThan %15 %43 %18 +%61 = OpUGreaterThan %15 %60 %18 OpLine %3 17 10 -OpSelectionMerge %45 None -OpBranchConditional %44 %45 %46 -%46 = OpLabel +OpSelectionMerge %62 None +OpBranchConditional %61 %62 %63 +%63 = OpLabel OpBranch %40 -%45 = OpLabel -OpBranch %47 -%47 = OpLabel +%62 = OpLabel +OpBranch %64 +%64 = OpLabel OpLine %3 1 1 -%49 = OpLoad %4 %34 +%66 = OpLoad %4 %34 OpLine %3 18 12 -%50 = OpFunctionCall %4 %10 %49 %32 +%67 = OpFunctionCall %4 %10 %66 %32 OpLine %3 18 12 -%51 = OpIEqual %15 %50 %16 +%68 = OpIEqual %15 %67 %16 OpLine %3 18 9 -OpSelectionMerge %52 None -OpBranchConditional %51 %53 %54 -%53 = OpLabel +OpSelectionMerge %69 None +OpBranchConditional %68 %70 %71 +%70 = OpLabel OpLine %3 1 1 -%55 = OpLoad %4 %34 +%72 = OpLoad %4 %34 OpLine %3 19 17 -%56 = OpFunctionCall %4 %21 %55 %32 +%73 = OpFunctionCall %4 %21 %72 %32 OpLine %3 19 13 -OpStore %34 %56 -OpBranch %52 -%54 = OpLabel +OpStore %34 %73 +OpBranch %69 +%71 = OpLabel OpLine %3 22 17 -%57 = OpLoad %4 %34 -%58 = OpIMul %4 %33 %57 +%74 = OpLoad %4 %34 +%75 = OpIMul %4 %33 %74 OpLine %3 22 17 -%59 = OpIAdd %4 %58 %18 +%76 = OpIAdd %4 %75 %18 OpLine %3 22 13 -OpStore %34 %59 -OpBranch %52 -%52 = OpLabel +OpStore %34 %76 +OpBranch %69 +%69 = OpLabel OpLine %3 1 1 -%60 = OpLoad %4 %37 +%77 = OpLoad %4 %37 OpLine %3 24 13 -%61 = OpIAdd %4 %60 %18 +%78 = OpIAdd %4 %77 %18 OpLine %3 24 9 -OpStore %37 %61 -OpBranch %48 -%48 = OpLabel +OpStore %37 %78 +OpBranch %65 +%65 = OpLabel OpBranch %42 %42 = OpLabel OpBranch %39 %40 = OpLabel OpLine %3 1 1 -%62 = OpLoad %4 %37 -OpReturnValue %62 +%79 = OpLoad %4 %37 +OpReturnValue %79 OpFunctionEnd -%67 = OpFunction %2 None %68 -%63 = OpLabel -%66 = OpLoad %7 %64 -OpBranch %69 -%69 = OpLabel +%84 = OpFunction %2 None %85 +%80 = OpLabel +%83 = OpLoad %7 %81 +OpBranch %86 +%86 = OpLabel OpLine %3 31 5 -%71 = OpCompositeExtract %4 %66 0 +%88 = OpCompositeExtract %4 %83 0 OpLine %3 31 54 -%73 = OpCompositeExtract %4 %66 0 -%74 = OpAccessChain %72 %8 %16 %73 -%75 = OpLoad %4 %74 +%90 = OpCompositeExtract %4 %83 0 +%91 = OpAccessChain %89 %8 %16 %90 +%92 = OpLoad %4 %91 OpLine %3 31 35 -%76 = OpFunctionCall %4 %30 %75 +%93 = OpFunctionCall %4 %30 %92 OpLine %3 31 5 -%77 = OpAccessChain %72 %8 %16 %71 -OpStore %77 %76 +%94 = OpAccessChain %89 %8 %16 %88 +OpStore %94 %93 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/control-flow.spvasm b/naga/tests/out/spv/control-flow.spvasm index f3c3644b4f..1fb3b52b1a 100644 --- a/naga/tests/out/spv/control-flow.spvasm +++ b/naga/tests/out/spv/control-flow.spvasm @@ -1,13 +1,13 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 134 +; Bound: 207 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %104 "main" %101 -OpExecutionMode %104 LocalSize 1 1 1 -OpDecorate %101 BuiltIn GlobalInvocationId +OpEntryPoint GLCompute %179 "main" %176 +OpExecutionMode %179 LocalSize 1 1 1 +OpDecorate %176 BuiltIn GlobalInvocationId %2 = OpTypeVoid %4 = OpTypeInt 32 0 %3 = OpTypeVector %4 3 @@ -15,21 +15,28 @@ OpDecorate %101 BuiltIn GlobalInvocationId %9 = OpTypeFunction %2 %5 %15 = OpTypeFunction %2 %16 = OpConstant %5 0 -%37 = OpTypeFunction %2 %5 %5 %5 -%73 = OpTypeFunction %2 %5 %5 %5 %5 -%74 = OpConstant %5 1 -%75 = OpConstant %5 2 -%77 = OpTypePointer Function %5 -%102 = OpTypePointer Input %3 -%101 = OpVariable %102 Input -%105 = OpConstant %5 3 -%106 = OpConstant %5 4 -%107 = OpConstant %4 0 -%109 = OpConstantNull %5 -%111 = OpConstant %4 2 -%112 = OpConstant %4 1 -%113 = OpConstant %4 72 -%114 = OpConstant %4 264 +%29 = OpTypeVector %4 2 +%30 = OpTypePointer Function %29 +%31 = OpTypeBool +%32 = OpTypeVector %31 2 +%33 = OpConstant %4 0 +%34 = OpConstantComposite %29 %33 %33 +%35 = OpConstant %4 1 +%36 = OpConstant %4 4294967295 +%37 = OpConstantComposite %29 %36 %36 +%57 = OpTypeFunction %2 %5 %5 %5 +%126 = OpTypeFunction %2 %5 %5 %5 %5 +%127 = OpConstant %5 1 +%128 = OpConstant %5 2 +%130 = OpTypePointer Function %5 +%177 = OpTypePointer Input %3 +%176 = OpVariable %177 Input +%180 = OpConstant %5 3 +%181 = OpConstant %5 4 +%183 = OpConstantNull %5 +%185 = OpConstant %4 2 +%186 = OpConstant %4 72 +%187 = OpConstant %4 264 %8 = OpFunction %2 None %9 %7 = OpFunctionParameter %5 %6 = OpLabel @@ -58,218 +65,308 @@ OpFunctionEnd %23 = OpFunction %2 None %9 %22 = OpFunctionParameter %5 %21 = OpLabel +%38 = OpVariable %30 Function %34 OpBranch %24 %24 = OpLabel OpBranch %25 %25 = OpLabel OpLoopMerge %26 %28 None +OpBranch %39 +%39 = OpLabel +%40 = OpLoad %29 %38 +%41 = OpIEqual %32 %37 %40 +%42 = OpAll %31 %41 +OpSelectionMerge %43 None +OpBranchConditional %42 %26 %43 +%43 = OpLabel +%44 = OpCompositeExtract %4 %40 1 +%45 = OpIEqual %31 %44 %36 +%46 = OpSelect %4 %45 %35 %33 +%47 = OpCompositeConstruct %29 %46 %35 +%48 = OpIAdd %29 %40 %47 +OpStore %38 %48 OpBranch %27 %27 = OpLabel -OpSelectionMerge %29 None -OpSwitch %22 %31 1 %30 -%30 = OpLabel +OpSelectionMerge %49 None +OpSwitch %22 %51 1 %50 +%50 = OpLabel OpBranch %28 -%31 = OpLabel -OpBranch %29 -%29 = OpLabel +%51 = OpLabel +OpBranch %49 +%49 = OpLabel OpBranch %28 %28 = OpLabel OpBranch %25 %26 = OpLabel OpReturn OpFunctionEnd -%36 = OpFunction %2 None %37 -%33 = OpFunctionParameter %5 -%34 = OpFunctionParameter %5 -%35 = OpFunctionParameter %5 -%32 = OpLabel -OpBranch %38 -%38 = OpLabel -OpBranch %39 -%39 = OpLabel -OpLoopMerge %40 %42 None -OpBranch %41 -%41 = OpLabel -OpSelectionMerge %43 None -OpSwitch %33 %46 1 %44 2 %45 -%44 = OpLabel -OpBranch %42 -%45 = OpLabel -OpSelectionMerge %47 None -OpSwitch %34 %49 1 %48 -%48 = OpLabel -OpBranch %42 -%49 = OpLabel -OpBranch %50 -%50 = OpLabel -OpLoopMerge %51 %53 None -OpBranch %52 +%56 = OpFunction %2 None %57 +%53 = OpFunctionParameter %5 +%54 = OpFunctionParameter %5 +%55 = OpFunctionParameter %5 %52 = OpLabel -OpSelectionMerge %54 None -OpSwitch %35 %56 1 %55 -%55 = OpLabel -OpBranch %53 -%56 = OpLabel -OpBranch %54 -%54 = OpLabel -OpBranch %53 -%53 = OpLabel -OpBranch %50 -%51 = OpLabel -OpBranch %47 -%47 = OpLabel -OpBranch %43 -%46 = OpLabel -OpBranch %43 -%43 = OpLabel -OpSelectionMerge %57 None -OpSwitch %34 %58 +%63 = OpVariable %30 Function %34 +%85 = OpVariable %30 Function %34 +%105 = OpVariable %30 Function %34 +OpBranch %58 %58 = OpLabel -OpBranch %42 -%57 = OpLabel -OpBranch %42 -%42 = OpLabel -OpBranch %39 -%40 = OpLabel OpBranch %59 %59 = OpLabel OpLoopMerge %60 %62 None +OpBranch %64 +%64 = OpLabel +%65 = OpLoad %29 %63 +%66 = OpIEqual %32 %37 %65 +%67 = OpAll %31 %66 +OpSelectionMerge %68 None +OpBranchConditional %67 %60 %68 +%68 = OpLabel +%69 = OpCompositeExtract %4 %65 1 +%70 = OpIEqual %31 %69 %36 +%71 = OpSelect %4 %70 %35 %33 +%72 = OpCompositeConstruct %29 %71 %35 +%73 = OpIAdd %29 %65 %72 +OpStore %63 %73 OpBranch %61 %61 = OpLabel -OpSelectionMerge %63 None -OpSwitch %34 %64 1 %64 -%64 = OpLabel -OpSelectionMerge %65 None -OpSwitch %35 %66 -%66 = OpLabel +OpSelectionMerge %74 None +OpSwitch %53 %77 1 %75 2 %76 +%75 = OpLabel OpBranch %62 -%65 = OpLabel -OpBranch %63 -%63 = OpLabel +%76 = OpLabel +OpSelectionMerge %78 None +OpSwitch %54 %80 1 %79 +%79 = OpLabel +OpBranch %62 +%80 = OpLabel +OpBranch %81 +%81 = OpLabel +OpLoopMerge %82 %84 None +OpBranch %86 +%86 = OpLabel +%87 = OpLoad %29 %85 +%88 = OpIEqual %32 %37 %87 +%89 = OpAll %31 %88 +OpSelectionMerge %90 None +OpBranchConditional %89 %82 %90 +%90 = OpLabel +%91 = OpCompositeExtract %4 %87 1 +%92 = OpIEqual %31 %91 %36 +%93 = OpSelect %4 %92 %35 %33 +%94 = OpCompositeConstruct %29 %93 %35 +%95 = OpIAdd %29 %87 %94 +OpStore %85 %95 +OpBranch %83 +%83 = OpLabel +OpSelectionMerge %96 None +OpSwitch %55 %98 1 %97 +%97 = OpLabel +OpBranch %84 +%98 = OpLabel +OpBranch %96 +%96 = OpLabel +OpBranch %84 +%84 = OpLabel +OpBranch %81 +%82 = OpLabel +OpBranch %78 +%78 = OpLabel +OpBranch %74 +%77 = OpLabel +OpBranch %74 +%74 = OpLabel +OpSelectionMerge %99 None +OpSwitch %54 %100 +%100 = OpLabel +OpBranch %62 +%99 = OpLabel OpBranch %62 %62 = OpLabel OpBranch %59 %60 = OpLabel -OpReturn -OpFunctionEnd -%72 = OpFunction %2 None %73 -%68 = OpFunctionParameter %5 -%69 = OpFunctionParameter %5 -%70 = OpFunctionParameter %5 -%71 = OpFunctionParameter %5 -%67 = OpLabel -%76 = OpVariable %77 Function %16 -OpBranch %78 -%78 = OpLabel -OpBranch %79 -%79 = OpLabel -OpLoopMerge %80 %82 None -OpBranch %81 -%81 = OpLabel -OpSelectionMerge %83 None -OpSwitch %68 %85 1 %84 -%84 = OpLabel -OpStore %76 %74 -OpBranch %83 -%85 = OpLabel -OpBranch %83 -%83 = OpLabel -OpBranch %82 -%82 = OpLabel -OpBranch %79 -%80 = OpLabel -OpBranch %86 -%86 = OpLabel -OpLoopMerge %87 %89 None -OpBranch %88 -%88 = OpLabel -OpSelectionMerge %90 None -OpSwitch %68 %93 1 %91 2 %92 -%91 = OpLabel -OpBranch %90 -%92 = OpLabel -OpSelectionMerge %94 None -OpSwitch %69 %96 1 %95 -%95 = OpLabel -OpBranch %89 -%96 = OpLabel -OpSelectionMerge %97 None -OpSwitch %70 %99 1 %98 -%98 = OpLabel -OpStore %76 %75 -OpBranch %97 -%99 = OpLabel -OpBranch %97 -%97 = OpLabel -OpBranch %94 -%94 = OpLabel -OpBranch %90 -%93 = OpLabel -OpBranch %90 -%90 = OpLabel -OpBranch %89 -%89 = OpLabel -OpBranch %86 -%87 = OpLabel -OpReturn -OpFunctionEnd -%104 = OpFunction %2 None %15 -%100 = OpLabel -%108 = OpVariable %77 Function %109 -%103 = OpLoad %3 %101 -OpBranch %110 +OpBranch %101 +%101 = OpLabel +OpLoopMerge %102 %104 None +OpBranch %106 +%106 = OpLabel +%107 = OpLoad %29 %105 +%108 = OpIEqual %32 %37 %107 +%109 = OpAll %31 %108 +OpSelectionMerge %110 None +OpBranchConditional %109 %102 %110 %110 = OpLabel -OpControlBarrier %111 %112 %113 -OpControlBarrier %111 %111 %114 -OpSelectionMerge %115 None -OpSwitch %74 %116 -%116 = OpLabel -OpStore %108 %74 -OpBranch %115 -%115 = OpLabel -%117 = OpLoad %5 %108 +%111 = OpCompositeExtract %4 %107 1 +%112 = OpIEqual %31 %111 %36 +%113 = OpSelect %4 %112 %35 %33 +%114 = OpCompositeConstruct %29 %113 %35 +%115 = OpIAdd %29 %107 %114 +OpStore %105 %115 +OpBranch %103 +%103 = OpLabel +OpSelectionMerge %116 None +OpSwitch %54 %117 1 %117 +%117 = OpLabel OpSelectionMerge %118 None -OpSwitch %117 %123 1 %119 2 %120 3 %121 4 %121 5 %122 6 %123 +OpSwitch %55 %119 %119 = OpLabel -OpStore %108 %16 -OpBranch %118 -%120 = OpLabel -OpStore %108 %74 -OpBranch %118 -%121 = OpLabel -OpStore %108 %75 -OpBranch %118 -%122 = OpLabel -OpStore %108 %105 -OpBranch %118 -%123 = OpLabel -OpStore %108 %106 -OpBranch %118 +OpBranch %104 %118 = OpLabel -OpSelectionMerge %124 None -OpSwitch %107 %126 0 %125 -%125 = OpLabel -OpBranch %124 -%126 = OpLabel -OpBranch %124 -%124 = OpLabel -%127 = OpLoad %5 %108 -OpSelectionMerge %128 None -OpSwitch %127 %133 1 %129 2 %130 3 %131 4 %132 -%129 = OpLabel -OpStore %108 %16 -OpBranch %128 -%130 = OpLabel -OpStore %108 %74 +OpBranch %116 +%116 = OpLabel +OpBranch %104 +%104 = OpLabel +OpBranch %101 +%102 = OpLabel OpReturn +OpFunctionEnd +%125 = OpFunction %2 None %126 +%121 = OpFunctionParameter %5 +%122 = OpFunctionParameter %5 +%123 = OpFunctionParameter %5 +%124 = OpFunctionParameter %5 +%120 = OpLabel +%129 = OpVariable %130 Function %16 +%136 = OpVariable %30 Function %34 +%154 = OpVariable %30 Function %34 +OpBranch %131 %131 = OpLabel -OpStore %108 %75 -OpReturn +OpBranch %132 %132 = OpLabel -OpReturn +OpLoopMerge %133 %135 None +OpBranch %137 +%137 = OpLabel +%138 = OpLoad %29 %136 +%139 = OpIEqual %32 %37 %138 +%140 = OpAll %31 %139 +OpSelectionMerge %141 None +OpBranchConditional %140 %133 %141 +%141 = OpLabel +%142 = OpCompositeExtract %4 %138 1 +%143 = OpIEqual %31 %142 %36 +%144 = OpSelect %4 %143 %35 %33 +%145 = OpCompositeConstruct %29 %144 %35 +%146 = OpIAdd %29 %138 %145 +OpStore %136 %146 +OpBranch %134 +%134 = OpLabel +OpSelectionMerge %147 None +OpSwitch %121 %149 1 %148 +%148 = OpLabel +OpStore %129 %127 +OpBranch %147 +%149 = OpLabel +OpBranch %147 +%147 = OpLabel +OpBranch %135 +%135 = OpLabel +OpBranch %132 %133 = OpLabel -OpStore %108 %105 +OpBranch %150 +%150 = OpLabel +OpLoopMerge %151 %153 None +OpBranch %155 +%155 = OpLabel +%156 = OpLoad %29 %154 +%157 = OpIEqual %32 %37 %156 +%158 = OpAll %31 %157 +OpSelectionMerge %159 None +OpBranchConditional %158 %151 %159 +%159 = OpLabel +%160 = OpCompositeExtract %4 %156 1 +%161 = OpIEqual %31 %160 %36 +%162 = OpSelect %4 %161 %35 %33 +%163 = OpCompositeConstruct %29 %162 %35 +%164 = OpIAdd %29 %156 %163 +OpStore %154 %164 +OpBranch %152 +%152 = OpLabel +OpSelectionMerge %165 None +OpSwitch %121 %168 1 %166 2 %167 +%166 = OpLabel +OpBranch %165 +%167 = OpLabel +OpSelectionMerge %169 None +OpSwitch %122 %171 1 %170 +%170 = OpLabel +OpBranch %153 +%171 = OpLabel +OpSelectionMerge %172 None +OpSwitch %123 %174 1 %173 +%173 = OpLabel +OpStore %129 %128 +OpBranch %172 +%174 = OpLabel +OpBranch %172 +%172 = OpLabel +OpBranch %169 +%169 = OpLabel +OpBranch %165 +%168 = OpLabel +OpBranch %165 +%165 = OpLabel +OpBranch %153 +%153 = OpLabel +OpBranch %150 +%151 = OpLabel OpReturn -%128 = OpLabel +OpFunctionEnd +%179 = OpFunction %2 None %15 +%175 = OpLabel +%182 = OpVariable %130 Function %183 +%178 = OpLoad %3 %176 +OpBranch %184 +%184 = OpLabel +OpControlBarrier %185 %35 %186 +OpControlBarrier %185 %185 %187 +OpSelectionMerge %188 None +OpSwitch %127 %189 +%189 = OpLabel +OpStore %182 %127 +OpBranch %188 +%188 = OpLabel +%190 = OpLoad %5 %182 +OpSelectionMerge %191 None +OpSwitch %190 %196 1 %192 2 %193 3 %194 4 %194 5 %195 6 %196 +%192 = OpLabel +OpStore %182 %16 +OpBranch %191 +%193 = OpLabel +OpStore %182 %127 +OpBranch %191 +%194 = OpLabel +OpStore %182 %128 +OpBranch %191 +%195 = OpLabel +OpStore %182 %180 +OpBranch %191 +%196 = OpLabel +OpStore %182 %181 +OpBranch %191 +%191 = OpLabel +OpSelectionMerge %197 None +OpSwitch %33 %199 0 %198 +%198 = OpLabel +OpBranch %197 +%199 = OpLabel +OpBranch %197 +%197 = OpLabel +%200 = OpLoad %5 %182 +OpSelectionMerge %201 None +OpSwitch %200 %206 1 %202 2 %203 3 %204 4 %205 +%202 = OpLabel +OpStore %182 %16 +OpBranch %201 +%203 = OpLabel +OpStore %182 %127 +OpReturn +%204 = OpLabel +OpStore %182 %128 +OpReturn +%205 = OpLabel +OpReturn +%206 = OpLabel +OpStore %182 %180 +OpReturn +%201 = OpLabel OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/debug-symbol-large-source.spvasm b/naga/tests/out/spv/debug-symbol-large-source.spvasm index c761e6cdac..f8d786a526 100644 --- a/naga/tests/out/spv/debug-symbol-large-source.spvasm +++ b/naga/tests/out/spv/debug-symbol-large-source.spvasm @@ -1,19 +1,19 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 659 +; Bound: 674 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %353 "gen_terrain_compute" %350 -OpEntryPoint Vertex %430 "gen_terrain_vertex" %421 %424 %426 %428 -OpEntryPoint Fragment %480 "gen_terrain_fragment" %470 %472 %475 %478 %479 -OpEntryPoint Vertex %573 "vs_main" %564 %567 %569 %570 %572 -OpEntryPoint Fragment %598 "fs_main" %591 %593 %595 %597 -OpExecutionMode %353 LocalSize 64 1 1 -OpExecutionMode %480 OriginUpperLeft -OpExecutionMode %598 OriginUpperLeft +OpEntryPoint GLCompute %368 "gen_terrain_compute" %365 +OpEntryPoint Vertex %445 "gen_terrain_vertex" %436 %439 %441 %443 +OpEntryPoint Fragment %495 "gen_terrain_fragment" %485 %487 %490 %493 %494 +OpEntryPoint Vertex %588 "vs_main" %579 %582 %584 %585 %587 +OpEntryPoint Fragment %613 "fs_main" %606 %608 %610 %612 +OpExecutionMode %368 LocalSize 64 1 1 +OpExecutionMode %495 OriginUpperLeft +OpExecutionMode %613 OriginUpperLeft %3 = OpString "debug-symbol-large-source.wgsl" OpSource Unknown 0 %3 "//This is a test 这是测试 これはテストだ 테스트입니다 This is a test 这是测试 これはテストだ 테스트입니다 This is a test 这是测试 これはテストだ 테스트입니다 //This is a test 这是测试 これはテストだ 테스트입니다 This is a test 这是测试 これはテストだ 테스트입니다 This is a test 这是测试 これはテストだ 테스트입니다 @@ -7535,50 +7535,51 @@ OpName %212 "x" OpName %214 "v" OpName %216 "a" OpName %217 "i" -OpName %255 "p" -OpName %256 "min_max_height" -OpName %257 "terrain_point" -OpName %268 "p" -OpName %269 "min_max_height" -OpName %270 "terrain_vertex" -OpName %299 "naga_div" -OpName %301 "lhs" -OpName %302 "rhs" -OpName %308 "vert_index" -OpName %309 "chunk_size" -OpName %310 "chunk_corner" -OpName %311 "index_to_p" -OpName %327 "p" -OpName %328 "color23" -OpName %350 "gid" -OpName %353 "gen_terrain_compute" -OpName %413 "naga_mod" -OpName %414 "lhs" -OpName %415 "rhs" -OpName %421 "vindex" -OpName %424 "index" -OpName %426 "position" -OpName %428 "uv" -OpName %430 "gen_terrain_vertex" -OpName %470 "index" -OpName %472 "position" -OpName %475 "uv" -OpName %478 "vert_component" -OpName %479 "index" -OpName %480 "gen_terrain_fragment" -OpName %483 "vert_component" -OpName %484 "index" -OpName %564 "position" -OpName %567 "normal" -OpName %569 "clip_position" -OpName %570 "normal" -OpName %572 "world_pos" -OpName %573 "vs_main" -OpName %591 "clip_position" -OpName %593 "normal" -OpName %595 "world_pos" -OpName %598 "fs_main" -OpName %607 "color" +OpName %237 "loop_bound" +OpName %270 "p" +OpName %271 "min_max_height" +OpName %272 "terrain_point" +OpName %283 "p" +OpName %284 "min_max_height" +OpName %285 "terrain_vertex" +OpName %314 "naga_div" +OpName %316 "lhs" +OpName %317 "rhs" +OpName %323 "vert_index" +OpName %324 "chunk_size" +OpName %325 "chunk_corner" +OpName %326 "index_to_p" +OpName %342 "p" +OpName %343 "color23" +OpName %365 "gid" +OpName %368 "gen_terrain_compute" +OpName %428 "naga_mod" +OpName %429 "lhs" +OpName %430 "rhs" +OpName %436 "vindex" +OpName %439 "index" +OpName %441 "position" +OpName %443 "uv" +OpName %445 "gen_terrain_vertex" +OpName %485 "index" +OpName %487 "position" +OpName %490 "uv" +OpName %493 "vert_component" +OpName %494 "index" +OpName %495 "gen_terrain_fragment" +OpName %498 "vert_component" +OpName %499 "index" +OpName %579 "position" +OpName %582 "normal" +OpName %584 "clip_position" +OpName %585 "normal" +OpName %587 "world_pos" +OpName %588 "vs_main" +OpName %606 "clip_position" +OpName %608 "normal" +OpName %610 "world_pos" +OpName %613 "fs_main" +OpName %622 "color" OpMemberDecorate %13 0 Offset 0 OpMemberDecorate %13 1 Offset 8 OpMemberDecorate %13 2 Offset 16 @@ -7637,27 +7638,27 @@ OpDecorate %49 DescriptorSet 2 OpDecorate %49 Binding 2 OpDecorate %50 DescriptorSet 2 OpDecorate %50 Binding 3 -OpDecorate %350 BuiltIn GlobalInvocationId -OpDecorate %421 BuiltIn VertexIndex -OpDecorate %424 Location 0 -OpDecorate %424 Flat -OpDecorate %426 BuiltIn Position -OpDecorate %428 Location 1 -OpDecorate %470 Location 0 -OpDecorate %470 Flat -OpDecorate %472 BuiltIn FragCoord -OpDecorate %475 Location 1 -OpDecorate %478 Location 0 -OpDecorate %479 Location 1 -OpDecorate %564 Location 0 -OpDecorate %567 Location 1 -OpDecorate %569 BuiltIn Position -OpDecorate %570 Location 0 -OpDecorate %572 Location 1 -OpDecorate %591 BuiltIn FragCoord -OpDecorate %593 Location 0 -OpDecorate %595 Location 1 -OpDecorate %597 Location 0 +OpDecorate %365 BuiltIn GlobalInvocationId +OpDecorate %436 BuiltIn VertexIndex +OpDecorate %439 Location 0 +OpDecorate %439 Flat +OpDecorate %441 BuiltIn Position +OpDecorate %443 Location 1 +OpDecorate %485 Location 0 +OpDecorate %485 Flat +OpDecorate %487 BuiltIn FragCoord +OpDecorate %490 Location 1 +OpDecorate %493 Location 0 +OpDecorate %494 Location 1 +OpDecorate %579 Location 0 +OpDecorate %582 Location 1 +OpDecorate %584 BuiltIn Position +OpDecorate %585 Location 0 +OpDecorate %587 Location 1 +OpDecorate %606 BuiltIn FragCoord +OpDecorate %608 Location 0 +OpDecorate %610 Location 1 +OpDecorate %612 Location 0 %2 = OpTypeVoid %4 = OpTypeFloat 32 %5 = OpTypeVector %4 3 @@ -7752,81 +7753,85 @@ OpDecorate %597 Location 0 %213 = OpConstantNull %6 %215 = OpTypePointer Function %4 %218 = OpTypePointer Function %8 -%258 = OpTypeFunction %5 %6 %6 -%271 = OpTypeFunction %14 %6 %6 -%272 = OpConstant %4 0.1 -%273 = OpConstantComposite %6 %272 %74 -%274 = OpConstantComposite %6 %74 %272 -%275 = OpConstant %4 -0.1 -%276 = OpConstantComposite %6 %275 %74 -%277 = OpConstantComposite %6 %74 %275 -%300 = OpTypeFunction %8 %8 %8 -%312 = OpTypeFunction %6 %8 %10 %11 -%329 = OpTypeFunction %5 %6 -%330 = OpConstant %4 23.0 -%331 = OpConstant %4 32.0 -%332 = OpConstantComposite %6 %330 %331 -%333 = OpConstant %4 -43.0 -%334 = OpConstant %4 3.0 -%335 = OpConstantComposite %6 %333 %334 -%351 = OpTypePointer Input %19 -%350 = OpVariable %351 Input -%354 = OpTypeFunction %2 -%355 = OpTypePointer Uniform %13 -%357 = OpConstant %8 6 -%358 = OpConstant %8 2 -%359 = OpConstant %8 3 -%360 = OpConstant %8 4 -%363 = OpTypePointer Uniform %10 -%366 = OpTypePointer Uniform %11 -%370 = OpTypePointer StorageBuffer %15 -%371 = OpTypePointer StorageBuffer %14 -%372 = OpTypePointer Uniform %6 -%379 = OpTypePointer Uniform %8 -%400 = OpTypePointer StorageBuffer %17 -%401 = OpTypePointer StorageBuffer %8 -%422 = OpTypePointer Input %8 -%421 = OpVariable %422 Input -%425 = OpTypePointer Output %8 -%424 = OpVariable %425 Output -%427 = OpTypePointer Output %7 -%426 = OpVariable %427 Output -%429 = OpTypePointer Output %6 -%428 = OpVariable %429 Output -%431 = OpTypePointer Uniform %20 -%433 = OpConstant %4 -1.0 -%434 = OpConstantComposite %6 %433 %433 -%449 = OpTypePointer Uniform %8 -%470 = OpVariable %422 Input -%473 = OpTypePointer Input %7 -%472 = OpVariable %473 Input -%476 = OpTypePointer Input %6 -%475 = OpVariable %476 Input -%478 = OpVariable %425 Output -%479 = OpVariable %425 Output -%482 = OpConstant %4 6.0 -%565 = OpTypePointer Input %5 -%564 = OpVariable %565 Input -%567 = OpVariable %565 Input -%569 = OpVariable %427 Output -%571 = OpTypePointer Output %5 -%570 = OpVariable %571 Output -%572 = OpVariable %571 Output -%574 = OpTypePointer Uniform %24 -%577 = OpTypePointer Uniform %23 -%591 = OpVariable %473 Input -%593 = OpVariable %565 Input -%595 = OpVariable %565 Input -%597 = OpVariable %427 Output -%600 = OpTypePointer Uniform %25 -%602 = OpConstantComposite %5 %272 %272 %272 -%603 = OpConstant %4 0.7 -%604 = OpConstantComposite %5 %78 %272 %603 -%605 = OpConstant %4 0.2 -%606 = OpConstantComposite %5 %605 %605 %605 -%608 = OpConstantNull %5 -%623 = OpTypePointer Uniform %5 -%632 = OpTypePointer Uniform %7 +%233 = OpTypePointer Function %10 +%234 = OpConstantComposite %10 %135 %135 +%235 = OpConstant %8 4294967295 +%236 = OpConstantComposite %10 %235 %235 +%273 = OpTypeFunction %5 %6 %6 +%286 = OpTypeFunction %14 %6 %6 +%287 = OpConstant %4 0.1 +%288 = OpConstantComposite %6 %287 %74 +%289 = OpConstantComposite %6 %74 %287 +%290 = OpConstant %4 -0.1 +%291 = OpConstantComposite %6 %290 %74 +%292 = OpConstantComposite %6 %74 %290 +%315 = OpTypeFunction %8 %8 %8 +%327 = OpTypeFunction %6 %8 %10 %11 +%344 = OpTypeFunction %5 %6 +%345 = OpConstant %4 23.0 +%346 = OpConstant %4 32.0 +%347 = OpConstantComposite %6 %345 %346 +%348 = OpConstant %4 -43.0 +%349 = OpConstant %4 3.0 +%350 = OpConstantComposite %6 %348 %349 +%366 = OpTypePointer Input %19 +%365 = OpVariable %366 Input +%369 = OpTypeFunction %2 +%370 = OpTypePointer Uniform %13 +%372 = OpConstant %8 6 +%373 = OpConstant %8 2 +%374 = OpConstant %8 3 +%375 = OpConstant %8 4 +%378 = OpTypePointer Uniform %10 +%381 = OpTypePointer Uniform %11 +%385 = OpTypePointer StorageBuffer %15 +%386 = OpTypePointer StorageBuffer %14 +%387 = OpTypePointer Uniform %6 +%394 = OpTypePointer Uniform %8 +%415 = OpTypePointer StorageBuffer %17 +%416 = OpTypePointer StorageBuffer %8 +%437 = OpTypePointer Input %8 +%436 = OpVariable %437 Input +%440 = OpTypePointer Output %8 +%439 = OpVariable %440 Output +%442 = OpTypePointer Output %7 +%441 = OpVariable %442 Output +%444 = OpTypePointer Output %6 +%443 = OpVariable %444 Output +%446 = OpTypePointer Uniform %20 +%448 = OpConstant %4 -1.0 +%449 = OpConstantComposite %6 %448 %448 +%464 = OpTypePointer Uniform %8 +%485 = OpVariable %437 Input +%488 = OpTypePointer Input %7 +%487 = OpVariable %488 Input +%491 = OpTypePointer Input %6 +%490 = OpVariable %491 Input +%493 = OpVariable %440 Output +%494 = OpVariable %440 Output +%497 = OpConstant %4 6.0 +%580 = OpTypePointer Input %5 +%579 = OpVariable %580 Input +%582 = OpVariable %580 Input +%584 = OpVariable %442 Output +%586 = OpTypePointer Output %5 +%585 = OpVariable %586 Output +%587 = OpVariable %586 Output +%589 = OpTypePointer Uniform %24 +%592 = OpTypePointer Uniform %23 +%606 = OpVariable %488 Input +%608 = OpVariable %580 Input +%610 = OpVariable %580 Input +%612 = OpVariable %442 Output +%615 = OpTypePointer Uniform %25 +%617 = OpConstantComposite %5 %287 %287 %287 +%618 = OpConstant %4 0.7 +%619 = OpConstantComposite %5 %78 %287 %618 +%620 = OpConstant %4 0.2 +%621 = OpConstantComposite %5 %620 %620 %620 +%623 = OpConstantNull %5 +%638 = OpTypePointer Uniform %5 +%647 = OpTypePointer Uniform %7 %53 = OpFunction %5 None %54 %52 = OpFunctionParameter %5 %51 = OpLabel @@ -8014,6 +8019,7 @@ OpFunctionEnd %217 = OpVariable %218 Function %135 %212 = OpVariable %87 Function %213 %216 = OpVariable %215 Function %78 +%237 = OpVariable %233 Function %234 OpBranch %219 %219 = OpLabel OpLine %3 7179 13 @@ -8035,616 +8041,630 @@ OpBranch %229 %229 = OpLabel OpLine %3 7186 5 OpLoopMerge %230 %232 None +OpBranch %238 +%238 = OpLabel +%239 = OpLoad %10 %237 +%240 = OpIEqual %115 %236 %239 +%241 = OpAll %112 %240 +OpSelectionMerge %242 None +OpBranchConditional %241 %230 %242 +%242 = OpLabel +%243 = OpCompositeExtract %8 %239 1 +%244 = OpIEqual %112 %243 %235 +%245 = OpSelect %8 %244 %126 %135 +%246 = OpCompositeConstruct %10 %245 %126 +%247 = OpIAdd %10 %239 %246 +OpStore %237 %247 OpBranch %231 %231 = OpLabel OpLine %3 7186 22 -%233 = OpLoad %8 %217 -%234 = OpULessThan %112 %233 %205 +%248 = OpLoad %8 %217 +%249 = OpULessThan %112 %248 %205 OpLine %3 7186 21 -OpSelectionMerge %235 None -OpBranchConditional %234 %235 %236 -%236 = OpLabel +OpSelectionMerge %250 None +OpBranchConditional %249 %250 %251 +%251 = OpLabel OpBranch %230 -%235 = OpLabel -OpBranch %237 -%237 = OpLabel +%250 = OpLabel +OpBranch %252 +%252 = OpLabel OpLine %3 1 1 -%239 = OpLoad %4 %214 -%240 = OpLoad %4 %216 -%241 = OpLoad %6 %212 +%254 = OpLoad %4 %214 +%255 = OpLoad %4 %216 +%256 = OpLoad %6 %212 OpLine %3 7187 21 -%242 = OpFunctionCall %4 %67 %241 +%257 = OpFunctionCall %4 %67 %256 OpLine %3 7187 13 -%243 = OpFMul %4 %240 %242 -%244 = OpFAdd %4 %239 %243 +%258 = OpFMul %4 %255 %257 +%259 = OpFAdd %4 %254 %258 OpLine %3 7187 9 -OpStore %214 %244 +OpStore %214 %259 OpLine %3 7188 13 -%245 = OpLoad %6 %212 -%246 = OpMatrixTimesVector %6 %228 %245 +%260 = OpLoad %6 %212 +%261 = OpMatrixTimesVector %6 %228 %260 OpLine %3 7188 13 -%247 = OpVectorTimesScalar %6 %246 %81 -%248 = OpFAdd %6 %247 %208 +%262 = OpVectorTimesScalar %6 %261 %81 +%263 = OpFAdd %6 %262 %208 OpLine %3 7188 9 -OpStore %212 %248 +OpStore %212 %263 OpLine %3 1 1 -%249 = OpLoad %4 %216 +%264 = OpLoad %4 %216 OpLine %3 7189 13 -%250 = OpFMul %4 %249 %78 +%265 = OpFMul %4 %264 %78 OpLine %3 7189 9 -OpStore %216 %250 -OpBranch %238 -%238 = OpLabel +OpStore %216 %265 +OpBranch %253 +%253 = OpLabel OpBranch %232 %232 = OpLabel OpLine %3 1 1 -%251 = OpLoad %8 %217 +%266 = OpLoad %8 %217 OpLine %3 7186 43 -%252 = OpIAdd %8 %251 %126 +%267 = OpIAdd %8 %266 %126 OpLine %3 7186 39 -OpStore %217 %252 +OpStore %217 %267 OpBranch %229 %230 = OpLabel OpLine %3 1 1 -%253 = OpLoad %4 %214 -OpReturnValue %253 +%268 = OpLoad %4 %214 +OpReturnValue %268 OpFunctionEnd -%257 = OpFunction %5 None %258 -%255 = OpFunctionParameter %6 -%256 = OpFunctionParameter %6 -%254 = OpLabel -OpBranch %259 -%259 = OpLabel +%272 = OpFunction %5 None %273 +%270 = OpFunctionParameter %6 +%271 = OpFunctionParameter %6 +%269 = OpLabel +OpBranch %274 +%274 = OpLabel OpLine %3 7220 9 -%260 = OpCompositeExtract %4 %255 0 -%261 = OpCompositeExtract %4 %256 0 -%262 = OpCompositeExtract %4 %256 1 +%275 = OpCompositeExtract %4 %270 0 +%276 = OpCompositeExtract %4 %271 0 +%277 = OpCompositeExtract %4 %271 1 OpLine %3 7221 49 -%263 = OpFunctionCall %4 %204 %255 +%278 = OpFunctionCall %4 %204 %270 OpLine %3 7219 12 -%264 = OpExtInst %4 %1 FMix %261 %262 %263 -%265 = OpCompositeExtract %4 %255 1 -%266 = OpCompositeConstruct %5 %260 %264 %265 -OpReturnValue %266 +%279 = OpExtInst %4 %1 FMix %276 %277 %278 +%280 = OpCompositeExtract %4 %270 1 +%281 = OpCompositeConstruct %5 %275 %279 %280 +OpReturnValue %281 OpFunctionEnd -%270 = OpFunction %14 None %271 -%268 = OpFunctionParameter %6 -%269 = OpFunctionParameter %6 -%267 = OpLabel -OpBranch %278 -%278 = OpLabel +%285 = OpFunction %14 None %286 +%283 = OpFunctionParameter %6 +%284 = OpFunctionParameter %6 +%282 = OpLabel +OpBranch %293 +%293 = OpLabel OpLine %3 7227 13 -%279 = OpFunctionCall %5 %257 %268 %269 +%294 = OpFunctionCall %5 %272 %283 %284 OpLine %3 7229 29 -%280 = OpFAdd %6 %268 %273 +%295 = OpFAdd %6 %283 %288 OpLine %3 7229 15 -%281 = OpFunctionCall %5 %257 %280 %269 +%296 = OpFunctionCall %5 %272 %295 %284 OpLine %3 7229 15 -%282 = OpFSub %5 %281 %279 +%297 = OpFSub %5 %296 %294 OpLine %3 7230 29 -%283 = OpFAdd %6 %268 %274 +%298 = OpFAdd %6 %283 %289 OpLine %3 7230 15 -%284 = OpFunctionCall %5 %257 %283 %269 +%299 = OpFunctionCall %5 %272 %298 %284 OpLine %3 7230 15 -%285 = OpFSub %5 %284 %279 +%300 = OpFSub %5 %299 %294 OpLine %3 7231 29 -%286 = OpFAdd %6 %268 %276 +%301 = OpFAdd %6 %283 %291 OpLine %3 7231 15 -%287 = OpFunctionCall %5 %257 %286 %269 +%302 = OpFunctionCall %5 %272 %301 %284 OpLine %3 7231 15 -%288 = OpFSub %5 %287 %279 +%303 = OpFSub %5 %302 %294 OpLine %3 7232 29 -%289 = OpFAdd %6 %268 %277 +%304 = OpFAdd %6 %283 %292 OpLine %3 7232 15 -%290 = OpFunctionCall %5 %257 %289 %269 +%305 = OpFunctionCall %5 %272 %304 %284 OpLine %3 7232 15 -%291 = OpFSub %5 %290 %279 +%306 = OpFSub %5 %305 %294 OpLine %3 7234 14 -%292 = OpExtInst %5 %1 Cross %285 %282 -%293 = OpExtInst %5 %1 Normalize %292 +%307 = OpExtInst %5 %1 Cross %300 %297 +%308 = OpExtInst %5 %1 Normalize %307 OpLine %3 7235 14 -%294 = OpExtInst %5 %1 Cross %291 %288 -%295 = OpExtInst %5 %1 Normalize %294 +%309 = OpExtInst %5 %1 Cross %306 %303 +%310 = OpExtInst %5 %1 Normalize %309 OpLine %3 7237 14 -%296 = OpFAdd %5 %293 %295 +%311 = OpFAdd %5 %308 %310 OpLine %3 7237 13 -%297 = OpVectorTimesScalar %5 %296 %78 +%312 = OpVectorTimesScalar %5 %311 %78 OpLine %3 7239 12 -%298 = OpCompositeConstruct %14 %279 %297 -OpReturnValue %298 +%313 = OpCompositeConstruct %14 %294 %312 +OpReturnValue %313 OpFunctionEnd -%299 = OpFunction %8 None %300 -%301 = OpFunctionParameter %8 -%302 = OpFunctionParameter %8 -%303 = OpLabel -%304 = OpIEqual %112 %302 %135 -%305 = OpSelect %8 %304 %126 %302 -%306 = OpUDiv %8 %301 %305 -OpReturnValue %306 +%314 = OpFunction %8 None %315 +%316 = OpFunctionParameter %8 +%317 = OpFunctionParameter %8 +%318 = OpLabel +%319 = OpIEqual %112 %317 %135 +%320 = OpSelect %8 %319 %126 %317 +%321 = OpUDiv %8 %316 %320 +OpReturnValue %321 OpFunctionEnd -%311 = OpFunction %6 None %312 -%308 = OpFunctionParameter %8 -%309 = OpFunctionParameter %10 -%310 = OpFunctionParameter %11 -%307 = OpLabel -OpBranch %313 -%313 = OpLabel +%326 = OpFunction %6 None %327 +%323 = OpFunctionParameter %8 +%324 = OpFunctionParameter %10 +%325 = OpFunctionParameter %11 +%322 = OpLabel +OpBranch %328 +%328 = OpLabel OpLine %3 7244 9 -%314 = OpConvertUToF %4 %308 -%315 = OpCompositeExtract %8 %309 0 +%329 = OpConvertUToF %4 %323 +%330 = OpCompositeExtract %8 %324 0 OpLine %3 7244 9 -%316 = OpIAdd %8 %315 %126 -%317 = OpConvertUToF %4 %316 -%318 = OpFRem %4 %314 %317 -%319 = OpCompositeExtract %8 %309 0 +%331 = OpIAdd %8 %330 %126 +%332 = OpConvertUToF %4 %331 +%333 = OpFRem %4 %329 %332 +%334 = OpCompositeExtract %8 %324 0 OpLine %3 7243 12 -%320 = OpIAdd %8 %319 %126 -%321 = OpFunctionCall %8 %299 %308 %320 -%322 = OpConvertUToF %4 %321 -%323 = OpCompositeConstruct %6 %318 %322 -%324 = OpConvertSToF %6 %310 -%325 = OpFAdd %6 %323 %324 -OpReturnValue %325 +%335 = OpIAdd %8 %334 %126 +%336 = OpFunctionCall %8 %314 %323 %335 +%337 = OpConvertUToF %4 %336 +%338 = OpCompositeConstruct %6 %333 %337 +%339 = OpConvertSToF %6 %325 +%340 = OpFAdd %6 %338 %339 +OpReturnValue %340 OpFunctionEnd -%328 = OpFunction %5 None %329 -%327 = OpFunctionParameter %6 -%326 = OpLabel -OpBranch %336 -%336 = OpLabel +%343 = OpFunction %5 None %344 +%342 = OpFunctionParameter %6 +%341 = OpLabel +OpBranch %351 +%351 = OpLabel OpLine %3 7413 9 -%337 = OpFunctionCall %4 %67 %327 +%352 = OpFunctionCall %4 %67 %342 OpLine %3 7413 9 -%338 = OpFMul %4 %337 %78 +%353 = OpFMul %4 %352 %78 OpLine %3 7413 9 -%339 = OpFAdd %4 %338 %78 +%354 = OpFAdd %4 %353 %78 OpLine %3 7414 17 -%340 = OpFAdd %6 %327 %332 +%355 = OpFAdd %6 %342 %347 OpLine %3 7414 9 -%341 = OpFunctionCall %4 %67 %340 +%356 = OpFunctionCall %4 %67 %355 OpLine %3 7414 9 -%342 = OpFMul %4 %341 %78 +%357 = OpFMul %4 %356 %78 OpLine %3 7414 9 -%343 = OpFAdd %4 %342 %78 +%358 = OpFAdd %4 %357 %78 OpLine %3 7415 17 -%344 = OpFAdd %6 %327 %335 +%359 = OpFAdd %6 %342 %350 OpLine %3 7415 9 -%345 = OpFunctionCall %4 %67 %344 +%360 = OpFunctionCall %4 %67 %359 OpLine %3 7415 9 -%346 = OpFMul %4 %345 %78 +%361 = OpFMul %4 %360 %78 OpLine %3 7412 12 -%347 = OpFAdd %4 %346 %78 -%348 = OpCompositeConstruct %5 %339 %343 %347 -OpReturnValue %348 +%362 = OpFAdd %4 %361 %78 +%363 = OpCompositeConstruct %5 %354 %358 %362 +OpReturnValue %363 OpFunctionEnd -%353 = OpFunction %2 None %354 -%349 = OpLabel -%352 = OpLoad %19 %350 -%356 = OpAccessChain %355 %29 %135 -OpBranch %361 -%361 = OpLabel +%368 = OpFunction %2 None %369 +%364 = OpLabel +%367 = OpLoad %19 %365 +%371 = OpAccessChain %370 %29 %135 +OpBranch %376 +%376 = OpLabel OpLine %3 7254 22 -%362 = OpCompositeExtract %8 %352 0 +%377 = OpCompositeExtract %8 %367 0 OpLine %3 7256 36 -%364 = OpAccessChain %363 %356 %135 -%365 = OpLoad %10 %364 +%379 = OpAccessChain %378 %371 %135 +%380 = OpLoad %10 %379 OpLine %3 7256 59 -%367 = OpAccessChain %366 %356 %126 -%368 = OpLoad %11 %367 +%382 = OpAccessChain %381 %371 %126 +%383 = OpLoad %11 %382 OpLine %3 7256 13 -%369 = OpFunctionCall %6 %311 %362 %365 %368 +%384 = OpFunctionCall %6 %326 %377 %380 %383 OpLine %3 7258 5 OpLine %3 7258 51 -%373 = OpAccessChain %372 %356 %358 -%374 = OpLoad %6 %373 +%388 = OpAccessChain %387 %371 %373 +%389 = OpLoad %6 %388 OpLine %3 7258 33 -%375 = OpFunctionCall %14 %270 %369 %374 +%390 = OpFunctionCall %14 %285 %384 %389 OpLine %3 7258 5 -%376 = OpAccessChain %371 %32 %135 %362 -OpStore %376 %375 +%391 = OpAccessChain %386 %32 %135 %377 +OpStore %391 %390 OpLine %3 7261 23 -%377 = OpCompositeExtract %8 %352 0 +%392 = OpCompositeExtract %8 %367 0 OpLine %3 7261 23 -%378 = OpIMul %8 %377 %357 +%393 = OpIMul %8 %392 %372 OpLine %3 7263 24 -%380 = OpAccessChain %379 %356 %135 %135 -%381 = OpLoad %8 %380 -OpLine %3 7263 24 -%382 = OpAccessChain %379 %356 %135 %126 -%383 = OpLoad %8 %382 -%384 = OpIMul %8 %381 %383 -OpLine %3 7263 8 -%385 = OpIMul %8 %384 %357 -%386 = OpUGreaterThanEqual %112 %378 %385 -OpLine %3 7263 5 -OpSelectionMerge %387 None -OpBranchConditional %386 %388 %387 -%388 = OpLabel -OpReturn -%387 = OpLabel -OpLine %3 7265 28 -%389 = OpCompositeExtract %8 %352 0 -OpLine %3 7265 15 -%390 = OpAccessChain %379 %356 %135 %135 -%391 = OpLoad %8 %390 -%392 = OpFunctionCall %8 %299 %389 %391 -%393 = OpIAdd %8 %362 %392 -OpLine %3 7266 15 -%394 = OpIAdd %8 %393 %126 -OpLine %3 7267 15 -%395 = OpAccessChain %379 %356 %135 %135 +%395 = OpAccessChain %394 %371 %135 %135 %396 = OpLoad %8 %395 -%397 = OpIAdd %8 %393 %396 +OpLine %3 7263 24 +%397 = OpAccessChain %394 %371 %135 %126 +%398 = OpLoad %8 %397 +%399 = OpIMul %8 %396 %398 +OpLine %3 7263 8 +%400 = OpIMul %8 %399 %372 +%401 = OpUGreaterThanEqual %112 %393 %400 +OpLine %3 7263 5 +OpSelectionMerge %402 None +OpBranchConditional %401 %403 %402 +%403 = OpLabel +OpReturn +%402 = OpLabel +OpLine %3 7265 28 +%404 = OpCompositeExtract %8 %367 0 +OpLine %3 7265 15 +%405 = OpAccessChain %394 %371 %135 %135 +%406 = OpLoad %8 %405 +%407 = OpFunctionCall %8 %314 %404 %406 +%408 = OpIAdd %8 %377 %407 +OpLine %3 7266 15 +%409 = OpIAdd %8 %408 %126 OpLine %3 7267 15 -%398 = OpIAdd %8 %397 %126 +%410 = OpAccessChain %394 %371 %135 %135 +%411 = OpLoad %8 %410 +%412 = OpIAdd %8 %408 %411 +OpLine %3 7267 15 +%413 = OpIAdd %8 %412 %126 OpLine %3 7268 15 -%399 = OpIAdd %8 %398 %126 +%414 = OpIAdd %8 %413 %126 OpLine %3 7270 5 OpLine %3 7270 5 -%402 = OpAccessChain %401 %34 %135 %378 -OpStore %402 %393 +%417 = OpAccessChain %416 %34 %135 %393 +OpStore %417 %408 OpLine %3 7271 5 OpLine %3 7271 5 -%403 = OpIAdd %8 %378 %126 +%418 = OpIAdd %8 %393 %126 OpLine %3 7271 5 -%404 = OpAccessChain %401 %34 %135 %403 -OpStore %404 %398 +%419 = OpAccessChain %416 %34 %135 %418 +OpStore %419 %413 OpLine %3 7272 5 OpLine %3 7272 5 -%405 = OpIAdd %8 %378 %358 +%420 = OpIAdd %8 %393 %373 OpLine %3 7272 5 -%406 = OpAccessChain %401 %34 %135 %405 -OpStore %406 %399 +%421 = OpAccessChain %416 %34 %135 %420 +OpStore %421 %414 OpLine %3 7273 5 OpLine %3 7273 5 -%407 = OpIAdd %8 %378 %359 +%422 = OpIAdd %8 %393 %374 OpLine %3 7273 5 -%408 = OpAccessChain %401 %34 %135 %407 -OpStore %408 %393 +%423 = OpAccessChain %416 %34 %135 %422 +OpStore %423 %408 OpLine %3 7274 5 OpLine %3 7274 5 -%409 = OpIAdd %8 %378 %360 +%424 = OpIAdd %8 %393 %375 OpLine %3 7274 5 -%410 = OpAccessChain %401 %34 %135 %409 -OpStore %410 %399 +%425 = OpAccessChain %416 %34 %135 %424 +OpStore %425 %414 OpLine %3 7275 5 OpLine %3 7275 5 -%411 = OpIAdd %8 %378 %205 +%426 = OpIAdd %8 %393 %205 OpLine %3 7275 5 -%412 = OpAccessChain %401 %34 %135 %411 -OpStore %412 %394 +%427 = OpAccessChain %416 %34 %135 %426 +OpStore %427 %409 OpReturn OpFunctionEnd -%413 = OpFunction %8 None %300 -%414 = OpFunctionParameter %8 -%415 = OpFunctionParameter %8 -%416 = OpLabel -%417 = OpIEqual %112 %415 %135 -%418 = OpSelect %8 %417 %126 %415 -%419 = OpUMod %8 %414 %418 -OpReturnValue %419 +%428 = OpFunction %8 None %315 +%429 = OpFunctionParameter %8 +%430 = OpFunctionParameter %8 +%431 = OpLabel +%432 = OpIEqual %112 %430 %135 +%433 = OpSelect %8 %432 %126 %430 +%434 = OpUMod %8 %429 %433 +OpReturnValue %434 OpFunctionEnd -%430 = OpFunction %2 None %354 -%420 = OpLabel -%423 = OpLoad %8 %421 -%432 = OpAccessChain %431 %36 %135 -OpBranch %435 +%445 = OpFunction %2 None %369 %435 = OpLabel +%438 = OpLoad %8 %436 +%447 = OpAccessChain %446 %36 %135 +OpBranch %450 +%450 = OpLabel OpLine %3 7304 19 -%436 = OpIAdd %8 %423 %358 +%451 = OpIAdd %8 %438 %373 OpLine %3 7304 18 -%437 = OpFunctionCall %8 %299 %436 %359 +%452 = OpFunctionCall %8 %314 %451 %374 OpLine %3 7304 13 -%438 = OpFunctionCall %8 %413 %437 %358 -%439 = OpConvertUToF %4 %438 +%453 = OpFunctionCall %8 %428 %452 %373 +%454 = OpConvertUToF %4 %453 OpLine %3 7305 19 -%440 = OpIAdd %8 %423 %126 +%455 = OpIAdd %8 %438 %126 OpLine %3 7305 18 -%441 = OpFunctionCall %8 %299 %440 %359 +%456 = OpFunctionCall %8 %314 %455 %374 OpLine %3 7305 13 -%442 = OpFunctionCall %8 %413 %441 %358 -%443 = OpConvertUToF %4 %442 +%457 = OpFunctionCall %8 %428 %456 %373 +%458 = OpConvertUToF %4 %457 OpLine %3 7306 14 -%444 = OpCompositeConstruct %6 %439 %443 +%459 = OpCompositeConstruct %6 %454 %458 OpLine %3 7308 30 -%445 = OpVectorTimesScalar %6 %444 %81 +%460 = OpVectorTimesScalar %6 %459 %81 OpLine %3 7308 30 -%446 = OpFAdd %6 %434 %445 +%461 = OpFAdd %6 %449 %460 OpLine %3 7308 20 -%447 = OpCompositeConstruct %7 %446 %74 %56 +%462 = OpCompositeConstruct %7 %461 %74 %56 OpLine %3 7311 21 -%448 = OpCompositeExtract %4 %444 0 +%463 = OpCompositeExtract %4 %459 0 OpLine %3 7311 21 -%450 = OpAccessChain %449 %432 %359 -%451 = OpLoad %8 %450 -%452 = OpConvertUToF %4 %451 -%453 = OpFMul %4 %448 %452 -%454 = OpCompositeExtract %4 %444 1 +%465 = OpAccessChain %464 %447 %374 +%466 = OpLoad %8 %465 +%467 = OpConvertUToF %4 %466 +%468 = OpFMul %4 %463 %467 +%469 = OpCompositeExtract %4 %459 1 OpLine %3 7311 17 -%455 = OpAccessChain %449 %432 %359 -%456 = OpLoad %8 %455 -%457 = OpConvertUToF %4 %456 -%458 = OpFMul %4 %454 %457 -%459 = OpFAdd %4 %453 %458 -%460 = OpConvertFToU %8 %459 -OpLine %3 7311 17 -%461 = OpAccessChain %449 %432 %360 -%462 = OpLoad %8 %461 -%463 = OpIAdd %8 %460 %462 -OpLine %3 7313 12 -%464 = OpCompositeConstruct %21 %463 %447 %444 -%465 = OpCompositeExtract %8 %464 0 -OpStore %424 %465 -%466 = OpCompositeExtract %7 %464 1 -OpStore %426 %466 -%467 = OpCompositeExtract %6 %464 2 -OpStore %428 %467 -OpReturn -OpFunctionEnd -%480 = OpFunction %2 None %354 -%468 = OpLabel -%483 = OpVariable %215 Function %74 -%484 = OpVariable %218 Function %135 +%470 = OpAccessChain %464 %447 %374 %471 = OpLoad %8 %470 -%474 = OpLoad %7 %472 -%477 = OpLoad %6 %475 -%469 = OpCompositeConstruct %21 %471 %474 %477 -%481 = OpAccessChain %431 %36 %135 -OpBranch %485 -%485 = OpLabel +%472 = OpConvertUToF %4 %471 +%473 = OpFMul %4 %469 %472 +%474 = OpFAdd %4 %468 %473 +%475 = OpConvertFToU %8 %474 +OpLine %3 7311 17 +%476 = OpAccessChain %464 %447 %375 +%477 = OpLoad %8 %476 +%478 = OpIAdd %8 %475 %477 +OpLine %3 7313 12 +%479 = OpCompositeConstruct %21 %478 %462 %459 +%480 = OpCompositeExtract %8 %479 0 +OpStore %439 %480 +%481 = OpCompositeExtract %7 %479 1 +OpStore %441 %481 +%482 = OpCompositeExtract %6 %479 2 +OpStore %443 %482 +OpReturn +OpFunctionEnd +%495 = OpFunction %2 None %369 +%483 = OpLabel +%498 = OpVariable %215 Function %74 +%499 = OpVariable %218 Function %135 +%486 = OpLoad %8 %485 +%489 = OpLoad %7 %487 +%492 = OpLoad %6 %490 +%484 = OpCompositeConstruct %21 %486 %489 %492 +%496 = OpAccessChain %446 %36 %135 +OpBranch %500 +%500 = OpLabel OpLine %3 7324 17 -%486 = OpCompositeExtract %6 %469 2 -%487 = OpCompositeExtract %4 %486 0 +%501 = OpCompositeExtract %6 %484 2 +%502 = OpCompositeExtract %4 %501 0 OpLine %3 7324 17 -%488 = OpAccessChain %449 %481 %359 -%489 = OpLoad %8 %488 -%490 = OpConvertUToF %4 %489 -%491 = OpFMul %4 %487 %490 -%492 = OpCompositeExtract %6 %469 2 -%493 = OpCompositeExtract %4 %492 1 -OpLine %3 7324 70 -%494 = OpAccessChain %449 %481 %359 -%495 = OpLoad %8 %494 -OpLine %3 7324 13 -%496 = OpAccessChain %449 %481 %359 -%497 = OpLoad %8 %496 -%498 = OpIMul %8 %495 %497 -%499 = OpConvertUToF %4 %498 -%500 = OpFMul %4 %493 %499 -%501 = OpFAdd %4 %491 %500 -%502 = OpConvertFToU %8 %501 -OpLine %3 7324 13 -%503 = OpAccessChain %449 %481 %360 +%503 = OpAccessChain %464 %496 %374 %504 = OpLoad %8 %503 -%505 = OpIAdd %8 %502 %504 +%505 = OpConvertUToF %4 %504 +%506 = OpFMul %4 %502 %505 +%507 = OpCompositeExtract %6 %484 2 +%508 = OpCompositeExtract %4 %507 1 +OpLine %3 7324 70 +%509 = OpAccessChain %464 %496 %374 +%510 = OpLoad %8 %509 +OpLine %3 7324 13 +%511 = OpAccessChain %464 %496 %374 +%512 = OpLoad %8 %511 +%513 = OpIMul %8 %510 %512 +%514 = OpConvertUToF %4 %513 +%515 = OpFMul %4 %508 %514 +%516 = OpFAdd %4 %506 %515 +%517 = OpConvertFToU %8 %516 +OpLine %3 7324 13 +%518 = OpAccessChain %464 %496 %375 +%519 = OpLoad %8 %518 +%520 = OpIAdd %8 %517 %519 OpLine %3 7325 32 -%506 = OpConvertUToF %4 %505 +%521 = OpConvertUToF %4 %520 OpLine %3 7325 22 -%507 = OpFDiv %4 %506 %482 -%508 = OpExtInst %4 %1 Floor %507 -%509 = OpConvertFToU %8 %508 +%522 = OpFDiv %4 %521 %497 +%523 = OpExtInst %4 %1 Floor %522 +%524 = OpConvertFToU %8 %523 OpLine %3 7326 22 -%510 = OpFunctionCall %8 %413 %505 %357 +%525 = OpFunctionCall %8 %428 %520 %372 OpLine %3 7328 36 -%511 = OpAccessChain %363 %481 %135 -%512 = OpLoad %10 %511 +%526 = OpAccessChain %378 %496 %135 +%527 = OpLoad %10 %526 OpLine %3 7328 57 -%513 = OpAccessChain %366 %481 %126 -%514 = OpLoad %11 %513 +%528 = OpAccessChain %381 %496 %126 +%529 = OpLoad %11 %528 OpLine %3 7328 13 -%515 = OpFunctionCall %6 %311 %509 %512 %514 +%530 = OpFunctionCall %6 %326 %524 %527 %529 OpLine %3 7329 31 -%516 = OpAccessChain %372 %481 %358 -%517 = OpLoad %6 %516 +%531 = OpAccessChain %387 %496 %373 +%532 = OpLoad %6 %531 OpLine %3 7329 13 -%518 = OpFunctionCall %14 %270 %515 %517 +%533 = OpFunctionCall %14 %285 %530 %532 OpLine %3 7333 5 -OpSelectionMerge %519 None -OpSwitch %510 %526 0 %520 1 %521 2 %522 3 %523 4 %524 5 %525 -%520 = OpLabel +OpSelectionMerge %534 None +OpSwitch %525 %541 0 %535 1 %536 2 %537 3 %538 4 %539 5 %540 +%535 = OpLabel OpLine %3 7334 37 -%527 = OpCompositeExtract %5 %518 0 -%528 = OpCompositeExtract %4 %527 0 +%542 = OpCompositeExtract %5 %533 0 +%543 = OpCompositeExtract %4 %542 0 OpLine %3 7334 20 -OpStore %483 %528 -OpBranch %519 -%521 = OpLabel +OpStore %498 %543 +OpBranch %534 +%536 = OpLabel OpLine %3 7335 37 -%529 = OpCompositeExtract %5 %518 0 -%530 = OpCompositeExtract %4 %529 1 +%544 = OpCompositeExtract %5 %533 0 +%545 = OpCompositeExtract %4 %544 1 OpLine %3 7335 20 -OpStore %483 %530 -OpBranch %519 -%522 = OpLabel +OpStore %498 %545 +OpBranch %534 +%537 = OpLabel OpLine %3 7336 37 -%531 = OpCompositeExtract %5 %518 0 -%532 = OpCompositeExtract %4 %531 2 +%546 = OpCompositeExtract %5 %533 0 +%547 = OpCompositeExtract %4 %546 2 OpLine %3 7336 20 -OpStore %483 %532 -OpBranch %519 -%523 = OpLabel +OpStore %498 %547 +OpBranch %534 +%538 = OpLabel OpLine %3 7337 37 -%533 = OpCompositeExtract %5 %518 1 -%534 = OpCompositeExtract %4 %533 0 +%548 = OpCompositeExtract %5 %533 1 +%549 = OpCompositeExtract %4 %548 0 OpLine %3 7337 20 -OpStore %483 %534 -OpBranch %519 -%524 = OpLabel +OpStore %498 %549 +OpBranch %534 +%539 = OpLabel OpLine %3 7338 37 -%535 = OpCompositeExtract %5 %518 1 -%536 = OpCompositeExtract %4 %535 1 +%550 = OpCompositeExtract %5 %533 1 +%551 = OpCompositeExtract %4 %550 1 OpLine %3 7338 20 -OpStore %483 %536 -OpBranch %519 -%525 = OpLabel +OpStore %498 %551 +OpBranch %534 +%540 = OpLabel OpLine %3 7339 37 -%537 = OpCompositeExtract %5 %518 1 -%538 = OpCompositeExtract %4 %537 2 +%552 = OpCompositeExtract %5 %533 1 +%553 = OpCompositeExtract %4 %552 2 OpLine %3 7339 20 -OpStore %483 %538 -OpBranch %519 -%526 = OpLabel -OpBranch %519 -%519 = OpLabel +OpStore %498 %553 +OpBranch %534 +%541 = OpLabel +OpBranch %534 +%534 = OpLabel OpLine %3 7343 15 -%539 = OpAccessChain %379 %481 %135 %135 -%540 = OpLoad %8 %539 -%541 = OpFunctionCall %8 %299 %509 %540 -%542 = OpIAdd %8 %509 %541 +%554 = OpAccessChain %394 %496 %135 %135 +%555 = OpLoad %8 %554 +%556 = OpFunctionCall %8 %314 %524 %555 +%557 = OpIAdd %8 %524 %556 OpLine %3 7344 15 -%543 = OpIAdd %8 %542 %126 +%558 = OpIAdd %8 %557 %126 OpLine %3 7345 15 -%544 = OpAccessChain %379 %481 %135 %135 -%545 = OpLoad %8 %544 -%546 = OpIAdd %8 %542 %545 +%559 = OpAccessChain %394 %496 %135 %135 +%560 = OpLoad %8 %559 +%561 = OpIAdd %8 %557 %560 OpLine %3 7345 15 -%547 = OpIAdd %8 %546 %126 +%562 = OpIAdd %8 %561 %126 OpLine %3 7346 15 -%548 = OpIAdd %8 %547 %126 +%563 = OpIAdd %8 %562 %126 OpLine %3 7349 5 -OpSelectionMerge %549 None -OpSwitch %510 %554 0 %550 3 %550 2 %551 4 %551 1 %552 5 %553 -%550 = OpLabel +OpSelectionMerge %564 None +OpSwitch %525 %569 0 %565 3 %565 2 %566 4 %566 1 %567 5 %568 +%565 = OpLabel OpLine %3 7350 24 -OpStore %484 %542 -OpBranch %549 -%551 = OpLabel +OpStore %499 %557 +OpBranch %564 +%566 = OpLabel OpLine %3 7351 24 -OpStore %484 %548 -OpBranch %549 -%552 = OpLabel +OpStore %499 %563 +OpBranch %564 +%567 = OpLabel OpLine %3 7352 20 -OpStore %484 %547 -OpBranch %549 -%553 = OpLabel +OpStore %499 %562 +OpBranch %564 +%568 = OpLabel OpLine %3 7353 20 -OpStore %484 %543 -OpBranch %549 -%554 = OpLabel -OpBranch %549 -%549 = OpLabel +OpStore %499 %558 +OpBranch %564 +%569 = OpLabel +OpBranch %564 +%564 = OpLabel OpLine %3 7356 13 -%555 = OpCompositeExtract %8 %469 0 +%570 = OpCompositeExtract %8 %484 0 OpLine %3 7356 5 -OpStore %484 %555 +OpStore %499 %570 OpLine %3 7365 27 -%556 = OpLoad %4 %483 -%557 = OpBitcast %8 %556 +%571 = OpLoad %4 %498 +%572 = OpBitcast %8 %571 OpLine %3 7366 12 -%558 = OpLoad %8 %484 -%559 = OpCompositeConstruct %22 %557 %558 -%560 = OpCompositeExtract %8 %559 0 -OpStore %478 %560 -%561 = OpCompositeExtract %8 %559 1 -OpStore %479 %561 +%573 = OpLoad %8 %499 +%574 = OpCompositeConstruct %22 %572 %573 +%575 = OpCompositeExtract %8 %574 0 +OpStore %493 %575 +%576 = OpCompositeExtract %8 %574 1 +OpStore %494 %576 OpReturn OpFunctionEnd -%573 = OpFunction %2 None %354 -%562 = OpLabel -%566 = OpLoad %5 %564 -%568 = OpLoad %5 %567 -%563 = OpCompositeConstruct %14 %566 %568 -%575 = OpAccessChain %574 %39 %135 -OpBranch %576 -%576 = OpLabel +%588 = OpFunction %2 None %369 +%577 = OpLabel +%581 = OpLoad %5 %579 +%583 = OpLoad %5 %582 +%578 = OpCompositeConstruct %14 %581 %583 +%590 = OpAccessChain %589 %39 %135 +OpBranch %591 +%591 = OpLabel OpLine %3 7397 25 -%578 = OpAccessChain %577 %575 %126 -%579 = OpLoad %23 %578 -%580 = OpCompositeExtract %5 %563 0 +%593 = OpAccessChain %592 %590 %126 +%594 = OpLoad %23 %593 +%595 = OpCompositeExtract %5 %578 0 OpLine %3 7397 25 -%581 = OpCompositeConstruct %7 %580 %56 -%582 = OpMatrixTimesVector %7 %579 %581 +%596 = OpCompositeConstruct %7 %595 %56 +%597 = OpMatrixTimesVector %7 %594 %596 OpLine %3 7398 18 -%583 = OpCompositeExtract %5 %563 1 +%598 = OpCompositeExtract %5 %578 1 OpLine %3 7399 12 -%584 = OpCompositeExtract %5 %563 0 -%585 = OpCompositeConstruct %26 %582 %583 %584 -%586 = OpCompositeExtract %7 %585 0 -OpStore %569 %586 -%587 = OpCompositeExtract %5 %585 1 -OpStore %570 %587 -%588 = OpCompositeExtract %5 %585 2 -OpStore %572 %588 +%599 = OpCompositeExtract %5 %578 0 +%600 = OpCompositeConstruct %26 %597 %598 %599 +%601 = OpCompositeExtract %7 %600 0 +OpStore %584 %601 +%602 = OpCompositeExtract %5 %600 1 +OpStore %585 %602 +%603 = OpCompositeExtract %5 %600 2 +OpStore %587 %603 OpReturn OpFunctionEnd -%598 = OpFunction %2 None %354 -%589 = OpLabel -%607 = OpVariable %95 Function %608 -%592 = OpLoad %7 %591 -%594 = OpLoad %5 %593 -%596 = OpLoad %5 %595 -%590 = OpCompositeConstruct %26 %592 %594 %596 -%599 = OpAccessChain %574 %39 %135 -%601 = OpAccessChain %600 %42 %135 -OpBranch %609 -%609 = OpLabel +%613 = OpFunction %2 None %369 +%604 = OpLabel +%622 = OpVariable %95 Function %623 +%607 = OpLoad %7 %606 +%609 = OpLoad %5 %608 +%611 = OpLoad %5 %610 +%605 = OpCompositeConstruct %26 %607 %609 %611 +%614 = OpAccessChain %589 %39 %135 +%616 = OpAccessChain %615 %42 %135 +OpBranch %624 +%624 = OpLabel OpLine %3 7421 28 OpLine %3 7421 17 -%610 = OpCompositeExtract %5 %590 2 -%611 = OpExtInst %5 %1 Fract %610 -%612 = OpExtInst %5 %1 SmoothStep %80 %602 %611 +%625 = OpCompositeExtract %5 %605 2 +%626 = OpExtInst %5 %1 Fract %625 +%627 = OpExtInst %5 %1 SmoothStep %80 %617 %626 OpLine %3 7421 5 -OpStore %607 %612 +OpStore %622 %627 OpLine %3 7422 17 OpLine %3 7422 13 -%613 = OpAccessChain %125 %607 %135 -%614 = OpLoad %4 %613 -%615 = OpAccessChain %125 %607 %126 -%616 = OpLoad %4 %615 -%617 = OpFMul %4 %614 %616 -%618 = OpAccessChain %125 %607 %358 -%619 = OpLoad %4 %618 -%620 = OpFMul %4 %617 %619 -%621 = OpCompositeConstruct %5 %620 %620 %620 -%622 = OpExtInst %5 %1 FMix %604 %606 %621 +%628 = OpAccessChain %125 %622 %135 +%629 = OpLoad %4 %628 +%630 = OpAccessChain %125 %622 %126 +%631 = OpLoad %4 %630 +%632 = OpFMul %4 %629 %631 +%633 = OpAccessChain %125 %622 %373 +%634 = OpLoad %4 %633 +%635 = OpFMul %4 %632 %634 +%636 = OpCompositeConstruct %5 %635 %635 %635 +%637 = OpExtInst %5 %1 FMix %619 %621 %636 OpLine %3 7422 5 -OpStore %607 %622 +OpStore %622 %637 OpLine %3 7425 25 -%624 = OpAccessChain %623 %601 %126 -%625 = OpLoad %5 %624 -%626 = OpVectorTimesScalar %5 %625 %272 +%639 = OpAccessChain %638 %616 %126 +%640 = OpLoad %5 %639 +%641 = OpVectorTimesScalar %5 %640 %287 OpLine %3 7427 21 -%627 = OpAccessChain %623 %601 %135 -%628 = OpLoad %5 %627 -%629 = OpCompositeExtract %5 %590 2 -%630 = OpFSub %5 %628 %629 -%631 = OpExtInst %5 %1 Normalize %630 +%642 = OpAccessChain %638 %616 %135 +%643 = OpLoad %5 %642 +%644 = OpCompositeExtract %5 %605 2 +%645 = OpFSub %5 %643 %644 +%646 = OpExtInst %5 %1 Normalize %645 OpLine %3 7428 20 -%633 = OpAccessChain %632 %599 %135 -%634 = OpLoad %7 %633 -%635 = OpVectorShuffle %5 %634 %634 0 1 2 -%636 = OpCompositeExtract %5 %590 2 -%637 = OpFSub %5 %635 %636 -%638 = OpExtInst %5 %1 Normalize %637 +%648 = OpAccessChain %647 %614 %135 +%649 = OpLoad %7 %648 +%650 = OpVectorShuffle %5 %649 %649 0 1 2 +%651 = OpCompositeExtract %5 %605 2 +%652 = OpFSub %5 %650 %651 +%653 = OpExtInst %5 %1 Normalize %652 OpLine %3 7429 20 -%639 = OpFAdd %5 %638 %631 -%640 = OpExtInst %5 %1 Normalize %639 +%654 = OpFAdd %5 %653 %646 +%655 = OpExtInst %5 %1 Normalize %654 OpLine %3 7431 32 -%641 = OpCompositeExtract %5 %590 1 -%642 = OpDot %4 %641 %631 +%656 = OpCompositeExtract %5 %605 1 +%657 = OpDot %4 %656 %646 OpLine %3 7431 28 -%643 = OpExtInst %4 %1 FMax %642 %74 +%658 = OpExtInst %4 %1 FMax %657 %74 OpLine %3 7432 25 -%644 = OpAccessChain %623 %601 %126 -%645 = OpLoad %5 %644 -%646 = OpVectorTimesScalar %5 %645 %643 +%659 = OpAccessChain %638 %616 %126 +%660 = OpLoad %5 %659 +%661 = OpVectorTimesScalar %5 %660 %658 OpLine %3 7434 37 -%647 = OpCompositeExtract %5 %590 1 -%648 = OpDot %4 %647 %640 +%662 = OpCompositeExtract %5 %605 1 +%663 = OpDot %4 %662 %655 OpLine %3 7434 33 -%649 = OpExtInst %4 %1 FMax %648 %74 +%664 = OpExtInst %4 %1 FMax %663 %74 OpLine %3 7434 29 -%650 = OpExtInst %4 %1 Pow %649 %331 +%665 = OpExtInst %4 %1 Pow %664 %346 OpLine %3 7435 26 -%651 = OpAccessChain %623 %601 %126 -%652 = OpLoad %5 %651 -%653 = OpVectorTimesScalar %5 %652 %650 +%666 = OpAccessChain %638 %616 %126 +%667 = OpLoad %5 %666 +%668 = OpVectorTimesScalar %5 %667 %665 OpLine %3 7437 18 -%654 = OpFAdd %5 %626 %646 -%655 = OpFAdd %5 %654 %653 -%656 = OpLoad %5 %607 -%657 = OpFMul %5 %655 %656 +%669 = OpFAdd %5 %641 %661 +%670 = OpFAdd %5 %669 %668 +%671 = OpLoad %5 %622 +%672 = OpFMul %5 %670 %671 OpLine %3 7439 12 -%658 = OpCompositeConstruct %7 %657 %56 -OpStore %597 %658 +%673 = OpCompositeConstruct %7 %672 %56 +OpStore %612 %673 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/debug-symbol-simple.spvasm b/naga/tests/out/spv/debug-symbol-simple.spvasm index e525177f28..8315032b65 100644 --- a/naga/tests/out/spv/debug-symbol-simple.spvasm +++ b/naga/tests/out/spv/debug-symbol-simple.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 94 +; Bound: 111 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 @@ -60,6 +60,7 @@ OpName %49 "fs_main" OpName %55 "color" OpName %57 "i" OpName %59 "ii" +OpName %75 "loop_bound" OpMemberDecorate %6 0 Offset 0 OpMemberDecorate %6 1 Offset 16 OpMemberDecorate %8 0 Offset 0 @@ -107,8 +108,14 @@ OpDecorate %48 Location 0 %58 = OpTypePointer Function %9 %60 = OpTypePointer Function %4 %61 = OpConstantNull %4 -%69 = OpTypeBool -%77 = OpTypePointer Function %4 +%68 = OpTypeVector %31 2 +%69 = OpTypePointer Function %68 +%70 = OpTypeBool +%71 = OpTypeVector %70 2 +%72 = OpConstantComposite %68 %36 %36 +%73 = OpConstant %31 4294967295 +%74 = OpConstantComposite %68 %73 %73 +%94 = OpTypePointer Function %4 %21 = OpFunction %2 None %22 %10 = OpLabel %24 = OpVariable %25 Function %26 @@ -142,6 +149,7 @@ OpFunctionEnd %55 = OpVariable %28 Function %56 %57 = OpVariable %58 Function %50 %59 = OpVariable %60 Function %61 +%75 = OpVariable %69 Function %72 %45 = OpLoad %7 %43 %47 = OpLoad %5 %46 %42 = OpCompositeConstruct %8 %45 %47 @@ -155,60 +163,74 @@ OpBranch %64 %64 = OpLabel OpLine %3 26 5 OpLoopMerge %65 %67 None +OpBranch %76 +%76 = OpLabel +%77 = OpLoad %68 %75 +%78 = OpIEqual %71 %74 %77 +%79 = OpAll %70 %78 +OpSelectionMerge %80 None +OpBranchConditional %79 %65 %80 +%80 = OpLabel +%81 = OpCompositeExtract %31 %77 1 +%82 = OpIEqual %70 %81 %73 +%83 = OpSelect %31 %82 %30 %36 +%84 = OpCompositeConstruct %68 %83 %30 +%85 = OpIAdd %68 %77 %84 +OpStore %75 %85 OpBranch %66 %66 = OpLabel OpLine %3 1 1 -%68 = OpLoad %9 %57 +%86 = OpLoad %9 %57 OpLine %3 26 21 -%70 = OpSLessThan %69 %68 %51 +%87 = OpSLessThan %70 %86 %51 OpLine %3 26 20 -OpSelectionMerge %71 None -OpBranchConditional %70 %71 %72 -%72 = OpLabel +OpSelectionMerge %88 None +OpBranchConditional %87 %88 %89 +%89 = OpLabel OpBranch %65 -%71 = OpLabel -OpBranch %73 -%73 = OpLabel +%88 = OpLabel +OpBranch %90 +%90 = OpLabel OpLine %3 27 18 -%75 = OpLoad %9 %57 -%76 = OpConvertSToF %4 %75 +%92 = OpLoad %9 %57 +%93 = OpConvertSToF %4 %92 OpLine %3 27 9 -OpStore %59 %76 +OpStore %59 %93 OpLine %3 28 9 -%78 = OpLoad %4 %59 +%95 = OpLoad %4 %59 OpLine %3 28 9 -%79 = OpFMul %4 %78 %52 -%80 = OpAccessChain %77 %55 %36 -%81 = OpLoad %4 %80 -%82 = OpFAdd %4 %81 %79 +%96 = OpFMul %4 %95 %52 +%97 = OpAccessChain %94 %55 %36 +%98 = OpLoad %4 %97 +%99 = OpFAdd %4 %98 %96 OpLine %3 28 9 -%83 = OpAccessChain %77 %55 %36 -OpStore %83 %82 +%100 = OpAccessChain %94 %55 %36 +OpStore %100 %99 OpLine %3 29 9 -%84 = OpLoad %4 %59 +%101 = OpLoad %4 %59 OpLine %3 29 9 -%85 = OpFMul %4 %84 %53 -%86 = OpAccessChain %77 %55 %30 -%87 = OpLoad %4 %86 -%88 = OpFAdd %4 %87 %85 +%102 = OpFMul %4 %101 %53 +%103 = OpAccessChain %94 %55 %30 +%104 = OpLoad %4 %103 +%105 = OpFAdd %4 %104 %102 OpLine %3 29 9 -%89 = OpAccessChain %77 %55 %30 -OpStore %89 %88 -OpBranch %74 -%74 = OpLabel +%106 = OpAccessChain %94 %55 %30 +OpStore %106 %105 +OpBranch %91 +%91 = OpLabel OpBranch %67 %67 = OpLabel OpLine %3 26 29 -%90 = OpLoad %9 %57 -%91 = OpIAdd %9 %90 %54 +%107 = OpLoad %9 %57 +%108 = OpIAdd %9 %107 %54 OpLine %3 26 29 -OpStore %57 %91 +OpStore %57 %108 OpBranch %64 %65 = OpLabel OpLine %3 1 1 -%92 = OpLoad %5 %55 +%109 = OpLoad %5 %55 OpLine %3 32 12 -%93 = OpCompositeConstruct %7 %92 %23 -OpStore %48 %93 +%110 = OpCompositeConstruct %7 %109 %23 +OpStore %48 %110 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 e8d7d141e7..aba39dd9e1 100644 --- a/naga/tests/out/spv/debug-symbol-terrain.spvasm +++ b/naga/tests/out/spv/debug-symbol-terrain.spvasm @@ -1,19 +1,19 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 659 +; Bound: 674 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %353 "gen_terrain_compute" %350 -OpEntryPoint Vertex %430 "gen_terrain_vertex" %421 %424 %426 %428 -OpEntryPoint Fragment %480 "gen_terrain_fragment" %470 %472 %475 %478 %479 -OpEntryPoint Vertex %573 "vs_main" %564 %567 %569 %570 %572 -OpEntryPoint Fragment %598 "fs_main" %591 %593 %595 %597 -OpExecutionMode %353 LocalSize 64 1 1 -OpExecutionMode %480 OriginUpperLeft -OpExecutionMode %598 OriginUpperLeft +OpEntryPoint GLCompute %368 "gen_terrain_compute" %365 +OpEntryPoint Vertex %445 "gen_terrain_vertex" %436 %439 %441 %443 +OpEntryPoint Fragment %495 "gen_terrain_fragment" %485 %487 %490 %493 %494 +OpEntryPoint Vertex %588 "vs_main" %579 %582 %584 %585 %587 +OpEntryPoint Fragment %613 "fs_main" %606 %608 %610 %612 +OpExecutionMode %368 LocalSize 64 1 1 +OpExecutionMode %495 OriginUpperLeft +OpExecutionMode %613 OriginUpperLeft %3 = OpString "debug-symbol-terrain.wgsl" OpSource Unknown 0 %3 "// Taken from https://github.com/sotrh/learn-wgpu/blob/11820796f5e1dbce42fb1119f04ddeb4b167d2a0/code/intermediate/tutorial13-terrain/src/terrain.wgsl // ============================ @@ -370,50 +370,51 @@ OpName %212 "x" OpName %214 "v" OpName %216 "a" OpName %217 "i" -OpName %255 "p" -OpName %256 "min_max_height" -OpName %257 "terrain_point" -OpName %268 "p" -OpName %269 "min_max_height" -OpName %270 "terrain_vertex" -OpName %299 "naga_div" -OpName %301 "lhs" -OpName %302 "rhs" -OpName %308 "vert_index" -OpName %309 "chunk_size" -OpName %310 "chunk_corner" -OpName %311 "index_to_p" -OpName %327 "p" -OpName %328 "color23" -OpName %350 "gid" -OpName %353 "gen_terrain_compute" -OpName %413 "naga_mod" -OpName %414 "lhs" -OpName %415 "rhs" -OpName %421 "vindex" -OpName %424 "index" -OpName %426 "position" -OpName %428 "uv" -OpName %430 "gen_terrain_vertex" -OpName %470 "index" -OpName %472 "position" -OpName %475 "uv" -OpName %478 "vert_component" -OpName %479 "index" -OpName %480 "gen_terrain_fragment" -OpName %483 "vert_component" -OpName %484 "index" -OpName %564 "position" -OpName %567 "normal" -OpName %569 "clip_position" -OpName %570 "normal" -OpName %572 "world_pos" -OpName %573 "vs_main" -OpName %591 "clip_position" -OpName %593 "normal" -OpName %595 "world_pos" -OpName %598 "fs_main" -OpName %607 "color" +OpName %237 "loop_bound" +OpName %270 "p" +OpName %271 "min_max_height" +OpName %272 "terrain_point" +OpName %283 "p" +OpName %284 "min_max_height" +OpName %285 "terrain_vertex" +OpName %314 "naga_div" +OpName %316 "lhs" +OpName %317 "rhs" +OpName %323 "vert_index" +OpName %324 "chunk_size" +OpName %325 "chunk_corner" +OpName %326 "index_to_p" +OpName %342 "p" +OpName %343 "color23" +OpName %365 "gid" +OpName %368 "gen_terrain_compute" +OpName %428 "naga_mod" +OpName %429 "lhs" +OpName %430 "rhs" +OpName %436 "vindex" +OpName %439 "index" +OpName %441 "position" +OpName %443 "uv" +OpName %445 "gen_terrain_vertex" +OpName %485 "index" +OpName %487 "position" +OpName %490 "uv" +OpName %493 "vert_component" +OpName %494 "index" +OpName %495 "gen_terrain_fragment" +OpName %498 "vert_component" +OpName %499 "index" +OpName %579 "position" +OpName %582 "normal" +OpName %584 "clip_position" +OpName %585 "normal" +OpName %587 "world_pos" +OpName %588 "vs_main" +OpName %606 "clip_position" +OpName %608 "normal" +OpName %610 "world_pos" +OpName %613 "fs_main" +OpName %622 "color" OpMemberDecorate %13 0 Offset 0 OpMemberDecorate %13 1 Offset 8 OpMemberDecorate %13 2 Offset 16 @@ -472,27 +473,27 @@ OpDecorate %49 DescriptorSet 2 OpDecorate %49 Binding 2 OpDecorate %50 DescriptorSet 2 OpDecorate %50 Binding 3 -OpDecorate %350 BuiltIn GlobalInvocationId -OpDecorate %421 BuiltIn VertexIndex -OpDecorate %424 Location 0 -OpDecorate %424 Flat -OpDecorate %426 BuiltIn Position -OpDecorate %428 Location 1 -OpDecorate %470 Location 0 -OpDecorate %470 Flat -OpDecorate %472 BuiltIn FragCoord -OpDecorate %475 Location 1 -OpDecorate %478 Location 0 -OpDecorate %479 Location 1 -OpDecorate %564 Location 0 -OpDecorate %567 Location 1 -OpDecorate %569 BuiltIn Position -OpDecorate %570 Location 0 -OpDecorate %572 Location 1 -OpDecorate %591 BuiltIn FragCoord -OpDecorate %593 Location 0 -OpDecorate %595 Location 1 -OpDecorate %597 Location 0 +OpDecorate %365 BuiltIn GlobalInvocationId +OpDecorate %436 BuiltIn VertexIndex +OpDecorate %439 Location 0 +OpDecorate %439 Flat +OpDecorate %441 BuiltIn Position +OpDecorate %443 Location 1 +OpDecorate %485 Location 0 +OpDecorate %485 Flat +OpDecorate %487 BuiltIn FragCoord +OpDecorate %490 Location 1 +OpDecorate %493 Location 0 +OpDecorate %494 Location 1 +OpDecorate %579 Location 0 +OpDecorate %582 Location 1 +OpDecorate %584 BuiltIn Position +OpDecorate %585 Location 0 +OpDecorate %587 Location 1 +OpDecorate %606 BuiltIn FragCoord +OpDecorate %608 Location 0 +OpDecorate %610 Location 1 +OpDecorate %612 Location 0 %2 = OpTypeVoid %4 = OpTypeFloat 32 %5 = OpTypeVector %4 3 @@ -587,81 +588,85 @@ OpDecorate %597 Location 0 %213 = OpConstantNull %6 %215 = OpTypePointer Function %4 %218 = OpTypePointer Function %8 -%258 = OpTypeFunction %5 %6 %6 -%271 = OpTypeFunction %14 %6 %6 -%272 = OpConstant %4 0.1 -%273 = OpConstantComposite %6 %272 %74 -%274 = OpConstantComposite %6 %74 %272 -%275 = OpConstant %4 -0.1 -%276 = OpConstantComposite %6 %275 %74 -%277 = OpConstantComposite %6 %74 %275 -%300 = OpTypeFunction %8 %8 %8 -%312 = OpTypeFunction %6 %8 %10 %11 -%329 = OpTypeFunction %5 %6 -%330 = OpConstant %4 23.0 -%331 = OpConstant %4 32.0 -%332 = OpConstantComposite %6 %330 %331 -%333 = OpConstant %4 -43.0 -%334 = OpConstant %4 3.0 -%335 = OpConstantComposite %6 %333 %334 -%351 = OpTypePointer Input %19 -%350 = OpVariable %351 Input -%354 = OpTypeFunction %2 -%355 = OpTypePointer Uniform %13 -%357 = OpConstant %8 6 -%358 = OpConstant %8 2 -%359 = OpConstant %8 3 -%360 = OpConstant %8 4 -%363 = OpTypePointer Uniform %10 -%366 = OpTypePointer Uniform %11 -%370 = OpTypePointer StorageBuffer %15 -%371 = OpTypePointer StorageBuffer %14 -%372 = OpTypePointer Uniform %6 -%379 = OpTypePointer Uniform %8 -%400 = OpTypePointer StorageBuffer %17 -%401 = OpTypePointer StorageBuffer %8 -%422 = OpTypePointer Input %8 -%421 = OpVariable %422 Input -%425 = OpTypePointer Output %8 -%424 = OpVariable %425 Output -%427 = OpTypePointer Output %7 -%426 = OpVariable %427 Output -%429 = OpTypePointer Output %6 -%428 = OpVariable %429 Output -%431 = OpTypePointer Uniform %20 -%433 = OpConstant %4 -1.0 -%434 = OpConstantComposite %6 %433 %433 -%449 = OpTypePointer Uniform %8 -%470 = OpVariable %422 Input -%473 = OpTypePointer Input %7 -%472 = OpVariable %473 Input -%476 = OpTypePointer Input %6 -%475 = OpVariable %476 Input -%478 = OpVariable %425 Output -%479 = OpVariable %425 Output -%482 = OpConstant %4 6.0 -%565 = OpTypePointer Input %5 -%564 = OpVariable %565 Input -%567 = OpVariable %565 Input -%569 = OpVariable %427 Output -%571 = OpTypePointer Output %5 -%570 = OpVariable %571 Output -%572 = OpVariable %571 Output -%574 = OpTypePointer Uniform %24 -%577 = OpTypePointer Uniform %23 -%591 = OpVariable %473 Input -%593 = OpVariable %565 Input -%595 = OpVariable %565 Input -%597 = OpVariable %427 Output -%600 = OpTypePointer Uniform %25 -%602 = OpConstantComposite %5 %272 %272 %272 -%603 = OpConstant %4 0.7 -%604 = OpConstantComposite %5 %78 %272 %603 -%605 = OpConstant %4 0.2 -%606 = OpConstantComposite %5 %605 %605 %605 -%608 = OpConstantNull %5 -%623 = OpTypePointer Uniform %5 -%632 = OpTypePointer Uniform %7 +%233 = OpTypePointer Function %10 +%234 = OpConstantComposite %10 %135 %135 +%235 = OpConstant %8 4294967295 +%236 = OpConstantComposite %10 %235 %235 +%273 = OpTypeFunction %5 %6 %6 +%286 = OpTypeFunction %14 %6 %6 +%287 = OpConstant %4 0.1 +%288 = OpConstantComposite %6 %287 %74 +%289 = OpConstantComposite %6 %74 %287 +%290 = OpConstant %4 -0.1 +%291 = OpConstantComposite %6 %290 %74 +%292 = OpConstantComposite %6 %74 %290 +%315 = OpTypeFunction %8 %8 %8 +%327 = OpTypeFunction %6 %8 %10 %11 +%344 = OpTypeFunction %5 %6 +%345 = OpConstant %4 23.0 +%346 = OpConstant %4 32.0 +%347 = OpConstantComposite %6 %345 %346 +%348 = OpConstant %4 -43.0 +%349 = OpConstant %4 3.0 +%350 = OpConstantComposite %6 %348 %349 +%366 = OpTypePointer Input %19 +%365 = OpVariable %366 Input +%369 = OpTypeFunction %2 +%370 = OpTypePointer Uniform %13 +%372 = OpConstant %8 6 +%373 = OpConstant %8 2 +%374 = OpConstant %8 3 +%375 = OpConstant %8 4 +%378 = OpTypePointer Uniform %10 +%381 = OpTypePointer Uniform %11 +%385 = OpTypePointer StorageBuffer %15 +%386 = OpTypePointer StorageBuffer %14 +%387 = OpTypePointer Uniform %6 +%394 = OpTypePointer Uniform %8 +%415 = OpTypePointer StorageBuffer %17 +%416 = OpTypePointer StorageBuffer %8 +%437 = OpTypePointer Input %8 +%436 = OpVariable %437 Input +%440 = OpTypePointer Output %8 +%439 = OpVariable %440 Output +%442 = OpTypePointer Output %7 +%441 = OpVariable %442 Output +%444 = OpTypePointer Output %6 +%443 = OpVariable %444 Output +%446 = OpTypePointer Uniform %20 +%448 = OpConstant %4 -1.0 +%449 = OpConstantComposite %6 %448 %448 +%464 = OpTypePointer Uniform %8 +%485 = OpVariable %437 Input +%488 = OpTypePointer Input %7 +%487 = OpVariable %488 Input +%491 = OpTypePointer Input %6 +%490 = OpVariable %491 Input +%493 = OpVariable %440 Output +%494 = OpVariable %440 Output +%497 = OpConstant %4 6.0 +%580 = OpTypePointer Input %5 +%579 = OpVariable %580 Input +%582 = OpVariable %580 Input +%584 = OpVariable %442 Output +%586 = OpTypePointer Output %5 +%585 = OpVariable %586 Output +%587 = OpVariable %586 Output +%589 = OpTypePointer Uniform %24 +%592 = OpTypePointer Uniform %23 +%606 = OpVariable %488 Input +%608 = OpVariable %580 Input +%610 = OpVariable %580 Input +%612 = OpVariable %442 Output +%615 = OpTypePointer Uniform %25 +%617 = OpConstantComposite %5 %287 %287 %287 +%618 = OpConstant %4 0.7 +%619 = OpConstantComposite %5 %78 %287 %618 +%620 = OpConstant %4 0.2 +%621 = OpConstantComposite %5 %620 %620 %620 +%623 = OpConstantNull %5 +%638 = OpTypePointer Uniform %5 +%647 = OpTypePointer Uniform %7 %53 = OpFunction %5 None %54 %52 = OpFunctionParameter %5 %51 = OpLabel @@ -849,6 +854,7 @@ OpFunctionEnd %217 = OpVariable %218 Function %135 %212 = OpVariable %87 Function %213 %216 = OpVariable %215 Function %78 +%237 = OpVariable %233 Function %234 OpBranch %219 %219 = OpLabel OpLine %3 36 13 @@ -870,616 +876,630 @@ OpBranch %229 %229 = OpLabel OpLine %3 43 5 OpLoopMerge %230 %232 None +OpBranch %238 +%238 = OpLabel +%239 = OpLoad %10 %237 +%240 = OpIEqual %115 %236 %239 +%241 = OpAll %112 %240 +OpSelectionMerge %242 None +OpBranchConditional %241 %230 %242 +%242 = OpLabel +%243 = OpCompositeExtract %8 %239 1 +%244 = OpIEqual %112 %243 %235 +%245 = OpSelect %8 %244 %126 %135 +%246 = OpCompositeConstruct %10 %245 %126 +%247 = OpIAdd %10 %239 %246 +OpStore %237 %247 OpBranch %231 %231 = OpLabel OpLine %3 43 22 -%233 = OpLoad %8 %217 -%234 = OpULessThan %112 %233 %205 +%248 = OpLoad %8 %217 +%249 = OpULessThan %112 %248 %205 OpLine %3 43 21 -OpSelectionMerge %235 None -OpBranchConditional %234 %235 %236 -%236 = OpLabel +OpSelectionMerge %250 None +OpBranchConditional %249 %250 %251 +%251 = OpLabel OpBranch %230 -%235 = OpLabel -OpBranch %237 -%237 = OpLabel +%250 = OpLabel +OpBranch %252 +%252 = OpLabel OpLine %3 1 1 -%239 = OpLoad %4 %214 -%240 = OpLoad %4 %216 -%241 = OpLoad %6 %212 +%254 = OpLoad %4 %214 +%255 = OpLoad %4 %216 +%256 = OpLoad %6 %212 OpLine %3 44 21 -%242 = OpFunctionCall %4 %67 %241 +%257 = OpFunctionCall %4 %67 %256 OpLine %3 44 13 -%243 = OpFMul %4 %240 %242 -%244 = OpFAdd %4 %239 %243 +%258 = OpFMul %4 %255 %257 +%259 = OpFAdd %4 %254 %258 OpLine %3 44 9 -OpStore %214 %244 +OpStore %214 %259 OpLine %3 45 13 -%245 = OpLoad %6 %212 -%246 = OpMatrixTimesVector %6 %228 %245 +%260 = OpLoad %6 %212 +%261 = OpMatrixTimesVector %6 %228 %260 OpLine %3 45 13 -%247 = OpVectorTimesScalar %6 %246 %81 -%248 = OpFAdd %6 %247 %208 +%262 = OpVectorTimesScalar %6 %261 %81 +%263 = OpFAdd %6 %262 %208 OpLine %3 45 9 -OpStore %212 %248 +OpStore %212 %263 OpLine %3 1 1 -%249 = OpLoad %4 %216 +%264 = OpLoad %4 %216 OpLine %3 46 13 -%250 = OpFMul %4 %249 %78 +%265 = OpFMul %4 %264 %78 OpLine %3 46 9 -OpStore %216 %250 -OpBranch %238 -%238 = OpLabel +OpStore %216 %265 +OpBranch %253 +%253 = OpLabel OpBranch %232 %232 = OpLabel OpLine %3 1 1 -%251 = OpLoad %8 %217 +%266 = OpLoad %8 %217 OpLine %3 43 43 -%252 = OpIAdd %8 %251 %126 +%267 = OpIAdd %8 %266 %126 OpLine %3 43 39 -OpStore %217 %252 +OpStore %217 %267 OpBranch %229 %230 = OpLabel OpLine %3 1 1 -%253 = OpLoad %4 %214 -OpReturnValue %253 +%268 = OpLoad %4 %214 +OpReturnValue %268 OpFunctionEnd -%257 = OpFunction %5 None %258 -%255 = OpFunctionParameter %6 -%256 = OpFunctionParameter %6 -%254 = OpLabel -OpBranch %259 -%259 = OpLabel +%272 = OpFunction %5 None %273 +%270 = OpFunctionParameter %6 +%271 = OpFunctionParameter %6 +%269 = OpLabel +OpBranch %274 +%274 = OpLabel OpLine %3 77 9 -%260 = OpCompositeExtract %4 %255 0 -%261 = OpCompositeExtract %4 %256 0 -%262 = OpCompositeExtract %4 %256 1 +%275 = OpCompositeExtract %4 %270 0 +%276 = OpCompositeExtract %4 %271 0 +%277 = OpCompositeExtract %4 %271 1 OpLine %3 78 49 -%263 = OpFunctionCall %4 %204 %255 +%278 = OpFunctionCall %4 %204 %270 OpLine %3 76 12 -%264 = OpExtInst %4 %1 FMix %261 %262 %263 -%265 = OpCompositeExtract %4 %255 1 -%266 = OpCompositeConstruct %5 %260 %264 %265 -OpReturnValue %266 +%279 = OpExtInst %4 %1 FMix %276 %277 %278 +%280 = OpCompositeExtract %4 %270 1 +%281 = OpCompositeConstruct %5 %275 %279 %280 +OpReturnValue %281 OpFunctionEnd -%270 = OpFunction %14 None %271 -%268 = OpFunctionParameter %6 -%269 = OpFunctionParameter %6 -%267 = OpLabel -OpBranch %278 -%278 = OpLabel +%285 = OpFunction %14 None %286 +%283 = OpFunctionParameter %6 +%284 = OpFunctionParameter %6 +%282 = OpLabel +OpBranch %293 +%293 = OpLabel OpLine %3 84 13 -%279 = OpFunctionCall %5 %257 %268 %269 +%294 = OpFunctionCall %5 %272 %283 %284 OpLine %3 86 29 -%280 = OpFAdd %6 %268 %273 +%295 = OpFAdd %6 %283 %288 OpLine %3 86 15 -%281 = OpFunctionCall %5 %257 %280 %269 +%296 = OpFunctionCall %5 %272 %295 %284 OpLine %3 86 15 -%282 = OpFSub %5 %281 %279 +%297 = OpFSub %5 %296 %294 OpLine %3 87 29 -%283 = OpFAdd %6 %268 %274 +%298 = OpFAdd %6 %283 %289 OpLine %3 87 15 -%284 = OpFunctionCall %5 %257 %283 %269 +%299 = OpFunctionCall %5 %272 %298 %284 OpLine %3 87 15 -%285 = OpFSub %5 %284 %279 +%300 = OpFSub %5 %299 %294 OpLine %3 88 29 -%286 = OpFAdd %6 %268 %276 +%301 = OpFAdd %6 %283 %291 OpLine %3 88 15 -%287 = OpFunctionCall %5 %257 %286 %269 +%302 = OpFunctionCall %5 %272 %301 %284 OpLine %3 88 15 -%288 = OpFSub %5 %287 %279 +%303 = OpFSub %5 %302 %294 OpLine %3 89 29 -%289 = OpFAdd %6 %268 %277 +%304 = OpFAdd %6 %283 %292 OpLine %3 89 15 -%290 = OpFunctionCall %5 %257 %289 %269 +%305 = OpFunctionCall %5 %272 %304 %284 OpLine %3 89 15 -%291 = OpFSub %5 %290 %279 +%306 = OpFSub %5 %305 %294 OpLine %3 91 14 -%292 = OpExtInst %5 %1 Cross %285 %282 -%293 = OpExtInst %5 %1 Normalize %292 +%307 = OpExtInst %5 %1 Cross %300 %297 +%308 = OpExtInst %5 %1 Normalize %307 OpLine %3 92 14 -%294 = OpExtInst %5 %1 Cross %291 %288 -%295 = OpExtInst %5 %1 Normalize %294 +%309 = OpExtInst %5 %1 Cross %306 %303 +%310 = OpExtInst %5 %1 Normalize %309 OpLine %3 94 14 -%296 = OpFAdd %5 %293 %295 +%311 = OpFAdd %5 %308 %310 OpLine %3 94 13 -%297 = OpVectorTimesScalar %5 %296 %78 +%312 = OpVectorTimesScalar %5 %311 %78 OpLine %3 96 12 -%298 = OpCompositeConstruct %14 %279 %297 -OpReturnValue %298 +%313 = OpCompositeConstruct %14 %294 %312 +OpReturnValue %313 OpFunctionEnd -%299 = OpFunction %8 None %300 -%301 = OpFunctionParameter %8 -%302 = OpFunctionParameter %8 -%303 = OpLabel -%304 = OpIEqual %112 %302 %135 -%305 = OpSelect %8 %304 %126 %302 -%306 = OpUDiv %8 %301 %305 -OpReturnValue %306 +%314 = OpFunction %8 None %315 +%316 = OpFunctionParameter %8 +%317 = OpFunctionParameter %8 +%318 = OpLabel +%319 = OpIEqual %112 %317 %135 +%320 = OpSelect %8 %319 %126 %317 +%321 = OpUDiv %8 %316 %320 +OpReturnValue %321 OpFunctionEnd -%311 = OpFunction %6 None %312 -%308 = OpFunctionParameter %8 -%309 = OpFunctionParameter %10 -%310 = OpFunctionParameter %11 -%307 = OpLabel -OpBranch %313 -%313 = OpLabel +%326 = OpFunction %6 None %327 +%323 = OpFunctionParameter %8 +%324 = OpFunctionParameter %10 +%325 = OpFunctionParameter %11 +%322 = OpLabel +OpBranch %328 +%328 = OpLabel OpLine %3 101 9 -%314 = OpConvertUToF %4 %308 -%315 = OpCompositeExtract %8 %309 0 +%329 = OpConvertUToF %4 %323 +%330 = OpCompositeExtract %8 %324 0 OpLine %3 101 9 -%316 = OpIAdd %8 %315 %126 -%317 = OpConvertUToF %4 %316 -%318 = OpFRem %4 %314 %317 -%319 = OpCompositeExtract %8 %309 0 +%331 = OpIAdd %8 %330 %126 +%332 = OpConvertUToF %4 %331 +%333 = OpFRem %4 %329 %332 +%334 = OpCompositeExtract %8 %324 0 OpLine %3 100 12 -%320 = OpIAdd %8 %319 %126 -%321 = OpFunctionCall %8 %299 %308 %320 -%322 = OpConvertUToF %4 %321 -%323 = OpCompositeConstruct %6 %318 %322 -%324 = OpConvertSToF %6 %310 -%325 = OpFAdd %6 %323 %324 -OpReturnValue %325 +%335 = OpIAdd %8 %334 %126 +%336 = OpFunctionCall %8 %314 %323 %335 +%337 = OpConvertUToF %4 %336 +%338 = OpCompositeConstruct %6 %333 %337 +%339 = OpConvertSToF %6 %325 +%340 = OpFAdd %6 %338 %339 +OpReturnValue %340 OpFunctionEnd -%328 = OpFunction %5 None %329 -%327 = OpFunctionParameter %6 -%326 = OpLabel -OpBranch %336 -%336 = OpLabel +%343 = OpFunction %5 None %344 +%342 = OpFunctionParameter %6 +%341 = OpLabel +OpBranch %351 +%351 = OpLabel OpLine %3 270 9 -%337 = OpFunctionCall %4 %67 %327 +%352 = OpFunctionCall %4 %67 %342 OpLine %3 270 9 -%338 = OpFMul %4 %337 %78 +%353 = OpFMul %4 %352 %78 OpLine %3 270 9 -%339 = OpFAdd %4 %338 %78 +%354 = OpFAdd %4 %353 %78 OpLine %3 271 17 -%340 = OpFAdd %6 %327 %332 +%355 = OpFAdd %6 %342 %347 OpLine %3 271 9 -%341 = OpFunctionCall %4 %67 %340 +%356 = OpFunctionCall %4 %67 %355 OpLine %3 271 9 -%342 = OpFMul %4 %341 %78 +%357 = OpFMul %4 %356 %78 OpLine %3 271 9 -%343 = OpFAdd %4 %342 %78 +%358 = OpFAdd %4 %357 %78 OpLine %3 272 17 -%344 = OpFAdd %6 %327 %335 +%359 = OpFAdd %6 %342 %350 OpLine %3 272 9 -%345 = OpFunctionCall %4 %67 %344 +%360 = OpFunctionCall %4 %67 %359 OpLine %3 272 9 -%346 = OpFMul %4 %345 %78 +%361 = OpFMul %4 %360 %78 OpLine %3 269 12 -%347 = OpFAdd %4 %346 %78 -%348 = OpCompositeConstruct %5 %339 %343 %347 -OpReturnValue %348 +%362 = OpFAdd %4 %361 %78 +%363 = OpCompositeConstruct %5 %354 %358 %362 +OpReturnValue %363 OpFunctionEnd -%353 = OpFunction %2 None %354 -%349 = OpLabel -%352 = OpLoad %19 %350 -%356 = OpAccessChain %355 %29 %135 -OpBranch %361 -%361 = OpLabel +%368 = OpFunction %2 None %369 +%364 = OpLabel +%367 = OpLoad %19 %365 +%371 = OpAccessChain %370 %29 %135 +OpBranch %376 +%376 = OpLabel OpLine %3 111 22 -%362 = OpCompositeExtract %8 %352 0 +%377 = OpCompositeExtract %8 %367 0 OpLine %3 113 36 -%364 = OpAccessChain %363 %356 %135 -%365 = OpLoad %10 %364 +%379 = OpAccessChain %378 %371 %135 +%380 = OpLoad %10 %379 OpLine %3 113 59 -%367 = OpAccessChain %366 %356 %126 -%368 = OpLoad %11 %367 +%382 = OpAccessChain %381 %371 %126 +%383 = OpLoad %11 %382 OpLine %3 113 13 -%369 = OpFunctionCall %6 %311 %362 %365 %368 +%384 = OpFunctionCall %6 %326 %377 %380 %383 OpLine %3 115 5 OpLine %3 115 51 -%373 = OpAccessChain %372 %356 %358 -%374 = OpLoad %6 %373 +%388 = OpAccessChain %387 %371 %373 +%389 = OpLoad %6 %388 OpLine %3 115 33 -%375 = OpFunctionCall %14 %270 %369 %374 +%390 = OpFunctionCall %14 %285 %384 %389 OpLine %3 115 5 -%376 = OpAccessChain %371 %32 %135 %362 -OpStore %376 %375 +%391 = OpAccessChain %386 %32 %135 %377 +OpStore %391 %390 OpLine %3 118 23 -%377 = OpCompositeExtract %8 %352 0 +%392 = OpCompositeExtract %8 %367 0 OpLine %3 118 23 -%378 = OpIMul %8 %377 %357 +%393 = OpIMul %8 %392 %372 OpLine %3 120 25 -%380 = OpAccessChain %379 %356 %135 %135 -%381 = OpLoad %8 %380 -OpLine %3 120 25 -%382 = OpAccessChain %379 %356 %135 %126 -%383 = OpLoad %8 %382 -%384 = OpIMul %8 %381 %383 -OpLine %3 120 9 -%385 = OpIMul %8 %384 %357 -%386 = OpUGreaterThanEqual %112 %378 %385 -OpLine %3 120 5 -OpSelectionMerge %387 None -OpBranchConditional %386 %388 %387 -%388 = OpLabel -OpReturn -%387 = OpLabel -OpLine %3 122 28 -%389 = OpCompositeExtract %8 %352 0 -OpLine %3 122 15 -%390 = OpAccessChain %379 %356 %135 %135 -%391 = OpLoad %8 %390 -%392 = OpFunctionCall %8 %299 %389 %391 -%393 = OpIAdd %8 %362 %392 -OpLine %3 123 15 -%394 = OpIAdd %8 %393 %126 -OpLine %3 124 15 -%395 = OpAccessChain %379 %356 %135 %135 +%395 = OpAccessChain %394 %371 %135 %135 %396 = OpLoad %8 %395 -%397 = OpIAdd %8 %393 %396 +OpLine %3 120 25 +%397 = OpAccessChain %394 %371 %135 %126 +%398 = OpLoad %8 %397 +%399 = OpIMul %8 %396 %398 +OpLine %3 120 9 +%400 = OpIMul %8 %399 %372 +%401 = OpUGreaterThanEqual %112 %393 %400 +OpLine %3 120 5 +OpSelectionMerge %402 None +OpBranchConditional %401 %403 %402 +%403 = OpLabel +OpReturn +%402 = OpLabel +OpLine %3 122 28 +%404 = OpCompositeExtract %8 %367 0 +OpLine %3 122 15 +%405 = OpAccessChain %394 %371 %135 %135 +%406 = OpLoad %8 %405 +%407 = OpFunctionCall %8 %314 %404 %406 +%408 = OpIAdd %8 %377 %407 +OpLine %3 123 15 +%409 = OpIAdd %8 %408 %126 OpLine %3 124 15 -%398 = OpIAdd %8 %397 %126 +%410 = OpAccessChain %394 %371 %135 %135 +%411 = OpLoad %8 %410 +%412 = OpIAdd %8 %408 %411 +OpLine %3 124 15 +%413 = OpIAdd %8 %412 %126 OpLine %3 125 15 -%399 = OpIAdd %8 %398 %126 +%414 = OpIAdd %8 %413 %126 OpLine %3 127 5 OpLine %3 127 5 -%402 = OpAccessChain %401 %34 %135 %378 -OpStore %402 %393 +%417 = OpAccessChain %416 %34 %135 %393 +OpStore %417 %408 OpLine %3 128 5 OpLine %3 128 5 -%403 = OpIAdd %8 %378 %126 +%418 = OpIAdd %8 %393 %126 OpLine %3 128 5 -%404 = OpAccessChain %401 %34 %135 %403 -OpStore %404 %398 +%419 = OpAccessChain %416 %34 %135 %418 +OpStore %419 %413 OpLine %3 129 5 OpLine %3 129 5 -%405 = OpIAdd %8 %378 %358 +%420 = OpIAdd %8 %393 %373 OpLine %3 129 5 -%406 = OpAccessChain %401 %34 %135 %405 -OpStore %406 %399 +%421 = OpAccessChain %416 %34 %135 %420 +OpStore %421 %414 OpLine %3 130 5 OpLine %3 130 5 -%407 = OpIAdd %8 %378 %359 +%422 = OpIAdd %8 %393 %374 OpLine %3 130 5 -%408 = OpAccessChain %401 %34 %135 %407 -OpStore %408 %393 +%423 = OpAccessChain %416 %34 %135 %422 +OpStore %423 %408 OpLine %3 131 5 OpLine %3 131 5 -%409 = OpIAdd %8 %378 %360 +%424 = OpIAdd %8 %393 %375 OpLine %3 131 5 -%410 = OpAccessChain %401 %34 %135 %409 -OpStore %410 %399 +%425 = OpAccessChain %416 %34 %135 %424 +OpStore %425 %414 OpLine %3 132 5 OpLine %3 132 5 -%411 = OpIAdd %8 %378 %205 +%426 = OpIAdd %8 %393 %205 OpLine %3 132 5 -%412 = OpAccessChain %401 %34 %135 %411 -OpStore %412 %394 +%427 = OpAccessChain %416 %34 %135 %426 +OpStore %427 %409 OpReturn OpFunctionEnd -%413 = OpFunction %8 None %300 -%414 = OpFunctionParameter %8 -%415 = OpFunctionParameter %8 -%416 = OpLabel -%417 = OpIEqual %112 %415 %135 -%418 = OpSelect %8 %417 %126 %415 -%419 = OpUMod %8 %414 %418 -OpReturnValue %419 +%428 = OpFunction %8 None %315 +%429 = OpFunctionParameter %8 +%430 = OpFunctionParameter %8 +%431 = OpLabel +%432 = OpIEqual %112 %430 %135 +%433 = OpSelect %8 %432 %126 %430 +%434 = OpUMod %8 %429 %433 +OpReturnValue %434 OpFunctionEnd -%430 = OpFunction %2 None %354 -%420 = OpLabel -%423 = OpLoad %8 %421 -%432 = OpAccessChain %431 %36 %135 -OpBranch %435 +%445 = OpFunction %2 None %369 %435 = OpLabel +%438 = OpLoad %8 %436 +%447 = OpAccessChain %446 %36 %135 +OpBranch %450 +%450 = OpLabel OpLine %3 161 19 -%436 = OpIAdd %8 %423 %358 +%451 = OpIAdd %8 %438 %373 OpLine %3 161 18 -%437 = OpFunctionCall %8 %299 %436 %359 +%452 = OpFunctionCall %8 %314 %451 %374 OpLine %3 161 13 -%438 = OpFunctionCall %8 %413 %437 %358 -%439 = OpConvertUToF %4 %438 +%453 = OpFunctionCall %8 %428 %452 %373 +%454 = OpConvertUToF %4 %453 OpLine %3 162 19 -%440 = OpIAdd %8 %423 %126 +%455 = OpIAdd %8 %438 %126 OpLine %3 162 18 -%441 = OpFunctionCall %8 %299 %440 %359 +%456 = OpFunctionCall %8 %314 %455 %374 OpLine %3 162 13 -%442 = OpFunctionCall %8 %413 %441 %358 -%443 = OpConvertUToF %4 %442 +%457 = OpFunctionCall %8 %428 %456 %373 +%458 = OpConvertUToF %4 %457 OpLine %3 163 14 -%444 = OpCompositeConstruct %6 %439 %443 +%459 = OpCompositeConstruct %6 %454 %458 OpLine %3 165 30 -%445 = OpVectorTimesScalar %6 %444 %81 +%460 = OpVectorTimesScalar %6 %459 %81 OpLine %3 165 30 -%446 = OpFAdd %6 %434 %445 +%461 = OpFAdd %6 %449 %460 OpLine %3 165 20 -%447 = OpCompositeConstruct %7 %446 %74 %56 +%462 = OpCompositeConstruct %7 %461 %74 %56 OpLine %3 168 21 -%448 = OpCompositeExtract %4 %444 0 +%463 = OpCompositeExtract %4 %459 0 OpLine %3 168 21 -%450 = OpAccessChain %449 %432 %359 -%451 = OpLoad %8 %450 -%452 = OpConvertUToF %4 %451 -%453 = OpFMul %4 %448 %452 -%454 = OpCompositeExtract %4 %444 1 +%465 = OpAccessChain %464 %447 %374 +%466 = OpLoad %8 %465 +%467 = OpConvertUToF %4 %466 +%468 = OpFMul %4 %463 %467 +%469 = OpCompositeExtract %4 %459 1 OpLine %3 168 17 -%455 = OpAccessChain %449 %432 %359 -%456 = OpLoad %8 %455 -%457 = OpConvertUToF %4 %456 -%458 = OpFMul %4 %454 %457 -%459 = OpFAdd %4 %453 %458 -%460 = OpConvertFToU %8 %459 -OpLine %3 168 17 -%461 = OpAccessChain %449 %432 %360 -%462 = OpLoad %8 %461 -%463 = OpIAdd %8 %460 %462 -OpLine %3 170 12 -%464 = OpCompositeConstruct %21 %463 %447 %444 -%465 = OpCompositeExtract %8 %464 0 -OpStore %424 %465 -%466 = OpCompositeExtract %7 %464 1 -OpStore %426 %466 -%467 = OpCompositeExtract %6 %464 2 -OpStore %428 %467 -OpReturn -OpFunctionEnd -%480 = OpFunction %2 None %354 -%468 = OpLabel -%483 = OpVariable %215 Function %74 -%484 = OpVariable %218 Function %135 +%470 = OpAccessChain %464 %447 %374 %471 = OpLoad %8 %470 -%474 = OpLoad %7 %472 -%477 = OpLoad %6 %475 -%469 = OpCompositeConstruct %21 %471 %474 %477 -%481 = OpAccessChain %431 %36 %135 -OpBranch %485 -%485 = OpLabel +%472 = OpConvertUToF %4 %471 +%473 = OpFMul %4 %469 %472 +%474 = OpFAdd %4 %468 %473 +%475 = OpConvertFToU %8 %474 +OpLine %3 168 17 +%476 = OpAccessChain %464 %447 %375 +%477 = OpLoad %8 %476 +%478 = OpIAdd %8 %475 %477 +OpLine %3 170 12 +%479 = OpCompositeConstruct %21 %478 %462 %459 +%480 = OpCompositeExtract %8 %479 0 +OpStore %439 %480 +%481 = OpCompositeExtract %7 %479 1 +OpStore %441 %481 +%482 = OpCompositeExtract %6 %479 2 +OpStore %443 %482 +OpReturn +OpFunctionEnd +%495 = OpFunction %2 None %369 +%483 = OpLabel +%498 = OpVariable %215 Function %74 +%499 = OpVariable %218 Function %135 +%486 = OpLoad %8 %485 +%489 = OpLoad %7 %487 +%492 = OpLoad %6 %490 +%484 = OpCompositeConstruct %21 %486 %489 %492 +%496 = OpAccessChain %446 %36 %135 +OpBranch %500 +%500 = OpLabel OpLine %3 181 17 -%486 = OpCompositeExtract %6 %469 2 -%487 = OpCompositeExtract %4 %486 0 +%501 = OpCompositeExtract %6 %484 2 +%502 = OpCompositeExtract %4 %501 0 OpLine %3 181 17 -%488 = OpAccessChain %449 %481 %359 -%489 = OpLoad %8 %488 -%490 = OpConvertUToF %4 %489 -%491 = OpFMul %4 %487 %490 -%492 = OpCompositeExtract %6 %469 2 -%493 = OpCompositeExtract %4 %492 1 -OpLine %3 181 70 -%494 = OpAccessChain %449 %481 %359 -%495 = OpLoad %8 %494 -OpLine %3 181 13 -%496 = OpAccessChain %449 %481 %359 -%497 = OpLoad %8 %496 -%498 = OpIMul %8 %495 %497 -%499 = OpConvertUToF %4 %498 -%500 = OpFMul %4 %493 %499 -%501 = OpFAdd %4 %491 %500 -%502 = OpConvertFToU %8 %501 -OpLine %3 181 13 -%503 = OpAccessChain %449 %481 %360 +%503 = OpAccessChain %464 %496 %374 %504 = OpLoad %8 %503 -%505 = OpIAdd %8 %502 %504 +%505 = OpConvertUToF %4 %504 +%506 = OpFMul %4 %502 %505 +%507 = OpCompositeExtract %6 %484 2 +%508 = OpCompositeExtract %4 %507 1 +OpLine %3 181 70 +%509 = OpAccessChain %464 %496 %374 +%510 = OpLoad %8 %509 +OpLine %3 181 13 +%511 = OpAccessChain %464 %496 %374 +%512 = OpLoad %8 %511 +%513 = OpIMul %8 %510 %512 +%514 = OpConvertUToF %4 %513 +%515 = OpFMul %4 %508 %514 +%516 = OpFAdd %4 %506 %515 +%517 = OpConvertFToU %8 %516 +OpLine %3 181 13 +%518 = OpAccessChain %464 %496 %375 +%519 = OpLoad %8 %518 +%520 = OpIAdd %8 %517 %519 OpLine %3 182 32 -%506 = OpConvertUToF %4 %505 +%521 = OpConvertUToF %4 %520 OpLine %3 182 22 -%507 = OpFDiv %4 %506 %482 -%508 = OpExtInst %4 %1 Floor %507 -%509 = OpConvertFToU %8 %508 +%522 = OpFDiv %4 %521 %497 +%523 = OpExtInst %4 %1 Floor %522 +%524 = OpConvertFToU %8 %523 OpLine %3 183 22 -%510 = OpFunctionCall %8 %413 %505 %357 +%525 = OpFunctionCall %8 %428 %520 %372 OpLine %3 185 36 -%511 = OpAccessChain %363 %481 %135 -%512 = OpLoad %10 %511 +%526 = OpAccessChain %378 %496 %135 +%527 = OpLoad %10 %526 OpLine %3 185 57 -%513 = OpAccessChain %366 %481 %126 -%514 = OpLoad %11 %513 +%528 = OpAccessChain %381 %496 %126 +%529 = OpLoad %11 %528 OpLine %3 185 13 -%515 = OpFunctionCall %6 %311 %509 %512 %514 +%530 = OpFunctionCall %6 %326 %524 %527 %529 OpLine %3 186 31 -%516 = OpAccessChain %372 %481 %358 -%517 = OpLoad %6 %516 +%531 = OpAccessChain %387 %496 %373 +%532 = OpLoad %6 %531 OpLine %3 186 13 -%518 = OpFunctionCall %14 %270 %515 %517 +%533 = OpFunctionCall %14 %285 %530 %532 OpLine %3 190 5 -OpSelectionMerge %519 None -OpSwitch %510 %526 0 %520 1 %521 2 %522 3 %523 4 %524 5 %525 -%520 = OpLabel +OpSelectionMerge %534 None +OpSwitch %525 %541 0 %535 1 %536 2 %537 3 %538 4 %539 5 %540 +%535 = OpLabel OpLine %3 191 37 -%527 = OpCompositeExtract %5 %518 0 -%528 = OpCompositeExtract %4 %527 0 +%542 = OpCompositeExtract %5 %533 0 +%543 = OpCompositeExtract %4 %542 0 OpLine %3 191 20 -OpStore %483 %528 -OpBranch %519 -%521 = OpLabel +OpStore %498 %543 +OpBranch %534 +%536 = OpLabel OpLine %3 192 37 -%529 = OpCompositeExtract %5 %518 0 -%530 = OpCompositeExtract %4 %529 1 +%544 = OpCompositeExtract %5 %533 0 +%545 = OpCompositeExtract %4 %544 1 OpLine %3 192 20 -OpStore %483 %530 -OpBranch %519 -%522 = OpLabel +OpStore %498 %545 +OpBranch %534 +%537 = OpLabel OpLine %3 193 37 -%531 = OpCompositeExtract %5 %518 0 -%532 = OpCompositeExtract %4 %531 2 +%546 = OpCompositeExtract %5 %533 0 +%547 = OpCompositeExtract %4 %546 2 OpLine %3 193 20 -OpStore %483 %532 -OpBranch %519 -%523 = OpLabel +OpStore %498 %547 +OpBranch %534 +%538 = OpLabel OpLine %3 194 37 -%533 = OpCompositeExtract %5 %518 1 -%534 = OpCompositeExtract %4 %533 0 +%548 = OpCompositeExtract %5 %533 1 +%549 = OpCompositeExtract %4 %548 0 OpLine %3 194 20 -OpStore %483 %534 -OpBranch %519 -%524 = OpLabel +OpStore %498 %549 +OpBranch %534 +%539 = OpLabel OpLine %3 195 37 -%535 = OpCompositeExtract %5 %518 1 -%536 = OpCompositeExtract %4 %535 1 +%550 = OpCompositeExtract %5 %533 1 +%551 = OpCompositeExtract %4 %550 1 OpLine %3 195 20 -OpStore %483 %536 -OpBranch %519 -%525 = OpLabel +OpStore %498 %551 +OpBranch %534 +%540 = OpLabel OpLine %3 196 37 -%537 = OpCompositeExtract %5 %518 1 -%538 = OpCompositeExtract %4 %537 2 +%552 = OpCompositeExtract %5 %533 1 +%553 = OpCompositeExtract %4 %552 2 OpLine %3 196 20 -OpStore %483 %538 -OpBranch %519 -%526 = OpLabel -OpBranch %519 -%519 = OpLabel +OpStore %498 %553 +OpBranch %534 +%541 = OpLabel +OpBranch %534 +%534 = OpLabel OpLine %3 200 15 -%539 = OpAccessChain %379 %481 %135 %135 -%540 = OpLoad %8 %539 -%541 = OpFunctionCall %8 %299 %509 %540 -%542 = OpIAdd %8 %509 %541 +%554 = OpAccessChain %394 %496 %135 %135 +%555 = OpLoad %8 %554 +%556 = OpFunctionCall %8 %314 %524 %555 +%557 = OpIAdd %8 %524 %556 OpLine %3 201 15 -%543 = OpIAdd %8 %542 %126 +%558 = OpIAdd %8 %557 %126 OpLine %3 202 15 -%544 = OpAccessChain %379 %481 %135 %135 -%545 = OpLoad %8 %544 -%546 = OpIAdd %8 %542 %545 +%559 = OpAccessChain %394 %496 %135 %135 +%560 = OpLoad %8 %559 +%561 = OpIAdd %8 %557 %560 OpLine %3 202 15 -%547 = OpIAdd %8 %546 %126 +%562 = OpIAdd %8 %561 %126 OpLine %3 203 15 -%548 = OpIAdd %8 %547 %126 +%563 = OpIAdd %8 %562 %126 OpLine %3 206 5 -OpSelectionMerge %549 None -OpSwitch %510 %554 0 %550 3 %550 2 %551 4 %551 1 %552 5 %553 -%550 = OpLabel +OpSelectionMerge %564 None +OpSwitch %525 %569 0 %565 3 %565 2 %566 4 %566 1 %567 5 %568 +%565 = OpLabel OpLine %3 207 24 -OpStore %484 %542 -OpBranch %549 -%551 = OpLabel +OpStore %499 %557 +OpBranch %564 +%566 = OpLabel OpLine %3 208 24 -OpStore %484 %548 -OpBranch %549 -%552 = OpLabel +OpStore %499 %563 +OpBranch %564 +%567 = OpLabel OpLine %3 209 20 -OpStore %484 %547 -OpBranch %549 -%553 = OpLabel +OpStore %499 %562 +OpBranch %564 +%568 = OpLabel OpLine %3 210 20 -OpStore %484 %543 -OpBranch %549 -%554 = OpLabel -OpBranch %549 -%549 = OpLabel +OpStore %499 %558 +OpBranch %564 +%569 = OpLabel +OpBranch %564 +%564 = OpLabel OpLine %3 213 13 -%555 = OpCompositeExtract %8 %469 0 +%570 = OpCompositeExtract %8 %484 0 OpLine %3 213 5 -OpStore %484 %555 +OpStore %499 %570 OpLine %3 222 27 -%556 = OpLoad %4 %483 -%557 = OpBitcast %8 %556 +%571 = OpLoad %4 %498 +%572 = OpBitcast %8 %571 OpLine %3 223 12 -%558 = OpLoad %8 %484 -%559 = OpCompositeConstruct %22 %557 %558 -%560 = OpCompositeExtract %8 %559 0 -OpStore %478 %560 -%561 = OpCompositeExtract %8 %559 1 -OpStore %479 %561 +%573 = OpLoad %8 %499 +%574 = OpCompositeConstruct %22 %572 %573 +%575 = OpCompositeExtract %8 %574 0 +OpStore %493 %575 +%576 = OpCompositeExtract %8 %574 1 +OpStore %494 %576 OpReturn OpFunctionEnd -%573 = OpFunction %2 None %354 -%562 = OpLabel -%566 = OpLoad %5 %564 -%568 = OpLoad %5 %567 -%563 = OpCompositeConstruct %14 %566 %568 -%575 = OpAccessChain %574 %39 %135 -OpBranch %576 -%576 = OpLabel +%588 = OpFunction %2 None %369 +%577 = OpLabel +%581 = OpLoad %5 %579 +%583 = OpLoad %5 %582 +%578 = OpCompositeConstruct %14 %581 %583 +%590 = OpAccessChain %589 %39 %135 +OpBranch %591 +%591 = OpLabel OpLine %3 254 25 -%578 = OpAccessChain %577 %575 %126 -%579 = OpLoad %23 %578 -%580 = OpCompositeExtract %5 %563 0 +%593 = OpAccessChain %592 %590 %126 +%594 = OpLoad %23 %593 +%595 = OpCompositeExtract %5 %578 0 OpLine %3 254 25 -%581 = OpCompositeConstruct %7 %580 %56 -%582 = OpMatrixTimesVector %7 %579 %581 +%596 = OpCompositeConstruct %7 %595 %56 +%597 = OpMatrixTimesVector %7 %594 %596 OpLine %3 255 18 -%583 = OpCompositeExtract %5 %563 1 +%598 = OpCompositeExtract %5 %578 1 OpLine %3 256 12 -%584 = OpCompositeExtract %5 %563 0 -%585 = OpCompositeConstruct %26 %582 %583 %584 -%586 = OpCompositeExtract %7 %585 0 -OpStore %569 %586 -%587 = OpCompositeExtract %5 %585 1 -OpStore %570 %587 -%588 = OpCompositeExtract %5 %585 2 -OpStore %572 %588 +%599 = OpCompositeExtract %5 %578 0 +%600 = OpCompositeConstruct %26 %597 %598 %599 +%601 = OpCompositeExtract %7 %600 0 +OpStore %584 %601 +%602 = OpCompositeExtract %5 %600 1 +OpStore %585 %602 +%603 = OpCompositeExtract %5 %600 2 +OpStore %587 %603 OpReturn OpFunctionEnd -%598 = OpFunction %2 None %354 -%589 = OpLabel -%607 = OpVariable %95 Function %608 -%592 = OpLoad %7 %591 -%594 = OpLoad %5 %593 -%596 = OpLoad %5 %595 -%590 = OpCompositeConstruct %26 %592 %594 %596 -%599 = OpAccessChain %574 %39 %135 -%601 = OpAccessChain %600 %42 %135 -OpBranch %609 -%609 = OpLabel +%613 = OpFunction %2 None %369 +%604 = OpLabel +%622 = OpVariable %95 Function %623 +%607 = OpLoad %7 %606 +%609 = OpLoad %5 %608 +%611 = OpLoad %5 %610 +%605 = OpCompositeConstruct %26 %607 %609 %611 +%614 = OpAccessChain %589 %39 %135 +%616 = OpAccessChain %615 %42 %135 +OpBranch %624 +%624 = OpLabel OpLine %3 278 28 OpLine %3 278 17 -%610 = OpCompositeExtract %5 %590 2 -%611 = OpExtInst %5 %1 Fract %610 -%612 = OpExtInst %5 %1 SmoothStep %80 %602 %611 +%625 = OpCompositeExtract %5 %605 2 +%626 = OpExtInst %5 %1 Fract %625 +%627 = OpExtInst %5 %1 SmoothStep %80 %617 %626 OpLine %3 278 5 -OpStore %607 %612 +OpStore %622 %627 OpLine %3 279 17 OpLine %3 279 13 -%613 = OpAccessChain %125 %607 %135 -%614 = OpLoad %4 %613 -%615 = OpAccessChain %125 %607 %126 -%616 = OpLoad %4 %615 -%617 = OpFMul %4 %614 %616 -%618 = OpAccessChain %125 %607 %358 -%619 = OpLoad %4 %618 -%620 = OpFMul %4 %617 %619 -%621 = OpCompositeConstruct %5 %620 %620 %620 -%622 = OpExtInst %5 %1 FMix %604 %606 %621 +%628 = OpAccessChain %125 %622 %135 +%629 = OpLoad %4 %628 +%630 = OpAccessChain %125 %622 %126 +%631 = OpLoad %4 %630 +%632 = OpFMul %4 %629 %631 +%633 = OpAccessChain %125 %622 %373 +%634 = OpLoad %4 %633 +%635 = OpFMul %4 %632 %634 +%636 = OpCompositeConstruct %5 %635 %635 %635 +%637 = OpExtInst %5 %1 FMix %619 %621 %636 OpLine %3 279 5 -OpStore %607 %622 +OpStore %622 %637 OpLine %3 282 25 -%624 = OpAccessChain %623 %601 %126 -%625 = OpLoad %5 %624 -%626 = OpVectorTimesScalar %5 %625 %272 +%639 = OpAccessChain %638 %616 %126 +%640 = OpLoad %5 %639 +%641 = OpVectorTimesScalar %5 %640 %287 OpLine %3 284 21 -%627 = OpAccessChain %623 %601 %135 -%628 = OpLoad %5 %627 -%629 = OpCompositeExtract %5 %590 2 -%630 = OpFSub %5 %628 %629 -%631 = OpExtInst %5 %1 Normalize %630 +%642 = OpAccessChain %638 %616 %135 +%643 = OpLoad %5 %642 +%644 = OpCompositeExtract %5 %605 2 +%645 = OpFSub %5 %643 %644 +%646 = OpExtInst %5 %1 Normalize %645 OpLine %3 285 20 -%633 = OpAccessChain %632 %599 %135 -%634 = OpLoad %7 %633 -%635 = OpVectorShuffle %5 %634 %634 0 1 2 -%636 = OpCompositeExtract %5 %590 2 -%637 = OpFSub %5 %635 %636 -%638 = OpExtInst %5 %1 Normalize %637 +%648 = OpAccessChain %647 %614 %135 +%649 = OpLoad %7 %648 +%650 = OpVectorShuffle %5 %649 %649 0 1 2 +%651 = OpCompositeExtract %5 %605 2 +%652 = OpFSub %5 %650 %651 +%653 = OpExtInst %5 %1 Normalize %652 OpLine %3 286 20 -%639 = OpFAdd %5 %638 %631 -%640 = OpExtInst %5 %1 Normalize %639 +%654 = OpFAdd %5 %653 %646 +%655 = OpExtInst %5 %1 Normalize %654 OpLine %3 288 32 -%641 = OpCompositeExtract %5 %590 1 -%642 = OpDot %4 %641 %631 +%656 = OpCompositeExtract %5 %605 1 +%657 = OpDot %4 %656 %646 OpLine %3 288 28 -%643 = OpExtInst %4 %1 FMax %642 %74 +%658 = OpExtInst %4 %1 FMax %657 %74 OpLine %3 289 25 -%644 = OpAccessChain %623 %601 %126 -%645 = OpLoad %5 %644 -%646 = OpVectorTimesScalar %5 %645 %643 +%659 = OpAccessChain %638 %616 %126 +%660 = OpLoad %5 %659 +%661 = OpVectorTimesScalar %5 %660 %658 OpLine %3 291 37 -%647 = OpCompositeExtract %5 %590 1 -%648 = OpDot %4 %647 %640 +%662 = OpCompositeExtract %5 %605 1 +%663 = OpDot %4 %662 %655 OpLine %3 291 33 -%649 = OpExtInst %4 %1 FMax %648 %74 +%664 = OpExtInst %4 %1 FMax %663 %74 OpLine %3 291 29 -%650 = OpExtInst %4 %1 Pow %649 %331 +%665 = OpExtInst %4 %1 Pow %664 %346 OpLine %3 292 26 -%651 = OpAccessChain %623 %601 %126 -%652 = OpLoad %5 %651 -%653 = OpVectorTimesScalar %5 %652 %650 +%666 = OpAccessChain %638 %616 %126 +%667 = OpLoad %5 %666 +%668 = OpVectorTimesScalar %5 %667 %665 OpLine %3 294 18 -%654 = OpFAdd %5 %626 %646 -%655 = OpFAdd %5 %654 %653 -%656 = OpLoad %5 %607 -%657 = OpFMul %5 %655 %656 +%669 = OpFAdd %5 %641 %661 +%670 = OpFAdd %5 %669 %668 +%671 = OpLoad %5 %622 +%672 = OpFMul %5 %670 %671 OpLine %3 296 12 -%658 = OpCompositeConstruct %7 %657 %56 -OpStore %597 %658 +%673 = OpCompositeConstruct %7 %672 %56 +OpStore %612 %673 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/overrides-ray-query.main.spvasm b/naga/tests/out/spv/overrides-ray-query.main.spvasm index a341393468..15878879ac 100644 --- a/naga/tests/out/spv/overrides-ray-query.main.spvasm +++ b/naga/tests/out/spv/overrides-ray-query.main.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.4 ; Generator: rspirv -; Bound: 46 +; Bound: 65 OpCapability Shader OpCapability RayQueryKHR OpExtension "SPV_KHR_ray_query" @@ -40,10 +40,19 @@ OpDecorate %10 Binding 0 %25 = OpConstantComposite %7 %22 %23 %24 %26 = OpConstantComposite %8 %16 %17 %18 %19 %21 %25 %28 = OpTypePointer Function %5 -%41 = OpTypeBool +%40 = OpTypeVector %6 2 +%41 = OpTypePointer Function %40 +%42 = OpTypeBool +%43 = OpTypeVector %42 2 +%44 = OpConstant %6 0 +%45 = OpConstantComposite %40 %44 %44 +%46 = OpConstant %6 1 +%47 = OpConstant %6 4294967295 +%48 = OpConstantComposite %40 %47 %47 %13 = OpFunction %2 None %14 %12 = OpLabel %27 = OpVariable %28 Function +%49 = OpVariable %41 Function %45 %15 = OpLoad %4 %10 OpBranch %29 %29 = OpLabel @@ -57,18 +66,32 @@ OpRayQueryInitializeKHR %27 %15 %30 %31 %34 %32 %35 %33 OpBranch %36 %36 = OpLabel OpLoopMerge %37 %39 None +OpBranch %50 +%50 = OpLabel +%51 = OpLoad %40 %49 +%52 = OpIEqual %43 %48 %51 +%53 = OpAll %42 %52 +OpSelectionMerge %54 None +OpBranchConditional %53 %37 %54 +%54 = OpLabel +%55 = OpCompositeExtract %6 %51 1 +%56 = OpIEqual %42 %55 %47 +%57 = OpSelect %6 %56 %46 %44 +%58 = OpCompositeConstruct %40 %57 %46 +%59 = OpIAdd %40 %51 %58 +OpStore %49 %59 OpBranch %38 %38 = OpLabel -%40 = OpRayQueryProceedKHR %41 %27 -OpSelectionMerge %42 None -OpBranchConditional %40 %42 %43 -%43 = OpLabel +%60 = OpRayQueryProceedKHR %42 %27 +OpSelectionMerge %61 None +OpBranchConditional %60 %61 %62 +%62 = OpLabel OpBranch %37 -%42 = OpLabel -OpBranch %44 -%44 = OpLabel -OpBranch %45 -%45 = OpLabel +%61 = OpLabel +OpBranch %63 +%63 = OpLabel +OpBranch %64 +%64 = OpLabel OpBranch %39 %39 = OpLabel OpBranch %36 diff --git a/naga/tests/out/spv/ray-query.spvasm b/naga/tests/out/spv/ray-query.spvasm index 32c2d0fae2..3e28a18e7b 100644 --- a/naga/tests/out/spv/ray-query.spvasm +++ b/naga/tests/out/spv/ray-query.spvasm @@ -1,16 +1,16 @@ ; SPIR-V ; Version: 1.4 ; Generator: rspirv -; Bound: 166 +; Bound: 183 OpCapability Shader OpCapability RayQueryKHR OpExtension "SPV_KHR_ray_query" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %123 "main" %15 %17 -OpEntryPoint GLCompute %143 "main_candidate" %15 -OpExecutionMode %123 LocalSize 1 1 1 -OpExecutionMode %143 LocalSize 1 1 1 +OpEntryPoint GLCompute %140 "main" %15 %17 +OpEntryPoint GLCompute %160 "main_candidate" %15 +OpExecutionMode %140 LocalSize 1 1 1 +OpExecutionMode %160 LocalSize 1 1 1 OpMemberDecorate %10 0 Offset 0 OpMemberDecorate %10 1 Offset 4 OpMemberDecorate %10 2 Offset 8 @@ -64,87 +64,93 @@ OpMemberDecorate %18 0 Offset 0 %29 = OpConstant %3 0.1 %30 = OpConstant %3 100.0 %32 = OpTypePointer Function %11 -%50 = OpTypePointer Function %10 -%51 = OpTypePointer Function %6 -%52 = OpTypePointer Function %9 -%53 = OpTypePointer Function %7 -%54 = OpTypePointer Function %8 -%55 = OpTypePointer Function %3 -%56 = OpTypeFunction %10 %32 -%58 = OpConstantNull %10 -%62 = OpConstant %6 1 -%64 = OpConstant %6 0 -%76 = OpConstant %6 2 -%78 = OpConstant %6 3 -%81 = OpConstant %6 5 -%83 = OpConstant %6 6 -%85 = OpConstant %6 9 -%87 = OpConstant %6 10 -%96 = OpConstant %6 7 -%98 = OpConstant %6 8 -%106 = OpTypeFunction %4 %4 %10 -%107 = OpConstant %3 1.0 -%108 = OpConstant %3 2.4 -%109 = OpConstant %3 0.0 -%124 = OpTypeFunction %2 -%126 = OpTypePointer StorageBuffer %13 -%128 = OpConstantComposite %4 %109 %109 %109 -%129 = OpConstantComposite %4 %109 %107 %109 -%132 = OpTypePointer StorageBuffer %6 -%137 = OpTypePointer StorageBuffer %4 -%145 = OpConstantComposite %12 %27 %28 %29 %30 %128 %129 -%146 = OpConstant %3 10.0 -%57 = OpFunction %10 None %56 -%59 = OpFunctionParameter %32 -%60 = OpLabel -%61 = OpVariable %50 Function %58 -%63 = OpRayQueryGetIntersectionTypeKHR %6 %59 %62 -%65 = OpAccessChain %51 %61 %64 -OpStore %65 %63 -%66 = OpINotEqual %8 %63 %64 -OpSelectionMerge %68 None -OpBranchConditional %66 %67 %68 -%67 = OpLabel -%69 = OpRayQueryGetIntersectionInstanceCustomIndexKHR %6 %59 %62 -%70 = OpRayQueryGetIntersectionInstanceIdKHR %6 %59 %62 -%71 = OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR %6 %59 %62 -%72 = OpRayQueryGetIntersectionGeometryIndexKHR %6 %59 %62 -%73 = OpRayQueryGetIntersectionPrimitiveIndexKHR %6 %59 %62 -%74 = OpRayQueryGetIntersectionObjectToWorldKHR %9 %59 %62 -%75 = OpRayQueryGetIntersectionWorldToObjectKHR %9 %59 %62 -%77 = OpAccessChain %51 %61 %76 -OpStore %77 %69 -%79 = OpAccessChain %51 %61 %78 -OpStore %79 %70 -%80 = OpAccessChain %51 %61 %27 -OpStore %80 %71 -%82 = OpAccessChain %51 %61 %81 -OpStore %82 %72 -%84 = OpAccessChain %51 %61 %83 -OpStore %84 %73 -%86 = OpAccessChain %52 %61 %85 -OpStore %86 %74 -%88 = OpAccessChain %52 %61 %87 -OpStore %88 %75 -%89 = OpIEqual %8 %63 %62 -%92 = OpRayQueryGetIntersectionTKHR %3 %59 %62 -%93 = OpAccessChain %55 %61 %62 -OpStore %93 %92 -OpSelectionMerge %91 None -OpBranchConditional %66 %90 %91 -%90 = OpLabel -%94 = OpRayQueryGetIntersectionBarycentricsKHR %7 %59 %62 -%95 = OpRayQueryGetIntersectionFrontFaceKHR %8 %59 %62 -%97 = OpAccessChain %53 %61 %96 -OpStore %97 %94 -%99 = OpAccessChain %54 %61 %98 -OpStore %99 %95 -OpBranch %91 -%91 = OpLabel -OpBranch %68 -%68 = OpLabel -%100 = OpLoad %10 %61 -OpReturnValue %100 +%45 = OpTypeVector %6 2 +%46 = OpTypePointer Function %45 +%47 = OpTypeVector %8 2 +%48 = OpConstant %6 0 +%49 = OpConstantComposite %45 %48 %48 +%50 = OpConstant %6 1 +%51 = OpConstant %6 4294967295 +%52 = OpConstantComposite %45 %51 %51 +%69 = OpTypePointer Function %10 +%70 = OpTypePointer Function %6 +%71 = OpTypePointer Function %9 +%72 = OpTypePointer Function %7 +%73 = OpTypePointer Function %8 +%74 = OpTypePointer Function %3 +%75 = OpTypeFunction %10 %32 +%77 = OpConstantNull %10 +%93 = OpConstant %6 2 +%95 = OpConstant %6 3 +%98 = OpConstant %6 5 +%100 = OpConstant %6 6 +%102 = OpConstant %6 9 +%104 = OpConstant %6 10 +%113 = OpConstant %6 7 +%115 = OpConstant %6 8 +%123 = OpTypeFunction %4 %4 %10 +%124 = OpConstant %3 1.0 +%125 = OpConstant %3 2.4 +%126 = OpConstant %3 0.0 +%141 = OpTypeFunction %2 +%143 = OpTypePointer StorageBuffer %13 +%145 = OpConstantComposite %4 %126 %126 %126 +%146 = OpConstantComposite %4 %126 %124 %126 +%149 = OpTypePointer StorageBuffer %6 +%154 = OpTypePointer StorageBuffer %4 +%162 = OpConstantComposite %12 %27 %28 %29 %30 %145 %146 +%163 = OpConstant %3 10.0 +%76 = OpFunction %10 None %75 +%78 = OpFunctionParameter %32 +%79 = OpLabel +%80 = OpVariable %69 Function %77 +%81 = OpRayQueryGetIntersectionTypeKHR %6 %78 %50 +%82 = OpAccessChain %70 %80 %48 +OpStore %82 %81 +%83 = OpINotEqual %8 %81 %48 +OpSelectionMerge %85 None +OpBranchConditional %83 %84 %85 +%84 = OpLabel +%86 = OpRayQueryGetIntersectionInstanceCustomIndexKHR %6 %78 %50 +%87 = OpRayQueryGetIntersectionInstanceIdKHR %6 %78 %50 +%88 = OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR %6 %78 %50 +%89 = OpRayQueryGetIntersectionGeometryIndexKHR %6 %78 %50 +%90 = OpRayQueryGetIntersectionPrimitiveIndexKHR %6 %78 %50 +%91 = OpRayQueryGetIntersectionObjectToWorldKHR %9 %78 %50 +%92 = OpRayQueryGetIntersectionWorldToObjectKHR %9 %78 %50 +%94 = OpAccessChain %70 %80 %93 +OpStore %94 %86 +%96 = OpAccessChain %70 %80 %95 +OpStore %96 %87 +%97 = OpAccessChain %70 %80 %27 +OpStore %97 %88 +%99 = OpAccessChain %70 %80 %98 +OpStore %99 %89 +%101 = OpAccessChain %70 %80 %100 +OpStore %101 %90 +%103 = OpAccessChain %71 %80 %102 +OpStore %103 %91 +%105 = OpAccessChain %71 %80 %104 +OpStore %105 %92 +%106 = OpIEqual %8 %81 %50 +%109 = OpRayQueryGetIntersectionTKHR %3 %78 %50 +%110 = OpAccessChain %74 %80 %50 +OpStore %110 %109 +OpSelectionMerge %108 None +OpBranchConditional %83 %107 %108 +%107 = OpLabel +%111 = OpRayQueryGetIntersectionBarycentricsKHR %7 %78 %50 +%112 = OpRayQueryGetIntersectionFrontFaceKHR %8 %78 %50 +%114 = OpAccessChain %72 %80 %113 +OpStore %114 %111 +%116 = OpAccessChain %73 %80 %115 +OpStore %116 %112 +OpBranch %108 +%108 = OpLabel +OpBranch %85 +%85 = OpLabel +%117 = OpLoad %10 %80 +OpReturnValue %117 OpFunctionEnd %25 = OpFunction %10 None %26 %21 = OpFunctionParameter %4 @@ -152,6 +158,7 @@ OpFunctionEnd %23 = OpFunctionParameter %16 %20 = OpLabel %31 = OpVariable %32 Function +%53 = OpVariable %46 Function %49 %24 = OpLoad %5 %23 OpBranch %33 %33 = OpLabel @@ -166,96 +173,110 @@ OpRayQueryInitializeKHR %31 %24 %35 %36 %39 %37 %40 %38 OpBranch %41 %41 = OpLabel OpLoopMerge %42 %44 None +OpBranch %54 +%54 = OpLabel +%55 = OpLoad %45 %53 +%56 = OpIEqual %47 %52 %55 +%57 = OpAll %8 %56 +OpSelectionMerge %58 None +OpBranchConditional %57 %42 %58 +%58 = OpLabel +%59 = OpCompositeExtract %6 %55 1 +%60 = OpIEqual %8 %59 %51 +%61 = OpSelect %6 %60 %50 %48 +%62 = OpCompositeConstruct %45 %61 %50 +%63 = OpIAdd %45 %55 %62 +OpStore %53 %63 OpBranch %43 %43 = OpLabel -%45 = OpRayQueryProceedKHR %8 %31 -OpSelectionMerge %46 None -OpBranchConditional %45 %46 %47 -%47 = OpLabel +%64 = OpRayQueryProceedKHR %8 %31 +OpSelectionMerge %65 None +OpBranchConditional %64 %65 %66 +%66 = OpLabel OpBranch %42 -%46 = OpLabel -OpBranch %48 -%48 = OpLabel -OpBranch %49 -%49 = OpLabel +%65 = OpLabel +OpBranch %67 +%67 = OpLabel +OpBranch %68 +%68 = OpLabel OpBranch %44 %44 = OpLabel OpBranch %41 %42 = OpLabel -%101 = OpFunctionCall %10 %57 %31 -OpReturnValue %101 +%118 = OpFunctionCall %10 %76 %31 +OpReturnValue %118 OpFunctionEnd -%105 = OpFunction %4 None %106 -%103 = OpFunctionParameter %4 -%104 = OpFunctionParameter %10 -%102 = OpLabel -OpBranch %110 -%110 = OpLabel -%111 = OpCompositeExtract %9 %104 10 -%112 = OpCompositeConstruct %14 %103 %107 -%113 = OpMatrixTimesVector %4 %111 %112 -%114 = OpVectorShuffle %7 %113 %113 0 1 -%115 = OpExtInst %7 %1 Normalize %114 -%116 = OpVectorTimesScalar %7 %115 %108 -%117 = OpCompositeExtract %9 %104 9 -%118 = OpCompositeConstruct %14 %116 %109 %107 -%119 = OpMatrixTimesVector %4 %117 %118 -%120 = OpFSub %4 %103 %119 -%121 = OpExtInst %4 %1 Normalize %120 -OpReturnValue %121 +%122 = OpFunction %4 None %123 +%120 = OpFunctionParameter %4 +%121 = OpFunctionParameter %10 +%119 = OpLabel +OpBranch %127 +%127 = OpLabel +%128 = OpCompositeExtract %9 %121 10 +%129 = OpCompositeConstruct %14 %120 %124 +%130 = OpMatrixTimesVector %4 %128 %129 +%131 = OpVectorShuffle %7 %130 %130 0 1 +%132 = OpExtInst %7 %1 Normalize %131 +%133 = OpVectorTimesScalar %7 %132 %125 +%134 = OpCompositeExtract %9 %121 9 +%135 = OpCompositeConstruct %14 %133 %126 %124 +%136 = OpMatrixTimesVector %4 %134 %135 +%137 = OpFSub %4 %120 %136 +%138 = OpExtInst %4 %1 Normalize %137 +OpReturnValue %138 OpFunctionEnd -%123 = OpFunction %2 None %124 -%122 = OpLabel -%125 = OpLoad %5 %15 -%127 = OpAccessChain %126 %17 %64 -OpBranch %130 -%130 = OpLabel -%131 = OpFunctionCall %10 %25 %128 %129 %15 -%133 = OpCompositeExtract %6 %131 0 -%134 = OpIEqual %8 %133 %64 -%135 = OpSelect %6 %134 %62 %64 -%136 = OpAccessChain %132 %127 %64 -OpStore %136 %135 -%138 = OpCompositeExtract %3 %131 1 -%139 = OpVectorTimesScalar %4 %129 %138 -%140 = OpFunctionCall %4 %105 %139 %131 -%141 = OpAccessChain %137 %127 %62 -OpStore %141 %140 +%140 = OpFunction %2 None %141 +%139 = OpLabel +%142 = OpLoad %5 %15 +%144 = OpAccessChain %143 %17 %48 +OpBranch %147 +%147 = OpLabel +%148 = OpFunctionCall %10 %25 %145 %146 %15 +%150 = OpCompositeExtract %6 %148 0 +%151 = OpIEqual %8 %150 %48 +%152 = OpSelect %6 %151 %50 %48 +%153 = OpAccessChain %149 %144 %48 +OpStore %153 %152 +%155 = OpCompositeExtract %3 %148 1 +%156 = OpVectorTimesScalar %4 %146 %155 +%157 = OpFunctionCall %4 %122 %156 %148 +%158 = OpAccessChain %154 %144 %50 +OpStore %158 %157 OpReturn OpFunctionEnd -%143 = OpFunction %2 None %124 -%142 = OpLabel -%147 = OpVariable %32 Function -%144 = OpLoad %5 %15 -OpBranch %148 -%148 = OpLabel -%149 = OpCompositeExtract %6 %145 0 -%150 = OpCompositeExtract %6 %145 1 -%151 = OpCompositeExtract %3 %145 2 -%152 = OpCompositeExtract %3 %145 3 -%153 = OpCompositeExtract %4 %145 4 -%154 = OpCompositeExtract %4 %145 5 -OpRayQueryInitializeKHR %147 %144 %149 %150 %153 %151 %154 %152 -%155 = OpFunctionCall %10 %57 %147 -%156 = OpCompositeExtract %6 %155 0 -%157 = OpIEqual %8 %156 %78 -OpSelectionMerge %158 None -OpBranchConditional %157 %159 %160 +%160 = OpFunction %2 None %141 %159 = OpLabel -OpRayQueryGenerateIntersectionKHR %147 %146 -OpReturn -%160 = OpLabel -%161 = OpCompositeExtract %6 %155 0 -%162 = OpIEqual %8 %161 %62 -OpSelectionMerge %163 None -OpBranchConditional %162 %164 %165 -%164 = OpLabel -OpRayQueryConfirmIntersectionKHR %147 -OpReturn +%164 = OpVariable %32 Function +%161 = OpLoad %5 %15 +OpBranch %165 %165 = OpLabel +%166 = OpCompositeExtract %6 %162 0 +%167 = OpCompositeExtract %6 %162 1 +%168 = OpCompositeExtract %3 %162 2 +%169 = OpCompositeExtract %3 %162 3 +%170 = OpCompositeExtract %4 %162 4 +%171 = OpCompositeExtract %4 %162 5 +OpRayQueryInitializeKHR %164 %161 %166 %167 %170 %168 %171 %169 +%172 = OpFunctionCall %10 %76 %164 +%173 = OpCompositeExtract %6 %172 0 +%174 = OpIEqual %8 %173 %95 +OpSelectionMerge %175 None +OpBranchConditional %174 %176 %177 +%176 = OpLabel +OpRayQueryGenerateIntersectionKHR %164 %163 OpReturn -%163 = OpLabel -OpBranch %158 -%158 = OpLabel +%177 = OpLabel +%178 = OpCompositeExtract %6 %172 0 +%179 = OpIEqual %8 %178 %50 +OpSelectionMerge %180 None +OpBranchConditional %179 %181 %182 +%181 = OpLabel +OpRayQueryConfirmIntersectionKHR %164 +OpReturn +%182 = OpLabel +OpReturn +%180 = OpLabel +OpBranch %175 +%175 = OpLabel OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/shadow.spvasm b/naga/tests/out/spv/shadow.spvasm index 8a115d36f7..1c1eebae49 100644 --- a/naga/tests/out/spv/shadow.spvasm +++ b/naga/tests/out/spv/shadow.spvasm @@ -1,16 +1,16 @@ ; SPIR-V ; Version: 1.2 ; Generator: rspirv -; Bound: 266 +; Bound: 294 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %85 "vs_main" %75 %78 %80 %82 %84 OpEntryPoint Fragment %143 "fs_main" %134 %137 %140 %142 -OpEntryPoint Fragment %211 "fs_main_without_storage" %204 %206 %208 %210 +OpEntryPoint Fragment %228 "fs_main_without_storage" %221 %223 %225 %227 OpExecutionMode %143 OriginUpperLeft -OpExecutionMode %211 OriginUpperLeft +OpExecutionMode %228 OriginUpperLeft %3 = OpString "shadow.wgsl" OpSource Unknown 0 %3 "struct Globals { view_proj: mat4x4, @@ -168,12 +168,14 @@ OpName %140 "world_position" OpName %143 "fs_main" OpName %150 "color" OpName %151 "i" -OpName %204 "proj_position" -OpName %206 "world_normal" -OpName %208 "world_position" -OpName %211 "fs_main_without_storage" -OpName %218 "color" -OpName %219 "i" +OpName %166 "loop_bound" +OpName %221 "proj_position" +OpName %223 "world_normal" +OpName %225 "world_position" +OpName %228 "fs_main_without_storage" +OpName %235 "color" +OpName %236 "i" +OpName %244 "loop_bound" OpMemberDecorate %9 0 Offset 0 OpMemberDecorate %9 0 ColMajor OpMemberDecorate %9 0 MatrixStride 16 @@ -222,10 +224,10 @@ OpDecorate %134 BuiltIn FragCoord OpDecorate %137 Location 0 OpDecorate %140 Location 1 OpDecorate %142 Location 0 -OpDecorate %204 BuiltIn FragCoord -OpDecorate %206 Location 0 -OpDecorate %208 Location 1 -OpDecorate %210 Location 0 +OpDecorate %221 BuiltIn FragCoord +OpDecorate %223 Location 0 +OpDecorate %225 Location 1 +OpDecorate %227 Location 0 %2 = OpTypeVoid %4 = OpTypeFloat 32 %6 = OpTypeVector %4 4 @@ -302,16 +304,22 @@ OpDecorate %210 Location 0 %142 = OpVariable %81 Output %146 = OpTypePointer StorageBuffer %17 %152 = OpTypePointer Function %7 -%161 = OpTypePointer Uniform %8 -%162 = OpTypePointer Uniform %7 -%172 = OpTypePointer StorageBuffer %16 -%198 = OpTypePointer Uniform %6 -%204 = OpVariable %135 Input -%206 = OpVariable %138 Input -%208 = OpVariable %135 Input -%210 = OpVariable %81 Output -%214 = OpTypePointer Uniform %18 -%237 = OpTypePointer Uniform %16 +%160 = OpTypeVector %7 2 +%161 = OpTypePointer Function %160 +%162 = OpTypeVector %56 2 +%163 = OpConstantComposite %160 %88 %88 +%164 = OpConstant %7 4294967295 +%165 = OpConstantComposite %160 %164 %164 +%178 = OpTypePointer Uniform %8 +%179 = OpTypePointer Uniform %7 +%189 = OpTypePointer StorageBuffer %16 +%215 = OpTypePointer Uniform %6 +%221 = OpVariable %135 Input +%223 = OpVariable %138 Input +%225 = OpVariable %135 Input +%227 = OpVariable %81 Output +%231 = OpTypePointer Uniform %18 +%265 = OpTypePointer Uniform %16 %44 = OpFunction %4 None %45 %42 = OpFunctionParameter %7 %43 = OpFunctionParameter %6 @@ -415,6 +423,7 @@ OpFunctionEnd %132 = OpLabel %150 = OpVariable %103 Function %24 %151 = OpVariable %152 Function %88 +%166 = OpVariable %161 Function %163 %136 = OpLoad %6 %134 %139 = OpLoad %11 %137 %141 = OpLoad %6 %140 @@ -433,165 +442,194 @@ OpBranch %156 %156 = OpLabel OpLine %3 88 5 OpLoopMerge %157 %159 None +OpBranch %167 +%167 = OpLabel +%168 = OpLoad %160 %166 +%169 = OpIEqual %162 %165 %168 +%170 = OpAll %56 %169 +OpSelectionMerge %171 None +OpBranchConditional %170 %157 %171 +%171 = OpLabel +%172 = OpCompositeExtract %7 %168 1 +%173 = OpIEqual %56 %172 %164 +%174 = OpSelect %7 %173 %115 %88 +%175 = OpCompositeConstruct %160 %174 %115 +%176 = OpIAdd %160 %168 %175 +OpStore %166 %176 OpBranch %158 %158 = OpLabel OpLine %3 1 1 -%160 = OpLoad %7 %151 +%177 = OpLoad %7 %151 OpLine %3 88 29 -%163 = OpAccessChain %162 %144 %115 %88 -%164 = OpLoad %7 %163 +%180 = OpAccessChain %179 %144 %115 %88 +%181 = OpLoad %7 %180 OpLine %3 88 21 -%165 = OpExtInst %7 %1 UMin %164 %19 -%166 = OpULessThan %56 %160 %165 +%182 = OpExtInst %7 %1 UMin %181 %19 +%183 = OpULessThan %56 %177 %182 OpLine %3 88 20 -OpSelectionMerge %167 None -OpBranchConditional %166 %167 %168 -%168 = OpLabel +OpSelectionMerge %184 None +OpBranchConditional %183 %184 %185 +%185 = OpLabel OpBranch %157 -%167 = OpLabel -OpBranch %169 -%169 = OpLabel +%184 = OpLabel +OpBranch %186 +%186 = OpLabel OpLine %3 89 21 -%171 = OpLoad %7 %151 -%173 = OpAccessChain %172 %147 %171 -%174 = OpLoad %16 %173 +%188 = OpLoad %7 %151 +%190 = OpAccessChain %189 %147 %188 +%191 = OpLoad %16 %190 OpLine %3 91 38 -%175 = OpLoad %7 %151 -%176 = OpCompositeExtract %5 %174 0 -%177 = OpCompositeExtract %6 %133 2 -%178 = OpMatrixTimesVector %6 %176 %177 +%192 = OpLoad %7 %151 +%193 = OpCompositeExtract %5 %191 0 +%194 = OpCompositeExtract %6 %133 2 +%195 = OpMatrixTimesVector %6 %193 %194 OpLine %3 91 22 -%179 = OpFunctionCall %4 %44 %175 %178 +%196 = OpFunctionCall %4 %44 %192 %195 OpLine %3 93 25 -%180 = OpCompositeExtract %6 %174 1 -%181 = OpVectorShuffle %11 %180 %180 0 1 2 -%182 = OpCompositeExtract %6 %133 2 -%183 = OpVectorShuffle %11 %182 %182 0 1 2 -%184 = OpFSub %11 %181 %183 -%185 = OpExtInst %11 %1 Normalize %184 +%197 = OpCompositeExtract %6 %191 1 +%198 = OpVectorShuffle %11 %197 %197 0 1 2 +%199 = OpCompositeExtract %6 %133 2 +%200 = OpVectorShuffle %11 %199 %199 0 1 2 +%201 = OpFSub %11 %198 %200 +%202 = OpExtInst %11 %1 Normalize %201 OpLine %3 94 23 -%186 = OpDot %4 %155 %185 -%187 = OpExtInst %4 %1 FMax %48 %186 +%203 = OpDot %4 %155 %202 +%204 = OpExtInst %4 %1 FMax %48 %203 OpLine %3 96 9 -%188 = OpFMul %4 %179 %187 -%189 = OpCompositeExtract %6 %174 2 -%190 = OpVectorShuffle %11 %189 %189 0 1 2 -%191 = OpVectorTimesScalar %11 %190 %188 -%192 = OpLoad %11 %150 -%193 = OpFAdd %11 %192 %191 +%205 = OpFMul %4 %196 %204 +%206 = OpCompositeExtract %6 %191 2 +%207 = OpVectorShuffle %11 %206 %206 0 1 2 +%208 = OpVectorTimesScalar %11 %207 %205 +%209 = OpLoad %11 %150 +%210 = OpFAdd %11 %209 %208 OpLine %3 96 9 -OpStore %150 %193 -OpBranch %170 -%170 = OpLabel +OpStore %150 %210 +OpBranch %187 +%187 = OpLabel OpBranch %159 %159 = OpLabel OpLine %3 88 68 -%194 = OpLoad %7 %151 -%195 = OpIAdd %7 %194 %115 +%211 = OpLoad %7 %151 +%212 = OpIAdd %7 %211 %115 OpLine %3 88 68 -OpStore %151 %195 +OpStore %151 %212 OpBranch %156 %157 = OpLabel OpLine %3 1 1 -%196 = OpLoad %11 %150 +%213 = OpLoad %11 %150 OpLine %3 99 12 -%197 = OpCompositeConstruct %6 %196 %49 +%214 = OpCompositeConstruct %6 %213 %49 OpLine %3 99 12 -%199 = OpAccessChain %198 %145 %115 -%200 = OpLoad %6 %199 -%201 = OpFMul %6 %197 %200 -OpStore %142 %201 +%216 = OpAccessChain %215 %145 %115 +%217 = OpLoad %6 %216 +%218 = OpFMul %6 %214 %217 +OpStore %142 %218 OpReturn OpFunctionEnd -%211 = OpFunction %2 None %86 -%202 = OpLabel -%218 = OpVariable %103 Function %24 -%219 = OpVariable %152 Function %88 -%205 = OpLoad %6 %204 -%207 = OpLoad %11 %206 -%209 = OpLoad %6 %208 -%203 = OpCompositeConstruct %12 %205 %207 %209 -%212 = OpAccessChain %87 %25 %88 -%213 = OpAccessChain %90 %28 %88 -%215 = OpAccessChain %214 %34 %88 -%216 = OpLoad %20 %37 -%217 = OpLoad %21 %39 -OpBranch %220 -%220 = OpLabel +%228 = OpFunction %2 None %86 +%219 = OpLabel +%235 = OpVariable %103 Function %24 +%236 = OpVariable %152 Function %88 +%244 = OpVariable %161 Function %163 +%222 = OpLoad %6 %221 +%224 = OpLoad %11 %223 +%226 = OpLoad %6 %225 +%220 = OpCompositeConstruct %12 %222 %224 %226 +%229 = OpAccessChain %87 %25 %88 +%230 = OpAccessChain %90 %28 %88 +%232 = OpAccessChain %231 %34 %88 +%233 = OpLoad %20 %37 +%234 = OpLoad %21 %39 +OpBranch %237 +%237 = OpLabel OpLine %3 105 18 -%221 = OpCompositeExtract %11 %203 1 -%222 = OpExtInst %11 %1 Normalize %221 -OpBranch %223 -%223 = OpLabel +%238 = OpCompositeExtract %11 %220 1 +%239 = OpExtInst %11 %1 Normalize %238 +OpBranch %240 +%240 = OpLabel OpLine %3 107 5 -OpLoopMerge %224 %226 None -OpBranch %225 -%225 = OpLabel +OpLoopMerge %241 %243 None +OpBranch %245 +%245 = OpLabel +%246 = OpLoad %160 %244 +%247 = OpIEqual %162 %165 %246 +%248 = OpAll %56 %247 +OpSelectionMerge %249 None +OpBranchConditional %248 %241 %249 +%249 = OpLabel +%250 = OpCompositeExtract %7 %246 1 +%251 = OpIEqual %56 %250 %164 +%252 = OpSelect %7 %251 %115 %88 +%253 = OpCompositeConstruct %160 %252 %115 +%254 = OpIAdd %160 %246 %253 +OpStore %244 %254 +OpBranch %242 +%242 = OpLabel OpLine %3 1 1 -%227 = OpLoad %7 %219 +%255 = OpLoad %7 %236 OpLine %3 107 29 -%228 = OpAccessChain %162 %212 %115 %88 -%229 = OpLoad %7 %228 +%256 = OpAccessChain %179 %229 %115 %88 +%257 = OpLoad %7 %256 OpLine %3 107 21 -%230 = OpExtInst %7 %1 UMin %229 %19 -%231 = OpULessThan %56 %227 %230 +%258 = OpExtInst %7 %1 UMin %257 %19 +%259 = OpULessThan %56 %255 %258 OpLine %3 107 20 -OpSelectionMerge %232 None -OpBranchConditional %231 %232 %233 -%233 = OpLabel -OpBranch %224 -%232 = OpLabel -OpBranch %234 -%234 = OpLabel +OpSelectionMerge %260 None +OpBranchConditional %259 %260 %261 +%261 = OpLabel +OpBranch %241 +%260 = OpLabel +OpBranch %262 +%262 = OpLabel OpLine %3 110 21 -%236 = OpLoad %7 %219 -%238 = OpAccessChain %237 %215 %236 -%239 = OpLoad %16 %238 +%264 = OpLoad %7 %236 +%266 = OpAccessChain %265 %232 %264 +%267 = OpLoad %16 %266 OpLine %3 111 38 -%240 = OpLoad %7 %219 -%241 = OpCompositeExtract %5 %239 0 -%242 = OpCompositeExtract %6 %203 2 -%243 = OpMatrixTimesVector %6 %241 %242 +%268 = OpLoad %7 %236 +%269 = OpCompositeExtract %5 %267 0 +%270 = OpCompositeExtract %6 %220 2 +%271 = OpMatrixTimesVector %6 %269 %270 OpLine %3 111 22 -%244 = OpFunctionCall %4 %44 %240 %243 +%272 = OpFunctionCall %4 %44 %268 %271 OpLine %3 112 25 -%245 = OpCompositeExtract %6 %239 1 -%246 = OpVectorShuffle %11 %245 %245 0 1 2 -%247 = OpCompositeExtract %6 %203 2 -%248 = OpVectorShuffle %11 %247 %247 0 1 2 -%249 = OpFSub %11 %246 %248 -%250 = OpExtInst %11 %1 Normalize %249 +%273 = OpCompositeExtract %6 %267 1 +%274 = OpVectorShuffle %11 %273 %273 0 1 2 +%275 = OpCompositeExtract %6 %220 2 +%276 = OpVectorShuffle %11 %275 %275 0 1 2 +%277 = OpFSub %11 %274 %276 +%278 = OpExtInst %11 %1 Normalize %277 OpLine %3 113 23 -%251 = OpDot %4 %222 %250 -%252 = OpExtInst %4 %1 FMax %48 %251 +%279 = OpDot %4 %239 %278 +%280 = OpExtInst %4 %1 FMax %48 %279 OpLine %3 114 9 -%253 = OpFMul %4 %244 %252 -%254 = OpCompositeExtract %6 %239 2 -%255 = OpVectorShuffle %11 %254 %254 0 1 2 -%256 = OpVectorTimesScalar %11 %255 %253 -%257 = OpLoad %11 %218 -%258 = OpFAdd %11 %257 %256 +%281 = OpFMul %4 %272 %280 +%282 = OpCompositeExtract %6 %267 2 +%283 = OpVectorShuffle %11 %282 %282 0 1 2 +%284 = OpVectorTimesScalar %11 %283 %281 +%285 = OpLoad %11 %235 +%286 = OpFAdd %11 %285 %284 OpLine %3 114 9 -OpStore %218 %258 -OpBranch %235 -%235 = OpLabel -OpBranch %226 -%226 = OpLabel +OpStore %235 %286 +OpBranch %263 +%263 = OpLabel +OpBranch %243 +%243 = OpLabel OpLine %3 107 68 -%259 = OpLoad %7 %219 -%260 = OpIAdd %7 %259 %115 +%287 = OpLoad %7 %236 +%288 = OpIAdd %7 %287 %115 OpLine %3 107 68 -OpStore %219 %260 -OpBranch %223 -%224 = OpLabel +OpStore %236 %288 +OpBranch %240 +%241 = OpLabel OpLine %3 1 1 -%261 = OpLoad %11 %218 +%289 = OpLoad %11 %235 OpLine %3 116 12 -%262 = OpCompositeConstruct %6 %261 %49 +%290 = OpCompositeConstruct %6 %289 %49 OpLine %3 116 12 -%263 = OpAccessChain %198 %213 %115 -%264 = OpLoad %6 %263 -%265 = OpFMul %6 %262 %264 -OpStore %210 %265 +%291 = OpAccessChain %215 %230 %115 +%292 = OpLoad %6 %291 +%293 = OpFMul %6 %290 %292 +OpStore %227 %293 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/snapshots.rs b/naga/tests/snapshots.rs index 1d5152427e..27d976355b 100644 --- a/naga/tests/snapshots.rs +++ b/naga/tests/snapshots.rs @@ -565,6 +565,7 @@ fn write_output_spv( bounds_check_policies, binding_map: params.binding_map.clone(), zero_initialize_workgroup_memory: spv::ZeroInitializeWorkgroupMemoryMode::Polyfill, + force_loop_bounding: true, debug_info, }; diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 23b7cdd94b..477a7711f9 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1914,6 +1914,7 @@ impl super::Adapter { } else { spv::ZeroInitializeWorkgroupMemoryMode::Polyfill }, + force_loop_bounding: true, // We need to build this separately for each invocation, so just default it out here binding_map: BTreeMap::default(), debug_info: None, diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index 3707456a8e..9fce6b37e4 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -908,6 +908,7 @@ impl super::Device { shader_stage: naga_stage, }; let needs_temp_options = !runtime_checks.bounds_checks + || !runtime_checks.force_loop_bounding || !binding_map.is_empty() || naga_shader.debug_source.is_some() || !stage.zero_initialize_workgroup_memory; @@ -922,6 +923,9 @@ impl super::Device { binding_array: naga::proc::BoundsCheckPolicy::Unchecked, }; } + if !runtime_checks.force_loop_bounding { + temp_options.force_loop_bounding = false; + } if !binding_map.is_empty() { temp_options.binding_map = binding_map.clone(); }