diff --git a/src/back/spv/writer.rs b/src/back/spv/writer.rs index e11fb6aaee..bb5c2323ec 100644 --- a/src/back/spv/writer.rs +++ b/src/back/spv/writer.rs @@ -255,22 +255,6 @@ impl Writer { } } - fn get_constant_id( - &mut self, - handle: crate::Handle, - ir_module: &crate::Module, - ) -> Result { - if let Entry::Occupied(e) = self.lookup_constant.entry(handle) { - Ok(*e.get()) - } else { - let id = self.generate_id(); - self.lookup_constant.insert(handle, id); - let inner = &ir_module.constants[handle].inner; - self.write_constant_type(id, inner, ir_module)?; - Ok(id) - } - } - fn get_global_variable_id( &mut self, ir_module: &crate::Module, @@ -383,8 +367,7 @@ impl Writer { let init_word = variable .init - .map(|constant| self.get_constant_id(constant, ir_module)) - .transpose()?; + .map(|constant| self.lookup_constant[&constant]); let pointer_type_id = self.get_pointer_id(&ir_module.types, variable.ty, crate::StorageClass::Function)?; let instruction = super::instructions::instruction_variable( @@ -806,12 +789,12 @@ impl Writer { &mut self, id: Word, inner: &crate::ConstantInner, - ir_module: &crate::Module, + types: &crate::Arena, ) -> Result<(), Error> { let instruction = match *inner { crate::ConstantInner::Scalar { width, ref value } => { let type_id = self.get_type_id( - &ir_module.types, + types, LookupType::Local(LocalType::Scalar { kind: value.scalar_kind(), width, @@ -873,20 +856,11 @@ impl Writer { crate::ConstantInner::Composite { ty, ref components } => { let mut constituent_ids = Vec::with_capacity(components.len()); for constituent in components.iter() { - let constituent_id = self.get_constant_id(*constituent, &ir_module)?; + let constituent_id = self.lookup_constant[constituent]; constituent_ids.push(constituent_id); } - // Get the size constant for arrays - if let crate::TypeInner::Array { - size: crate::ArraySize::Constant(const_handle), - .. - } = ir_module.types[ty].inner - { - self.get_constant_id(const_handle, &ir_module)?; - } - - let type_id = self.get_type_id(&ir_module.types, LookupType::Handle(ty))?; + let type_id = self.get_type_id(types, LookupType::Handle(ty))?; super::instructions::instruction_constant_composite( type_id, id, @@ -912,8 +886,7 @@ impl Writer { let init_word = global_variable .init - .map(|constant| self.get_constant_id(constant, ir_module)) - .transpose()?; + .map(|constant| self.lookup_constant[&constant]); let pointer_type_id = self.get_pointer_id(&ir_module.types, global_variable.ty, global_variable.class)?; let instruction = @@ -1294,7 +1267,7 @@ impl Writer { } crate::Expression::Constant(handle) => { let var = &ir_module.constants[handle]; - let id = self.get_constant_id(handle, ir_module)?; + let id = self.lookup_constant[&handle]; let lookup_type = match var.inner { crate::ConstantInner::Scalar { width, ref value } => { LookupType::Local(LocalType::Scalar { @@ -2043,7 +2016,7 @@ impl Writer { width: 4, value: crate::ScalarValue::Float(0.0), }; - self.write_constant_type(zero_id, &zero_inner, ir_module)?; + self.write_constant_type(zero_id, &zero_inner, &ir_module.types)?; inst.add_operand(spirv::ImageOperands::LOD.bits()); inst.add_operand(zero_id); @@ -2124,7 +2097,7 @@ impl Writer { }; if let Some(offset_const) = offset { - let offset_id = self.get_constant_id(offset_const, ir_module)?; + let offset_id = self.lookup_constant[&offset_const]; main_instruction.add_operand(spirv::ImageOperands::CONST_OFFSET.bits()); main_instruction.add_operand(offset_id); } @@ -2343,6 +2316,12 @@ impl Writer { )); } + for (handle, constant) in ir_module.constants.iter() { + let id = self.generate_id(); + self.lookup_constant.insert(handle, id); + self.write_constant_type(id, &constant.inner, &ir_module.types)?; + } + for (_, var) in ir_module.global_variables.iter() { if !var.storage_access.is_empty() { self.storage_type_handles.insert(var.ty, var.storage_access); diff --git a/tests/snapshots/snapshots__boids.spvasm.snap b/tests/snapshots/snapshots__boids.spvasm.snap index ece073bbeb..dc2eea87a3 100644 --- a/tests/snapshots/snapshots__boids.spvasm.snap +++ b/tests/snapshots/snapshots__boids.spvasm.snap @@ -9,401 +9,401 @@ expression: dis OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %22 "main" %27 -OpExecutionMode %22 LocalSize 64 1 1 -OpDecorate %27 BuiltIn GlobalInvocationId -OpDecorate %42 BufferBlock -OpMemberDecorate %42 0 Offset 0 -OpDecorate %43 ArrayStride 16 -OpDecorate %44 Block -OpMemberDecorate %44 0 Offset 0 -OpMemberDecorate %44 1 Offset 8 -OpDecorate %41 DescriptorSet 0 -OpDecorate %41 Binding 1 -OpDecorate %117 Block -OpMemberDecorate %117 0 Offset 0 -OpMemberDecorate %117 1 Offset 4 -OpMemberDecorate %117 2 Offset 8 -OpMemberDecorate %117 3 Offset 12 -OpMemberDecorate %117 4 Offset 16 -OpMemberDecorate %117 5 Offset 20 -OpMemberDecorate %117 6 Offset 24 -OpDecorate %116 DescriptorSet 0 -OpDecorate %116 Binding 0 +OpEntryPoint GLCompute %29 "main" %34 +OpExecutionMode %29 LocalSize 64 1 1 +OpDecorate %34 BuiltIn GlobalInvocationId +OpDecorate %48 BufferBlock +OpMemberDecorate %48 0 Offset 0 +OpDecorate %49 ArrayStride 16 +OpDecorate %50 Block +OpMemberDecorate %50 0 Offset 0 +OpMemberDecorate %50 1 Offset 8 +OpDecorate %47 DescriptorSet 0 +OpDecorate %47 Binding 1 +OpDecorate %122 Block +OpMemberDecorate %122 0 Offset 0 +OpMemberDecorate %122 1 Offset 4 +OpMemberDecorate %122 2 Offset 8 +OpMemberDecorate %122 3 Offset 12 +OpMemberDecorate %122 4 Offset 16 +OpMemberDecorate %122 5 Offset 20 +OpMemberDecorate %122 6 Offset 24 +OpDecorate %121 DescriptorSet 0 +OpDecorate %121 Binding 0 OpDecorate %274 DescriptorSet 0 OpDecorate %274 Binding 2 -%4 = OpTypeFloat 32 -%3 = OpTypeVector %4 2 -%5 = OpTypePointer Function %3 -%12 = OpTypeInt 32 1 -%11 = OpConstant %12 0 -%13 = OpTypePointer Function %12 -%19 = OpTypeInt 32 0 -%18 = OpConstant %19 0 -%20 = OpTypePointer Function %19 -%21 = OpTypeVoid -%23 = OpTypeFunction %21 -%28 = OpTypeVector %19 3 -%29 = OpTypePointer Input %28 -%27 = OpVariable %29 Input -%30 = OpConstant %12 0 -%31 = OpTypePointer Input %19 -%33 = OpConstant %12 1500 -%34 = OpTypeBool -%44 = OpTypeStruct %3 %3 -%43 = OpTypeRuntimeArray %44 -%42 = OpTypeStruct %43 -%45 = OpTypePointer Uniform %42 -%41 = OpVariable %45 Uniform -%46 = OpConstant %12 0 -%47 = OpTypePointer Uniform %43 -%49 = OpConstant %12 0 -%50 = OpTypePointer Input %19 -%52 = OpTypePointer Uniform %44 -%53 = OpConstant %12 0 -%54 = OpTypePointer Uniform %3 -%59 = OpConstant %12 0 -%60 = OpTypePointer Uniform %43 -%62 = OpConstant %12 0 -%63 = OpTypePointer Input %19 -%65 = OpTypePointer Uniform %44 -%66 = OpConstant %12 1 -%67 = OpTypePointer Uniform %3 -%69 = OpConstant %4 0.0 -%85 = OpConstant %12 0 -%86 = OpTypePointer Input %19 -%94 = OpConstant %12 0 -%95 = OpTypePointer Uniform %43 -%97 = OpTypePointer Uniform %44 -%98 = OpConstant %12 0 -%99 = OpTypePointer Uniform %3 -%104 = OpConstant %12 0 -%105 = OpTypePointer Uniform %43 -%107 = OpTypePointer Uniform %44 -%108 = OpConstant %12 1 -%109 = OpTypePointer Uniform %3 -%117 = OpTypeStruct %4 %4 %4 %4 %4 %4 %4 -%118 = OpTypePointer Uniform %117 -%116 = OpVariable %118 Uniform -%119 = OpConstant %12 1 -%120 = OpTypePointer Uniform %4 -%130 = OpConstant %12 1 -%136 = OpConstant %12 2 -%137 = OpTypePointer Uniform %4 -%152 = OpConstant %12 3 -%153 = OpTypePointer Uniform %4 -%165 = OpConstant %19 1 -%175 = OpConstant %4 1.0 -%196 = OpConstant %12 4 -%197 = OpTypePointer Uniform %4 -%202 = OpConstant %12 5 -%203 = OpTypePointer Uniform %4 -%208 = OpConstant %12 6 -%209 = OpTypePointer Uniform %4 -%216 = OpConstant %4 0.1 -%223 = OpConstant %12 0 -%224 = OpTypePointer Uniform %4 -%228 = OpConstant %12 0 -%229 = OpTypePointer Function %4 -%231 = OpConstant %4 -1.0 -%236 = OpConstant %12 0 -%237 = OpTypePointer Function %4 -%240 = OpConstant %12 0 -%241 = OpTypePointer Function %4 -%247 = OpConstant %12 0 -%248 = OpTypePointer Function %4 -%251 = OpConstant %12 1 -%252 = OpTypePointer Function %4 -%258 = OpConstant %12 1 -%259 = OpTypePointer Function %4 -%262 = OpConstant %12 1 -%263 = OpTypePointer Function %4 -%269 = OpConstant %12 1 -%270 = OpTypePointer Function %4 -%274 = OpVariable %45 Uniform -%275 = OpConstant %12 0 -%276 = OpTypePointer Uniform %43 -%278 = OpConstant %12 0 -%279 = OpTypePointer Input %19 -%281 = OpTypePointer Uniform %44 -%282 = OpConstant %12 0 -%283 = OpTypePointer Uniform %3 -%288 = OpConstant %12 0 -%289 = OpTypePointer Uniform %43 -%291 = OpConstant %12 0 -%292 = OpTypePointer Input %19 -%294 = OpTypePointer Uniform %44 -%295 = OpConstant %12 1 -%296 = OpTypePointer Uniform %3 -%22 = OpFunction %21 None %23 -%24 = OpLabel -%17 = OpVariable %20 Function %18 -%14 = OpVariable %13 Function %11 -%8 = OpVariable %5 Function -%2 = OpVariable %5 Function -%15 = OpVariable %5 Function -%9 = OpVariable %5 Function -%6 = OpVariable %5 Function -%16 = OpVariable %5 Function -%10 = OpVariable %13 Function %11 -%7 = OpVariable %5 Function -%26 = OpAccessChain %31 %27 %30 -%32 = OpLoad %19 %26 -%25 = OpUGreaterThanEqual %34 %32 %33 -OpSelectionMerge %35 None -OpBranchConditional %25 %36 %37 -%36 = OpLabel +%3 = OpTypeInt 32 1 +%2 = OpConstant %3 1500 +%5 = OpTypeFloat 32 +%4 = OpConstant %5 0.0 +%6 = OpConstant %3 0 +%8 = OpTypeInt 32 0 +%7 = OpConstant %8 0 +%9 = OpConstant %3 1 +%10 = OpConstant %8 1 +%11 = OpConstant %5 1.0 +%12 = OpConstant %5 0.1 +%13 = OpConstant %5 -1.0 +%15 = OpTypeVector %5 2 +%16 = OpTypePointer Function %15 +%22 = OpTypePointer Function %3 +%27 = OpTypePointer Function %8 +%28 = OpTypeVoid +%30 = OpTypeFunction %28 +%35 = OpTypeVector %8 3 +%36 = OpTypePointer Input %35 +%34 = OpVariable %36 Input +%37 = OpConstant %3 0 +%38 = OpTypePointer Input %8 +%40 = OpTypeBool +%50 = OpTypeStruct %15 %15 +%49 = OpTypeRuntimeArray %50 +%48 = OpTypeStruct %49 +%51 = OpTypePointer Uniform %48 +%47 = OpVariable %51 Uniform +%52 = OpConstant %3 0 +%53 = OpTypePointer Uniform %49 +%55 = OpConstant %3 0 +%56 = OpTypePointer Input %8 +%58 = OpTypePointer Uniform %50 +%59 = OpConstant %3 0 +%60 = OpTypePointer Uniform %15 +%65 = OpConstant %3 0 +%66 = OpTypePointer Uniform %49 +%68 = OpConstant %3 0 +%69 = OpTypePointer Input %8 +%71 = OpTypePointer Uniform %50 +%72 = OpConstant %3 1 +%73 = OpTypePointer Uniform %15 +%90 = OpConstant %3 0 +%91 = OpTypePointer Input %8 +%99 = OpConstant %3 0 +%100 = OpTypePointer Uniform %49 +%102 = OpTypePointer Uniform %50 +%103 = OpConstant %3 0 +%104 = OpTypePointer Uniform %15 +%109 = OpConstant %3 0 +%110 = OpTypePointer Uniform %49 +%112 = OpTypePointer Uniform %50 +%113 = OpConstant %3 1 +%114 = OpTypePointer Uniform %15 +%122 = OpTypeStruct %5 %5 %5 %5 %5 %5 %5 +%123 = OpTypePointer Uniform %122 +%121 = OpVariable %123 Uniform +%124 = OpConstant %3 1 +%125 = OpTypePointer Uniform %5 +%140 = OpConstant %3 2 +%141 = OpTypePointer Uniform %5 +%156 = OpConstant %3 3 +%157 = OpTypePointer Uniform %5 +%198 = OpConstant %3 4 +%199 = OpTypePointer Uniform %5 +%204 = OpConstant %3 5 +%205 = OpTypePointer Uniform %5 +%210 = OpConstant %3 6 +%211 = OpTypePointer Uniform %5 +%224 = OpConstant %3 0 +%225 = OpTypePointer Uniform %5 +%229 = OpConstant %3 0 +%230 = OpTypePointer Function %5 +%236 = OpConstant %3 0 +%237 = OpTypePointer Function %5 +%240 = OpConstant %3 0 +%241 = OpTypePointer Function %5 +%247 = OpConstant %3 0 +%248 = OpTypePointer Function %5 +%251 = OpConstant %3 1 +%252 = OpTypePointer Function %5 +%258 = OpConstant %3 1 +%259 = OpTypePointer Function %5 +%262 = OpConstant %3 1 +%263 = OpTypePointer Function %5 +%269 = OpConstant %3 1 +%270 = OpTypePointer Function %5 +%274 = OpVariable %51 Uniform +%275 = OpConstant %3 0 +%276 = OpTypePointer Uniform %49 +%278 = OpConstant %3 0 +%279 = OpTypePointer Input %8 +%281 = OpTypePointer Uniform %50 +%282 = OpConstant %3 0 +%283 = OpTypePointer Uniform %15 +%288 = OpConstant %3 0 +%289 = OpTypePointer Uniform %49 +%291 = OpConstant %3 0 +%292 = OpTypePointer Input %8 +%294 = OpTypePointer Uniform %50 +%295 = OpConstant %3 1 +%296 = OpTypePointer Uniform %15 +%29 = OpFunction %28 None %30 +%31 = OpLabel +%26 = OpVariable %27 Function %7 +%23 = OpVariable %22 Function %6 +%19 = OpVariable %16 Function +%14 = OpVariable %16 Function +%24 = OpVariable %16 Function +%20 = OpVariable %16 Function +%17 = OpVariable %16 Function +%25 = OpVariable %16 Function +%21 = OpVariable %22 Function %6 +%18 = OpVariable %16 Function +%33 = OpAccessChain %38 %34 %37 +%39 = OpLoad %8 %33 +%32 = OpUGreaterThanEqual %40 %39 %2 +OpSelectionMerge %41 None +OpBranchConditional %32 %42 %43 +%42 = OpLabel OpReturn -%37 = OpLabel -OpBranch %35 -%35 = OpLabel -%40 = OpAccessChain %47 %41 %46 -%48 = OpAccessChain %50 %27 %49 -%51 = OpLoad %19 %48 -%39 = OpAccessChain %52 %40 %51 -%38 = OpAccessChain %54 %39 %53 -%55 = OpLoad %3 %38 -OpStore %2 %55 -%58 = OpAccessChain %60 %41 %59 -%61 = OpAccessChain %63 %27 %62 -%64 = OpLoad %19 %61 -%57 = OpAccessChain %65 %58 %64 -%56 = OpAccessChain %67 %57 %66 -%68 = OpLoad %3 %56 -OpStore %6 %68 -%70 = OpCompositeConstruct %3 %69 %69 -OpStore %7 %70 -%71 = OpCompositeConstruct %3 %69 %69 -OpStore %8 %71 -%72 = OpCompositeConstruct %3 %69 %69 -OpStore %9 %72 -OpBranch %73 -%73 = OpLabel -OpLoopMerge %74 %76 None -OpBranch %75 -%75 = OpLabel -%78 = OpLoad %19 %17 -%77 = OpUGreaterThanEqual %34 %78 %33 -OpSelectionMerge %79 None -OpBranchConditional %77 %80 %81 +%43 = OpLabel +OpBranch %41 +%41 = OpLabel +%46 = OpAccessChain %53 %47 %52 +%54 = OpAccessChain %56 %34 %55 +%57 = OpLoad %8 %54 +%45 = OpAccessChain %58 %46 %57 +%44 = OpAccessChain %60 %45 %59 +%61 = OpLoad %15 %44 +OpStore %14 %61 +%64 = OpAccessChain %66 %47 %65 +%67 = OpAccessChain %69 %34 %68 +%70 = OpLoad %8 %67 +%63 = OpAccessChain %71 %64 %70 +%62 = OpAccessChain %73 %63 %72 +%74 = OpLoad %15 %62 +OpStore %17 %74 +%75 = OpCompositeConstruct %15 %4 %4 +OpStore %18 %75 +%76 = OpCompositeConstruct %15 %4 %4 +OpStore %19 %76 +%77 = OpCompositeConstruct %15 %4 %4 +OpStore %20 %77 +OpBranch %78 +%78 = OpLabel +OpLoopMerge %79 %81 None +OpBranch %80 %80 = OpLabel -OpBranch %74 -%81 = OpLabel +%83 = OpLoad %8 %26 +%82 = OpUGreaterThanEqual %40 %83 %2 +OpSelectionMerge %84 None +OpBranchConditional %82 %85 %86 +%85 = OpLabel OpBranch %79 +%86 = OpLabel +OpBranch %84 +%84 = OpLabel +%88 = OpLoad %8 %26 +%89 = OpAccessChain %91 %34 %90 +%92 = OpLoad %8 %89 +%87 = OpIEqual %40 %88 %92 +OpSelectionMerge %93 None +OpBranchConditional %87 %94 %95 +%94 = OpLabel +OpBranch %81 +%95 = OpLabel +OpBranch %93 +%93 = OpLabel +%98 = OpAccessChain %100 %47 %99 +%101 = OpLoad %8 %26 +%97 = OpAccessChain %102 %98 %101 +%96 = OpAccessChain %104 %97 %103 +%105 = OpLoad %15 %96 +OpStore %24 %105 +%108 = OpAccessChain %110 %47 %109 +%111 = OpLoad %8 %26 +%107 = OpAccessChain %112 %108 %111 +%106 = OpAccessChain %114 %107 %113 +%115 = OpLoad %15 %106 +OpStore %25 %115 +%117 = OpLoad %15 %24 +%118 = OpLoad %15 %14 +%119 = OpExtInst %5 %1 Distance %117 %118 +%120 = OpAccessChain %125 %121 %124 +%126 = OpLoad %5 %120 +%116 = OpFOrdLessThan %40 %119 %126 +OpSelectionMerge %127 None +OpBranchConditional %116 %128 %129 +%128 = OpLabel +%131 = OpLoad %15 %18 +%132 = OpLoad %15 %24 +%130 = OpFAdd %15 %131 %132 +OpStore %18 %130 +%134 = OpLoad %3 %21 +%133 = OpIAdd %3 %134 %9 +OpStore %21 %133 +OpBranch %127 +%129 = OpLabel +OpBranch %127 +%127 = OpLabel +%136 = OpLoad %15 %24 +%137 = OpLoad %15 %14 +%138 = OpExtInst %5 %1 Distance %136 %137 +%139 = OpAccessChain %141 %121 %140 +%142 = OpLoad %5 %139 +%135 = OpFOrdLessThan %40 %138 %142 +OpSelectionMerge %143 None +OpBranchConditional %135 %144 %145 +%144 = OpLabel +%147 = OpLoad %15 %20 +%149 = OpLoad %15 %24 +%150 = OpLoad %15 %14 +%148 = OpFSub %15 %149 %150 +%146 = OpFSub %15 %147 %148 +OpStore %20 %146 +OpBranch %143 +%145 = OpLabel +OpBranch %143 +%143 = OpLabel +%152 = OpLoad %15 %24 +%153 = OpLoad %15 %14 +%154 = OpExtInst %5 %1 Distance %152 %153 +%155 = OpAccessChain %157 %121 %156 +%158 = OpLoad %5 %155 +%151 = OpFOrdLessThan %40 %154 %158 +OpSelectionMerge %159 None +OpBranchConditional %151 %160 %161 +%160 = OpLabel +%163 = OpLoad %15 %19 +%164 = OpLoad %15 %25 +%162 = OpFAdd %15 %163 %164 +OpStore %19 %162 +%166 = OpLoad %3 %23 +%165 = OpIAdd %3 %166 %9 +OpStore %23 %165 +OpBranch %159 +%161 = OpLabel +OpBranch %159 +%159 = OpLabel +OpBranch %81 +%81 = OpLabel +%168 = OpLoad %8 %26 +%167 = OpIAdd %8 %168 %10 +OpStore %26 %167 +OpBranch %78 %79 = OpLabel -%83 = OpLoad %19 %17 -%84 = OpAccessChain %86 %27 %85 -%87 = OpLoad %19 %84 -%82 = OpIEqual %34 %83 %87 -OpSelectionMerge %88 None -OpBranchConditional %82 %89 %90 -%89 = OpLabel -OpBranch %76 -%90 = OpLabel -OpBranch %88 -%88 = OpLabel -%93 = OpAccessChain %95 %41 %94 -%96 = OpLoad %19 %17 -%92 = OpAccessChain %97 %93 %96 -%91 = OpAccessChain %99 %92 %98 -%100 = OpLoad %3 %91 -OpStore %15 %100 -%103 = OpAccessChain %105 %41 %104 -%106 = OpLoad %19 %17 -%102 = OpAccessChain %107 %103 %106 -%101 = OpAccessChain %109 %102 %108 -%110 = OpLoad %3 %101 -OpStore %16 %110 -%112 = OpLoad %3 %15 -%113 = OpLoad %3 %2 -%114 = OpExtInst %4 %1 Distance %112 %113 -%115 = OpAccessChain %120 %116 %119 -%121 = OpLoad %4 %115 -%111 = OpFOrdLessThan %34 %114 %121 -OpSelectionMerge %122 None -OpBranchConditional %111 %123 %124 -%123 = OpLabel -%126 = OpLoad %3 %7 -%127 = OpLoad %3 %15 -%125 = OpFAdd %3 %126 %127 -OpStore %7 %125 -%129 = OpLoad %12 %10 -%128 = OpIAdd %12 %129 %130 -OpStore %10 %128 -OpBranch %122 -%124 = OpLabel -OpBranch %122 -%122 = OpLabel -%132 = OpLoad %3 %15 -%133 = OpLoad %3 %2 -%134 = OpExtInst %4 %1 Distance %132 %133 -%135 = OpAccessChain %137 %116 %136 -%138 = OpLoad %4 %135 -%131 = OpFOrdLessThan %34 %134 %138 -OpSelectionMerge %139 None -OpBranchConditional %131 %140 %141 -%140 = OpLabel -%143 = OpLoad %3 %9 -%145 = OpLoad %3 %15 -%146 = OpLoad %3 %2 -%144 = OpFSub %3 %145 %146 -%142 = OpFSub %3 %143 %144 -OpStore %9 %142 -OpBranch %139 -%141 = OpLabel -OpBranch %139 -%139 = OpLabel -%148 = OpLoad %3 %15 -%149 = OpLoad %3 %2 -%150 = OpExtInst %4 %1 Distance %148 %149 -%151 = OpAccessChain %153 %116 %152 -%154 = OpLoad %4 %151 -%147 = OpFOrdLessThan %34 %150 %154 -OpSelectionMerge %155 None -OpBranchConditional %147 %156 %157 -%156 = OpLabel -%159 = OpLoad %3 %8 -%160 = OpLoad %3 %16 -%158 = OpFAdd %3 %159 %160 -OpStore %8 %158 -%162 = OpLoad %12 %14 -%161 = OpIAdd %12 %162 %130 -OpStore %14 %161 -OpBranch %155 -%157 = OpLabel -OpBranch %155 -%155 = OpLabel -OpBranch %76 -%76 = OpLabel -%164 = OpLoad %19 %17 -%163 = OpIAdd %19 %164 %165 -OpStore %17 %163 -OpBranch %73 -%74 = OpLabel -%167 = OpLoad %12 %10 -%166 = OpSGreaterThan %34 %167 %11 -OpSelectionMerge %168 None -OpBranchConditional %166 %169 %170 -%169 = OpLabel -%173 = OpLoad %3 %7 -%176 = OpLoad %12 %10 -%177 = OpConvertSToF %4 %176 -%174 = OpFDiv %4 %175 %177 -%172 = OpVectorTimesScalar %3 %173 %174 -%178 = OpLoad %3 %2 -%171 = OpFSub %3 %172 %178 -OpStore %7 %171 -OpBranch %168 -%170 = OpLabel -OpBranch %168 -%168 = OpLabel -%180 = OpLoad %12 %14 -%179 = OpSGreaterThan %34 %180 %11 -OpSelectionMerge %181 None -OpBranchConditional %179 %182 %183 -%182 = OpLabel -%185 = OpLoad %3 %8 -%187 = OpLoad %12 %14 -%188 = OpConvertSToF %4 %187 -%186 = OpFDiv %4 %175 %188 -%184 = OpVectorTimesScalar %3 %185 %186 -OpStore %8 %184 -OpBranch %181 +%170 = OpLoad %3 %21 +%169 = OpSGreaterThan %40 %170 %6 +OpSelectionMerge %171 None +OpBranchConditional %169 %172 %173 +%172 = OpLabel +%176 = OpLoad %15 %18 +%178 = OpLoad %3 %21 +%179 = OpConvertSToF %5 %178 +%177 = OpFDiv %5 %11 %179 +%175 = OpVectorTimesScalar %15 %176 %177 +%180 = OpLoad %15 %14 +%174 = OpFSub %15 %175 %180 +OpStore %18 %174 +OpBranch %171 +%173 = OpLabel +OpBranch %171 +%171 = OpLabel +%182 = OpLoad %3 %23 +%181 = OpSGreaterThan %40 %182 %6 +OpSelectionMerge %183 None +OpBranchConditional %181 %184 %185 +%184 = OpLabel +%187 = OpLoad %15 %19 +%189 = OpLoad %3 %23 +%190 = OpConvertSToF %5 %189 +%188 = OpFDiv %5 %11 %190 +%186 = OpVectorTimesScalar %15 %187 %188 +OpStore %19 %186 +OpBranch %183 +%185 = OpLabel +OpBranch %183 %183 = OpLabel -OpBranch %181 -%181 = OpLabel -%192 = OpLoad %3 %6 -%194 = OpLoad %3 %7 -%195 = OpAccessChain %197 %116 %196 -%198 = OpLoad %4 %195 -%193 = OpVectorTimesScalar %3 %194 %198 -%191 = OpFAdd %3 %192 %193 -%200 = OpLoad %3 %9 -%201 = OpAccessChain %203 %116 %202 -%204 = OpLoad %4 %201 -%199 = OpVectorTimesScalar %3 %200 %204 -%190 = OpFAdd %3 %191 %199 -%206 = OpLoad %3 %8 -%207 = OpAccessChain %209 %116 %208 -%210 = OpLoad %4 %207 -%205 = OpVectorTimesScalar %3 %206 %210 -%189 = OpFAdd %3 %190 %205 -OpStore %6 %189 -%212 = OpLoad %3 %6 -%213 = OpExtInst %3 %1 Normalize %212 -%214 = OpLoad %3 %6 -%215 = OpExtInst %4 %1 Length %214 -%217 = OpExtInst %4 %1 FClamp %215 %69 %216 -%211 = OpVectorTimesScalar %3 %213 %217 -OpStore %6 %211 -%219 = OpLoad %3 %2 -%221 = OpLoad %3 %6 -%222 = OpAccessChain %224 %116 %223 -%225 = OpLoad %4 %222 -%220 = OpVectorTimesScalar %3 %221 %225 -%218 = OpFAdd %3 %219 %220 -OpStore %2 %218 -%227 = OpAccessChain %229 %2 %228 -%230 = OpLoad %4 %227 -%226 = OpFOrdLessThan %34 %230 %231 +%194 = OpLoad %15 %17 +%196 = OpLoad %15 %18 +%197 = OpAccessChain %199 %121 %198 +%200 = OpLoad %5 %197 +%195 = OpVectorTimesScalar %15 %196 %200 +%193 = OpFAdd %15 %194 %195 +%202 = OpLoad %15 %20 +%203 = OpAccessChain %205 %121 %204 +%206 = OpLoad %5 %203 +%201 = OpVectorTimesScalar %15 %202 %206 +%192 = OpFAdd %15 %193 %201 +%208 = OpLoad %15 %19 +%209 = OpAccessChain %211 %121 %210 +%212 = OpLoad %5 %209 +%207 = OpVectorTimesScalar %15 %208 %212 +%191 = OpFAdd %15 %192 %207 +OpStore %17 %191 +%214 = OpLoad %15 %17 +%215 = OpExtInst %15 %1 Normalize %214 +%216 = OpLoad %15 %17 +%217 = OpExtInst %5 %1 Length %216 +%218 = OpExtInst %5 %1 FClamp %217 %4 %12 +%213 = OpVectorTimesScalar %15 %215 %218 +OpStore %17 %213 +%220 = OpLoad %15 %14 +%222 = OpLoad %15 %17 +%223 = OpAccessChain %225 %121 %224 +%226 = OpLoad %5 %223 +%221 = OpVectorTimesScalar %15 %222 %226 +%219 = OpFAdd %15 %220 %221 +OpStore %14 %219 +%228 = OpAccessChain %230 %14 %229 +%231 = OpLoad %5 %228 +%227 = OpFOrdLessThan %40 %231 %13 OpSelectionMerge %232 None -OpBranchConditional %226 %233 %234 +OpBranchConditional %227 %233 %234 %233 = OpLabel -%235 = OpAccessChain %237 %2 %236 -OpStore %235 %175 +%235 = OpAccessChain %237 %14 %236 +OpStore %235 %11 OpBranch %232 %234 = OpLabel OpBranch %232 %232 = OpLabel -%239 = OpAccessChain %241 %2 %240 -%242 = OpLoad %4 %239 -%238 = OpFOrdGreaterThan %34 %242 %175 +%239 = OpAccessChain %241 %14 %240 +%242 = OpLoad %5 %239 +%238 = OpFOrdGreaterThan %40 %242 %11 OpSelectionMerge %243 None OpBranchConditional %238 %244 %245 %244 = OpLabel -%246 = OpAccessChain %248 %2 %247 -OpStore %246 %231 +%246 = OpAccessChain %248 %14 %247 +OpStore %246 %13 OpBranch %243 %245 = OpLabel OpBranch %243 %243 = OpLabel -%250 = OpAccessChain %252 %2 %251 -%253 = OpLoad %4 %250 -%249 = OpFOrdLessThan %34 %253 %231 +%250 = OpAccessChain %252 %14 %251 +%253 = OpLoad %5 %250 +%249 = OpFOrdLessThan %40 %253 %13 OpSelectionMerge %254 None OpBranchConditional %249 %255 %256 %255 = OpLabel -%257 = OpAccessChain %259 %2 %258 -OpStore %257 %175 +%257 = OpAccessChain %259 %14 %258 +OpStore %257 %11 OpBranch %254 %256 = OpLabel OpBranch %254 %254 = OpLabel -%261 = OpAccessChain %263 %2 %262 -%264 = OpLoad %4 %261 -%260 = OpFOrdGreaterThan %34 %264 %175 +%261 = OpAccessChain %263 %14 %262 +%264 = OpLoad %5 %261 +%260 = OpFOrdGreaterThan %40 %264 %11 OpSelectionMerge %265 None OpBranchConditional %260 %266 %267 %266 = OpLabel -%268 = OpAccessChain %270 %2 %269 -OpStore %268 %231 +%268 = OpAccessChain %270 %14 %269 +OpStore %268 %13 OpBranch %265 %267 = OpLabel OpBranch %265 %265 = OpLabel %273 = OpAccessChain %276 %274 %275 -%277 = OpAccessChain %279 %27 %278 -%280 = OpLoad %19 %277 +%277 = OpAccessChain %279 %34 %278 +%280 = OpLoad %8 %277 %272 = OpAccessChain %281 %273 %280 %271 = OpAccessChain %283 %272 %282 -%284 = OpLoad %3 %2 +%284 = OpLoad %15 %14 OpStore %271 %284 %287 = OpAccessChain %289 %274 %288 -%290 = OpAccessChain %292 %27 %291 -%293 = OpLoad %19 %290 +%290 = OpAccessChain %292 %34 %291 +%293 = OpLoad %8 %290 %286 = OpAccessChain %294 %287 %293 %285 = OpAccessChain %296 %286 %295 -%297 = OpLoad %3 %6 +%297 = OpLoad %15 %17 OpStore %285 %297 OpReturn OpFunctionEnd diff --git a/tests/snapshots/snapshots__collatz.spvasm.snap b/tests/snapshots/snapshots__collatz.spvasm.snap index 5f789ffe76..b2d30f32d4 100644 --- a/tests/snapshots/snapshots__collatz.spvasm.snap +++ b/tests/snapshots/snapshots__collatz.spvasm.snap @@ -18,13 +18,13 @@ OpDecorate %44 DescriptorSet 0 OpDecorate %44 Binding 0 OpDecorate %52 BuiltIn GlobalInvocationId %3 = OpTypeInt 32 0 -%4 = OpTypePointer Function %3 -%6 = OpConstant %3 0 -%9 = OpTypeFunction %3 %3 -%17 = OpConstant %3 1 -%18 = OpTypeBool -%25 = OpConstant %3 2 -%33 = OpConstant %3 3 +%2 = OpConstant %3 0 +%4 = OpConstant %3 1 +%5 = OpConstant %3 2 +%6 = OpConstant %3 3 +%8 = OpTypePointer Function %3 +%12 = OpTypeFunction %3 %3 +%20 = OpTypeBool %38 = OpTypeVoid %40 = OpTypeFunction %38 %46 = OpTypeRuntimeArray %3 @@ -45,51 +45,51 @@ OpDecorate %52 BuiltIn GlobalInvocationId %65 = OpConstant %48 0 %66 = OpTypePointer Input %3 %68 = OpTypePointer Uniform %3 -%8 = OpFunction %3 None %9 -%7 = OpFunctionParameter %3 -%10 = OpLabel -%2 = OpVariable %4 Function -%5 = OpVariable %4 Function %6 -OpStore %2 %7 -OpBranch %11 -%11 = OpLabel -OpLoopMerge %12 %14 None -OpBranch %13 +%11 = OpFunction %3 None %12 +%10 = OpFunctionParameter %3 %13 = OpLabel -%16 = OpLoad %3 %2 -%15 = OpULessThanEqual %18 %16 %17 -OpSelectionMerge %19 None -OpBranchConditional %15 %20 %21 -%20 = OpLabel -OpBranch %12 -%21 = OpLabel -OpBranch %19 -%19 = OpLabel -%24 = OpLoad %3 %2 -%23 = OpUMod %3 %24 %25 -%22 = OpIEqual %18 %23 %6 -OpSelectionMerge %26 None -OpBranchConditional %22 %27 %28 -%27 = OpLabel -%30 = OpLoad %3 %2 -%29 = OpUDiv %3 %30 %25 -OpStore %2 %29 -OpBranch %26 -%28 = OpLabel -%34 = OpLoad %3 %2 -%32 = OpIMul %3 %33 %34 -%31 = OpIAdd %3 %32 %17 -OpStore %2 %31 -OpBranch %26 -%26 = OpLabel -%36 = OpLoad %3 %5 -%35 = OpIAdd %3 %36 %17 -OpStore %5 %35 +%7 = OpVariable %8 Function +%9 = OpVariable %8 Function %2 +OpStore %7 %10 OpBranch %14 %14 = OpLabel -OpBranch %11 -%12 = OpLabel -%37 = OpLoad %3 %5 +OpLoopMerge %15 %17 None +OpBranch %16 +%16 = OpLabel +%19 = OpLoad %3 %7 +%18 = OpULessThanEqual %20 %19 %4 +OpSelectionMerge %21 None +OpBranchConditional %18 %22 %23 +%22 = OpLabel +OpBranch %15 +%23 = OpLabel +OpBranch %21 +%21 = OpLabel +%26 = OpLoad %3 %7 +%25 = OpUMod %3 %26 %5 +%24 = OpIEqual %20 %25 %2 +OpSelectionMerge %27 None +OpBranchConditional %24 %28 %29 +%28 = OpLabel +%31 = OpLoad %3 %7 +%30 = OpUDiv %3 %31 %5 +OpStore %7 %30 +OpBranch %27 +%29 = OpLabel +%34 = OpLoad %3 %7 +%33 = OpIMul %3 %6 %34 +%32 = OpIAdd %3 %33 %4 +OpStore %7 %32 +OpBranch %27 +%27 = OpLabel +%36 = OpLoad %3 %9 +%35 = OpIAdd %3 %36 %4 +OpStore %9 %35 +OpBranch %17 +%17 = OpLabel +OpBranch %14 +%15 = OpLabel +%37 = OpLoad %3 %9 OpReturnValue %37 OpFunctionEnd %39 = OpFunction %38 None %40 @@ -103,7 +103,7 @@ OpFunctionEnd %67 = OpLoad %3 %64 %60 = OpAccessChain %68 %61 %67 %69 = OpLoad %3 %60 -%59 = OpFunctionCall %3 %8 %69 +%59 = OpFunctionCall %3 %11 %69 OpStore %42 %59 OpReturn OpFunctionEnd diff --git a/tests/snapshots/snapshots__quad.spvasm.snap b/tests/snapshots/snapshots__quad.spvasm.snap index bfeeb453a2..145c7399a7 100644 --- a/tests/snapshots/snapshots__quad.spvasm.snap +++ b/tests/snapshots/snapshots__quad.spvasm.snap @@ -9,60 +9,60 @@ expression: dis OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Vertex %3 "main" %18 %10 %6 %13 +OpEntryPoint Vertex %7 "main" %20 %13 %10 %16 OpEntryPoint Fragment %23 "main" %35 %25 OpExecutionMode %23 OriginUpperLeft -OpDecorate %6 Location 0 -OpDecorate %10 Location 1 -OpDecorate %13 BuiltIn Position -OpDecorate %18 Location 0 +OpDecorate %10 Location 0 +OpDecorate %13 Location 1 +OpDecorate %16 BuiltIn Position +OpDecorate %20 Location 0 OpDecorate %25 Location 0 OpDecorate %26 DescriptorSet 0 OpDecorate %26 Binding 0 OpDecorate %31 DescriptorSet 0 OpDecorate %31 Binding 1 OpDecorate %35 Location 0 -%2 = OpTypeVoid -%4 = OpTypeFunction %2 -%8 = OpTypeFloat 32 -%7 = OpTypeVector %8 2 -%9 = OpTypePointer Output %7 -%6 = OpVariable %9 Output -%11 = OpTypePointer Input %7 -%10 = OpVariable %11 Input -%14 = OpTypeVector %8 4 -%15 = OpTypePointer Output %14 -%13 = OpVariable %15 Output -%17 = OpConstant %8 1.2 -%18 = OpVariable %11 Input -%20 = OpConstant %8 0.0 -%21 = OpConstant %8 1.0 -%25 = OpVariable %15 Output -%27 = OpTypeImage %8 2D 0 0 0 1 Unknown +%3 = OpTypeFloat 32 +%2 = OpConstant %3 1.2 +%4 = OpConstant %3 0.0 +%5 = OpConstant %3 1.0 +%6 = OpTypeVoid +%8 = OpTypeFunction %6 +%11 = OpTypeVector %3 2 +%12 = OpTypePointer Output %11 +%10 = OpVariable %12 Output +%14 = OpTypePointer Input %11 +%13 = OpVariable %14 Input +%17 = OpTypeVector %3 4 +%18 = OpTypePointer Output %17 +%16 = OpVariable %18 Output +%20 = OpVariable %14 Input +%25 = OpVariable %18 Output +%27 = OpTypeImage %3 2D 0 0 0 1 Unknown %28 = OpTypePointer UniformConstant %27 %26 = OpVariable %28 UniformConstant %30 = OpTypeSampledImage %27 %32 = OpTypeSampler %33 = OpTypePointer UniformConstant %32 %31 = OpVariable %33 UniformConstant -%35 = OpVariable %11 Input -%3 = OpFunction %2 None %4 -%5 = OpLabel -%12 = OpLoad %7 %10 -OpStore %6 %12 -%19 = OpLoad %7 %18 -%16 = OpVectorTimesScalar %7 %19 %17 -%22 = OpCompositeConstruct %14 %16 %20 %21 -OpStore %13 %22 +%35 = OpVariable %14 Input +%7 = OpFunction %6 None %8 +%9 = OpLabel +%15 = OpLoad %11 %13 +OpStore %10 %15 +%21 = OpLoad %11 %20 +%19 = OpVectorTimesScalar %11 %21 %2 +%22 = OpCompositeConstruct %17 %19 %4 %5 +OpStore %16 %22 OpReturn OpFunctionEnd -%23 = OpFunction %2 None %4 +%23 = OpFunction %6 None %8 %24 = OpLabel %29 = OpLoad %27 %26 %34 = OpLoad %32 %31 -%36 = OpLoad %7 %35 +%36 = OpLoad %11 %35 %37 = OpSampledImage %30 %29 %34 -%38 = OpImageSampleImplicitLod %14 %37 %36 +%38 = OpImageSampleImplicitLod %17 %37 %36 OpStore %25 %38 OpReturn OpFunctionEnd diff --git a/tests/snapshots/snapshots__shadow.spvasm.snap b/tests/snapshots/snapshots__shadow.spvasm.snap index e699d3d0cd..6e7ae4f4f7 100644 --- a/tests/snapshots/snapshots__shadow.spvasm.snap +++ b/tests/snapshots/snapshots__shadow.spvasm.snap @@ -9,266 +9,266 @@ expression: dis OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %60 "fs_main" %112 %109 %216 -OpExecutionMode %60 OriginUpperLeft -OpDecorate %18 DescriptorSet 0 -OpDecorate %18 Binding 2 -OpDecorate %23 DescriptorSet 0 -OpDecorate %23 Binding 3 -OpDecorate %72 Block -OpMemberDecorate %72 0 Offset 0 -OpDecorate %71 DescriptorSet 0 -OpDecorate %71 Binding 0 -OpDecorate %97 BufferBlock -OpMemberDecorate %97 0 Offset 0 -OpMemberDecorate %97 0 NonWritable -OpDecorate %98 ArrayStride 96 -OpDecorate %99 Block -OpMemberDecorate %99 0 Offset 0 -OpMemberDecorate %99 0 ColMajor -OpMemberDecorate %99 0 MatrixStride 16 -OpMemberDecorate %99 1 Offset 64 -OpMemberDecorate %99 2 Offset 80 -OpDecorate %96 DescriptorSet 0 -OpDecorate %96 Binding 1 -OpDecorate %109 Location 1 -OpDecorate %112 Location 0 +OpEntryPoint Fragment %62 "fs_main" %113 %110 %216 +OpExecutionMode %62 OriginUpperLeft +OpDecorate %26 DescriptorSet 0 +OpDecorate %26 Binding 2 +OpDecorate %31 DescriptorSet 0 +OpDecorate %31 Binding 3 +OpDecorate %74 Block +OpMemberDecorate %74 0 Offset 0 +OpDecorate %73 DescriptorSet 0 +OpDecorate %73 Binding 0 +OpDecorate %98 BufferBlock +OpMemberDecorate %98 0 Offset 0 +OpMemberDecorate %98 0 NonWritable +OpDecorate %99 ArrayStride 96 +OpDecorate %100 Block +OpMemberDecorate %100 0 Offset 0 +OpMemberDecorate %100 0 ColMajor +OpMemberDecorate %100 0 MatrixStride 16 +OpMemberDecorate %100 1 Offset 64 +OpMemberDecorate %100 2 Offset 80 +OpDecorate %97 DescriptorSet 0 +OpDecorate %97 Binding 1 +OpDecorate %110 Location 1 +OpDecorate %113 Location 0 OpDecorate %216 Location 0 -%2 = OpTypeFloat 32 -%4 = OpTypeInt 32 0 -%6 = OpTypeVector %2 4 -%8 = OpTypeFunction %2 %4 %6 -%12 = OpConstant %2 0.0 -%13 = OpTypeBool -%17 = OpConstant %2 1.0 -%19 = OpTypeImage %2 2D 1 1 0 1 Unknown -%20 = OpTypePointer UniformConstant %19 -%18 = OpVariable %20 UniformConstant -%22 = OpTypeSampledImage %19 -%24 = OpTypeSampler -%25 = OpTypePointer UniformConstant %24 -%23 = OpVariable %25 UniformConstant -%30 = OpTypeVector %2 2 -%34 = OpConstant %2 0.5 -%35 = OpConstant %2 -0.5 -%43 = OpTypeVector %2 3 -%51 = OpConstant %2 0.0 -%54 = OpConstant %2 0.05 -%53 = OpConstantComposite %43 %54 %54 %54 -%55 = OpTypePointer Function %43 -%57 = OpConstant %4 0 -%58 = OpTypePointer Function %4 -%59 = OpTypeVoid -%61 = OpTypeFunction %59 -%73 = OpTypeVector %4 4 -%72 = OpTypeStruct %73 -%74 = OpTypePointer Uniform %72 -%71 = OpVariable %74 Uniform -%75 = OpTypeInt 32 1 -%76 = OpConstant %75 0 -%77 = OpTypePointer Uniform %73 -%78 = OpConstant %75 0 -%79 = OpTypePointer Uniform %4 -%81 = OpConstant %4 10 -%100 = OpTypeMatrix %6 4 -%99 = OpTypeStruct %100 %6 %6 -%98 = OpTypeRuntimeArray %99 -%97 = OpTypeStruct %98 -%101 = OpTypePointer Uniform %97 -%96 = OpVariable %101 Uniform -%102 = OpConstant %75 0 -%103 = OpTypePointer Uniform %98 -%105 = OpTypePointer Uniform %99 -%106 = OpConstant %75 0 -%107 = OpTypePointer Uniform %100 -%110 = OpTypePointer Input %6 -%109 = OpVariable %110 Input -%113 = OpTypePointer Input %43 -%112 = OpVariable %113 Input -%121 = OpConstant %75 0 -%122 = OpTypePointer Uniform %98 -%124 = OpTypePointer Uniform %99 -%125 = OpConstant %75 1 -%126 = OpTypePointer Uniform %6 -%127 = OpConstant %75 0 -%128 = OpTypePointer Uniform %2 -%134 = OpConstant %75 0 -%135 = OpTypePointer Uniform %98 -%137 = OpTypePointer Uniform %99 -%138 = OpConstant %75 1 -%139 = OpTypePointer Uniform %6 -%140 = OpConstant %75 1 -%141 = OpTypePointer Uniform %2 -%147 = OpConstant %75 0 -%148 = OpTypePointer Uniform %98 -%150 = OpTypePointer Uniform %99 -%151 = OpConstant %75 1 -%152 = OpTypePointer Uniform %6 -%153 = OpConstant %75 2 -%154 = OpTypePointer Uniform %2 -%158 = OpConstant %75 0 -%159 = OpTypePointer Input %2 -%162 = OpConstant %75 1 -%163 = OpTypePointer Input %2 -%166 = OpConstant %75 2 -%167 = OpTypePointer Input %2 -%177 = OpConstant %75 0 -%178 = OpTypePointer Uniform %98 -%180 = OpTypePointer Uniform %99 -%181 = OpConstant %75 2 -%182 = OpTypePointer Uniform %6 -%183 = OpConstant %75 0 -%184 = OpTypePointer Uniform %2 -%190 = OpConstant %75 0 -%191 = OpTypePointer Uniform %98 -%193 = OpTypePointer Uniform %99 -%194 = OpConstant %75 2 -%195 = OpTypePointer Uniform %6 -%196 = OpConstant %75 1 -%197 = OpTypePointer Uniform %2 -%203 = OpConstant %75 0 -%204 = OpTypePointer Uniform %98 -%206 = OpTypePointer Uniform %99 -%207 = OpConstant %75 2 -%208 = OpTypePointer Uniform %6 -%209 = OpConstant %75 2 -%210 = OpTypePointer Uniform %2 -%215 = OpConstant %4 1 -%217 = OpTypePointer Output %6 +%3 = OpTypeFloat 32 +%2 = OpConstant %3 0.0 +%4 = OpConstant %3 1.0 +%5 = OpConstant %3 0.5 +%6 = OpConstant %3 -0.5 +%7 = OpConstant %3 0.05 +%9 = OpTypeVector %3 3 +%8 = OpConstantComposite %9 %7 %7 %7 +%11 = OpTypeInt 32 0 +%10 = OpConstant %11 10 +%12 = OpConstant %11 0 +%13 = OpConstant %11 1 +%16 = OpTypeVector %3 4 +%18 = OpTypeFunction %3 %11 %16 +%22 = OpTypeBool +%27 = OpTypeImage %3 2D 1 1 0 1 Unknown +%28 = OpTypePointer UniformConstant %27 +%26 = OpVariable %28 UniformConstant +%30 = OpTypeSampledImage %27 +%32 = OpTypeSampler +%33 = OpTypePointer UniformConstant %32 +%31 = OpVariable %33 UniformConstant +%38 = OpTypeVector %3 2 +%56 = OpConstant %3 0.0 +%58 = OpTypePointer Function %9 +%60 = OpTypePointer Function %11 +%61 = OpTypeVoid +%63 = OpTypeFunction %61 +%75 = OpTypeVector %11 4 +%74 = OpTypeStruct %75 +%76 = OpTypePointer Uniform %74 +%73 = OpVariable %76 Uniform +%77 = OpTypeInt 32 1 +%78 = OpConstant %77 0 +%79 = OpTypePointer Uniform %75 +%80 = OpConstant %77 0 +%81 = OpTypePointer Uniform %11 +%101 = OpTypeMatrix %16 4 +%100 = OpTypeStruct %101 %16 %16 +%99 = OpTypeRuntimeArray %100 +%98 = OpTypeStruct %99 +%102 = OpTypePointer Uniform %98 +%97 = OpVariable %102 Uniform +%103 = OpConstant %77 0 +%104 = OpTypePointer Uniform %99 +%106 = OpTypePointer Uniform %100 +%107 = OpConstant %77 0 +%108 = OpTypePointer Uniform %101 +%111 = OpTypePointer Input %16 +%110 = OpVariable %111 Input +%114 = OpTypePointer Input %9 +%113 = OpVariable %114 Input +%122 = OpConstant %77 0 +%123 = OpTypePointer Uniform %99 +%125 = OpTypePointer Uniform %100 +%126 = OpConstant %77 1 +%127 = OpTypePointer Uniform %16 +%128 = OpConstant %77 0 +%129 = OpTypePointer Uniform %3 +%135 = OpConstant %77 0 +%136 = OpTypePointer Uniform %99 +%138 = OpTypePointer Uniform %100 +%139 = OpConstant %77 1 +%140 = OpTypePointer Uniform %16 +%141 = OpConstant %77 1 +%142 = OpTypePointer Uniform %3 +%148 = OpConstant %77 0 +%149 = OpTypePointer Uniform %99 +%151 = OpTypePointer Uniform %100 +%152 = OpConstant %77 1 +%153 = OpTypePointer Uniform %16 +%154 = OpConstant %77 2 +%155 = OpTypePointer Uniform %3 +%159 = OpConstant %77 0 +%160 = OpTypePointer Input %3 +%163 = OpConstant %77 1 +%164 = OpTypePointer Input %3 +%167 = OpConstant %77 2 +%168 = OpTypePointer Input %3 +%178 = OpConstant %77 0 +%179 = OpTypePointer Uniform %99 +%181 = OpTypePointer Uniform %100 +%182 = OpConstant %77 2 +%183 = OpTypePointer Uniform %16 +%184 = OpConstant %77 0 +%185 = OpTypePointer Uniform %3 +%191 = OpConstant %77 0 +%192 = OpTypePointer Uniform %99 +%194 = OpTypePointer Uniform %100 +%195 = OpConstant %77 2 +%196 = OpTypePointer Uniform %16 +%197 = OpConstant %77 1 +%198 = OpTypePointer Uniform %3 +%204 = OpConstant %77 0 +%205 = OpTypePointer Uniform %99 +%207 = OpTypePointer Uniform %100 +%208 = OpConstant %77 2 +%209 = OpTypePointer Uniform %16 +%210 = OpConstant %77 2 +%211 = OpTypePointer Uniform %3 +%217 = OpTypePointer Output %16 %216 = OpVariable %217 Output -%7 = OpFunction %2 None %8 -%3 = OpFunctionParameter %4 -%5 = OpFunctionParameter %6 -%9 = OpLabel -%11 = OpCompositeExtract %2 %5 3 -%10 = OpFOrdLessThanEqual %13 %11 %12 -OpSelectionMerge %14 None -OpBranchConditional %10 %15 %16 -%15 = OpLabel -OpReturnValue %17 -%16 = OpLabel -OpBranch %14 -%14 = OpLabel -%21 = OpLoad %19 %18 -%26 = OpLoad %24 %23 -%31 = OpCompositeExtract %2 %5 0 -%32 = OpCompositeExtract %2 %5 1 -%33 = OpCompositeConstruct %30 %31 %32 -%36 = OpCompositeConstruct %30 %34 %35 -%29 = OpFMul %30 %33 %36 -%38 = OpCompositeExtract %2 %5 3 -%37 = OpFDiv %2 %17 %38 -%28 = OpVectorTimesScalar %30 %29 %37 -%39 = OpCompositeConstruct %30 %34 %34 -%27 = OpFAdd %30 %28 %39 -%40 = OpCompositeExtract %2 %27 0 -%41 = OpCompositeExtract %2 %27 1 -%42 = OpConvertUToF %2 %3 -%44 = OpCompositeConstruct %43 %40 %41 %42 -%45 = OpSampledImage %22 %21 %26 -%48 = OpCompositeExtract %2 %5 2 -%50 = OpCompositeExtract %2 %5 3 -%49 = OpFDiv %2 %17 %50 -%47 = OpFMul %2 %48 %49 -%46 = OpImageSampleDrefExplicitLod %2 %45 %44 %47 Lod %51 -OpReturnValue %46 +%17 = OpFunction %3 None %18 +%14 = OpFunctionParameter %11 +%15 = OpFunctionParameter %16 +%19 = OpLabel +%21 = OpCompositeExtract %3 %15 3 +%20 = OpFOrdLessThanEqual %22 %21 %2 +OpSelectionMerge %23 None +OpBranchConditional %20 %24 %25 +%24 = OpLabel +OpReturnValue %4 +%25 = OpLabel +OpBranch %23 +%23 = OpLabel +%29 = OpLoad %27 %26 +%34 = OpLoad %32 %31 +%39 = OpCompositeExtract %3 %15 0 +%40 = OpCompositeExtract %3 %15 1 +%41 = OpCompositeConstruct %38 %39 %40 +%42 = OpCompositeConstruct %38 %5 %6 +%37 = OpFMul %38 %41 %42 +%44 = OpCompositeExtract %3 %15 3 +%43 = OpFDiv %3 %4 %44 +%36 = OpVectorTimesScalar %38 %37 %43 +%45 = OpCompositeConstruct %38 %5 %5 +%35 = OpFAdd %38 %36 %45 +%46 = OpCompositeExtract %3 %35 0 +%47 = OpCompositeExtract %3 %35 1 +%48 = OpConvertUToF %3 %14 +%49 = OpCompositeConstruct %9 %46 %47 %48 +%50 = OpSampledImage %30 %29 %34 +%53 = OpCompositeExtract %3 %15 2 +%55 = OpCompositeExtract %3 %15 3 +%54 = OpFDiv %3 %4 %55 +%52 = OpFMul %3 %53 %54 +%51 = OpImageSampleDrefExplicitLod %3 %50 %49 %52 Lod %56 +OpReturnValue %51 OpFunctionEnd -%60 = OpFunction %59 None %61 -%62 = OpLabel -%52 = OpVariable %55 Function %53 -%56 = OpVariable %58 Function %57 -OpBranch %63 -%63 = OpLabel -OpLoopMerge %64 %66 None +%62 = OpFunction %61 None %63 +%64 = OpLabel +%57 = OpVariable %58 Function %8 +%59 = OpVariable %60 Function %12 OpBranch %65 %65 = OpLabel -%68 = OpLoad %4 %56 -%70 = OpAccessChain %77 %71 %76 -%69 = OpAccessChain %79 %70 %78 -%80 = OpLoad %4 %69 -%82 = OpExtInst %4 %1 UMin %80 %81 -%67 = OpUGreaterThanEqual %13 %68 %82 -OpSelectionMerge %83 None -OpBranchConditional %67 %84 %85 -%84 = OpLabel -OpBranch %64 +OpLoopMerge %66 %68 None +OpBranch %67 +%67 = OpLabel +%70 = OpLoad %11 %59 +%72 = OpAccessChain %79 %73 %78 +%71 = OpAccessChain %81 %72 %80 +%82 = OpLoad %11 %71 +%83 = OpExtInst %11 %1 UMin %82 %10 +%69 = OpUGreaterThanEqual %22 %70 %83 +OpSelectionMerge %84 None +OpBranchConditional %69 %85 %86 %85 = OpLabel -OpBranch %83 -%83 = OpLabel -%87 = OpLoad %43 %52 -%91 = OpLoad %4 %56 -%95 = OpAccessChain %103 %96 %102 -%104 = OpLoad %4 %56 -%94 = OpAccessChain %105 %95 %104 -%93 = OpAccessChain %107 %94 %106 -%108 = OpLoad %100 %93 -%111 = OpLoad %6 %109 -%92 = OpMatrixTimesVector %6 %108 %111 -%90 = OpFunctionCall %2 %7 %91 %92 -%114 = OpLoad %43 %112 -%115 = OpExtInst %43 %1 Normalize %114 -%120 = OpAccessChain %122 %96 %121 -%123 = OpLoad %4 %56 -%119 = OpAccessChain %124 %120 %123 -%118 = OpAccessChain %126 %119 %125 -%117 = OpAccessChain %128 %118 %127 -%129 = OpLoad %2 %117 -%133 = OpAccessChain %135 %96 %134 -%136 = OpLoad %4 %56 -%132 = OpAccessChain %137 %133 %136 -%131 = OpAccessChain %139 %132 %138 -%130 = OpAccessChain %141 %131 %140 -%142 = OpLoad %2 %130 -%146 = OpAccessChain %148 %96 %147 -%149 = OpLoad %4 %56 -%145 = OpAccessChain %150 %146 %149 -%144 = OpAccessChain %152 %145 %151 -%143 = OpAccessChain %154 %144 %153 -%155 = OpLoad %2 %143 -%156 = OpCompositeConstruct %43 %129 %142 %155 -%157 = OpAccessChain %159 %109 %158 -%160 = OpLoad %2 %157 -%161 = OpAccessChain %163 %109 %162 -%164 = OpLoad %2 %161 -%165 = OpAccessChain %167 %109 %166 -%168 = OpLoad %2 %165 -%169 = OpCompositeConstruct %43 %160 %164 %168 -%116 = OpFSub %43 %156 %169 -%170 = OpExtInst %43 %1 Normalize %116 -%171 = OpDot %2 %115 %170 -%172 = OpExtInst %2 %1 FMax %12 %171 -%89 = OpFMul %2 %90 %172 -%176 = OpAccessChain %178 %96 %177 -%179 = OpLoad %4 %56 -%175 = OpAccessChain %180 %176 %179 -%174 = OpAccessChain %182 %175 %181 -%173 = OpAccessChain %184 %174 %183 -%185 = OpLoad %2 %173 -%189 = OpAccessChain %191 %96 %190 -%192 = OpLoad %4 %56 -%188 = OpAccessChain %193 %189 %192 -%187 = OpAccessChain %195 %188 %194 -%186 = OpAccessChain %197 %187 %196 -%198 = OpLoad %2 %186 -%202 = OpAccessChain %204 %96 %203 -%205 = OpLoad %4 %56 -%201 = OpAccessChain %206 %202 %205 -%200 = OpAccessChain %208 %201 %207 -%199 = OpAccessChain %210 %200 %209 -%211 = OpLoad %2 %199 -%212 = OpCompositeConstruct %43 %185 %198 %211 -%88 = OpVectorTimesScalar %43 %212 %89 -%86 = OpFAdd %43 %87 %88 -OpStore %52 %86 OpBranch %66 +%86 = OpLabel +OpBranch %84 +%84 = OpLabel +%88 = OpLoad %9 %57 +%92 = OpLoad %11 %59 +%96 = OpAccessChain %104 %97 %103 +%105 = OpLoad %11 %59 +%95 = OpAccessChain %106 %96 %105 +%94 = OpAccessChain %108 %95 %107 +%109 = OpLoad %101 %94 +%112 = OpLoad %16 %110 +%93 = OpMatrixTimesVector %16 %109 %112 +%91 = OpFunctionCall %3 %17 %92 %93 +%115 = OpLoad %9 %113 +%116 = OpExtInst %9 %1 Normalize %115 +%121 = OpAccessChain %123 %97 %122 +%124 = OpLoad %11 %59 +%120 = OpAccessChain %125 %121 %124 +%119 = OpAccessChain %127 %120 %126 +%118 = OpAccessChain %129 %119 %128 +%130 = OpLoad %3 %118 +%134 = OpAccessChain %136 %97 %135 +%137 = OpLoad %11 %59 +%133 = OpAccessChain %138 %134 %137 +%132 = OpAccessChain %140 %133 %139 +%131 = OpAccessChain %142 %132 %141 +%143 = OpLoad %3 %131 +%147 = OpAccessChain %149 %97 %148 +%150 = OpLoad %11 %59 +%146 = OpAccessChain %151 %147 %150 +%145 = OpAccessChain %153 %146 %152 +%144 = OpAccessChain %155 %145 %154 +%156 = OpLoad %3 %144 +%157 = OpCompositeConstruct %9 %130 %143 %156 +%158 = OpAccessChain %160 %110 %159 +%161 = OpLoad %3 %158 +%162 = OpAccessChain %164 %110 %163 +%165 = OpLoad %3 %162 +%166 = OpAccessChain %168 %110 %167 +%169 = OpLoad %3 %166 +%170 = OpCompositeConstruct %9 %161 %165 %169 +%117 = OpFSub %9 %157 %170 +%171 = OpExtInst %9 %1 Normalize %117 +%172 = OpDot %3 %116 %171 +%173 = OpExtInst %3 %1 FMax %2 %172 +%90 = OpFMul %3 %91 %173 +%177 = OpAccessChain %179 %97 %178 +%180 = OpLoad %11 %59 +%176 = OpAccessChain %181 %177 %180 +%175 = OpAccessChain %183 %176 %182 +%174 = OpAccessChain %185 %175 %184 +%186 = OpLoad %3 %174 +%190 = OpAccessChain %192 %97 %191 +%193 = OpLoad %11 %59 +%189 = OpAccessChain %194 %190 %193 +%188 = OpAccessChain %196 %189 %195 +%187 = OpAccessChain %198 %188 %197 +%199 = OpLoad %3 %187 +%203 = OpAccessChain %205 %97 %204 +%206 = OpLoad %11 %59 +%202 = OpAccessChain %207 %203 %206 +%201 = OpAccessChain %209 %202 %208 +%200 = OpAccessChain %211 %201 %210 +%212 = OpLoad %3 %200 +%213 = OpCompositeConstruct %9 %186 %199 %212 +%89 = OpVectorTimesScalar %9 %213 %90 +%87 = OpFAdd %9 %88 %89 +OpStore %57 %87 +OpBranch %68 +%68 = OpLabel +%215 = OpLoad %11 %59 +%214 = OpIAdd %11 %215 %13 +OpStore %59 %214 +OpBranch %65 %66 = OpLabel -%214 = OpLoad %4 %56 -%213 = OpIAdd %4 %214 %215 -OpStore %56 %213 -OpBranch %63 -%64 = OpLabel -%218 = OpLoad %43 %52 -%219 = OpCompositeConstruct %6 %218 %17 +%218 = OpLoad %9 %57 +%219 = OpCompositeConstruct %16 %218 %4 OpStore %216 %219 OpReturn OpFunctionEnd diff --git a/tests/snapshots/snapshots__skybox.spvasm.snap b/tests/snapshots/snapshots__skybox.spvasm.snap index 45fdbf18c0..6c23904ab4 100644 --- a/tests/snapshots/snapshots__skybox.spvasm.snap +++ b/tests/snapshots/snapshots__skybox.spvasm.snap @@ -9,19 +9,19 @@ expression: dis OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Vertex %11 "vs_main" %157 %44 %15 +OpEntryPoint Vertex %16 "vs_main" %157 %44 %20 OpEntryPoint Fragment %168 "fs_main" %180 %170 OpExecutionMode %168 OriginUpperLeft -OpDecorate %15 BuiltIn VertexIndex -OpDecorate %26 Block -OpMemberDecorate %26 0 Offset 0 -OpMemberDecorate %26 0 ColMajor -OpMemberDecorate %26 0 MatrixStride 16 -OpMemberDecorate %26 1 Offset 64 -OpMemberDecorate %26 1 ColMajor -OpMemberDecorate %26 1 MatrixStride 16 -OpDecorate %25 DescriptorSet 0 -OpDecorate %25 Binding 0 +OpDecorate %20 BuiltIn VertexIndex +OpDecorate %29 Block +OpMemberDecorate %29 0 Offset 0 +OpMemberDecorate %29 0 ColMajor +OpMemberDecorate %29 0 MatrixStride 16 +OpMemberDecorate %29 1 Offset 64 +OpMemberDecorate %29 1 ColMajor +OpMemberDecorate %29 1 MatrixStride 16 +OpDecorate %28 DescriptorSet 0 +OpDecorate %28 Binding 0 OpDecorate %44 Location 0 OpDecorate %157 BuiltIn Position OpDecorate %170 Location 0 @@ -31,94 +31,94 @@ OpDecorate %176 DescriptorSet 0 OpDecorate %176 Binding 2 OpDecorate %180 Location 0 %3 = OpTypeInt 32 1 -%4 = OpTypePointer Function %3 -%8 = OpTypeFloat 32 -%7 = OpTypeVector %8 4 -%9 = OpTypePointer Function %7 -%10 = OpTypeVoid -%12 = OpTypeFunction %10 -%16 = OpTypeInt 32 0 -%17 = OpTypePointer Input %16 -%15 = OpVariable %17 Input -%19 = OpConstant %3 2 -%22 = OpConstant %3 1 -%27 = OpTypeMatrix %7 4 -%26 = OpTypeStruct %27 %27 -%28 = OpTypePointer Uniform %26 -%25 = OpVariable %28 Uniform -%29 = OpConstant %3 0 -%30 = OpTypePointer Uniform %27 -%36 = OpConstant %8 4.0 -%37 = OpConstant %8 1.0 -%42 = OpConstant %8 0.0 -%45 = OpTypeVector %8 3 +%2 = OpConstant %3 2 +%4 = OpConstant %3 1 +%6 = OpTypeFloat 32 +%5 = OpConstant %6 4.0 +%7 = OpConstant %6 1.0 +%8 = OpConstant %6 0.0 +%10 = OpTypePointer Function %3 +%13 = OpTypeVector %6 4 +%14 = OpTypePointer Function %13 +%15 = OpTypeVoid +%17 = OpTypeFunction %15 +%21 = OpTypeInt 32 0 +%22 = OpTypePointer Input %21 +%20 = OpVariable %22 Input +%30 = OpTypeMatrix %13 4 +%29 = OpTypeStruct %30 %30 +%31 = OpTypePointer Uniform %29 +%28 = OpVariable %31 Uniform +%32 = OpConstant %3 0 +%33 = OpTypePointer Uniform %30 +%45 = OpTypeVector %6 3 %46 = OpTypePointer Output %45 %44 = OpVariable %46 Output %48 = OpTypeMatrix %45 3 %52 = OpConstant %3 1 -%53 = OpTypePointer Uniform %27 +%53 = OpTypePointer Uniform %30 %54 = OpConstant %3 0 -%55 = OpTypePointer Uniform %7 +%55 = OpTypePointer Uniform %13 %56 = OpConstant %3 0 -%57 = OpTypePointer Uniform %8 +%57 = OpTypePointer Uniform %6 %62 = OpConstant %3 1 -%63 = OpTypePointer Uniform %27 +%63 = OpTypePointer Uniform %30 %64 = OpConstant %3 0 -%65 = OpTypePointer Uniform %7 +%65 = OpTypePointer Uniform %13 %66 = OpConstant %3 1 -%67 = OpTypePointer Uniform %8 +%67 = OpTypePointer Uniform %6 %72 = OpConstant %3 1 -%73 = OpTypePointer Uniform %27 +%73 = OpTypePointer Uniform %30 %74 = OpConstant %3 0 -%75 = OpTypePointer Uniform %7 +%75 = OpTypePointer Uniform %13 %76 = OpConstant %3 2 -%77 = OpTypePointer Uniform %8 +%77 = OpTypePointer Uniform %6 %83 = OpConstant %3 1 -%84 = OpTypePointer Uniform %27 +%84 = OpTypePointer Uniform %30 %85 = OpConstant %3 1 -%86 = OpTypePointer Uniform %7 +%86 = OpTypePointer Uniform %13 %87 = OpConstant %3 0 -%88 = OpTypePointer Uniform %8 +%88 = OpTypePointer Uniform %6 %93 = OpConstant %3 1 -%94 = OpTypePointer Uniform %27 +%94 = OpTypePointer Uniform %30 %95 = OpConstant %3 1 -%96 = OpTypePointer Uniform %7 +%96 = OpTypePointer Uniform %13 %97 = OpConstant %3 1 -%98 = OpTypePointer Uniform %8 +%98 = OpTypePointer Uniform %6 %103 = OpConstant %3 1 -%104 = OpTypePointer Uniform %27 +%104 = OpTypePointer Uniform %30 %105 = OpConstant %3 1 -%106 = OpTypePointer Uniform %7 +%106 = OpTypePointer Uniform %13 %107 = OpConstant %3 2 -%108 = OpTypePointer Uniform %8 +%108 = OpTypePointer Uniform %6 %114 = OpConstant %3 1 -%115 = OpTypePointer Uniform %27 +%115 = OpTypePointer Uniform %30 %116 = OpConstant %3 2 -%117 = OpTypePointer Uniform %7 +%117 = OpTypePointer Uniform %13 %118 = OpConstant %3 0 -%119 = OpTypePointer Uniform %8 +%119 = OpTypePointer Uniform %6 %124 = OpConstant %3 1 -%125 = OpTypePointer Uniform %27 +%125 = OpTypePointer Uniform %30 %126 = OpConstant %3 2 -%127 = OpTypePointer Uniform %7 +%127 = OpTypePointer Uniform %13 %128 = OpConstant %3 1 -%129 = OpTypePointer Uniform %8 +%129 = OpTypePointer Uniform %6 %134 = OpConstant %3 1 -%135 = OpTypePointer Uniform %27 +%135 = OpTypePointer Uniform %30 %136 = OpConstant %3 2 -%137 = OpTypePointer Uniform %7 +%137 = OpTypePointer Uniform %13 %138 = OpConstant %3 2 -%139 = OpTypePointer Uniform %8 +%139 = OpTypePointer Uniform %6 %145 = OpConstant %3 0 -%146 = OpTypePointer Function %8 +%146 = OpTypePointer Function %6 %149 = OpConstant %3 1 -%150 = OpTypePointer Function %8 +%150 = OpTypePointer Function %6 %153 = OpConstant %3 2 -%154 = OpTypePointer Function %8 -%158 = OpTypePointer Output %7 +%154 = OpTypePointer Function %6 +%158 = OpTypePointer Output %13 %157 = OpVariable %158 Output %170 = OpVariable %158 Output -%172 = OpTypeImage %8 Cube 0 0 0 1 Unknown +%172 = OpTypeImage %6 Cube 0 0 0 1 Unknown %173 = OpTypePointer UniformConstant %172 %171 = OpVariable %173 UniformConstant %175 = OpTypeSampledImage %172 @@ -127,99 +127,99 @@ OpDecorate %180 Location 0 %176 = OpVariable %178 UniformConstant %181 = OpTypePointer Input %45 %180 = OpVariable %181 Input -%11 = OpFunction %10 None %12 -%13 = OpLabel -%2 = OpVariable %4 Function -%5 = OpVariable %4 Function -%6 = OpVariable %9 Function -%18 = OpLoad %16 %15 -%14 = OpSDiv %3 %18 %19 -OpStore %2 %14 -%21 = OpLoad %16 %15 -%20 = OpBitwiseAnd %3 %21 %22 -OpStore %5 %20 -%24 = OpAccessChain %30 %25 %29 -%31 = OpLoad %27 %24 -%34 = OpLoad %3 %2 -%35 = OpConvertSToF %8 %34 -%33 = OpFMul %8 %35 %36 -%32 = OpFSub %8 %33 %37 -%40 = OpLoad %3 %5 -%41 = OpConvertSToF %8 %40 -%39 = OpFMul %8 %41 %36 -%38 = OpFSub %8 %39 %37 -%43 = OpCompositeConstruct %7 %32 %38 %42 %37 -%23 = OpMatrixTimesVector %7 %31 %43 -OpStore %6 %23 -%51 = OpAccessChain %53 %25 %52 +%16 = OpFunction %15 None %17 +%18 = OpLabel +%9 = OpVariable %10 Function +%11 = OpVariable %10 Function +%12 = OpVariable %14 Function +%23 = OpLoad %21 %20 +%19 = OpSDiv %3 %23 %2 +OpStore %9 %19 +%25 = OpLoad %21 %20 +%24 = OpBitwiseAnd %3 %25 %4 +OpStore %11 %24 +%27 = OpAccessChain %33 %28 %32 +%34 = OpLoad %30 %27 +%37 = OpLoad %3 %9 +%38 = OpConvertSToF %6 %37 +%36 = OpFMul %6 %38 %5 +%35 = OpFSub %6 %36 %7 +%41 = OpLoad %3 %11 +%42 = OpConvertSToF %6 %41 +%40 = OpFMul %6 %42 %5 +%39 = OpFSub %6 %40 %7 +%43 = OpCompositeConstruct %13 %35 %39 %8 %7 +%26 = OpMatrixTimesVector %13 %34 %43 +OpStore %12 %26 +%51 = OpAccessChain %53 %28 %52 %50 = OpAccessChain %55 %51 %54 %49 = OpAccessChain %57 %50 %56 -%58 = OpLoad %8 %49 -%61 = OpAccessChain %63 %25 %62 +%58 = OpLoad %6 %49 +%61 = OpAccessChain %63 %28 %62 %60 = OpAccessChain %65 %61 %64 %59 = OpAccessChain %67 %60 %66 -%68 = OpLoad %8 %59 -%71 = OpAccessChain %73 %25 %72 +%68 = OpLoad %6 %59 +%71 = OpAccessChain %73 %28 %72 %70 = OpAccessChain %75 %71 %74 %69 = OpAccessChain %77 %70 %76 -%78 = OpLoad %8 %69 +%78 = OpLoad %6 %69 %79 = OpCompositeConstruct %45 %58 %68 %78 -%82 = OpAccessChain %84 %25 %83 +%82 = OpAccessChain %84 %28 %83 %81 = OpAccessChain %86 %82 %85 %80 = OpAccessChain %88 %81 %87 -%89 = OpLoad %8 %80 -%92 = OpAccessChain %94 %25 %93 +%89 = OpLoad %6 %80 +%92 = OpAccessChain %94 %28 %93 %91 = OpAccessChain %96 %92 %95 %90 = OpAccessChain %98 %91 %97 -%99 = OpLoad %8 %90 -%102 = OpAccessChain %104 %25 %103 +%99 = OpLoad %6 %90 +%102 = OpAccessChain %104 %28 %103 %101 = OpAccessChain %106 %102 %105 %100 = OpAccessChain %108 %101 %107 -%109 = OpLoad %8 %100 +%109 = OpLoad %6 %100 %110 = OpCompositeConstruct %45 %89 %99 %109 -%113 = OpAccessChain %115 %25 %114 +%113 = OpAccessChain %115 %28 %114 %112 = OpAccessChain %117 %113 %116 %111 = OpAccessChain %119 %112 %118 -%120 = OpLoad %8 %111 -%123 = OpAccessChain %125 %25 %124 +%120 = OpLoad %6 %111 +%123 = OpAccessChain %125 %28 %124 %122 = OpAccessChain %127 %123 %126 %121 = OpAccessChain %129 %122 %128 -%130 = OpLoad %8 %121 -%133 = OpAccessChain %135 %25 %134 +%130 = OpLoad %6 %121 +%133 = OpAccessChain %135 %28 %134 %132 = OpAccessChain %137 %133 %136 %131 = OpAccessChain %139 %132 %138 -%140 = OpLoad %8 %131 +%140 = OpLoad %6 %131 %141 = OpCompositeConstruct %45 %120 %130 %140 %142 = OpCompositeConstruct %48 %79 %110 %141 %143 = OpTranspose %48 %142 -%144 = OpAccessChain %146 %6 %145 -%147 = OpLoad %8 %144 -%148 = OpAccessChain %150 %6 %149 -%151 = OpLoad %8 %148 -%152 = OpAccessChain %154 %6 %153 -%155 = OpLoad %8 %152 +%144 = OpAccessChain %146 %12 %145 +%147 = OpLoad %6 %144 +%148 = OpAccessChain %150 %12 %149 +%151 = OpLoad %6 %148 +%152 = OpAccessChain %154 %12 %153 +%155 = OpLoad %6 %152 %156 = OpCompositeConstruct %45 %147 %151 %155 %47 = OpMatrixTimesVector %45 %143 %156 OpStore %44 %47 -%161 = OpLoad %3 %2 -%162 = OpConvertSToF %8 %161 -%160 = OpFMul %8 %162 %36 -%159 = OpFSub %8 %160 %37 -%165 = OpLoad %3 %5 -%166 = OpConvertSToF %8 %165 -%164 = OpFMul %8 %166 %36 -%163 = OpFSub %8 %164 %37 -%167 = OpCompositeConstruct %7 %159 %163 %42 %37 +%161 = OpLoad %3 %9 +%162 = OpConvertSToF %6 %161 +%160 = OpFMul %6 %162 %5 +%159 = OpFSub %6 %160 %7 +%165 = OpLoad %3 %11 +%166 = OpConvertSToF %6 %165 +%164 = OpFMul %6 %166 %5 +%163 = OpFSub %6 %164 %7 +%167 = OpCompositeConstruct %13 %159 %163 %8 %7 OpStore %157 %167 OpReturn OpFunctionEnd -%168 = OpFunction %10 None %12 +%168 = OpFunction %15 None %17 %169 = OpLabel %174 = OpLoad %172 %171 %179 = OpLoad %177 %176 %182 = OpLoad %45 %180 %183 = OpSampledImage %175 %174 %179 -%184 = OpImageSampleImplicitLod %7 %183 %182 +%184 = OpImageSampleImplicitLod %13 %183 %182 OpStore %170 %184 OpReturn OpFunctionEnd