diff --git a/CHANGELOG.md b/CHANGELOG.md index 996c890f2..de479fe8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -286,6 +286,7 @@ By @stuartparmenter in [#9658](https://github.com/gfx-rs/wgpu/pull/9658). - Fixed loading of `libvulkan.so` on OpenHarmony (`target_env = "ohos"`). By @jschwe in [#9649](https://github.com/gfx-rs/wgpu/pull/9649). - Fixed `VUID-RuntimeSpirv-vulkanMemoryModel-06265` validation errors by enabling `vulkanMemoryModelDeviceScope` whenever the Vulkan memory model is enabled, since the SPIR-V backend emits storage atomics with `Device` scope. By @francisdb in [#9741](https://github.com/gfx-rs/wgpu/pull/9741). - Fixed some cases where out-of-memory errors were reported incorrectly. By @andyleiserson in [#9643](https://github.com/gfx-rs/wgpu/pull/9643) and [#9747](https://github.com/gfx-rs/wgpu/pull/9747). +- Fixed signed integer `%` (and `%=`) returning the wrong result for negative operands in the SPIR-V backend, e.g. `-1 % 768` yielding `255` instead of `-1` on NVIDIA. `OpSRem` is poison for negative operands in the Vulkan SPIR-V environment without `VK_KHR_maintenance8`, even though WGSL defines `%` for these operands, so signed remainder is now always lowered as `a - b * (a / b)`. By @mstampfli in [#9674](https://github.com/gfx-rs/wgpu/pull/9674). #### DX12 diff --git a/naga/src/back/spv/block.rs b/naga/src/back/spv/block.rs index 2c6dd1218..bb977e81f 100644 --- a/naga/src/back/spv/block.rs +++ b/naga/src/back/spv/block.rs @@ -1180,8 +1180,13 @@ impl BlockContext<'_> { crate::BinaryOperator::Modulo => match left_ty_inner.scalar_kind() { Some(crate::ScalarKind::Float) => spirv::Op::FRem, Some(crate::ScalarKind::Sint) => { - assert!(!self.writer.emit_int_div_checks); - spirv::Op::SRem + // Signed `%` is always lowered to `a - b * (a / b)` + // through a wrapper function (see + // `write_wrapped_functions`), because `OpSRem` with a + // negative operand is poison in the Vulkan SPIR-V + // environment without `VK_KHR_maintenance8`. So this raw + // path is never reached for signed modulo. + unreachable!("signed modulo must be lowered via the wrapped path") } Some(crate::ScalarKind::Uint) => { assert!(!self.writer.emit_int_div_checks); diff --git a/naga/src/back/spv/writer.rs b/naga/src/back/spv/writer.rs index 8b5b5d4ab..ea6a9530f 100644 --- a/naga/src/back/spv/writer.rs +++ b/naga/src/back/spv/writer.rs @@ -560,10 +560,22 @@ impl Writer { // is negative one, or when the divisor is zero. These wrapped // functions override the divisor to one in these cases, // matching the WGSL spec. + // + // Signed `%` is additionally always wrapped (even without + // `emit_int_div_checks`) so it can be lowered to + // `a - b * (a / b)`: `OpSRem` produces a poison result for + // negative operands in the Vulkan SPIR-V environment unless + // `VK_KHR_maintenance8` is enabled. See + // . ( crate::BinaryOperator::Divide | crate::BinaryOperator::Modulo, crate::ScalarKind::Sint | crate::ScalarKind::Uint, - ) if self.emit_int_div_checks => { + ) if self.emit_int_div_checks + || matches!( + (op, expr_ty.scalar().kind), + (crate::BinaryOperator::Modulo, crate::ScalarKind::Sint) + ) => + { self.write_wrapped_binary_op( op, expr_ty, @@ -804,21 +816,57 @@ impl Writer { composite_one_id, rhs_id, )); - let op = match (op, scalar.kind) { - (crate::BinaryOperator::Divide, crate::ScalarKind::Sint) => spirv::Op::SDiv, - (crate::BinaryOperator::Divide, crate::ScalarKind::Uint) => spirv::Op::UDiv, - (crate::BinaryOperator::Modulo, crate::ScalarKind::Sint) => spirv::Op::SRem, - (crate::BinaryOperator::Modulo, crate::ScalarKind::Uint) => spirv::Op::UMod, - _ => unreachable!(), + let return_id = if matches!(op, crate::BinaryOperator::Modulo) + && matches!(scalar.kind, crate::ScalarKind::Sint) + { + // `OpSRem` produces a poison result for negative operands in the Vulkan + // environment without the `maintenance8` feature. `OpSDiv` is not poisoned, so + // reconstruct the remainder as `a - b * (a / b)`, which is well-defined for + // negative operands. `divisor_id` is the zero/overflow-guarded divisor selected + // above, so the degenerate cases still match `OpSRem`'s guarded result (0). + let quotient_id = self.id_gen.next(); + block.body.push(Instruction::binary( + spirv::Op::SDiv, + return_type_id, + quotient_id, + lhs_id, + divisor_id, + )); + let product_id = self.id_gen.next(); + block.body.push(Instruction::binary( + spirv::Op::IMul, + return_type_id, + product_id, + quotient_id, + divisor_id, + )); + let remainder_id = self.id_gen.next(); + block.body.push(Instruction::binary( + spirv::Op::ISub, + return_type_id, + remainder_id, + lhs_id, + product_id, + )); + remainder_id + } else { + let spv_op = match (op, scalar.kind) { + (crate::BinaryOperator::Divide, crate::ScalarKind::Sint) => spirv::Op::SDiv, + (crate::BinaryOperator::Divide, crate::ScalarKind::Uint) => spirv::Op::UDiv, + (crate::BinaryOperator::Modulo, crate::ScalarKind::Sint) => spirv::Op::SRem, + (crate::BinaryOperator::Modulo, crate::ScalarKind::Uint) => spirv::Op::UMod, + _ => unreachable!(), + }; + let return_id = self.id_gen.next(); + block.body.push(Instruction::binary( + spv_op, + return_type_id, + return_id, + lhs_id, + divisor_id, + )); + return_id }; - let return_id = self.id_gen.next(); - block.body.push(Instruction::binary( - op, - return_type_id, - return_id, - lhs_id, - divisor_id, - )); function.consume(block, Instruction::return_value(return_id)); function.to_words(&mut self.logical_layout.function_definitions); diff --git a/naga/tests/in/wgsl/int-signed-remainder.toml b/naga/tests/in/wgsl/int-signed-remainder.toml new file mode 100644 index 000000000..4883dbbd8 --- /dev/null +++ b/naga/tests/in/wgsl/int-signed-remainder.toml @@ -0,0 +1 @@ +targets = "SPIRV" diff --git a/naga/tests/in/wgsl/int-signed-remainder.wgsl b/naga/tests/in/wgsl/int-signed-remainder.wgsl new file mode 100644 index 000000000..d0823b6df --- /dev/null +++ b/naga/tests/in/wgsl/int-signed-remainder.wgsl @@ -0,0 +1,16 @@ +// Regression test for signed `%` lowering in the SPIR-V backend (issue #8191). +// Signed `%` must avoid `OpSRem`, which is poison for negative operands in the +// Vulkan SPIR-V environment without VK_KHR_maintenance8, and instead lower to +// `a - b * (a / b)`. Unsigned `%` (`OpUMod`) is well-defined and unchanged. + +@compute @workgroup_size(1) +fn main() { + let a = 5i; + let b = 2i; + let mod_s = a % b; + let mod_s_vec = vec2(a) % vec2(b); + + let c = 5u; + let d = 2u; + let mod_u = c % d; +} diff --git a/naga/tests/out/spv/wgsl-image.spvasm b/naga/tests/out/spv/wgsl-image.spvasm index c67b73f69..21532c12c 100644 --- a/naga/tests/out/spv/wgsl-image.spvasm +++ b/naga/tests/out/spv/wgsl-image.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 567 +; Bound: 569 OpCapability Shader OpCapability Image1D OpCapability Sampled1D @@ -9,20 +9,20 @@ OpCapability SampledCubeArray OpCapability ImageQuery %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %96 "main" %93 -OpEntryPoint GLCompute %197 "depth_load" %195 -OpEntryPoint Vertex %220 "queries" %218 -OpEntryPoint Vertex %272 "levels_queries" %271 -OpEntryPoint Fragment %303 "texture_sample" %302 -OpEntryPoint Fragment %461 "texture_sample_comparison" %459 -OpEntryPoint Fragment %516 "gather" %515 -OpEntryPoint Fragment %550 "depth_no_comparison" %549 -OpExecutionMode %96 LocalSize 16 1 1 -OpExecutionMode %197 LocalSize 16 1 1 -OpExecutionMode %303 OriginUpperLeft -OpExecutionMode %461 OriginUpperLeft -OpExecutionMode %516 OriginUpperLeft -OpExecutionMode %550 OriginUpperLeft +OpEntryPoint GLCompute %98 "main" %95 +OpEntryPoint GLCompute %199 "depth_load" %197 +OpEntryPoint Vertex %222 "queries" %220 +OpEntryPoint Vertex %274 "levels_queries" %273 +OpEntryPoint Fragment %305 "texture_sample" %304 +OpEntryPoint Fragment %463 "texture_sample_comparison" %461 +OpEntryPoint Fragment %518 "gather" %517 +OpEntryPoint Fragment %552 "depth_no_comparison" %551 +OpExecutionMode %98 LocalSize 16 1 1 +OpExecutionMode %199 LocalSize 16 1 1 +OpExecutionMode %305 OriginUpperLeft +OpExecutionMode %463 OriginUpperLeft +OpExecutionMode %518 OriginUpperLeft +OpExecutionMode %552 OriginUpperLeft %3 = OpString "image.wgsl" OpSource Unknown 0 %3 "@group(0) @binding(0) var image_mipmapped_src: texture_2d; @@ -250,18 +250,18 @@ OpName %68 "image_cube_depth" OpName %70 "naga_mod" OpName %72 "lhs" OpName %73 "rhs" -OpName %93 "local_id" -OpName %96 "main" -OpName %195 "local_id" -OpName %197 "depth_load" -OpName %220 "queries" -OpName %272 "levels_queries" -OpName %303 "texture_sample" -OpName %318 "a" -OpName %461 "texture_sample_comparison" -OpName %466 "a" -OpName %516 "gather" -OpName %550 "depth_no_comparison" +OpName %95 "local_id" +OpName %98 "main" +OpName %197 "local_id" +OpName %199 "depth_load" +OpName %222 "queries" +OpName %274 "levels_queries" +OpName %305 "texture_sample" +OpName %320 "a" +OpName %463 "texture_sample_comparison" +OpName %468 "a" +OpName %518 "gather" +OpName %552 "depth_no_comparison" OpDecorate %29 DescriptorSet 0 OpDecorate %29 Binding 0 OpDecorate %31 DescriptorSet 0 @@ -309,14 +309,14 @@ OpDecorate %66 DescriptorSet 1 OpDecorate %66 Binding 3 OpDecorate %68 DescriptorSet 1 OpDecorate %68 Binding 4 -OpDecorate %93 BuiltIn LocalInvocationId -OpDecorate %195 BuiltIn LocalInvocationId -OpDecorate %218 BuiltIn Position -OpDecorate %271 BuiltIn Position -OpDecorate %302 Location 0 -OpDecorate %459 Location 0 -OpDecorate %515 Location 0 -OpDecorate %549 Location 0 +OpDecorate %95 BuiltIn LocalInvocationId +OpDecorate %197 BuiltIn LocalInvocationId +OpDecorate %220 BuiltIn Position +OpDecorate %273 BuiltIn Position +OpDecorate %304 Location 0 +OpDecorate %461 Location 0 +OpDecorate %517 Location 0 +OpDecorate %551 Location 0 %2 = OpTypeVoid %5 = OpTypeInt 32 0 %4 = OpTypeImage %5 2D 0 0 0 1 Unknown @@ -395,54 +395,54 @@ OpDecorate %549 Location 0 %83 = OpConstantComposite %14 %81 %81 %88 = OpConstant %15 1 %89 = OpConstantComposite %14 %88 %88 -%94 = OpTypePointer Input %13 -%93 = OpVariable %94 Input -%97 = OpTypeFunction %2 -%105 = OpConstant %15 10 -%106 = OpConstant %15 20 -%107 = OpConstantComposite %14 %105 %106 -%109 = OpTypeVector %5 2 -%117 = OpTypeVector %5 4 -%132 = OpTypeVector %15 3 -%195 = OpVariable %94 Input -%212 = OpConstant %8 0 -%213 = OpConstant %8 4294967000 -%219 = OpTypePointer Output %24 -%218 = OpVariable %219 Output -%229 = OpConstant %5 0 -%271 = OpVariable %219 Output -%302 = OpVariable %219 Output -%309 = OpConstant %8 0.5 -%310 = OpTypeVector %8 2 -%311 = OpConstantComposite %310 %309 %309 -%312 = OpTypeVector %8 3 -%313 = OpConstantComposite %312 %309 %309 %309 -%314 = OpConstant %15 3 -%315 = OpConstantComposite %14 %314 %88 -%316 = OpConstant %8 2.3 -%317 = OpConstant %8 2 -%319 = OpTypePointer Function %24 -%320 = OpConstantNull %24 -%323 = OpTypeSampledImage %16 -%328 = OpTypeSampledImage %17 -%352 = OpConstant %8 1 -%353 = OpConstantComposite %310 %352 %352 -%360 = OpTypeSampledImage %19 -%421 = OpTypeSampledImage %21 -%460 = OpTypePointer Output %8 -%459 = OpVariable %460 Output -%467 = OpTypePointer Function %8 -%468 = OpConstantNull %8 -%471 = OpTypeSampledImage %26 -%476 = OpTypeSampledImage %27 -%489 = OpTypeSampledImage %28 -%515 = OpVariable %219 Output -%526 = OpConstant %5 1 -%529 = OpConstant %5 3 -%534 = OpTypeSampledImage %4 -%537 = OpTypeVector %15 4 -%538 = OpTypeSampledImage %18 -%549 = OpVariable %219 Output +%96 = OpTypePointer Input %13 +%95 = OpVariable %96 Input +%99 = OpTypeFunction %2 +%107 = OpConstant %15 10 +%108 = OpConstant %15 20 +%109 = OpConstantComposite %14 %107 %108 +%111 = OpTypeVector %5 2 +%119 = OpTypeVector %5 4 +%134 = OpTypeVector %15 3 +%197 = OpVariable %96 Input +%214 = OpConstant %8 0 +%215 = OpConstant %8 4294967000 +%221 = OpTypePointer Output %24 +%220 = OpVariable %221 Output +%231 = OpConstant %5 0 +%273 = OpVariable %221 Output +%304 = OpVariable %221 Output +%311 = OpConstant %8 0.5 +%312 = OpTypeVector %8 2 +%313 = OpConstantComposite %312 %311 %311 +%314 = OpTypeVector %8 3 +%315 = OpConstantComposite %314 %311 %311 %311 +%316 = OpConstant %15 3 +%317 = OpConstantComposite %14 %316 %88 +%318 = OpConstant %8 2.3 +%319 = OpConstant %8 2 +%321 = OpTypePointer Function %24 +%322 = OpConstantNull %24 +%325 = OpTypeSampledImage %16 +%330 = OpTypeSampledImage %17 +%354 = OpConstant %8 1 +%355 = OpConstantComposite %312 %354 %354 +%362 = OpTypeSampledImage %19 +%423 = OpTypeSampledImage %21 +%462 = OpTypePointer Output %8 +%461 = OpVariable %462 Output +%469 = OpTypePointer Function %8 +%470 = OpConstantNull %8 +%473 = OpTypeSampledImage %26 +%478 = OpTypeSampledImage %27 +%491 = OpTypeSampledImage %28 +%517 = OpVariable %221 Output +%528 = OpConstant %5 1 +%531 = OpConstant %5 3 +%536 = OpTypeSampledImage %4 +%539 = OpTypeVector %15 4 +%540 = OpTypeSampledImage %18 +%551 = OpVariable %221 Output %70 = OpFunction %14 None %71 %72 = OpFunctionParameter %14 %73 = OpFunctionParameter %14 @@ -453,670 +453,672 @@ OpDecorate %549 Location 0 %86 = OpLogicalAnd %75 %84 %85 %87 = OpLogicalOr %75 %79 %86 %90 = OpSelect %14 %87 %89 %73 -%91 = OpSRem %14 %72 %90 -OpReturnValue %91 +%91 = OpSDiv %14 %72 %90 +%92 = OpIMul %14 %91 %90 +%93 = OpISub %14 %72 %92 +OpReturnValue %93 OpFunctionEnd -%96 = OpFunction %2 None %97 -%92 = OpLabel -%95 = OpLoad %13 %93 -%98 = OpLoad %4 %29 -%99 = OpLoad %6 %31 -%100 = OpLoad %9 %35 -%101 = OpLoad %10 %37 -%102 = OpLoad %11 %39 -%103 = OpLoad %12 %41 -%104 = OpLoad %11 %43 -OpBranch %108 -%108 = OpLabel +%98 = OpFunction %2 None %99 +%94 = OpLabel +%97 = OpLoad %13 %95 +%100 = OpLoad %4 %29 +%101 = OpLoad %6 %31 +%102 = OpLoad %9 %35 +%103 = OpLoad %10 %37 +%104 = OpLoad %11 %39 +%105 = OpLoad %12 %41 +%106 = OpLoad %11 %43 +OpBranch %110 +%110 = OpLabel OpLine %3 20 15 -%110 = OpImageQuerySize %109 %100 +%112 = OpImageQuerySize %111 %102 OpLine %3 21 15 -%111 = OpVectorShuffle %109 %95 %95 0 1 -%112 = OpIMul %109 %110 %111 -%113 = OpBitcast %14 %112 +%113 = OpVectorShuffle %111 %97 %97 0 1 +%114 = OpIMul %111 %112 %113 +%115 = OpBitcast %14 %114 OpLine %3 21 15 -%114 = OpFunctionCall %14 %70 %113 %107 +%116 = OpFunctionCall %14 %70 %115 %109 OpLine %3 23 18 -%115 = OpCompositeExtract %5 %95 2 -%116 = OpBitcast %15 %115 -%118 = OpImageFetch %117 %98 %114 Lod %116 +%117 = OpCompositeExtract %5 %97 2 +%118 = OpBitcast %15 %117 +%120 = OpImageFetch %119 %100 %116 Lod %118 OpLine %3 25 20 -%119 = OpCompositeExtract %5 %95 2 -%120 = OpImageFetch %117 %98 %114 Lod %119 +%121 = OpCompositeExtract %5 %97 2 +%122 = OpImageFetch %119 %100 %116 Lod %121 OpLine %3 26 18 -%121 = OpCompositeExtract %5 %95 2 -%122 = OpBitcast %15 %121 -%123 = OpImageFetch %117 %99 %114 Sample %122 +%123 = OpCompositeExtract %5 %97 2 +%124 = OpBitcast %15 %123 +%125 = OpImageFetch %119 %101 %116 Sample %124 OpLine %3 27 18 -%124 = OpCompositeExtract %5 %95 2 -%125 = OpImageFetch %117 %99 %114 Sample %124 +%126 = OpCompositeExtract %5 %97 2 +%127 = OpImageFetch %119 %101 %116 Sample %126 OpLine %3 28 18 -%126 = OpImageRead %117 %100 %114 +%128 = OpImageRead %119 %102 %116 OpLine %3 29 52 -%127 = OpCompositeExtract %5 %95 2 -%128 = OpCompositeExtract %5 %95 2 -%129 = OpBitcast %15 %128 +%129 = OpCompositeExtract %5 %97 2 +%130 = OpCompositeExtract %5 %97 2 +%131 = OpBitcast %15 %130 OpLine %3 29 18 -%130 = OpIAdd %15 %129 %88 -%131 = OpBitcast %15 %127 -%133 = OpCompositeConstruct %132 %114 %131 -%134 = OpImageFetch %117 %101 %133 Lod %130 +%132 = OpIAdd %15 %131 %88 +%133 = OpBitcast %15 %129 +%135 = OpCompositeConstruct %134 %116 %133 +%136 = OpImageFetch %119 %103 %135 Lod %132 OpLine %3 30 52 -%135 = OpCompositeExtract %5 %95 2 -%136 = OpBitcast %15 %135 -%137 = OpCompositeExtract %5 %95 2 +%137 = OpCompositeExtract %5 %97 2 %138 = OpBitcast %15 %137 +%139 = OpCompositeExtract %5 %97 2 +%140 = OpBitcast %15 %139 OpLine %3 30 18 -%139 = OpIAdd %15 %138 %88 -%140 = OpCompositeConstruct %132 %114 %136 -%141 = OpImageFetch %117 %101 %140 Lod %139 +%141 = OpIAdd %15 %140 %88 +%142 = OpCompositeConstruct %134 %116 %138 +%143 = OpImageFetch %119 %103 %142 Lod %141 OpLine %3 31 18 -%142 = OpCompositeExtract %5 %95 0 -%143 = OpBitcast %15 %142 -%144 = OpCompositeExtract %5 %95 2 +%144 = OpCompositeExtract %5 %97 0 %145 = OpBitcast %15 %144 -%146 = OpImageFetch %117 %103 %143 Lod %145 +%146 = OpCompositeExtract %5 %97 2 +%147 = OpBitcast %15 %146 +%148 = OpImageFetch %119 %105 %145 Lod %147 OpLine %3 32 18 -%147 = OpCompositeExtract %5 %95 0 -%148 = OpBitcast %15 %147 -%149 = OpImageRead %117 %102 %148 +%149 = OpCompositeExtract %5 %97 0 +%150 = OpBitcast %15 %149 +%151 = OpImageRead %119 %104 %150 OpLine %3 34 19 -%150 = OpBitcast %109 %114 -%151 = OpCompositeExtract %5 %95 2 -%152 = OpBitcast %15 %151 -%153 = OpImageFetch %117 %98 %150 Lod %152 +%152 = OpBitcast %111 %116 +%153 = OpCompositeExtract %5 %97 2 +%154 = OpBitcast %15 %153 +%155 = OpImageFetch %119 %100 %152 Lod %154 OpLine %3 35 19 -%154 = OpBitcast %109 %114 -%155 = OpCompositeExtract %5 %95 2 -%156 = OpBitcast %15 %155 -%157 = OpImageFetch %117 %99 %154 Sample %156 +%156 = OpBitcast %111 %116 +%157 = OpCompositeExtract %5 %97 2 +%158 = OpBitcast %15 %157 +%159 = OpImageFetch %119 %101 %156 Sample %158 OpLine %3 36 19 -%158 = OpBitcast %109 %114 -%159 = OpCompositeExtract %5 %95 2 -%160 = OpImageFetch %117 %99 %158 Sample %159 +%160 = OpBitcast %111 %116 +%161 = OpCompositeExtract %5 %97 2 +%162 = OpImageFetch %119 %101 %160 Sample %161 OpLine %3 37 19 -%161 = OpBitcast %109 %114 -%162 = OpImageRead %117 %100 %161 +%163 = OpBitcast %111 %116 +%164 = OpImageRead %119 %102 %163 OpLine %3 38 48 -%163 = OpBitcast %109 %114 -%164 = OpCompositeExtract %5 %95 2 -%165 = OpCompositeExtract %5 %95 2 -%166 = OpBitcast %15 %165 +%165 = OpBitcast %111 %116 +%166 = OpCompositeExtract %5 %97 2 +%167 = OpCompositeExtract %5 %97 2 +%168 = OpBitcast %15 %167 OpLine %3 38 19 -%167 = OpIAdd %15 %166 %88 -%168 = OpCompositeConstruct %13 %163 %164 -%169 = OpImageFetch %117 %101 %168 Lod %167 +%169 = OpIAdd %15 %168 %88 +%170 = OpCompositeConstruct %13 %165 %166 +%171 = OpImageFetch %119 %103 %170 Lod %169 OpLine %3 39 48 -%170 = OpBitcast %109 %114 -%171 = OpCompositeExtract %5 %95 2 -%172 = OpBitcast %15 %171 -%173 = OpCompositeExtract %5 %95 2 +%172 = OpBitcast %111 %116 +%173 = OpCompositeExtract %5 %97 2 %174 = OpBitcast %15 %173 +%175 = OpCompositeExtract %5 %97 2 +%176 = OpBitcast %15 %175 OpLine %3 39 19 -%175 = OpIAdd %15 %174 %88 -%176 = OpBitcast %5 %172 -%177 = OpCompositeConstruct %13 %170 %176 -%178 = OpImageFetch %117 %101 %177 Lod %175 +%177 = OpIAdd %15 %176 %88 +%178 = OpBitcast %5 %174 +%179 = OpCompositeConstruct %13 %172 %178 +%180 = OpImageFetch %119 %103 %179 Lod %177 OpLine %3 40 19 -%179 = OpCompositeExtract %5 %95 0 -%180 = OpCompositeExtract %5 %95 2 -%181 = OpBitcast %15 %180 -%182 = OpImageFetch %117 %103 %179 Lod %181 +%181 = OpCompositeExtract %5 %97 0 +%182 = OpCompositeExtract %5 %97 2 +%183 = OpBitcast %15 %182 +%184 = OpImageFetch %119 %105 %181 Lod %183 OpLine %3 42 29 -%183 = OpCompositeExtract %15 %114 0 -%184 = OpIAdd %117 %118 %123 -%185 = OpIAdd %117 %184 %126 -%186 = OpIAdd %117 %185 %134 -%187 = OpIAdd %117 %186 %141 +%185 = OpCompositeExtract %15 %116 0 +%186 = OpIAdd %119 %120 %125 +%187 = OpIAdd %119 %186 %128 +%188 = OpIAdd %119 %187 %136 +%189 = OpIAdd %119 %188 %143 OpLine %3 42 5 -OpImageWrite %104 %183 %187 +OpImageWrite %106 %185 %189 OpLine %3 44 29 -%188 = OpCompositeExtract %15 %114 0 -%189 = OpBitcast %5 %188 -%190 = OpIAdd %117 %153 %157 -%191 = OpIAdd %117 %190 %162 -%192 = OpIAdd %117 %191 %169 -%193 = OpIAdd %117 %192 %178 +%190 = OpCompositeExtract %15 %116 0 +%191 = OpBitcast %5 %190 +%192 = OpIAdd %119 %155 %159 +%193 = OpIAdd %119 %192 %164 +%194 = OpIAdd %119 %193 %171 +%195 = OpIAdd %119 %194 %180 OpLine %3 44 5 -OpImageWrite %104 %189 %193 +OpImageWrite %106 %191 %195 OpReturn OpFunctionEnd -%197 = OpFunction %2 None %97 -%194 = OpLabel -%196 = OpLoad %13 %195 -%198 = OpLoad %7 %33 -%199 = OpLoad %9 %35 -%200 = OpLoad %11 %43 -OpBranch %201 -%201 = OpLabel +%199 = OpFunction %2 None %99 +%196 = OpLabel +%198 = OpLoad %13 %197 +%200 = OpLoad %7 %33 +%201 = OpLoad %9 %35 +%202 = OpLoad %11 %43 +OpBranch %203 +%203 = OpLabel OpLine %3 49 26 -%202 = OpImageQuerySize %109 %199 +%204 = OpImageQuerySize %111 %201 OpLine %3 50 27 -%203 = OpVectorShuffle %109 %196 %196 0 1 -%204 = OpIMul %109 %202 %203 -%205 = OpBitcast %14 %204 +%205 = OpVectorShuffle %111 %198 %198 0 1 +%206 = OpIMul %111 %204 %205 +%207 = OpBitcast %14 %206 OpLine %3 50 27 -%206 = OpFunctionCall %14 %70 %205 %107 +%208 = OpFunctionCall %14 %70 %207 %109 OpLine %3 51 20 -%207 = OpCompositeExtract %5 %196 2 -%208 = OpBitcast %15 %207 -%209 = OpImageFetch %24 %198 %206 Sample %208 -%210 = OpCompositeExtract %8 %209 0 +%209 = OpCompositeExtract %5 %198 2 +%210 = OpBitcast %15 %209 +%211 = OpImageFetch %24 %200 %208 Sample %210 +%212 = OpCompositeExtract %8 %211 0 OpLine %3 52 29 -%211 = OpCompositeExtract %15 %206 0 -%214 = OpExtInst %8 %1 FClamp %210 %212 %213 -%215 = OpConvertFToU %5 %214 -%216 = OpCompositeConstruct %117 %215 %215 %215 %215 +%213 = OpCompositeExtract %15 %208 0 +%216 = OpExtInst %8 %1 FClamp %212 %214 %215 +%217 = OpConvertFToU %5 %216 +%218 = OpCompositeConstruct %119 %217 %217 %217 %217 OpLine %3 52 5 -OpImageWrite %200 %211 %216 +OpImageWrite %202 %213 %218 OpReturn OpFunctionEnd -%220 = OpFunction %2 None %97 -%217 = OpLabel -%221 = OpLoad %16 %44 -%222 = OpLoad %17 %46 -%223 = OpLoad %19 %51 -%224 = OpLoad %20 %53 -%225 = OpLoad %21 %55 -%226 = OpLoad %22 %57 -%227 = OpLoad %23 %59 -OpBranch %228 -%228 = OpLabel +%222 = OpFunction %2 None %99 +%219 = OpLabel +%223 = OpLoad %16 %44 +%224 = OpLoad %17 %46 +%225 = OpLoad %19 %51 +%226 = OpLoad %20 %53 +%227 = OpLoad %21 %55 +%228 = OpLoad %22 %57 +%229 = OpLoad %23 %59 +OpBranch %230 +%230 = OpLabel OpLine %3 77 18 -%230 = OpImageQuerySizeLod %5 %221 %229 +%232 = OpImageQuerySizeLod %5 %223 %231 OpLine %3 78 22 -%231 = OpBitcast %15 %230 -%232 = OpImageQuerySizeLod %5 %221 %231 +%233 = OpBitcast %15 %232 +%234 = OpImageQuerySizeLod %5 %223 %233 OpLine %3 79 18 -%233 = OpImageQuerySizeLod %109 %222 %229 +%235 = OpImageQuerySizeLod %111 %224 %231 OpLine %3 80 22 -%234 = OpImageQuerySizeLod %109 %222 %88 +%236 = OpImageQuerySizeLod %111 %224 %88 OpLine %3 81 24 -%235 = OpImageQuerySizeLod %13 %223 %229 -%236 = OpVectorShuffle %109 %235 %235 0 1 +%237 = OpImageQuerySizeLod %13 %225 %231 +%238 = OpVectorShuffle %111 %237 %237 0 1 OpLine %3 82 28 -%237 = OpImageQuerySizeLod %13 %223 %88 -%238 = OpVectorShuffle %109 %237 %237 0 1 +%239 = OpImageQuerySizeLod %13 %225 %88 +%240 = OpVectorShuffle %111 %239 %239 0 1 OpLine %3 83 20 -%239 = OpImageQuerySizeLod %109 %224 %229 +%241 = OpImageQuerySizeLod %111 %226 %231 OpLine %3 84 24 -%240 = OpImageQuerySizeLod %109 %224 %88 +%242 = OpImageQuerySizeLod %111 %226 %88 OpLine %3 85 26 -%241 = OpImageQuerySizeLod %13 %225 %229 -%242 = OpVectorShuffle %109 %241 %241 0 0 +%243 = OpImageQuerySizeLod %13 %227 %231 +%244 = OpVectorShuffle %111 %243 %243 0 0 OpLine %3 86 30 -%243 = OpImageQuerySizeLod %13 %225 %88 -%244 = OpVectorShuffle %109 %243 %243 0 0 +%245 = OpImageQuerySizeLod %13 %227 %88 +%246 = OpVectorShuffle %111 %245 %245 0 0 OpLine %3 87 18 -%245 = OpImageQuerySizeLod %13 %226 %229 +%247 = OpImageQuerySizeLod %13 %228 %231 OpLine %3 88 22 -%246 = OpImageQuerySizeLod %13 %226 %88 +%248 = OpImageQuerySizeLod %13 %228 %88 OpLine %3 89 21 -%247 = OpImageQuerySize %109 %227 +%249 = OpImageQuerySize %111 %229 OpLine %3 91 15 -%248 = OpCompositeExtract %5 %233 1 -%249 = OpIAdd %5 %230 %248 -%250 = OpCompositeExtract %5 %234 1 -%251 = OpIAdd %5 %249 %250 +%250 = OpCompositeExtract %5 %235 1 +%251 = OpIAdd %5 %232 %250 %252 = OpCompositeExtract %5 %236 1 %253 = OpIAdd %5 %251 %252 %254 = OpCompositeExtract %5 %238 1 %255 = OpIAdd %5 %253 %254 -%256 = OpCompositeExtract %5 %239 1 +%256 = OpCompositeExtract %5 %240 1 %257 = OpIAdd %5 %255 %256 -%258 = OpCompositeExtract %5 %240 1 +%258 = OpCompositeExtract %5 %241 1 %259 = OpIAdd %5 %257 %258 %260 = OpCompositeExtract %5 %242 1 %261 = OpIAdd %5 %259 %260 %262 = OpCompositeExtract %5 %244 1 %263 = OpIAdd %5 %261 %262 -%264 = OpCompositeExtract %5 %245 2 +%264 = OpCompositeExtract %5 %246 1 %265 = OpIAdd %5 %263 %264 -%266 = OpCompositeExtract %5 %246 2 +%266 = OpCompositeExtract %5 %247 2 %267 = OpIAdd %5 %265 %266 +%268 = OpCompositeExtract %5 %248 2 +%269 = OpIAdd %5 %267 %268 OpLine %3 94 12 -%268 = OpConvertUToF %8 %267 -%269 = OpCompositeConstruct %24 %268 %268 %268 %268 -OpStore %218 %269 +%270 = OpConvertUToF %8 %269 +%271 = OpCompositeConstruct %24 %270 %270 %270 %270 +OpStore %220 %271 OpReturn OpFunctionEnd -%272 = OpFunction %2 None %97 -%270 = OpLabel -%273 = OpLoad %17 %46 -%274 = OpLoad %19 %51 -%275 = OpLoad %20 %53 -%276 = OpLoad %21 %55 -%277 = OpLoad %22 %57 -%278 = OpLoad %23 %59 -OpBranch %279 -%279 = OpLabel +%274 = OpFunction %2 None %99 +%272 = OpLabel +%275 = OpLoad %17 %46 +%276 = OpLoad %19 %51 +%277 = OpLoad %20 %53 +%278 = OpLoad %21 %55 +%279 = OpLoad %22 %57 +%280 = OpLoad %23 %59 +OpBranch %281 +%281 = OpLabel OpLine %3 99 25 -%280 = OpImageQueryLevels %5 %273 +%282 = OpImageQueryLevels %5 %275 OpLine %3 100 25 -%281 = OpImageQuerySizeLod %13 %274 %229 -%282 = OpCompositeExtract %5 %281 2 +%283 = OpImageQuerySizeLod %13 %276 %231 +%284 = OpCompositeExtract %5 %283 2 OpLine %3 101 31 -%283 = OpImageQueryLevels %5 %274 +%285 = OpImageQueryLevels %5 %276 OpLine %3 102 31 -%284 = OpImageQuerySizeLod %13 %274 %229 -%285 = OpCompositeExtract %5 %284 2 +%286 = OpImageQuerySizeLod %13 %276 %231 +%287 = OpCompositeExtract %5 %286 2 OpLine %3 103 27 -%286 = OpImageQueryLevels %5 %275 +%288 = OpImageQueryLevels %5 %277 OpLine %3 104 33 -%287 = OpImageQueryLevels %5 %276 +%289 = OpImageQueryLevels %5 %278 OpLine %3 105 27 -%288 = OpImageQuerySizeLod %13 %276 %229 -%289 = OpCompositeExtract %5 %288 2 +%290 = OpImageQuerySizeLod %13 %278 %231 +%291 = OpCompositeExtract %5 %290 2 OpLine %3 106 25 -%290 = OpImageQueryLevels %5 %277 +%292 = OpImageQueryLevels %5 %279 OpLine %3 107 26 -%291 = OpImageQuerySamples %5 %278 +%293 = OpImageQuerySamples %5 %280 OpLine %3 109 15 -%292 = OpIAdd %5 %282 %289 -%293 = OpIAdd %5 %292 %291 -%294 = OpIAdd %5 %293 %280 -%295 = OpIAdd %5 %294 %283 -%296 = OpIAdd %5 %295 %290 -%297 = OpIAdd %5 %296 %286 -%298 = OpIAdd %5 %297 %287 +%294 = OpIAdd %5 %284 %291 +%295 = OpIAdd %5 %294 %293 +%296 = OpIAdd %5 %295 %282 +%297 = OpIAdd %5 %296 %285 +%298 = OpIAdd %5 %297 %292 +%299 = OpIAdd %5 %298 %288 +%300 = OpIAdd %5 %299 %289 OpLine %3 111 12 -%299 = OpConvertUToF %8 %298 -%300 = OpCompositeConstruct %24 %299 %299 %299 %299 -OpStore %271 %300 +%301 = OpConvertUToF %8 %300 +%302 = OpCompositeConstruct %24 %301 %301 %301 %301 +OpStore %273 %302 OpReturn OpFunctionEnd -%303 = OpFunction %2 None %97 -%301 = OpLabel -%318 = OpVariable %319 Function %320 -%304 = OpLoad %16 %44 -%305 = OpLoad %17 %46 -%306 = OpLoad %19 %51 -%307 = OpLoad %21 %55 -%308 = OpLoad %25 %61 -OpBranch %321 -%321 = OpLabel +%305 = OpFunction %2 None %99 +%303 = OpLabel +%320 = OpVariable %321 Function %322 +%306 = OpLoad %16 %44 +%307 = OpLoad %17 %46 +%308 = OpLoad %19 %51 +%309 = OpLoad %21 %55 +%310 = OpLoad %25 %61 +OpBranch %323 +%323 = OpLabel OpLine %3 119 16 OpLine %3 120 17 OpLine %3 121 20 OpLine %3 1 1 -%322 = OpLoad %24 %318 +%324 = OpLoad %24 %320 OpLine %3 124 5 -%324 = OpSampledImage %323 %304 %308 -%325 = OpImageSampleImplicitLod %24 %324 %309 -%326 = OpFAdd %24 %322 %325 +%326 = OpSampledImage %325 %306 %310 +%327 = OpImageSampleImplicitLod %24 %326 %311 +%328 = OpFAdd %24 %324 %327 OpLine %3 124 5 -OpStore %318 %326 +OpStore %320 %328 OpLine %3 1 1 -%327 = OpLoad %24 %318 +%329 = OpLoad %24 %320 OpLine %3 125 5 -%329 = OpSampledImage %328 %305 %308 -%330 = OpImageSampleImplicitLod %24 %329 %311 -%331 = OpFAdd %24 %327 %330 +%331 = OpSampledImage %330 %307 %310 +%332 = OpImageSampleImplicitLod %24 %331 %313 +%333 = OpFAdd %24 %329 %332 OpLine %3 125 5 -OpStore %318 %331 +OpStore %320 %333 OpLine %3 1 1 -%332 = OpLoad %24 %318 +%334 = OpLoad %24 %320 OpLine %3 126 5 -%333 = OpSampledImage %328 %305 %308 -%334 = OpImageSampleImplicitLod %24 %333 %311 ConstOffset %315 -%335 = OpFAdd %24 %332 %334 +%335 = OpSampledImage %330 %307 %310 +%336 = OpImageSampleImplicitLod %24 %335 %313 ConstOffset %317 +%337 = OpFAdd %24 %334 %336 OpLine %3 126 5 -OpStore %318 %335 +OpStore %320 %337 OpLine %3 1 1 -%336 = OpLoad %24 %318 +%338 = OpLoad %24 %320 OpLine %3 127 5 -%337 = OpSampledImage %328 %305 %308 -%338 = OpImageSampleExplicitLod %24 %337 %311 Lod %316 -%339 = OpFAdd %24 %336 %338 +%339 = OpSampledImage %330 %307 %310 +%340 = OpImageSampleExplicitLod %24 %339 %313 Lod %318 +%341 = OpFAdd %24 %338 %340 OpLine %3 127 5 -OpStore %318 %339 +OpStore %320 %341 OpLine %3 1 1 -%340 = OpLoad %24 %318 +%342 = OpLoad %24 %320 OpLine %3 128 5 -%341 = OpSampledImage %328 %305 %308 -%342 = OpImageSampleExplicitLod %24 %341 %311 Lod|ConstOffset %316 %315 -%343 = OpFAdd %24 %340 %342 +%343 = OpSampledImage %330 %307 %310 +%344 = OpImageSampleExplicitLod %24 %343 %313 Lod|ConstOffset %318 %317 +%345 = OpFAdd %24 %342 %344 OpLine %3 128 5 -OpStore %318 %343 +OpStore %320 %345 OpLine %3 1 1 -%344 = OpLoad %24 %318 +%346 = OpLoad %24 %320 OpLine %3 129 5 -%345 = OpSampledImage %328 %305 %308 -%346 = OpImageSampleImplicitLod %24 %345 %311 Bias|ConstOffset %317 %315 -%347 = OpFAdd %24 %344 %346 +%347 = OpSampledImage %330 %307 %310 +%348 = OpImageSampleImplicitLod %24 %347 %313 Bias|ConstOffset %319 %317 +%349 = OpFAdd %24 %346 %348 OpLine %3 129 5 -OpStore %318 %347 +OpStore %320 %349 OpLine %3 1 1 -%348 = OpLoad %24 %318 +%350 = OpLoad %24 %320 OpLine %3 130 5 -%349 = OpImageQuerySizeLod %109 %305 %229 -%350 = OpConvertUToF %310 %349 -%351 = OpFDiv %310 %311 %350 -%354 = OpFSub %310 %353 %351 -%355 = OpExtInst %310 %1 NClamp %311 %351 %354 -%356 = OpSampledImage %328 %305 %308 -%357 = OpImageSampleExplicitLod %24 %356 %355 Lod %212 -%358 = OpFAdd %24 %348 %357 +%351 = OpImageQuerySizeLod %111 %307 %231 +%352 = OpConvertUToF %312 %351 +%353 = OpFDiv %312 %313 %352 +%356 = OpFSub %312 %355 %353 +%357 = OpExtInst %312 %1 NClamp %313 %353 %356 +%358 = OpSampledImage %330 %307 %310 +%359 = OpImageSampleExplicitLod %24 %358 %357 Lod %214 +%360 = OpFAdd %24 %350 %359 OpLine %3 130 5 -OpStore %318 %358 +OpStore %320 %360 OpLine %3 1 1 -%359 = OpLoad %24 %318 +%361 = OpLoad %24 %320 OpLine %3 131 5 -%361 = OpConvertUToF %8 %229 -%362 = OpCompositeConstruct %312 %311 %361 -%363 = OpSampledImage %360 %306 %308 -%364 = OpImageSampleImplicitLod %24 %363 %362 -%365 = OpFAdd %24 %359 %364 +%363 = OpConvertUToF %8 %231 +%364 = OpCompositeConstruct %314 %313 %363 +%365 = OpSampledImage %362 %308 %310 +%366 = OpImageSampleImplicitLod %24 %365 %364 +%367 = OpFAdd %24 %361 %366 OpLine %3 131 5 -OpStore %318 %365 +OpStore %320 %367 OpLine %3 1 1 -%366 = OpLoad %24 %318 +%368 = OpLoad %24 %320 OpLine %3 132 5 -%367 = OpConvertUToF %8 %229 -%368 = OpCompositeConstruct %312 %311 %367 -%369 = OpSampledImage %360 %306 %308 -%370 = OpImageSampleImplicitLod %24 %369 %368 ConstOffset %315 -%371 = OpFAdd %24 %366 %370 +%369 = OpConvertUToF %8 %231 +%370 = OpCompositeConstruct %314 %313 %369 +%371 = OpSampledImage %362 %308 %310 +%372 = OpImageSampleImplicitLod %24 %371 %370 ConstOffset %317 +%373 = OpFAdd %24 %368 %372 OpLine %3 132 5 -OpStore %318 %371 +OpStore %320 %373 OpLine %3 1 1 -%372 = OpLoad %24 %318 +%374 = OpLoad %24 %320 OpLine %3 133 5 -%373 = OpConvertUToF %8 %229 -%374 = OpCompositeConstruct %312 %311 %373 -%375 = OpSampledImage %360 %306 %308 -%376 = OpImageSampleExplicitLod %24 %375 %374 Lod %316 -%377 = OpFAdd %24 %372 %376 +%375 = OpConvertUToF %8 %231 +%376 = OpCompositeConstruct %314 %313 %375 +%377 = OpSampledImage %362 %308 %310 +%378 = OpImageSampleExplicitLod %24 %377 %376 Lod %318 +%379 = OpFAdd %24 %374 %378 OpLine %3 133 5 -OpStore %318 %377 +OpStore %320 %379 OpLine %3 1 1 -%378 = OpLoad %24 %318 +%380 = OpLoad %24 %320 OpLine %3 134 5 -%379 = OpConvertUToF %8 %229 -%380 = OpCompositeConstruct %312 %311 %379 -%381 = OpSampledImage %360 %306 %308 -%382 = OpImageSampleExplicitLod %24 %381 %380 Lod|ConstOffset %316 %315 -%383 = OpFAdd %24 %378 %382 +%381 = OpConvertUToF %8 %231 +%382 = OpCompositeConstruct %314 %313 %381 +%383 = OpSampledImage %362 %308 %310 +%384 = OpImageSampleExplicitLod %24 %383 %382 Lod|ConstOffset %318 %317 +%385 = OpFAdd %24 %380 %384 OpLine %3 134 5 -OpStore %318 %383 +OpStore %320 %385 OpLine %3 1 1 -%384 = OpLoad %24 %318 +%386 = OpLoad %24 %320 OpLine %3 135 5 -%385 = OpConvertUToF %8 %229 -%386 = OpCompositeConstruct %312 %311 %385 -%387 = OpSampledImage %360 %306 %308 -%388 = OpImageSampleImplicitLod %24 %387 %386 Bias|ConstOffset %317 %315 -%389 = OpFAdd %24 %384 %388 +%387 = OpConvertUToF %8 %231 +%388 = OpCompositeConstruct %314 %313 %387 +%389 = OpSampledImage %362 %308 %310 +%390 = OpImageSampleImplicitLod %24 %389 %388 Bias|ConstOffset %319 %317 +%391 = OpFAdd %24 %386 %390 OpLine %3 135 5 -OpStore %318 %389 +OpStore %320 %391 OpLine %3 1 1 -%390 = OpLoad %24 %318 +%392 = OpLoad %24 %320 OpLine %3 136 5 -%391 = OpConvertSToF %8 %77 -%392 = OpCompositeConstruct %312 %311 %391 -%393 = OpSampledImage %360 %306 %308 -%394 = OpImageSampleImplicitLod %24 %393 %392 -%395 = OpFAdd %24 %390 %394 +%393 = OpConvertSToF %8 %77 +%394 = OpCompositeConstruct %314 %313 %393 +%395 = OpSampledImage %362 %308 %310 +%396 = OpImageSampleImplicitLod %24 %395 %394 +%397 = OpFAdd %24 %392 %396 OpLine %3 136 5 -OpStore %318 %395 +OpStore %320 %397 OpLine %3 1 1 -%396 = OpLoad %24 %318 +%398 = OpLoad %24 %320 OpLine %3 137 5 -%397 = OpConvertSToF %8 %77 -%398 = OpCompositeConstruct %312 %311 %397 -%399 = OpSampledImage %360 %306 %308 -%400 = OpImageSampleImplicitLod %24 %399 %398 ConstOffset %315 -%401 = OpFAdd %24 %396 %400 +%399 = OpConvertSToF %8 %77 +%400 = OpCompositeConstruct %314 %313 %399 +%401 = OpSampledImage %362 %308 %310 +%402 = OpImageSampleImplicitLod %24 %401 %400 ConstOffset %317 +%403 = OpFAdd %24 %398 %402 OpLine %3 137 5 -OpStore %318 %401 +OpStore %320 %403 OpLine %3 1 1 -%402 = OpLoad %24 %318 +%404 = OpLoad %24 %320 OpLine %3 138 5 -%403 = OpConvertSToF %8 %77 -%404 = OpCompositeConstruct %312 %311 %403 -%405 = OpSampledImage %360 %306 %308 -%406 = OpImageSampleExplicitLod %24 %405 %404 Lod %316 -%407 = OpFAdd %24 %402 %406 +%405 = OpConvertSToF %8 %77 +%406 = OpCompositeConstruct %314 %313 %405 +%407 = OpSampledImage %362 %308 %310 +%408 = OpImageSampleExplicitLod %24 %407 %406 Lod %318 +%409 = OpFAdd %24 %404 %408 OpLine %3 138 5 -OpStore %318 %407 +OpStore %320 %409 OpLine %3 1 1 -%408 = OpLoad %24 %318 +%410 = OpLoad %24 %320 OpLine %3 139 5 -%409 = OpConvertSToF %8 %77 -%410 = OpCompositeConstruct %312 %311 %409 -%411 = OpSampledImage %360 %306 %308 -%412 = OpImageSampleExplicitLod %24 %411 %410 Lod|ConstOffset %316 %315 -%413 = OpFAdd %24 %408 %412 +%411 = OpConvertSToF %8 %77 +%412 = OpCompositeConstruct %314 %313 %411 +%413 = OpSampledImage %362 %308 %310 +%414 = OpImageSampleExplicitLod %24 %413 %412 Lod|ConstOffset %318 %317 +%415 = OpFAdd %24 %410 %414 OpLine %3 139 5 -OpStore %318 %413 +OpStore %320 %415 OpLine %3 1 1 -%414 = OpLoad %24 %318 +%416 = OpLoad %24 %320 OpLine %3 140 5 -%415 = OpConvertSToF %8 %77 -%416 = OpCompositeConstruct %312 %311 %415 -%417 = OpSampledImage %360 %306 %308 -%418 = OpImageSampleImplicitLod %24 %417 %416 Bias|ConstOffset %317 %315 -%419 = OpFAdd %24 %414 %418 +%417 = OpConvertSToF %8 %77 +%418 = OpCompositeConstruct %314 %313 %417 +%419 = OpSampledImage %362 %308 %310 +%420 = OpImageSampleImplicitLod %24 %419 %418 Bias|ConstOffset %319 %317 +%421 = OpFAdd %24 %416 %420 OpLine %3 140 5 -OpStore %318 %419 +OpStore %320 %421 OpLine %3 1 1 -%420 = OpLoad %24 %318 +%422 = OpLoad %24 %320 OpLine %3 141 5 -%422 = OpConvertUToF %8 %229 -%423 = OpCompositeConstruct %24 %313 %422 -%424 = OpSampledImage %421 %307 %308 -%425 = OpImageSampleImplicitLod %24 %424 %423 -%426 = OpFAdd %24 %420 %425 +%424 = OpConvertUToF %8 %231 +%425 = OpCompositeConstruct %24 %315 %424 +%426 = OpSampledImage %423 %309 %310 +%427 = OpImageSampleImplicitLod %24 %426 %425 +%428 = OpFAdd %24 %422 %427 OpLine %3 141 5 -OpStore %318 %426 +OpStore %320 %428 OpLine %3 1 1 -%427 = OpLoad %24 %318 +%429 = OpLoad %24 %320 OpLine %3 142 5 -%428 = OpConvertUToF %8 %229 -%429 = OpCompositeConstruct %24 %313 %428 -%430 = OpSampledImage %421 %307 %308 -%431 = OpImageSampleExplicitLod %24 %430 %429 Lod %316 -%432 = OpFAdd %24 %427 %431 +%430 = OpConvertUToF %8 %231 +%431 = OpCompositeConstruct %24 %315 %430 +%432 = OpSampledImage %423 %309 %310 +%433 = OpImageSampleExplicitLod %24 %432 %431 Lod %318 +%434 = OpFAdd %24 %429 %433 OpLine %3 142 5 -OpStore %318 %432 +OpStore %320 %434 OpLine %3 1 1 -%433 = OpLoad %24 %318 +%435 = OpLoad %24 %320 OpLine %3 143 5 -%434 = OpConvertUToF %8 %229 -%435 = OpCompositeConstruct %24 %313 %434 -%436 = OpSampledImage %421 %307 %308 -%437 = OpImageSampleImplicitLod %24 %436 %435 Bias %317 -%438 = OpFAdd %24 %433 %437 +%436 = OpConvertUToF %8 %231 +%437 = OpCompositeConstruct %24 %315 %436 +%438 = OpSampledImage %423 %309 %310 +%439 = OpImageSampleImplicitLod %24 %438 %437 Bias %319 +%440 = OpFAdd %24 %435 %439 OpLine %3 143 5 -OpStore %318 %438 +OpStore %320 %440 OpLine %3 1 1 -%439 = OpLoad %24 %318 +%441 = OpLoad %24 %320 OpLine %3 144 5 -%440 = OpConvertSToF %8 %77 -%441 = OpCompositeConstruct %24 %313 %440 -%442 = OpSampledImage %421 %307 %308 -%443 = OpImageSampleImplicitLod %24 %442 %441 -%444 = OpFAdd %24 %439 %443 +%442 = OpConvertSToF %8 %77 +%443 = OpCompositeConstruct %24 %315 %442 +%444 = OpSampledImage %423 %309 %310 +%445 = OpImageSampleImplicitLod %24 %444 %443 +%446 = OpFAdd %24 %441 %445 OpLine %3 144 5 -OpStore %318 %444 +OpStore %320 %446 OpLine %3 1 1 -%445 = OpLoad %24 %318 +%447 = OpLoad %24 %320 OpLine %3 145 5 -%446 = OpConvertSToF %8 %77 -%447 = OpCompositeConstruct %24 %313 %446 -%448 = OpSampledImage %421 %307 %308 -%449 = OpImageSampleExplicitLod %24 %448 %447 Lod %316 -%450 = OpFAdd %24 %445 %449 +%448 = OpConvertSToF %8 %77 +%449 = OpCompositeConstruct %24 %315 %448 +%450 = OpSampledImage %423 %309 %310 +%451 = OpImageSampleExplicitLod %24 %450 %449 Lod %318 +%452 = OpFAdd %24 %447 %451 OpLine %3 145 5 -OpStore %318 %450 +OpStore %320 %452 OpLine %3 1 1 -%451 = OpLoad %24 %318 +%453 = OpLoad %24 %320 OpLine %3 146 5 -%452 = OpConvertSToF %8 %77 -%453 = OpCompositeConstruct %24 %313 %452 -%454 = OpSampledImage %421 %307 %308 -%455 = OpImageSampleImplicitLod %24 %454 %453 Bias %317 -%456 = OpFAdd %24 %451 %455 +%454 = OpConvertSToF %8 %77 +%455 = OpCompositeConstruct %24 %315 %454 +%456 = OpSampledImage %423 %309 %310 +%457 = OpImageSampleImplicitLod %24 %456 %455 Bias %319 +%458 = OpFAdd %24 %453 %457 OpLine %3 146 5 -OpStore %318 %456 +OpStore %320 %458 OpLine %3 1 1 -%457 = OpLoad %24 %318 -OpStore %302 %457 +%459 = OpLoad %24 %320 +OpStore %304 %459 OpReturn OpFunctionEnd -%461 = OpFunction %2 None %97 -%458 = OpLabel -%466 = OpVariable %467 Function %468 -%462 = OpLoad %25 %63 -%463 = OpLoad %26 %64 -%464 = OpLoad %27 %66 -%465 = OpLoad %28 %68 -OpBranch %469 -%469 = OpLabel +%463 = OpFunction %2 None %99 +%460 = OpLabel +%468 = OpVariable %469 Function %470 +%464 = OpLoad %25 %63 +%465 = OpLoad %26 %64 +%466 = OpLoad %27 %66 +%467 = OpLoad %28 %68 +OpBranch %471 +%471 = OpLabel OpLine %3 161 14 OpLine %3 162 15 OpLine %3 1 1 -%470 = OpLoad %8 %466 +%472 = OpLoad %8 %468 OpLine %3 165 5 -%472 = OpSampledImage %471 %463 %462 -%473 = OpImageSampleDrefImplicitLod %8 %472 %311 %309 -%474 = OpFAdd %8 %470 %473 +%474 = OpSampledImage %473 %465 %464 +%475 = OpImageSampleDrefImplicitLod %8 %474 %313 %311 +%476 = OpFAdd %8 %472 %475 OpLine %3 165 5 -OpStore %466 %474 +OpStore %468 %476 OpLine %3 1 1 -%475 = OpLoad %8 %466 +%477 = OpLoad %8 %468 OpLine %3 166 5 -%477 = OpConvertUToF %8 %229 -%478 = OpCompositeConstruct %312 %311 %477 -%479 = OpSampledImage %476 %464 %462 -%480 = OpImageSampleDrefImplicitLod %8 %479 %478 %309 -%481 = OpFAdd %8 %475 %480 +%479 = OpConvertUToF %8 %231 +%480 = OpCompositeConstruct %314 %313 %479 +%481 = OpSampledImage %478 %466 %464 +%482 = OpImageSampleDrefImplicitLod %8 %481 %480 %311 +%483 = OpFAdd %8 %477 %482 OpLine %3 166 5 -OpStore %466 %481 +OpStore %468 %483 OpLine %3 1 1 -%482 = OpLoad %8 %466 +%484 = OpLoad %8 %468 OpLine %3 167 5 -%483 = OpConvertSToF %8 %77 -%484 = OpCompositeConstruct %312 %311 %483 -%485 = OpSampledImage %476 %464 %462 -%486 = OpImageSampleDrefImplicitLod %8 %485 %484 %309 -%487 = OpFAdd %8 %482 %486 +%485 = OpConvertSToF %8 %77 +%486 = OpCompositeConstruct %314 %313 %485 +%487 = OpSampledImage %478 %466 %464 +%488 = OpImageSampleDrefImplicitLod %8 %487 %486 %311 +%489 = OpFAdd %8 %484 %488 OpLine %3 167 5 -OpStore %466 %487 +OpStore %468 %489 OpLine %3 1 1 -%488 = OpLoad %8 %466 +%490 = OpLoad %8 %468 OpLine %3 168 5 -%490 = OpSampledImage %489 %465 %462 -%491 = OpImageSampleDrefImplicitLod %8 %490 %313 %309 -%492 = OpFAdd %8 %488 %491 +%492 = OpSampledImage %491 %467 %464 +%493 = OpImageSampleDrefImplicitLod %8 %492 %315 %311 +%494 = OpFAdd %8 %490 %493 OpLine %3 168 5 -OpStore %466 %492 +OpStore %468 %494 OpLine %3 1 1 -%493 = OpLoad %8 %466 +%495 = OpLoad %8 %468 OpLine %3 169 5 -%494 = OpSampledImage %471 %463 %462 -%495 = OpImageSampleDrefExplicitLod %8 %494 %311 %309 Lod %212 -%496 = OpFAdd %8 %493 %495 +%496 = OpSampledImage %473 %465 %464 +%497 = OpImageSampleDrefExplicitLod %8 %496 %313 %311 Lod %214 +%498 = OpFAdd %8 %495 %497 OpLine %3 169 5 -OpStore %466 %496 +OpStore %468 %498 OpLine %3 1 1 -%497 = OpLoad %8 %466 +%499 = OpLoad %8 %468 OpLine %3 170 5 -%498 = OpConvertUToF %8 %229 -%499 = OpCompositeConstruct %312 %311 %498 -%500 = OpSampledImage %476 %464 %462 -%501 = OpImageSampleDrefExplicitLod %8 %500 %499 %309 Lod %212 -%502 = OpFAdd %8 %497 %501 +%500 = OpConvertUToF %8 %231 +%501 = OpCompositeConstruct %314 %313 %500 +%502 = OpSampledImage %478 %466 %464 +%503 = OpImageSampleDrefExplicitLod %8 %502 %501 %311 Lod %214 +%504 = OpFAdd %8 %499 %503 OpLine %3 170 5 -OpStore %466 %502 +OpStore %468 %504 OpLine %3 1 1 -%503 = OpLoad %8 %466 +%505 = OpLoad %8 %468 OpLine %3 171 5 -%504 = OpConvertSToF %8 %77 -%505 = OpCompositeConstruct %312 %311 %504 -%506 = OpSampledImage %476 %464 %462 -%507 = OpImageSampleDrefExplicitLod %8 %506 %505 %309 Lod %212 -%508 = OpFAdd %8 %503 %507 +%506 = OpConvertSToF %8 %77 +%507 = OpCompositeConstruct %314 %313 %506 +%508 = OpSampledImage %478 %466 %464 +%509 = OpImageSampleDrefExplicitLod %8 %508 %507 %311 Lod %214 +%510 = OpFAdd %8 %505 %509 OpLine %3 171 5 -OpStore %466 %508 +OpStore %468 %510 OpLine %3 1 1 -%509 = OpLoad %8 %466 +%511 = OpLoad %8 %468 OpLine %3 172 5 -%510 = OpSampledImage %489 %465 %462 -%511 = OpImageSampleDrefExplicitLod %8 %510 %313 %309 Lod %212 -%512 = OpFAdd %8 %509 %511 +%512 = OpSampledImage %491 %467 %464 +%513 = OpImageSampleDrefExplicitLod %8 %512 %315 %311 Lod %214 +%514 = OpFAdd %8 %511 %513 OpLine %3 172 5 -OpStore %466 %512 +OpStore %468 %514 OpLine %3 1 1 -%513 = OpLoad %8 %466 -OpStore %459 %513 +%515 = OpLoad %8 %468 +OpStore %461 %515 OpReturn OpFunctionEnd -%516 = OpFunction %2 None %97 -%514 = OpLabel -%517 = OpLoad %17 %46 -%518 = OpLoad %4 %48 -%519 = OpLoad %18 %49 -%520 = OpLoad %25 %61 -%521 = OpLoad %25 %63 -%522 = OpLoad %26 %64 -OpBranch %523 -%523 = OpLabel +%518 = OpFunction %2 None %99 +%516 = OpLabel +%519 = OpLoad %17 %46 +%520 = OpLoad %4 %48 +%521 = OpLoad %18 %49 +%522 = OpLoad %25 %61 +%523 = OpLoad %25 %63 +%524 = OpLoad %26 %64 +OpBranch %525 +%525 = OpLabel OpLine %3 178 14 OpLine %3 180 15 -%524 = OpSampledImage %328 %517 %520 -%525 = OpImageGather %24 %524 %311 %526 +%526 = OpSampledImage %330 %519 %522 +%527 = OpImageGather %24 %526 %313 %528 OpLine %3 181 22 -%527 = OpSampledImage %328 %517 %520 -%528 = OpImageGather %24 %527 %311 %529 ConstOffset %315 +%529 = OpSampledImage %330 %519 %522 +%530 = OpImageGather %24 %529 %313 %531 ConstOffset %317 OpLine %3 182 21 -%530 = OpSampledImage %471 %522 %521 -%531 = OpImageDrefGather %24 %530 %311 %309 +%532 = OpSampledImage %473 %524 %523 +%533 = OpImageDrefGather %24 %532 %313 %311 OpLine %3 183 28 -%532 = OpSampledImage %471 %522 %521 -%533 = OpImageDrefGather %24 %532 %311 %309 ConstOffset %315 +%534 = OpSampledImage %473 %524 %523 +%535 = OpImageDrefGather %24 %534 %313 %311 ConstOffset %317 OpLine %3 185 13 -%535 = OpSampledImage %534 %518 %520 -%536 = OpImageGather %117 %535 %311 %229 +%537 = OpSampledImage %536 %520 %522 +%538 = OpImageGather %119 %537 %313 %231 OpLine %3 186 13 -%539 = OpSampledImage %538 %519 %520 -%540 = OpImageGather %537 %539 %311 %229 +%541 = OpSampledImage %540 %521 %522 +%542 = OpImageGather %539 %541 %313 %231 OpLine %3 187 13 -%541 = OpConvertUToF %24 %536 -%542 = OpConvertSToF %24 %540 -%543 = OpFAdd %24 %541 %542 +%543 = OpConvertUToF %24 %538 +%544 = OpConvertSToF %24 %542 +%545 = OpFAdd %24 %543 %544 OpLine %3 189 12 -%544 = OpFAdd %24 %525 %528 -%545 = OpFAdd %24 %544 %531 -%546 = OpFAdd %24 %545 %533 -%547 = OpFAdd %24 %546 %543 -OpStore %515 %547 +%546 = OpFAdd %24 %527 %530 +%547 = OpFAdd %24 %546 %533 +%548 = OpFAdd %24 %547 %535 +%549 = OpFAdd %24 %548 %545 +OpStore %517 %549 OpReturn OpFunctionEnd -%550 = OpFunction %2 None %97 -%548 = OpLabel -%551 = OpLoad %25 %61 -%552 = OpLoad %26 %64 -OpBranch %553 -%553 = OpLabel +%552 = OpFunction %2 None %99 +%550 = OpLabel +%553 = OpLoad %25 %61 +%554 = OpLoad %26 %64 +OpBranch %555 +%555 = OpLabel OpLine %3 194 14 OpLine %3 196 15 -%554 = OpSampledImage %471 %552 %551 -%555 = OpImageSampleImplicitLod %24 %554 %311 -%556 = OpCompositeExtract %8 %555 0 +%556 = OpSampledImage %473 %554 %553 +%557 = OpImageSampleImplicitLod %24 %556 %313 +%558 = OpCompositeExtract %8 %557 0 OpLine %3 197 22 -%557 = OpSampledImage %471 %552 %551 -%558 = OpImageGather %24 %557 %311 %229 +%559 = OpSampledImage %473 %554 %553 +%560 = OpImageGather %24 %559 %313 %231 OpLine %3 198 21 -%559 = OpSampledImage %471 %552 %551 -%561 = OpConvertSToF %8 %88 -%560 = OpImageSampleExplicitLod %24 %559 %311 Lod %561 -%562 = OpCompositeExtract %8 %560 0 +%561 = OpSampledImage %473 %554 %553 +%563 = OpConvertSToF %8 %88 +%562 = OpImageSampleExplicitLod %24 %561 %313 Lod %563 +%564 = OpCompositeExtract %8 %562 0 OpLine %3 196 15 -%563 = OpCompositeConstruct %24 %556 %556 %556 %556 -%564 = OpFAdd %24 %563 %558 -%565 = OpCompositeConstruct %24 %562 %562 %562 %562 -%566 = OpFAdd %24 %564 %565 -OpStore %549 %566 +%565 = OpCompositeConstruct %24 %558 %558 %558 %558 +%566 = OpFAdd %24 %565 %560 +%567 = OpCompositeConstruct %24 %564 %564 %564 %564 +%568 = OpFAdd %24 %566 %567 +OpStore %551 %568 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/wgsl-image.spvasm.glsl b/naga/tests/out/spv/wgsl-image.spvasm.glsl index d311a332c..e39a257ab 100644 --- a/naga/tests/out/spv/wgsl-image.spvasm.glsl +++ b/naga/tests/out/spv/wgsl-image.spvasm.glsl @@ -34,15 +34,16 @@ ivec2 naga_mod(ivec2 lhs, ivec2 rhs) bvec2 _84 = equal(lhs, ivec2(int(0x80000000))); bvec2 _85 = equal(rhs, ivec2(-1)); bvec2 _86 = bvec2(_84.x && _85.x, _84.y && _85.y); - return lhs - mix(rhs, ivec2(1), bvec2(_79.x || _86.x, _79.y || _86.y)) * (lhs / mix(rhs, ivec2(1), bvec2(_79.x || _86.x, _79.y || _86.y))); + ivec2 _90 = mix(rhs, ivec2(1), bvec2(_79.x || _86.x, _79.y || _86.y)); + return lhs - ((lhs / _90) * _90); } void main() { - ivec2 _114 = naga_mod(ivec2(uvec2(imageSize(image_storage_src)) * gl_LocalInvocationID.xy), ivec2(10, 20)); - uvec4 _162 = imageLoad(image_storage_src, ivec2(uvec2(_114))); - imageStore(image_dst, _114.x, (((texelFetch(image_mipmapped_src, _114, int(gl_LocalInvocationID.z)) + texelFetch(image_multisampled_src, _114, int(gl_LocalInvocationID.z))) + imageLoad(image_storage_src, _114)) + texelFetch(image_array_src, ivec3(_114, int(gl_LocalInvocationID.z)), int(gl_LocalInvocationID.z) + 1)) + texelFetch(image_array_src, ivec3(_114, int(gl_LocalInvocationID.z)), int(gl_LocalInvocationID.z) + 1)); - imageStore(image_dst, int(uint(_114.x)), (((texelFetch(image_mipmapped_src, ivec2(uvec2(_114)), int(gl_LocalInvocationID.z)) + texelFetch(image_multisampled_src, ivec2(uvec2(_114)), int(gl_LocalInvocationID.z))) + _162) + texelFetch(image_array_src, ivec3(uvec3(uvec2(_114), gl_LocalInvocationID.z)), int(gl_LocalInvocationID.z) + 1)) + texelFetch(image_array_src, ivec3(uvec3(uvec2(_114), uint(int(gl_LocalInvocationID.z)))), int(gl_LocalInvocationID.z) + 1)); + ivec2 _116 = naga_mod(ivec2(uvec2(imageSize(image_storage_src)) * gl_LocalInvocationID.xy), ivec2(10, 20)); + uvec4 _164 = imageLoad(image_storage_src, ivec2(uvec2(_116))); + imageStore(image_dst, _116.x, (((texelFetch(image_mipmapped_src, _116, int(gl_LocalInvocationID.z)) + texelFetch(image_multisampled_src, _116, int(gl_LocalInvocationID.z))) + imageLoad(image_storage_src, _116)) + texelFetch(image_array_src, ivec3(_116, int(gl_LocalInvocationID.z)), int(gl_LocalInvocationID.z) + 1)) + texelFetch(image_array_src, ivec3(_116, int(gl_LocalInvocationID.z)), int(gl_LocalInvocationID.z) + 1)); + imageStore(image_dst, int(uint(_116.x)), (((texelFetch(image_mipmapped_src, ivec2(uvec2(_116)), int(gl_LocalInvocationID.z)) + texelFetch(image_multisampled_src, ivec2(uvec2(_116)), int(gl_LocalInvocationID.z))) + _164) + texelFetch(image_array_src, ivec3(uvec3(uvec2(_116), gl_LocalInvocationID.z)), int(gl_LocalInvocationID.z) + 1)) + texelFetch(image_array_src, ivec3(uvec3(uvec2(_116), uint(int(gl_LocalInvocationID.z)))), int(gl_LocalInvocationID.z) + 1)); } @@ -82,13 +83,14 @@ ivec2 naga_mod(ivec2 lhs, ivec2 rhs) bvec2 _84 = equal(lhs, ivec2(int(0x80000000))); bvec2 _85 = equal(rhs, ivec2(-1)); bvec2 _86 = bvec2(_84.x && _85.x, _84.y && _85.y); - return lhs - mix(rhs, ivec2(1), bvec2(_79.x || _86.x, _79.y || _86.y)) * (lhs / mix(rhs, ivec2(1), bvec2(_79.x || _86.x, _79.y || _86.y))); + ivec2 _90 = mix(rhs, ivec2(1), bvec2(_79.x || _86.x, _79.y || _86.y)); + return lhs - ((lhs / _90) * _90); } void main() { - ivec2 _206 = naga_mod(ivec2(uvec2(imageSize(image_storage_src)) * gl_LocalInvocationID.xy), ivec2(10, 20)); - imageStore(image_dst, _206.x, uvec4(uint(clamp(texelFetch(image_depth_multisampled_src, _206, int(gl_LocalInvocationID.z)).x, 0.0, 4294967040.0)))); + ivec2 _208 = naga_mod(ivec2(uvec2(imageSize(image_storage_src)) * gl_LocalInvocationID.xy), ivec2(10, 20)); + imageStore(image_dst, _208.x, uvec4(uint(clamp(texelFetch(image_depth_multisampled_src, _208, int(gl_LocalInvocationID.z)).x, 0.0, 4294967040.0)))); } @@ -123,8 +125,8 @@ layout(set = 1, binding = 4) uniform textureCube image_cube_depth; void main() { - uint _230 = uint(textureSize(image_1d, int(0u))); - gl_Position = vec4(float((((((((((_230 + uvec2(textureSize(image_2d, int(0u))).y) + uvec2(textureSize(image_2d, 1)).y) + uvec3(textureSize(image_2d_array, int(0u))).xy.y) + uvec3(textureSize(image_2d_array, 1)).xy.y) + uvec2(textureSize(image_cube, int(0u))).y) + uvec2(textureSize(image_cube, 1)).y) + uvec3(textureSize(image_cube_array, int(0u))).xx.y) + uvec3(textureSize(image_cube_array, 1)).xx.y) + uvec3(textureSize(image_3d, int(0u))).z) + uvec3(textureSize(image_3d, 1)).z)); + uint _232 = uint(textureSize(image_1d, int(0u))); + gl_Position = vec4(float((((((((((_232 + uvec2(textureSize(image_2d, int(0u))).y) + uvec2(textureSize(image_2d, 1)).y) + uvec3(textureSize(image_2d_array, int(0u))).xy.y) + uvec3(textureSize(image_2d_array, 1)).xy.y) + uvec2(textureSize(image_cube, int(0u))).y) + uvec2(textureSize(image_cube, 1)).y) + uvec3(textureSize(image_cube_array, int(0u))).xx.y) + uvec3(textureSize(image_cube_array, 1)).xx.y) + uvec3(textureSize(image_3d, int(0u))).z) + uvec3(textureSize(image_3d, 1)).z)); } @@ -193,7 +195,7 @@ layout(set = 1, binding = 2) uniform texture2D image_2d_depth; layout(set = 1, binding = 3) uniform texture2DArray image_2d_array_depth; layout(set = 1, binding = 4) uniform textureCube image_cube_depth; -layout(location = 0) out vec4 _302; +layout(location = 0) out vec4 _304; spirv_instruction(set = "GLSL.std.450", id = 81) float spvNClamp(float, float, float); spirv_instruction(set = "GLSL.std.450", id = 81) vec2 spvNClamp(vec2, vec2, vec2); @@ -209,41 +211,41 @@ void main() a += textureLod(sampler2D(image_2d, sampler_reg), vec2(0.5), 2.2999999523162841796875); a += textureLodOffset(sampler2D(image_2d, sampler_reg), vec2(0.5), 2.2999999523162841796875, ivec2(3, 1)); a += textureOffset(sampler2D(image_2d, sampler_reg), vec2(0.5), ivec2(3, 1), 2.0); - vec2 _351 = vec2(0.5) / vec2(uvec2(textureSize(image_2d, int(0u)))); - a += textureLod(sampler2D(image_2d, sampler_reg), spvNClamp(vec2(0.5), _351, vec2(1.0) - _351), 0.0); - float _361 = float(0u); - a += texture(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _361)); - float _367 = float(0u); - a += textureOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _367), ivec2(3, 1)); - float _373 = float(0u); - a += textureLod(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _373), 2.2999999523162841796875); - float _379 = float(0u); - a += textureLodOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _379), 2.2999999523162841796875, ivec2(3, 1)); - float _385 = float(0u); - a += textureOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _385), ivec2(3, 1), 2.0); - float _391 = float(0); - a += texture(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _391)); - float _397 = float(0); - a += textureOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _397), ivec2(3, 1)); - float _403 = float(0); - a += textureLod(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _403), 2.2999999523162841796875); - float _409 = float(0); - a += textureLodOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _409), 2.2999999523162841796875, ivec2(3, 1)); - float _415 = float(0); - a += textureOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _415), ivec2(3, 1), 2.0); - float _422 = float(0u); - a += texture(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _422)); - float _428 = float(0u); - a += textureLod(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _428), 2.2999999523162841796875); - float _434 = float(0u); - a += texture(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _434), 2.0); - float _440 = float(0); - a += texture(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _440)); - float _446 = float(0); - a += textureLod(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _446), 2.2999999523162841796875); - float _452 = float(0); - a += texture(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _452), 2.0); - _302 = a; + vec2 _353 = vec2(0.5) / vec2(uvec2(textureSize(image_2d, int(0u)))); + a += textureLod(sampler2D(image_2d, sampler_reg), spvNClamp(vec2(0.5), _353, vec2(1.0) - _353), 0.0); + float _363 = float(0u); + a += texture(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _363)); + float _369 = float(0u); + a += textureOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _369), ivec2(3, 1)); + float _375 = float(0u); + a += textureLod(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _375), 2.2999999523162841796875); + float _381 = float(0u); + a += textureLodOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _381), 2.2999999523162841796875, ivec2(3, 1)); + float _387 = float(0u); + a += textureOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _387), ivec2(3, 1), 2.0); + float _393 = float(0); + a += texture(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _393)); + float _399 = float(0); + a += textureOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _399), ivec2(3, 1)); + float _405 = float(0); + a += textureLod(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _405), 2.2999999523162841796875); + float _411 = float(0); + a += textureLodOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _411), 2.2999999523162841796875, ivec2(3, 1)); + float _417 = float(0); + a += textureOffset(sampler2DArray(image_2d_array, sampler_reg), vec3(vec2(0.5), _417), ivec2(3, 1), 2.0); + float _424 = float(0u); + a += texture(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _424)); + float _430 = float(0u); + a += textureLod(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _430), 2.2999999523162841796875); + float _436 = float(0u); + a += texture(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _436), 2.0); + float _442 = float(0); + a += texture(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _442)); + float _448 = float(0); + a += textureLod(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _448), 2.2999999523162841796875); + float _454 = float(0); + a += texture(samplerCubeArray(image_cube_array, sampler_reg), vec4(vec3(0.5), _454), 2.0); + _304 = a; } @@ -275,24 +277,24 @@ layout(set = 1, binding = 2) uniform texture2D image_2d_depth; layout(set = 1, binding = 3) uniform texture2DArray image_2d_array_depth; layout(set = 1, binding = 4) uniform textureCube image_cube_depth; -layout(location = 0) out float _459; +layout(location = 0) out float _461; void main() { float a = 0.0; a += texture(sampler2DShadow(image_2d_depth, sampler_cmp), vec3(vec2(0.5), 0.5)); - float _477 = float(0u); - a += texture(sampler2DArrayShadow(image_2d_array_depth, sampler_cmp), vec4(vec3(vec2(0.5), _477), 0.5)); - float _483 = float(0); - a += texture(sampler2DArrayShadow(image_2d_array_depth, sampler_cmp), vec4(vec3(vec2(0.5), _483), 0.5)); + float _479 = float(0u); + a += texture(sampler2DArrayShadow(image_2d_array_depth, sampler_cmp), vec4(vec3(vec2(0.5), _479), 0.5)); + float _485 = float(0); + a += texture(sampler2DArrayShadow(image_2d_array_depth, sampler_cmp), vec4(vec3(vec2(0.5), _485), 0.5)); a += texture(samplerCubeShadow(image_cube_depth, sampler_cmp), vec4(vec3(0.5), 0.5)); a += textureLod(sampler2DShadow(image_2d_depth, sampler_cmp), vec3(vec2(0.5), 0.5), 0.0); - float _498 = float(0u); - a += textureGrad(sampler2DArrayShadow(image_2d_array_depth, sampler_cmp), vec4(vec3(vec2(0.5), _498), 0.5), vec2(0.0), vec2(0.0)); - float _504 = float(0); - a += textureGrad(sampler2DArrayShadow(image_2d_array_depth, sampler_cmp), vec4(vec3(vec2(0.5), _504), 0.5), vec2(0.0), vec2(0.0)); + float _500 = float(0u); + a += textureGrad(sampler2DArrayShadow(image_2d_array_depth, sampler_cmp), vec4(vec3(vec2(0.5), _500), 0.5), vec2(0.0), vec2(0.0)); + float _506 = float(0); + a += textureGrad(sampler2DArrayShadow(image_2d_array_depth, sampler_cmp), vec4(vec3(vec2(0.5), _506), 0.5), vec2(0.0), vec2(0.0)); a += textureGrad(samplerCubeShadow(image_cube_depth, sampler_cmp), vec4(vec3(0.5), 0.5), vec3(0.0), vec3(0.0)); - _459 = a; + _461 = a; } @@ -324,11 +326,11 @@ layout(set = 1, binding = 2) uniform texture2D image_2d_depth; layout(set = 1, binding = 3) uniform texture2DArray image_2d_array_depth; layout(set = 1, binding = 4) uniform textureCube image_cube_depth; -layout(location = 0) out vec4 _515; +layout(location = 0) out vec4 _517; void main() { - _515 = (((textureGather(sampler2D(image_2d, sampler_reg), vec2(0.5), int(1u)) + textureGatherOffset(sampler2D(image_2d, sampler_reg), vec2(0.5), ivec2(3, 1), int(3u))) + textureGather(sampler2DShadow(image_2d_depth, sampler_cmp), vec2(0.5), 0.5)) + textureGatherOffset(sampler2DShadow(image_2d_depth, sampler_cmp), vec2(0.5), 0.5, ivec2(3, 1))) + (vec4(textureGather(usampler2D(image_2d_u32, sampler_reg), vec2(0.5))) + vec4(textureGather(isampler2D(image_2d_i32, sampler_reg), vec2(0.5)))); + _517 = (((textureGather(sampler2D(image_2d, sampler_reg), vec2(0.5), int(1u)) + textureGatherOffset(sampler2D(image_2d, sampler_reg), vec2(0.5), ivec2(3, 1), int(3u))) + textureGather(sampler2DShadow(image_2d_depth, sampler_cmp), vec2(0.5), 0.5)) + textureGatherOffset(sampler2DShadow(image_2d_depth, sampler_cmp), vec2(0.5), 0.5, ivec2(3, 1))) + (vec4(textureGather(usampler2D(image_2d_u32, sampler_reg), vec2(0.5))) + vec4(textureGather(isampler2D(image_2d_i32, sampler_reg), vec2(0.5)))); } @@ -360,11 +362,11 @@ layout(set = 1, binding = 2) uniform texture2D image_2d_depth; layout(set = 1, binding = 3) uniform texture2DArray image_2d_array_depth; layout(set = 1, binding = 4) uniform textureCube image_cube_depth; -layout(location = 0) out vec4 _549; +layout(location = 0) out vec4 _551; void main() { - float _561 = float(1); - _549 = (vec4(texture(sampler2DShadow(image_2d_depth, sampler_reg), vec2(0.5)).x) + textureGather(sampler2DShadow(image_2d_depth, sampler_reg), vec2(0.5))) + vec4(textureLod(sampler2DShadow(image_2d_depth, sampler_reg), vec2(0.5), _561).x); + float _563 = float(1); + _551 = (vec4(texture(sampler2DShadow(image_2d_depth, sampler_reg), vec2(0.5)).x) + textureGather(sampler2DShadow(image_2d_depth, sampler_reg), vec2(0.5))) + vec4(textureLod(sampler2DShadow(image_2d_depth, sampler_reg), vec2(0.5), _563).x); } diff --git a/naga/tests/out/spv/wgsl-int-div-unchecked.spvasm b/naga/tests/out/spv/wgsl-int-div-unchecked.spvasm index 99608d228..75f9ced54 100644 --- a/naga/tests/out/spv/wgsl-int-div-unchecked.spvasm +++ b/naga/tests/out/spv/wgsl-int-div-unchecked.spvasm @@ -1,27 +1,48 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 17 +; Bound: 36 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %4 "main" -OpExecutionMode %4 LocalSize 1 1 1 +OpEntryPoint GLCompute %24 "main" +OpExecutionMode %24 LocalSize 1 1 1 %2 = OpTypeVoid -%5 = OpTypeFunction %2 -%6 = OpTypeInt 32 1 -%7 = OpConstant %6 5 -%8 = OpConstant %6 2 -%9 = OpTypeInt 32 0 -%10 = OpConstant %9 5 -%11 = OpConstant %9 2 -%4 = OpFunction %2 None %5 -%3 = OpLabel -OpBranch %12 -%12 = OpLabel -%13 = OpSDiv %6 %7 %8 -%14 = OpSRem %6 %7 %8 -%15 = OpUDiv %9 %10 %11 -%16 = OpUMod %9 %10 %11 +%3 = OpTypeInt 32 1 +%5 = OpTypeFunction %3 %3 %3 +%9 = OpTypeBool +%10 = OpConstant %3 0 +%12 = OpConstant %3 -2147483648 +%13 = OpConstant %3 -1 +%18 = OpConstant %3 1 +%25 = OpTypeFunction %2 +%26 = OpConstant %3 5 +%27 = OpConstant %3 2 +%28 = OpTypeInt 32 0 +%29 = OpConstant %28 5 +%30 = OpConstant %28 2 +%4 = OpFunction %3 None %5 +%6 = OpFunctionParameter %3 +%7 = OpFunctionParameter %3 +%8 = OpLabel +%11 = OpIEqual %9 %7 %10 +%14 = OpIEqual %9 %6 %12 +%15 = OpIEqual %9 %7 %13 +%16 = OpLogicalAnd %9 %14 %15 +%17 = OpLogicalOr %9 %11 %16 +%19 = OpSelect %3 %17 %18 %7 +%20 = OpSDiv %3 %6 %19 +%21 = OpIMul %3 %20 %19 +%22 = OpISub %3 %6 %21 +OpReturnValue %22 +OpFunctionEnd +%24 = OpFunction %2 None %25 +%23 = OpLabel +OpBranch %31 +%31 = OpLabel +%32 = OpSDiv %3 %26 %27 +%33 = OpFunctionCall %3 %4 %26 %27 +%34 = OpUDiv %28 %29 %30 +%35 = OpUMod %28 %29 %30 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/wgsl-int-div-unchecked.spvasm.glsl b/naga/tests/out/spv/wgsl-int-div-unchecked.spvasm.glsl index 7421a703b..ed4bea3a0 100644 --- a/naga/tests/out/spv/wgsl-int-div-unchecked.spvasm.glsl +++ b/naga/tests/out/spv/wgsl-int-div-unchecked.spvasm.glsl @@ -1,11 +1,16 @@ #version 460 layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -void main() +int _4(int _6, int _7) { - int _13 = 5 / 2; - int _14 = 5 - 2 * (5 / 2); - uint _15 = 5u / 2u; - uint _16 = 5u % 2u; + int _19 = ((_7 == 0) || ((_6 == int(0x80000000)) && (_7 == (-1)))) ? 1 : _7; + return _6 - ((_6 / _19) * _19); +} + +void main() +{ + int _32 = 5 / 2; + uint _34 = 5u / 2u; + uint _35 = 5u % 2u; } diff --git a/naga/tests/out/spv/wgsl-int-signed-remainder.spvasm b/naga/tests/out/spv/wgsl-int-signed-remainder.spvasm new file mode 100644 index 000000000..0e9f8683a --- /dev/null +++ b/naga/tests/out/spv/wgsl-int-signed-remainder.spvasm @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.1 +; Generator: rspirv +; Bound: 67 +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %55 "main" +OpExecutionMode %55 LocalSize 1 1 1 +%2 = OpTypeVoid +%3 = OpTypeInt 32 1 +%5 = OpTypeFunction %3 %3 %3 +%9 = OpTypeBool +%10 = OpConstant %3 0 +%12 = OpConstant %3 -2147483648 +%13 = OpConstant %3 -1 +%18 = OpConstant %3 1 +%23 = OpTypeVector %3 2 +%25 = OpTypeFunction %23 %23 %23 +%29 = OpTypeVector %9 2 +%30 = OpConstantComposite %23 %10 %10 +%32 = OpConstantComposite %23 %12 %12 +%33 = OpConstantComposite %23 %13 %13 +%38 = OpConstantComposite %23 %18 %18 +%43 = OpTypeInt 32 0 +%45 = OpTypeFunction %43 %43 %43 +%49 = OpConstant %43 0 +%51 = OpConstant %43 1 +%56 = OpTypeFunction %2 +%57 = OpConstant %3 5 +%58 = OpConstant %3 2 +%59 = OpConstantComposite %23 %57 %57 +%60 = OpConstantComposite %23 %58 %58 +%61 = OpConstant %43 5 +%62 = OpConstant %43 2 +%4 = OpFunction %3 None %5 +%6 = OpFunctionParameter %3 +%7 = OpFunctionParameter %3 +%8 = OpLabel +%11 = OpIEqual %9 %7 %10 +%14 = OpIEqual %9 %6 %12 +%15 = OpIEqual %9 %7 %13 +%16 = OpLogicalAnd %9 %14 %15 +%17 = OpLogicalOr %9 %11 %16 +%19 = OpSelect %3 %17 %18 %7 +%20 = OpSDiv %3 %6 %19 +%21 = OpIMul %3 %20 %19 +%22 = OpISub %3 %6 %21 +OpReturnValue %22 +OpFunctionEnd +%24 = OpFunction %23 None %25 +%26 = OpFunctionParameter %23 +%27 = OpFunctionParameter %23 +%28 = OpLabel +%31 = OpIEqual %29 %27 %30 +%34 = OpIEqual %29 %26 %32 +%35 = OpIEqual %29 %27 %33 +%36 = OpLogicalAnd %29 %34 %35 +%37 = OpLogicalOr %29 %31 %36 +%39 = OpSelect %23 %37 %38 %27 +%40 = OpSDiv %23 %26 %39 +%41 = OpIMul %23 %40 %39 +%42 = OpISub %23 %26 %41 +OpReturnValue %42 +OpFunctionEnd +%44 = OpFunction %43 None %45 +%46 = OpFunctionParameter %43 +%47 = OpFunctionParameter %43 +%48 = OpLabel +%50 = OpIEqual %9 %47 %49 +%52 = OpSelect %43 %50 %51 %47 +%53 = OpUMod %43 %46 %52 +OpReturnValue %53 +OpFunctionEnd +%55 = OpFunction %2 None %56 +%54 = OpLabel +OpBranch %63 +%63 = OpLabel +%64 = OpFunctionCall %3 %4 %57 %58 +%65 = OpFunctionCall %23 %24 %59 %60 +%66 = OpFunctionCall %43 %44 %61 %62 +OpReturn +OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/wgsl-int-signed-remainder.spvasm.glsl b/naga/tests/out/spv/wgsl-int-signed-remainder.spvasm.glsl new file mode 100644 index 000000000..6a9672328 --- /dev/null +++ b/naga/tests/out/spv/wgsl-int-signed-remainder.spvasm.glsl @@ -0,0 +1,28 @@ +#version 460 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +int _4(int _6, int _7) +{ + int _19 = ((_7 == 0) || ((_6 == int(0x80000000)) && (_7 == (-1)))) ? 1 : _7; + return _6 - ((_6 / _19) * _19); +} + +ivec2 _24(ivec2 _26, ivec2 _27) +{ + bvec2 _31 = equal(_27, ivec2(0)); + bvec2 _34 = equal(_26, ivec2(int(0x80000000))); + bvec2 _35 = equal(_27, ivec2(-1)); + bvec2 _36 = bvec2(_34.x && _35.x, _34.y && _35.y); + ivec2 _39 = mix(_27, ivec2(1), bvec2(_31.x || _36.x, _31.y || _36.y)); + return _26 - ((_26 / _39) * _39); +} + +uint _44(uint _46, uint _47) +{ + return _46 % ((_47 == 0u) ? 1u : _47); +} + +void main() +{ +} + diff --git a/naga/tests/out/spv/wgsl-int16.spvasm b/naga/tests/out/spv/wgsl-int16.spvasm index efa5a1a0f..68f90c073 100644 --- a/naga/tests/out/spv/wgsl-int16.spvasm +++ b/naga/tests/out/spv/wgsl-int16.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: rspirv -; Bound: 431 +; Bound: 433 OpCapability Shader OpCapability Int16 OpCapability StorageBuffer16BitAccess @@ -14,8 +14,8 @@ OpCapability GroupNonUniformShuffle OpExtension "SPV_KHR_16bit_storage" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %375 "main" %372 %390 -OpExecutionMode %375 LocalSize 64 1 1 +OpEntryPoint GLCompute %377 "main" %374 %392 +OpExecutionMode %377 LocalSize 64 1 1 OpMemberDecorate %14 0 Offset 0 OpMemberDecorate %14 1 Offset 4 OpMemberDecorate %14 2 Offset 8 @@ -55,8 +55,8 @@ OpDecorate %38 DescriptorSet 0 OpDecorate %38 Binding 4 OpDecorate %39 Block OpMemberDecorate %39 0 Offset 0 -OpDecorate %372 BuiltIn SubgroupLocalInvocationId -OpDecorate %390 BuiltIn LocalInvocationIndex +OpDecorate %374 BuiltIn SubgroupLocalInvocationId +OpDecorate %392 BuiltIn LocalInvocationIndex %2 = OpTypeVoid %3 = OpTypeInt 16 1 %4 = OpTypeInt 16 0 @@ -103,75 +103,75 @@ OpDecorate %390 BuiltIn LocalInvocationIndex %49 = OpConstant %3 0 %51 = OpConstant %3 -32768 %52 = OpConstant %3 -1 -%73 = OpTypeFunction %3 %3 -%74 = OpTypePointer Uniform %14 -%75 = OpConstant %5 0 -%77 = OpTypePointer StorageBuffer %14 -%79 = OpTypePointer StorageBuffer %18 -%83 = OpConstant %3 20 -%84 = OpConstant %3 5 -%85 = OpConstant %3 2 -%86 = OpConstant %3 3 -%87 = OpConstant %3 4 -%88 = OpConstant %3 255 -%89 = OpConstant %3 16 -%90 = OpConstant %5 1 -%91 = OpConstantComposite %19 %21 %85 %86 %87 -%92 = OpConstant %4 1 -%93 = OpConstantComposite %11 %85 %85 -%95 = OpTypePointer Function %3 -%97 = OpTypePointer Function %19 -%103 = OpTypePointer Uniform %5 -%109 = OpTypePointer Uniform %6 -%115 = OpTypePointer Uniform %3 -%116 = OpConstant %5 7 -%122 = OpTypePointer StorageBuffer %3 -%129 = OpTypePointer StorageBuffer %11 -%130 = OpTypePointer Uniform %11 -%131 = OpConstant %5 8 -%138 = OpTypePointer StorageBuffer %12 -%139 = OpTypePointer Uniform %12 -%140 = OpConstant %5 9 -%147 = OpTypePointer StorageBuffer %13 -%148 = OpTypePointer Uniform %13 -%149 = OpConstant %5 10 -%156 = OpTypePointer StorageBuffer %17 -%214 = OpTypePointer StorageBuffer %5 -%218 = OpTypePointer StorageBuffer %6 -%222 = OpTypePointer StorageBuffer %7 -%241 = OpTypeFunction %4 %4 %4 -%245 = OpConstant %4 0 -%259 = OpTypeFunction %4 %4 -%265 = OpConstant %4 5 -%266 = OpConstant %4 2 -%267 = OpConstant %4 3 -%268 = OpConstant %4 4 -%269 = OpConstant %4 255 -%270 = OpConstant %4 16 -%272 = OpTypePointer Function %4 -%287 = OpTypePointer Uniform %4 -%288 = OpConstant %5 3 -%294 = OpTypePointer StorageBuffer %4 -%301 = OpTypePointer StorageBuffer %8 -%302 = OpTypePointer Uniform %8 -%309 = OpTypePointer StorageBuffer %9 -%310 = OpTypePointer Uniform %9 -%311 = OpConstant %5 5 -%318 = OpTypePointer StorageBuffer %10 -%319 = OpTypePointer Uniform %10 -%320 = OpConstant %5 6 -%327 = OpTypePointer StorageBuffer %15 -%373 = OpTypePointer Input %5 -%372 = OpVariable %373 Input -%376 = OpTypeFunction %2 -%382 = OpConstant %4 67 -%383 = OpConstant %3 60 -%385 = OpConstantNull %3 -%387 = OpConstantNull %4 +%75 = OpTypeFunction %3 %3 +%76 = OpTypePointer Uniform %14 +%77 = OpConstant %5 0 +%79 = OpTypePointer StorageBuffer %14 +%81 = OpTypePointer StorageBuffer %18 +%85 = OpConstant %3 20 +%86 = OpConstant %3 5 +%87 = OpConstant %3 2 +%88 = OpConstant %3 3 +%89 = OpConstant %3 4 +%90 = OpConstant %3 255 +%91 = OpConstant %3 16 +%92 = OpConstant %5 1 +%93 = OpConstantComposite %19 %21 %87 %88 %89 +%94 = OpConstant %4 1 +%95 = OpConstantComposite %11 %87 %87 +%97 = OpTypePointer Function %3 +%99 = OpTypePointer Function %19 +%105 = OpTypePointer Uniform %5 +%111 = OpTypePointer Uniform %6 +%117 = OpTypePointer Uniform %3 +%118 = OpConstant %5 7 +%124 = OpTypePointer StorageBuffer %3 +%131 = OpTypePointer StorageBuffer %11 +%132 = OpTypePointer Uniform %11 +%133 = OpConstant %5 8 +%140 = OpTypePointer StorageBuffer %12 +%141 = OpTypePointer Uniform %12 +%142 = OpConstant %5 9 +%149 = OpTypePointer StorageBuffer %13 +%150 = OpTypePointer Uniform %13 +%151 = OpConstant %5 10 +%158 = OpTypePointer StorageBuffer %17 +%216 = OpTypePointer StorageBuffer %5 +%220 = OpTypePointer StorageBuffer %6 +%224 = OpTypePointer StorageBuffer %7 +%243 = OpTypeFunction %4 %4 %4 +%247 = OpConstant %4 0 +%261 = OpTypeFunction %4 %4 +%267 = OpConstant %4 5 +%268 = OpConstant %4 2 +%269 = OpConstant %4 3 +%270 = OpConstant %4 4 +%271 = OpConstant %4 255 +%272 = OpConstant %4 16 +%274 = OpTypePointer Function %4 +%289 = OpTypePointer Uniform %4 +%290 = OpConstant %5 3 +%296 = OpTypePointer StorageBuffer %4 +%303 = OpTypePointer StorageBuffer %8 +%304 = OpTypePointer Uniform %8 +%311 = OpTypePointer StorageBuffer %9 +%312 = OpTypePointer Uniform %9 +%313 = OpConstant %5 5 +%320 = OpTypePointer StorageBuffer %10 +%321 = OpTypePointer Uniform %10 +%322 = OpConstant %5 6 +%329 = OpTypePointer StorageBuffer %15 +%375 = OpTypePointer Input %5 +%374 = OpVariable %375 Input +%378 = OpTypeFunction %2 +%384 = OpConstant %4 67 +%385 = OpConstant %3 60 +%387 = OpConstantNull %3 %389 = OpConstantNull %4 -%390 = OpVariable %373 Input -%395 = OpConstant %5 264 -%401 = OpConstant %5 11 +%391 = OpConstantNull %4 +%392 = OpVariable %375 Input +%397 = OpConstant %5 264 +%403 = OpConstant %5 11 %43 = OpFunction %3 None %44 %45 = OpFunctionParameter %3 %46 = OpFunctionParameter %3 @@ -195,392 +195,394 @@ OpFunctionEnd %66 = OpLogicalAnd %48 %64 %65 %67 = OpLogicalOr %48 %63 %66 %68 = OpSelect %3 %67 %21 %61 -%69 = OpSRem %3 %60 %68 -OpReturnValue %69 +%69 = OpSDiv %3 %60 %68 +%70 = OpIMul %3 %69 %68 +%71 = OpISub %3 %60 %70 +OpReturnValue %71 OpFunctionEnd -%72 = OpFunction %3 None %73 -%71 = OpFunctionParameter %3 -%70 = OpLabel -%94 = OpVariable %95 Function %83 -%96 = OpVariable %97 Function %91 -%76 = OpAccessChain %74 %26 %75 -%78 = OpAccessChain %77 %29 %75 -%80 = OpAccessChain %79 %32 %75 -%81 = OpAccessChain %77 %35 %75 -%82 = OpAccessChain %79 %38 %75 -OpBranch %98 -%98 = OpLabel -%99 = OpLoad %3 %24 -%100 = OpLoad %3 %94 -%101 = OpIAdd %3 %100 %84 -OpStore %94 %101 -%102 = OpLoad %3 %94 -%104 = OpAccessChain %103 %76 %75 -%105 = OpLoad %5 %104 -%106 = OpSConvert %3 %105 -%107 = OpIAdd %3 %102 %106 -OpStore %94 %107 -%108 = OpLoad %3 %94 -%110 = OpAccessChain %109 %76 %90 -%111 = OpLoad %6 %110 -%112 = OpSConvert %3 %111 -%113 = OpIAdd %3 %108 %112 -OpStore %94 %113 -%114 = OpLoad %3 %94 -%117 = OpAccessChain %115 %76 %116 -%118 = OpLoad %3 %117 -%119 = OpCompositeConstruct %12 %118 %118 %118 -%120 = OpCompositeExtract %3 %119 2 -%121 = OpIAdd %3 %114 %120 -OpStore %94 %121 -%123 = OpAccessChain %115 %76 %116 -%124 = OpLoad %3 %123 -%125 = OpAccessChain %122 %78 %116 +%74 = OpFunction %3 None %75 +%73 = OpFunctionParameter %3 +%72 = OpLabel +%96 = OpVariable %97 Function %85 +%98 = OpVariable %99 Function %93 +%78 = OpAccessChain %76 %26 %77 +%80 = OpAccessChain %79 %29 %77 +%82 = OpAccessChain %81 %32 %77 +%83 = OpAccessChain %79 %35 %77 +%84 = OpAccessChain %81 %38 %77 +OpBranch %100 +%100 = OpLabel +%101 = OpLoad %3 %24 +%102 = OpLoad %3 %96 +%103 = OpIAdd %3 %102 %86 +OpStore %96 %103 +%104 = OpLoad %3 %96 +%106 = OpAccessChain %105 %78 %77 +%107 = OpLoad %5 %106 +%108 = OpSConvert %3 %107 +%109 = OpIAdd %3 %104 %108 +OpStore %96 %109 +%110 = OpLoad %3 %96 +%112 = OpAccessChain %111 %78 %92 +%113 = OpLoad %6 %112 +%114 = OpSConvert %3 %113 +%115 = OpIAdd %3 %110 %114 +OpStore %96 %115 +%116 = OpLoad %3 %96 +%119 = OpAccessChain %117 %78 %118 +%120 = OpLoad %3 %119 +%121 = OpCompositeConstruct %12 %120 %120 %120 +%122 = OpCompositeExtract %3 %121 2 +%123 = OpIAdd %3 %116 %122 +OpStore %96 %123 +%125 = OpAccessChain %117 %78 %118 %126 = OpLoad %3 %125 -%127 = OpIAdd %3 %124 %126 -%128 = OpAccessChain %122 %81 %116 -OpStore %128 %127 -%132 = OpAccessChain %130 %76 %131 -%133 = OpLoad %11 %132 -%134 = OpAccessChain %129 %78 %131 +%127 = OpAccessChain %124 %80 %118 +%128 = OpLoad %3 %127 +%129 = OpIAdd %3 %126 %128 +%130 = OpAccessChain %124 %83 %118 +OpStore %130 %129 +%134 = OpAccessChain %132 %78 %133 %135 = OpLoad %11 %134 -%136 = OpIAdd %11 %133 %135 -%137 = OpAccessChain %129 %81 %131 -OpStore %137 %136 -%141 = OpAccessChain %139 %76 %140 -%142 = OpLoad %12 %141 -%143 = OpAccessChain %138 %78 %140 +%136 = OpAccessChain %131 %80 %133 +%137 = OpLoad %11 %136 +%138 = OpIAdd %11 %135 %137 +%139 = OpAccessChain %131 %83 %133 +OpStore %139 %138 +%143 = OpAccessChain %141 %78 %142 %144 = OpLoad %12 %143 -%145 = OpIAdd %12 %142 %144 -%146 = OpAccessChain %138 %81 %140 -OpStore %146 %145 -%150 = OpAccessChain %148 %76 %149 -%151 = OpLoad %13 %150 -%152 = OpAccessChain %147 %78 %149 +%145 = OpAccessChain %140 %80 %142 +%146 = OpLoad %12 %145 +%147 = OpIAdd %12 %144 %146 +%148 = OpAccessChain %140 %83 %142 +OpStore %148 %147 +%152 = OpAccessChain %150 %78 %151 %153 = OpLoad %13 %152 -%154 = OpIAdd %13 %151 %153 -%155 = OpAccessChain %147 %81 %149 -OpStore %155 %154 -%157 = OpAccessChain %156 %80 %90 -%158 = OpLoad %17 %157 -%159 = OpAccessChain %156 %82 %90 -OpStore %159 %158 -%160 = OpLoad %3 %94 -%161 = OpExtInst %3 %1 SAbs %160 -OpStore %94 %161 -%162 = OpLoad %3 %94 -%163 = OpLoad %3 %94 -%164 = OpExtInst %3 %1 SMax %162 %163 -OpStore %94 %164 -%165 = OpLoad %3 %94 -%166 = OpLoad %3 %94 -%167 = OpExtInst %3 %1 SMin %165 %166 -OpStore %94 %167 -%168 = OpLoad %3 %94 -%169 = OpLoad %3 %94 -%170 = OpLoad %3 %94 -%172 = OpExtInst %3 %1 SMax %168 %169 -%171 = OpExtInst %3 %1 SMin %172 %170 -OpStore %94 %171 -%173 = OpLoad %3 %94 -%174 = OpExtInst %3 %1 SSign %173 -OpStore %94 %174 -%175 = OpLoad %3 %94 -%176 = OpISub %3 %175 %21 -OpStore %94 %176 -%177 = OpLoad %3 %94 -%178 = OpIMul %3 %177 %85 -OpStore %94 %178 -%179 = OpLoad %3 %94 -%180 = OpFunctionCall %3 %43 %179 %86 -OpStore %94 %180 -%181 = OpLoad %3 %94 -%182 = OpFunctionCall %3 %59 %181 %87 -OpStore %94 %182 -%183 = OpLoad %3 %94 -%184 = OpBitwiseAnd %3 %183 %88 -OpStore %94 %184 -%185 = OpLoad %3 %94 -%186 = OpBitwiseOr %3 %185 %89 -OpStore %94 %186 -%187 = OpLoad %3 %94 -%188 = OpBitwiseXor %3 %187 %21 -OpStore %94 %188 -%189 = OpLoad %3 %94 -%190 = OpShiftLeftLogical %3 %189 %16 -OpStore %94 %190 -%191 = OpLoad %3 %94 -%192 = OpShiftRightArithmetic %3 %191 %90 -OpStore %94 %192 -%193 = OpLoad %3 %94 -%194 = OpSNegate %3 %193 -OpStore %94 %194 -%195 = OpLoad %3 %94 -%196 = OpSLessThan %48 %195 %49 -%197 = OpLoad %3 %94 -%198 = OpSLessThanEqual %48 %197 %49 -%199 = OpLoad %3 %94 -%200 = OpSGreaterThan %48 %199 %49 -%201 = OpLoad %3 %94 -%202 = OpSGreaterThanEqual %48 %201 %49 -%203 = OpLoad %3 %94 -%204 = OpIEqual %48 %203 %49 -%205 = OpLoad %3 %94 -%206 = OpINotEqual %48 %205 %49 -%207 = OpSelect %3 %196 %85 %21 -OpStore %94 %207 -%208 = OpLoad %3 %94 -%209 = OpAccessChain %95 %96 %75 -OpStore %209 %208 -%210 = OpAccessChain %95 %96 %90 -%211 = OpLoad %3 %210 -OpStore %94 %211 -%212 = OpAccessChain %95 %96 %90 +%154 = OpAccessChain %149 %80 %151 +%155 = OpLoad %13 %154 +%156 = OpIAdd %13 %153 %155 +%157 = OpAccessChain %149 %83 %151 +OpStore %157 %156 +%159 = OpAccessChain %158 %82 %92 +%160 = OpLoad %17 %159 +%161 = OpAccessChain %158 %84 %92 +OpStore %161 %160 +%162 = OpLoad %3 %96 +%163 = OpExtInst %3 %1 SAbs %162 +OpStore %96 %163 +%164 = OpLoad %3 %96 +%165 = OpLoad %3 %96 +%166 = OpExtInst %3 %1 SMax %164 %165 +OpStore %96 %166 +%167 = OpLoad %3 %96 +%168 = OpLoad %3 %96 +%169 = OpExtInst %3 %1 SMin %167 %168 +OpStore %96 %169 +%170 = OpLoad %3 %96 +%171 = OpLoad %3 %96 +%172 = OpLoad %3 %96 +%174 = OpExtInst %3 %1 SMax %170 %171 +%173 = OpExtInst %3 %1 SMin %174 %172 +OpStore %96 %173 +%175 = OpLoad %3 %96 +%176 = OpExtInst %3 %1 SSign %175 +OpStore %96 %176 +%177 = OpLoad %3 %96 +%178 = OpISub %3 %177 %21 +OpStore %96 %178 +%179 = OpLoad %3 %96 +%180 = OpIMul %3 %179 %87 +OpStore %96 %180 +%181 = OpLoad %3 %96 +%182 = OpFunctionCall %3 %43 %181 %88 +OpStore %96 %182 +%183 = OpLoad %3 %96 +%184 = OpFunctionCall %3 %59 %183 %89 +OpStore %96 %184 +%185 = OpLoad %3 %96 +%186 = OpBitwiseAnd %3 %185 %90 +OpStore %96 %186 +%187 = OpLoad %3 %96 +%188 = OpBitwiseOr %3 %187 %91 +OpStore %96 %188 +%189 = OpLoad %3 %96 +%190 = OpBitwiseXor %3 %189 %21 +OpStore %96 %190 +%191 = OpLoad %3 %96 +%192 = OpShiftLeftLogical %3 %191 %16 +OpStore %96 %192 +%193 = OpLoad %3 %96 +%194 = OpShiftRightArithmetic %3 %193 %92 +OpStore %96 %194 +%195 = OpLoad %3 %96 +%196 = OpSNegate %3 %195 +OpStore %96 %196 +%197 = OpLoad %3 %96 +%198 = OpSLessThan %48 %197 %49 +%199 = OpLoad %3 %96 +%200 = OpSLessThanEqual %48 %199 %49 +%201 = OpLoad %3 %96 +%202 = OpSGreaterThan %48 %201 %49 +%203 = OpLoad %3 %96 +%204 = OpSGreaterThanEqual %48 %203 %49 +%205 = OpLoad %3 %96 +%206 = OpIEqual %48 %205 %49 +%207 = OpLoad %3 %96 +%208 = OpINotEqual %48 %207 %49 +%209 = OpSelect %3 %198 %87 %21 +OpStore %96 %209 +%210 = OpLoad %3 %96 +%211 = OpAccessChain %97 %98 %77 +OpStore %211 %210 +%212 = OpAccessChain %97 %98 %92 %213 = OpLoad %3 %212 -OpStore %94 %213 -%215 = OpLoad %3 %94 -%216 = OpUConvert %5 %215 -%217 = OpAccessChain %214 %81 %75 -OpStore %217 %216 -%219 = OpLoad %3 %94 -%220 = OpSConvert %6 %219 -%221 = OpAccessChain %218 %81 %90 -OpStore %221 %220 -%223 = OpLoad %3 %94 -%224 = OpConvertSToF %7 %223 -%225 = OpAccessChain %222 %81 %16 -OpStore %225 %224 -%226 = OpAccessChain %214 %81 %75 -%227 = OpLoad %5 %226 -%228 = OpSConvert %3 %227 -OpStore %94 %228 -%229 = OpLoad %3 %94 -%230 = OpBitcast %4 %229 -%231 = OpBitcast %3 %230 -OpStore %94 %231 -%232 = OpAccessChain %130 %76 %131 -%233 = OpLoad %11 %232 -%234 = OpAccessChain %130 %76 %131 +OpStore %96 %213 +%214 = OpAccessChain %97 %98 %92 +%215 = OpLoad %3 %214 +OpStore %96 %215 +%217 = OpLoad %3 %96 +%218 = OpUConvert %5 %217 +%219 = OpAccessChain %216 %83 %77 +OpStore %219 %218 +%221 = OpLoad %3 %96 +%222 = OpSConvert %6 %221 +%223 = OpAccessChain %220 %83 %92 +OpStore %223 %222 +%225 = OpLoad %3 %96 +%226 = OpConvertSToF %7 %225 +%227 = OpAccessChain %224 %83 %16 +OpStore %227 %226 +%228 = OpAccessChain %216 %83 %77 +%229 = OpLoad %5 %228 +%230 = OpSConvert %3 %229 +OpStore %96 %230 +%231 = OpLoad %3 %96 +%232 = OpBitcast %4 %231 +%233 = OpBitcast %3 %232 +OpStore %96 %233 +%234 = OpAccessChain %132 %78 %133 %235 = OpLoad %11 %234 -%236 = OpIAdd %11 %233 %235 -%237 = OpIMul %11 %236 %93 -%238 = OpAccessChain %129 %81 %131 -OpStore %238 %237 -%239 = OpLoad %3 %94 -OpReturnValue %239 +%236 = OpAccessChain %132 %78 %133 +%237 = OpLoad %11 %236 +%238 = OpIAdd %11 %235 %237 +%239 = OpIMul %11 %238 %95 +%240 = OpAccessChain %131 %83 %133 +OpStore %240 %239 +%241 = OpLoad %3 %96 +OpReturnValue %241 OpFunctionEnd -%240 = OpFunction %4 None %241 -%242 = OpFunctionParameter %4 -%243 = OpFunctionParameter %4 -%244 = OpLabel -%246 = OpIEqual %48 %243 %245 -%247 = OpSelect %4 %246 %92 %243 -%248 = OpUDiv %4 %242 %247 -OpReturnValue %248 +%242 = OpFunction %4 None %243 +%244 = OpFunctionParameter %4 +%245 = OpFunctionParameter %4 +%246 = OpLabel +%248 = OpIEqual %48 %245 %247 +%249 = OpSelect %4 %248 %94 %245 +%250 = OpUDiv %4 %244 %249 +OpReturnValue %250 OpFunctionEnd -%249 = OpFunction %4 None %241 -%250 = OpFunctionParameter %4 -%251 = OpFunctionParameter %4 -%252 = OpLabel -%253 = OpIEqual %48 %251 %245 -%254 = OpSelect %4 %253 %92 %251 -%255 = OpUMod %4 %250 %254 -OpReturnValue %255 +%251 = OpFunction %4 None %243 +%252 = OpFunctionParameter %4 +%253 = OpFunctionParameter %4 +%254 = OpLabel +%255 = OpIEqual %48 %253 %247 +%256 = OpSelect %4 %255 %94 %253 +%257 = OpUMod %4 %252 %256 +OpReturnValue %257 OpFunctionEnd -%258 = OpFunction %4 None %259 -%257 = OpFunctionParameter %4 -%256 = OpLabel -%271 = OpVariable %272 Function %22 -%260 = OpAccessChain %74 %26 %75 -%261 = OpAccessChain %77 %29 %75 -%262 = OpAccessChain %79 %32 %75 -%263 = OpAccessChain %77 %35 %75 -%264 = OpAccessChain %79 %38 %75 -OpBranch %273 -%273 = OpLabel -%274 = OpLoad %4 %271 -%275 = OpIAdd %4 %274 %265 -OpStore %271 %275 -%276 = OpLoad %4 %271 -%277 = OpAccessChain %103 %260 %75 -%278 = OpLoad %5 %277 -%279 = OpUConvert %4 %278 -%280 = OpIAdd %4 %276 %279 -OpStore %271 %280 -%281 = OpLoad %4 %271 -%282 = OpAccessChain %109 %260 %90 -%283 = OpLoad %6 %282 -%284 = OpUConvert %4 %283 -%285 = OpIAdd %4 %281 %284 -OpStore %271 %285 -%286 = OpLoad %4 %271 -%289 = OpAccessChain %287 %260 %288 -%290 = OpLoad %4 %289 -%291 = OpCompositeConstruct %9 %290 %290 %290 -%292 = OpCompositeExtract %4 %291 2 -%293 = OpIAdd %4 %286 %292 -OpStore %271 %293 -%295 = OpAccessChain %287 %260 %288 -%296 = OpLoad %4 %295 -%297 = OpAccessChain %294 %261 %288 +%260 = OpFunction %4 None %261 +%259 = OpFunctionParameter %4 +%258 = OpLabel +%273 = OpVariable %274 Function %22 +%262 = OpAccessChain %76 %26 %77 +%263 = OpAccessChain %79 %29 %77 +%264 = OpAccessChain %81 %32 %77 +%265 = OpAccessChain %79 %35 %77 +%266 = OpAccessChain %81 %38 %77 +OpBranch %275 +%275 = OpLabel +%276 = OpLoad %4 %273 +%277 = OpIAdd %4 %276 %267 +OpStore %273 %277 +%278 = OpLoad %4 %273 +%279 = OpAccessChain %105 %262 %77 +%280 = OpLoad %5 %279 +%281 = OpUConvert %4 %280 +%282 = OpIAdd %4 %278 %281 +OpStore %273 %282 +%283 = OpLoad %4 %273 +%284 = OpAccessChain %111 %262 %92 +%285 = OpLoad %6 %284 +%286 = OpUConvert %4 %285 +%287 = OpIAdd %4 %283 %286 +OpStore %273 %287 +%288 = OpLoad %4 %273 +%291 = OpAccessChain %289 %262 %290 +%292 = OpLoad %4 %291 +%293 = OpCompositeConstruct %9 %292 %292 %292 +%294 = OpCompositeExtract %4 %293 2 +%295 = OpIAdd %4 %288 %294 +OpStore %273 %295 +%297 = OpAccessChain %289 %262 %290 %298 = OpLoad %4 %297 -%299 = OpIAdd %4 %296 %298 -%300 = OpAccessChain %294 %263 %288 -OpStore %300 %299 -%303 = OpAccessChain %302 %260 %20 -%304 = OpLoad %8 %303 -%305 = OpAccessChain %301 %261 %20 +%299 = OpAccessChain %296 %263 %290 +%300 = OpLoad %4 %299 +%301 = OpIAdd %4 %298 %300 +%302 = OpAccessChain %296 %265 %290 +OpStore %302 %301 +%305 = OpAccessChain %304 %262 %20 %306 = OpLoad %8 %305 -%307 = OpIAdd %8 %304 %306 -%308 = OpAccessChain %301 %263 %20 -OpStore %308 %307 -%312 = OpAccessChain %310 %260 %311 -%313 = OpLoad %9 %312 -%314 = OpAccessChain %309 %261 %311 +%307 = OpAccessChain %303 %263 %20 +%308 = OpLoad %8 %307 +%309 = OpIAdd %8 %306 %308 +%310 = OpAccessChain %303 %265 %20 +OpStore %310 %309 +%314 = OpAccessChain %312 %262 %313 %315 = OpLoad %9 %314 -%316 = OpIAdd %9 %313 %315 -%317 = OpAccessChain %309 %263 %311 -OpStore %317 %316 -%321 = OpAccessChain %319 %260 %320 -%322 = OpLoad %10 %321 -%323 = OpAccessChain %318 %261 %320 +%316 = OpAccessChain %311 %263 %313 +%317 = OpLoad %9 %316 +%318 = OpIAdd %9 %315 %317 +%319 = OpAccessChain %311 %265 %313 +OpStore %319 %318 +%323 = OpAccessChain %321 %262 %322 %324 = OpLoad %10 %323 -%325 = OpIAdd %10 %322 %324 -%326 = OpAccessChain %318 %263 %320 -OpStore %326 %325 -%328 = OpAccessChain %327 %262 %75 -%329 = OpLoad %15 %328 -%330 = OpAccessChain %327 %264 %75 -OpStore %330 %329 -%331 = OpLoad %4 %271 -%332 = OpCopyObject %4 %331 -OpStore %271 %332 -%333 = OpLoad %4 %271 -%334 = OpLoad %4 %271 -%335 = OpExtInst %4 %1 UMax %333 %334 -OpStore %271 %335 -%336 = OpLoad %4 %271 -%337 = OpLoad %4 %271 -%338 = OpExtInst %4 %1 UMin %336 %337 -OpStore %271 %338 -%339 = OpLoad %4 %271 -%340 = OpLoad %4 %271 -%341 = OpLoad %4 %271 -%343 = OpExtInst %4 %1 UMax %339 %340 -%342 = OpExtInst %4 %1 UMin %343 %341 -OpStore %271 %342 -%344 = OpLoad %4 %271 -%345 = OpISub %4 %344 %92 -OpStore %271 %345 -%346 = OpLoad %4 %271 -%347 = OpIMul %4 %346 %266 -OpStore %271 %347 -%348 = OpLoad %4 %271 -%349 = OpFunctionCall %4 %240 %348 %267 -OpStore %271 %349 -%350 = OpLoad %4 %271 -%351 = OpFunctionCall %4 %249 %350 %268 -OpStore %271 %351 -%352 = OpLoad %4 %271 -%353 = OpBitwiseAnd %4 %352 %269 -OpStore %271 %353 -%354 = OpLoad %4 %271 -%355 = OpBitwiseOr %4 %354 %270 -OpStore %271 %355 -%356 = OpLoad %4 %271 -%357 = OpBitwiseXor %4 %356 %92 -OpStore %271 %357 -%358 = OpLoad %4 %271 -%359 = OpUConvert %5 %358 -%360 = OpAccessChain %214 %263 %75 -OpStore %360 %359 -%361 = OpLoad %4 %271 -%362 = OpSConvert %6 %361 -%363 = OpAccessChain %218 %263 %90 -OpStore %363 %362 -%364 = OpLoad %4 %271 -%365 = OpConvertUToF %7 %364 -%366 = OpAccessChain %222 %263 %16 -OpStore %366 %365 -%367 = OpAccessChain %214 %263 %75 -%368 = OpLoad %5 %367 -%369 = OpUConvert %4 %368 -OpStore %271 %369 -%370 = OpLoad %4 %271 -OpReturnValue %370 +%325 = OpAccessChain %320 %263 %322 +%326 = OpLoad %10 %325 +%327 = OpIAdd %10 %324 %326 +%328 = OpAccessChain %320 %265 %322 +OpStore %328 %327 +%330 = OpAccessChain %329 %264 %77 +%331 = OpLoad %15 %330 +%332 = OpAccessChain %329 %266 %77 +OpStore %332 %331 +%333 = OpLoad %4 %273 +%334 = OpCopyObject %4 %333 +OpStore %273 %334 +%335 = OpLoad %4 %273 +%336 = OpLoad %4 %273 +%337 = OpExtInst %4 %1 UMax %335 %336 +OpStore %273 %337 +%338 = OpLoad %4 %273 +%339 = OpLoad %4 %273 +%340 = OpExtInst %4 %1 UMin %338 %339 +OpStore %273 %340 +%341 = OpLoad %4 %273 +%342 = OpLoad %4 %273 +%343 = OpLoad %4 %273 +%345 = OpExtInst %4 %1 UMax %341 %342 +%344 = OpExtInst %4 %1 UMin %345 %343 +OpStore %273 %344 +%346 = OpLoad %4 %273 +%347 = OpISub %4 %346 %94 +OpStore %273 %347 +%348 = OpLoad %4 %273 +%349 = OpIMul %4 %348 %268 +OpStore %273 %349 +%350 = OpLoad %4 %273 +%351 = OpFunctionCall %4 %242 %350 %269 +OpStore %273 %351 +%352 = OpLoad %4 %273 +%353 = OpFunctionCall %4 %251 %352 %270 +OpStore %273 %353 +%354 = OpLoad %4 %273 +%355 = OpBitwiseAnd %4 %354 %271 +OpStore %273 %355 +%356 = OpLoad %4 %273 +%357 = OpBitwiseOr %4 %356 %272 +OpStore %273 %357 +%358 = OpLoad %4 %273 +%359 = OpBitwiseXor %4 %358 %94 +OpStore %273 %359 +%360 = OpLoad %4 %273 +%361 = OpUConvert %5 %360 +%362 = OpAccessChain %216 %265 %77 +OpStore %362 %361 +%363 = OpLoad %4 %273 +%364 = OpSConvert %6 %363 +%365 = OpAccessChain %220 %265 %92 +OpStore %365 %364 +%366 = OpLoad %4 %273 +%367 = OpConvertUToF %7 %366 +%368 = OpAccessChain %224 %265 %16 +OpStore %368 %367 +%369 = OpAccessChain %216 %265 %77 +%370 = OpLoad %5 %369 +%371 = OpUConvert %4 %370 +OpStore %273 %371 +%372 = OpLoad %4 %273 +OpReturnValue %372 OpFunctionEnd -%375 = OpFunction %2 None %376 -%371 = OpLabel -%384 = OpVariable %95 Function %385 -%386 = OpVariable %272 Function %387 -%374 = OpLoad %5 %372 -%377 = OpAccessChain %74 %26 %75 -%378 = OpAccessChain %77 %29 %75 -%379 = OpAccessChain %79 %32 %75 -%380 = OpAccessChain %77 %35 %75 -%381 = OpAccessChain %79 %38 %75 -OpBranch %388 -%388 = OpLabel -%391 = OpLoad %5 %390 -%392 = OpIEqual %48 %391 %75 -OpSelectionMerge %393 None -OpBranchConditional %392 %394 %393 -%394 = OpLabel -OpStore %41 %389 -OpBranch %393 -%393 = OpLabel -OpControlBarrier %16 %16 %395 -OpBranch %396 +%377 = OpFunction %2 None %378 +%373 = OpLabel +%386 = OpVariable %97 Function %387 +%388 = OpVariable %274 Function %389 +%376 = OpLoad %5 %374 +%379 = OpAccessChain %76 %26 %77 +%380 = OpAccessChain %79 %29 %77 +%381 = OpAccessChain %81 %32 %77 +%382 = OpAccessChain %79 %35 %77 +%383 = OpAccessChain %81 %38 %77 +OpBranch %390 +%390 = OpLabel +%393 = OpLoad %5 %392 +%394 = OpIEqual %48 %393 %77 +OpSelectionMerge %395 None +OpBranchConditional %394 %396 %395 %396 = OpLabel -OpStore %41 %245 -%397 = OpFunctionCall %4 %258 %382 -%398 = OpFunctionCall %3 %72 %383 -%399 = OpBitcast %4 %398 -%400 = OpIAdd %4 %397 %399 -%402 = OpAccessChain %294 %380 %401 -OpStore %402 %400 -%403 = OpSConvert %3 %374 -OpStore %384 %403 -%404 = OpLoad %3 %384 -%405 = OpGroupNonUniformIAdd %3 %288 Reduce %404 -OpStore %384 %405 -%406 = OpLoad %3 %384 -%407 = OpGroupNonUniformIMul %3 %288 Reduce %406 -OpStore %384 %407 -%408 = OpLoad %3 %384 -%409 = OpGroupNonUniformSMin %3 %288 Reduce %408 -OpStore %384 %409 -%410 = OpLoad %3 %384 -%411 = OpGroupNonUniformSMax %3 %288 Reduce %410 -OpStore %384 %411 -%412 = OpLoad %3 %384 -%413 = OpGroupNonUniformIAdd %3 %288 ExclusiveScan %412 -OpStore %384 %413 -%414 = OpLoad %3 %384 -%415 = OpGroupNonUniformIAdd %3 %288 InclusiveScan %414 -OpStore %384 %415 -%416 = OpLoad %3 %384 -%417 = OpGroupNonUniformBroadcastFirst %3 %288 %416 -OpStore %384 %417 -%418 = OpLoad %3 %384 -%419 = OpGroupNonUniformShuffle %3 %288 %418 %20 -OpStore %384 %419 -%420 = OpUConvert %4 %374 -OpStore %386 %420 -%421 = OpLoad %4 %386 -%422 = OpGroupNonUniformIAdd %4 %288 Reduce %421 -OpStore %386 %422 -%423 = OpLoad %4 %386 -%424 = OpGroupNonUniformUMin %4 %288 Reduce %423 -OpStore %386 %424 -%425 = OpLoad %4 %386 -%426 = OpGroupNonUniformUMax %4 %288 Reduce %425 -OpStore %386 %426 -%427 = OpLoad %3 %384 -%428 = OpAccessChain %122 %380 %116 -OpStore %428 %427 -%429 = OpLoad %4 %386 -%430 = OpAccessChain %294 %380 %288 +OpStore %41 %391 +OpBranch %395 +%395 = OpLabel +OpControlBarrier %16 %16 %397 +OpBranch %398 +%398 = OpLabel +OpStore %41 %247 +%399 = OpFunctionCall %4 %260 %384 +%400 = OpFunctionCall %3 %74 %385 +%401 = OpBitcast %4 %400 +%402 = OpIAdd %4 %399 %401 +%404 = OpAccessChain %296 %382 %403 +OpStore %404 %402 +%405 = OpSConvert %3 %376 +OpStore %386 %405 +%406 = OpLoad %3 %386 +%407 = OpGroupNonUniformIAdd %3 %290 Reduce %406 +OpStore %386 %407 +%408 = OpLoad %3 %386 +%409 = OpGroupNonUniformIMul %3 %290 Reduce %408 +OpStore %386 %409 +%410 = OpLoad %3 %386 +%411 = OpGroupNonUniformSMin %3 %290 Reduce %410 +OpStore %386 %411 +%412 = OpLoad %3 %386 +%413 = OpGroupNonUniformSMax %3 %290 Reduce %412 +OpStore %386 %413 +%414 = OpLoad %3 %386 +%415 = OpGroupNonUniformIAdd %3 %290 ExclusiveScan %414 +OpStore %386 %415 +%416 = OpLoad %3 %386 +%417 = OpGroupNonUniformIAdd %3 %290 InclusiveScan %416 +OpStore %386 %417 +%418 = OpLoad %3 %386 +%419 = OpGroupNonUniformBroadcastFirst %3 %290 %418 +OpStore %386 %419 +%420 = OpLoad %3 %386 +%421 = OpGroupNonUniformShuffle %3 %290 %420 %20 +OpStore %386 %421 +%422 = OpUConvert %4 %376 +OpStore %388 %422 +%423 = OpLoad %4 %388 +%424 = OpGroupNonUniformIAdd %4 %290 Reduce %423 +OpStore %388 %424 +%425 = OpLoad %4 %388 +%426 = OpGroupNonUniformUMin %4 %290 Reduce %425 +OpStore %388 %426 +%427 = OpLoad %4 %388 +%428 = OpGroupNonUniformUMax %4 %290 Reduce %427 +OpStore %388 %428 +%429 = OpLoad %3 %386 +%430 = OpAccessChain %124 %382 %118 OpStore %430 %429 +%431 = OpLoad %4 %388 +%432 = OpAccessChain %296 %382 %290 +OpStore %432 %431 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/wgsl-int16.spvasm.glsl b/naga/tests/out/spv/wgsl-int16.spvasm.glsl index e96f51aa0..f28202a50 100644 --- a/naga/tests/out/spv/wgsl-int16.spvasm.glsl +++ b/naga/tests/out/spv/wgsl-int16.spvasm.glsl @@ -58,45 +58,45 @@ layout(set = 0, binding = 4, std430) buffer _39_38 int16_t _24 = 1s; shared uint16_t _41; -uint16_t _240(uint16_t _242, uint16_t _243) +uint16_t _242(uint16_t _244, uint16_t _245) { - return _242 / ((_243 == 0us) ? 1us : _243); + return _244 / ((_245 == 0us) ? 1us : _245); } -uint16_t _249(uint16_t _250, uint16_t _251) +uint16_t _251(uint16_t _252, uint16_t _253) { - return _250 % ((_251 == 0us) ? 1us : _251); + return _252 % ((_253 == 0us) ? 1us : _253); } -uint16_t _258(uint16_t _257) +uint16_t _260(uint16_t _259) { - uint16_t _271 = 20us; - _271 += 5us; - _271 += uint16_t(_26._m0._m0); - _271 += uint16_t(_26._m0._m1); - _271 += u16vec3(_26._m0._m3).z; + uint16_t _273 = 20us; + _273 += 5us; + _273 += uint16_t(_26._m0._m0); + _273 += uint16_t(_26._m0._m1); + _273 += u16vec3(_26._m0._m3).z; _35._m0._m3 = _26._m0._m3 + _29._m0._m3; _35._m0._m4 = _26._m0._m4 + _29._m0._m4; _35._m0._m5 = _26._m0._m5 + _29._m0._m5; _35._m0._m6 = _26._m0._m6 + _29._m0._m6; _38._m0._m0 = _32._m0._m0; - uint16_t _332 = _271; - _271 = _332; - _271 = max(_271, _271); - _271 = min(_271, _271); - _271 = min(max(_271, _271), _271); - _271 -= 1us; - _271 *= 2us; - _271 = _240(_271, 3us); - _271 = _249(_271, 4us); - _271 &= 255us; - _271 |= 16us; - _271 ^= 1us; - _35._m0._m0 = uint(_271); - _35._m0._m1 = int(int16_t(_271)); - _35._m0._m2 = float(_271); - _271 = uint16_t(_35._m0._m0); - return _271; + uint16_t _334 = _273; + _273 = _334; + _273 = max(_273, _273); + _273 = min(_273, _273); + _273 = min(max(_273, _273), _273); + _273 -= 1us; + _273 *= 2us; + _273 = _242(_273, 3us); + _273 = _251(_273, 4us); + _273 &= 255us; + _273 |= 16us; + _273 ^= 1us; + _35._m0._m0 = uint(_273); + _35._m0._m1 = int(int16_t(_273)); + _35._m0._m2 = float(_273); + _273 = uint16_t(_35._m0._m0); + return _273; } int16_t _43(int16_t _45, int16_t _46) @@ -106,77 +106,78 @@ int16_t _43(int16_t _45, int16_t _46) int16_t _59(int16_t _60, int16_t _61) { - return _60 - (((_61 == 0s) || ((_60 == (-32768s)) && (_61 == (-1s)))) ? 1s : _61) * (_60 / (((_61 == 0s) || ((_60 == (-32768s)) && (_61 == (-1s)))) ? 1s : _61)); + int16_t _68 = ((_61 == 0s) || ((_60 == (-32768s)) && (_61 == (-1s)))) ? 1s : _61; + return _60 - ((_60 / _68) * _68); } -int16_t _72(int16_t _71) +int16_t _74(int16_t _73) { - int16_t _94 = 20s; - int16_t _96[4] = int16_t[](1s, 2s, 3s, 4s); - _94 += 5s; - _94 += int16_t(_26._m0._m0); - _94 += int16_t(_26._m0._m1); - _94 += i16vec3(_26._m0._m7).z; + int16_t _96 = 20s; + int16_t _98[4] = int16_t[](1s, 2s, 3s, 4s); + _96 += 5s; + _96 += int16_t(_26._m0._m0); + _96 += int16_t(_26._m0._m1); + _96 += i16vec3(_26._m0._m7).z; _35._m0._m7 = _26._m0._m7 + _29._m0._m7; _35._m0._m8 = _26._m0._m8 + _29._m0._m8; _35._m0._m9 = _26._m0._m9 + _29._m0._m9; _35._m0._m10 = _26._m0._m10 + _29._m0._m10; _38._m0._m1 = _32._m0._m1; - _94 = abs(_94); - _94 = max(_94, _94); - _94 = min(_94, _94); - _94 = min(max(_94, _94), _94); - _94 = sign(_94); - _94 -= 1s; - _94 *= 2s; - _94 = _43(_94, 3s); - _94 = _59(_94, 4s); - _94 &= 255s; - _94 |= 16s; - _94 ^= 1s; - _94 = _94 << 2u; - _94 = _94 >> 1u; - _94 = -_94; - _94 = (_94 < 0s) ? 2s : 1s; - _96[0u] = _94; - _94 = _96[1u]; - _94 = _96[1u]; - _35._m0._m0 = uint(uint16_t(_94)); - _35._m0._m1 = int(_94); - _35._m0._m2 = float(_94); - _94 = int16_t(_35._m0._m0); - _94 = int16_t(uint16_t(_94)); + _96 = abs(_96); + _96 = max(_96, _96); + _96 = min(_96, _96); + _96 = min(max(_96, _96), _96); + _96 = sign(_96); + _96 -= 1s; + _96 *= 2s; + _96 = _43(_96, 3s); + _96 = _59(_96, 4s); + _96 &= 255s; + _96 |= 16s; + _96 ^= 1s; + _96 = _96 << 2u; + _96 = _96 >> 1u; + _96 = -_96; + _96 = (_96 < 0s) ? 2s : 1s; + _98[0u] = _96; + _96 = _98[1u]; + _96 = _98[1u]; + _35._m0._m0 = uint(uint16_t(_96)); + _35._m0._m1 = int(_96); + _35._m0._m2 = float(_96); + _96 = int16_t(_35._m0._m0); + _96 = int16_t(uint16_t(_96)); _35._m0._m8 = (_26._m0._m8 + _26._m0._m8) * i16vec2(2); - return _94; + return _96; } void main() { - int16_t _384 = 0s; - uint16_t _386 = 0us; + int16_t _386 = 0s; + uint16_t _388 = 0us; if (gl_LocalInvocationIndex == 0u) { _41 = 0us; } barrier(); _41 = 0us; - uint16_t _397 = _258(67us); - int16_t _398 = _72(60s); - _35._m0._m11 = _397 + uint16_t(_398); - _384 = int16_t(gl_SubgroupInvocationID); - _384 = subgroupAdd(_384); - _384 = subgroupMul(_384); - _384 = subgroupMin(_384); - _384 = subgroupMax(_384); - _384 = subgroupExclusiveAdd(_384); - _384 = subgroupInclusiveAdd(_384); - _384 = subgroupBroadcastFirst(_384); - _384 = subgroupShuffle(_384, 4u); - _386 = uint16_t(gl_SubgroupInvocationID); + uint16_t _399 = _260(67us); + int16_t _400 = _74(60s); + _35._m0._m11 = _399 + uint16_t(_400); + _386 = int16_t(gl_SubgroupInvocationID); _386 = subgroupAdd(_386); + _386 = subgroupMul(_386); _386 = subgroupMin(_386); _386 = subgroupMax(_386); - _35._m0._m7 = _384; - _35._m0._m3 = _386; + _386 = subgroupExclusiveAdd(_386); + _386 = subgroupInclusiveAdd(_386); + _386 = subgroupBroadcastFirst(_386); + _386 = subgroupShuffle(_386, 4u); + _388 = uint16_t(gl_SubgroupInvocationID); + _388 = subgroupAdd(_388); + _388 = subgroupMin(_388); + _388 = subgroupMax(_388); + _35._m0._m7 = _386; + _35._m0._m3 = _388; } diff --git a/naga/tests/out/spv/wgsl-operators.spvasm b/naga/tests/out/spv/wgsl-operators.spvasm index c2e60eb8b..4852fd430 100644 --- a/naga/tests/out/spv/wgsl-operators.spvasm +++ b/naga/tests/out/spv/wgsl-operators.spvasm @@ -1,13 +1,13 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 576 +; Bound: 582 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %559 "main" %556 -OpExecutionMode %559 LocalSize 1 1 1 -OpDecorate %556 BuiltIn WorkgroupId +OpEntryPoint GLCompute %565 "main" %562 +OpExecutionMode %565 LocalSize 1 1 1 +OpDecorate %562 BuiltIn WorkgroupId %2 = OpTypeVoid %3 = OpTypeFloat 32 %4 = OpTypeVector %3 4 @@ -43,77 +43,77 @@ OpDecorate %556 BuiltIn WorkgroupId %59 = OpConstantComposite %6 %57 %57 %57 %57 %60 = OpConstantComposite %6 %58 %58 %58 %58 %65 = OpConstantComposite %6 %21 %21 %21 %21 -%72 = OpTypeFunction %4 %3 %5 -%73 = OpConstant %3 2 -%74 = OpConstantComposite %8 %73 %73 -%75 = OpConstant %3 4 +%74 = OpTypeFunction %4 %3 %5 +%75 = OpConstant %3 2 %76 = OpConstantComposite %8 %75 %75 -%77 = OpConstant %3 8 +%77 = OpConstant %3 4 %78 = OpConstantComposite %8 %77 %77 -%79 = OpConstant %5 2 -%80 = OpConstantComposite %6 %79 %79 %79 %79 -%93 = OpTypeFunction %8 -%94 = OpConstantComposite %8 %15 %15 -%95 = OpConstant %3 3 -%96 = OpConstantComposite %8 %95 %95 -%98 = OpTypePointer Function %8 -%110 = OpTypeFunction %9 %9 -%112 = OpTypeVector %7 3 -%113 = OpConstantComposite %9 %17 %17 %17 -%115 = OpConstantComposite %9 %15 %15 %15 -%119 = OpTypeFunction %7 -%132 = OpTypeFunction %2 -%133 = OpTypeVector %7 2 -%134 = OpConstantComposite %133 %24 %24 -%135 = OpConstantComposite %112 %24 %24 %24 -%136 = OpConstantComposite %112 %23 %23 %23 -%137 = OpConstantComposite %34 %24 %24 %24 %24 -%138 = OpConstantComposite %34 %23 %23 %23 %23 -%140 = OpTypePointer Function %7 -%141 = OpConstantNull %7 +%79 = OpConstant %3 8 +%80 = OpConstantComposite %8 %79 %79 +%81 = OpConstant %5 2 +%82 = OpConstantComposite %6 %81 %81 %81 %81 +%95 = OpTypeFunction %8 +%96 = OpConstantComposite %8 %15 %15 +%97 = OpConstant %3 3 +%98 = OpConstantComposite %8 %97 %97 +%100 = OpTypePointer Function %8 +%112 = OpTypeFunction %9 %9 +%114 = OpTypeVector %7 3 +%115 = OpConstantComposite %9 %17 %17 %17 +%117 = OpConstantComposite %9 %15 %15 %15 +%121 = OpTypeFunction %7 +%134 = OpTypeFunction %2 +%135 = OpTypeVector %7 2 +%136 = OpConstantComposite %135 %24 %24 +%137 = OpConstantComposite %114 %24 %24 %24 +%138 = OpConstantComposite %114 %23 %23 %23 +%139 = OpConstantComposite %34 %24 %24 %24 %24 +%140 = OpConstantComposite %34 %23 %23 %23 %23 +%142 = OpTypePointer Function %7 %143 = OpConstantNull %7 %145 = OpConstantNull %7 %147 = OpConstantNull %7 %149 = OpConstantNull %7 %151 = OpConstantNull %7 %153 = OpConstantNull %7 -%200 = OpTypeFunction %5 %5 %5 -%212 = OpTypeFunction %11 %11 %11 -%216 = OpConstant %11 0 -%218 = OpConstant %11 1 -%221 = OpTypeVector %5 2 -%223 = OpTypeFunction %221 %221 %221 -%227 = OpConstantComposite %221 %28 %28 -%229 = OpConstantComposite %221 %57 %57 -%230 = OpConstantComposite %221 %58 %58 -%235 = OpConstantComposite %221 %21 %21 -%239 = OpTypeFunction %10 %10 %10 -%243 = OpConstantComposite %10 %216 %216 %216 +%155 = OpConstantNull %7 +%202 = OpTypeFunction %5 %5 %5 +%214 = OpTypeFunction %11 %11 %11 +%218 = OpConstant %11 0 +%220 = OpConstant %11 1 +%223 = OpTypeVector %5 2 +%225 = OpTypeFunction %223 %223 %223 +%229 = OpConstantComposite %223 %28 %28 +%231 = OpConstantComposite %223 %57 %57 +%232 = OpConstantComposite %223 %58 %58 +%237 = OpConstantComposite %223 %21 %21 +%241 = OpTypeFunction %10 %10 %10 %245 = OpConstantComposite %10 %218 %218 %218 -%284 = OpTypeVector %11 2 -%286 = OpTypeFunction %284 %284 %284 -%290 = OpConstantComposite %284 %216 %216 -%292 = OpConstantComposite %284 %218 %218 -%304 = OpConstant %11 2 -%305 = OpConstantComposite %221 %79 %79 -%306 = OpConstantComposite %10 %304 %304 %304 -%307 = OpConstantComposite %4 %73 %73 %73 %73 -%308 = OpConstantComposite %4 %15 %15 %15 %15 -%309 = OpConstantComposite %284 %304 %304 -%310 = OpConstantComposite %9 %17 %17 %17 -%311 = OpConstantComposite %12 %310 %310 %310 -%312 = OpConstantNull %12 -%313 = OpConstantNull %13 -%314 = OpConstantComposite %9 %73 %73 %73 -%316 = OpTypePointer Function %5 -%317 = OpConstantNull %5 -%319 = OpConstantNull %5 -%464 = OpConstantNull %14 -%466 = OpConstantNull %5 -%468 = OpTypePointer Function %14 -%557 = OpTypePointer Input %10 -%556 = OpVariable %557 Input -%560 = OpConstantComposite %9 %15 %15 %15 +%247 = OpConstantComposite %10 %220 %220 %220 +%290 = OpTypeVector %11 2 +%292 = OpTypeFunction %290 %290 %290 +%296 = OpConstantComposite %290 %218 %218 +%298 = OpConstantComposite %290 %220 %220 +%310 = OpConstant %11 2 +%311 = OpConstantComposite %223 %81 %81 +%312 = OpConstantComposite %10 %310 %310 %310 +%313 = OpConstantComposite %4 %75 %75 %75 %75 +%314 = OpConstantComposite %4 %15 %15 %15 %15 +%315 = OpConstantComposite %290 %310 %310 +%316 = OpConstantComposite %9 %17 %17 %17 +%317 = OpConstantComposite %12 %316 %316 %316 +%318 = OpConstantNull %12 +%319 = OpConstantNull %13 +%320 = OpConstantComposite %9 %75 %75 %75 +%322 = OpTypePointer Function %5 +%323 = OpConstantNull %5 +%325 = OpConstantNull %5 +%470 = OpConstantNull %14 +%472 = OpConstantNull %5 +%474 = OpTypePointer Function %14 +%563 = OpTypePointer Input %10 +%562 = OpVariable %563 Input +%566 = OpConstantComposite %9 %15 %15 %15 %26 = OpFunction %4 None %27 %25 = OpLabel OpBranch %31 @@ -147,568 +147,574 @@ OpFunctionEnd %63 = OpLogicalAnd %34 %61 %62 %64 = OpLogicalOr %34 %56 %63 %66 = OpSelect %6 %64 %65 %53 -%67 = OpSRem %6 %52 %66 -OpReturnValue %67 +%67 = OpSDiv %6 %52 %66 +%68 = OpIMul %6 %67 %66 +%69 = OpISub %6 %52 %68 +OpReturnValue %69 OpFunctionEnd -%71 = OpFunction %4 None %72 -%69 = OpFunctionParameter %3 -%70 = OpFunctionParameter %5 -%68 = OpLabel -OpBranch %81 -%81 = OpLabel -%82 = OpCompositeConstruct %8 %69 %69 -%83 = OpFAdd %8 %74 %82 -%84 = OpFSub %8 %83 %76 -%85 = OpFDiv %8 %84 %78 -%86 = OpCompositeConstruct %6 %70 %70 %70 %70 -%87 = OpFunctionCall %6 %50 %86 %80 -%88 = OpVectorShuffle %4 %85 %85 0 1 0 1 -%89 = OpConvertSToF %4 %87 -%90 = OpFAdd %4 %88 %89 -OpReturnValue %90 +%73 = OpFunction %4 None %74 +%71 = OpFunctionParameter %3 +%72 = OpFunctionParameter %5 +%70 = OpLabel +OpBranch %83 +%83 = OpLabel +%84 = OpCompositeConstruct %8 %71 %71 +%85 = OpFAdd %8 %76 %84 +%86 = OpFSub %8 %85 %78 +%87 = OpFDiv %8 %86 %80 +%88 = OpCompositeConstruct %6 %72 %72 %72 %72 +%89 = OpFunctionCall %6 %50 %88 %82 +%90 = OpVectorShuffle %4 %87 %87 0 1 0 1 +%91 = OpConvertSToF %4 %89 +%92 = OpFAdd %4 %90 %91 +OpReturnValue %92 OpFunctionEnd -%92 = OpFunction %8 None %93 -%91 = OpLabel -%97 = OpVariable %98 Function %74 -OpBranch %99 -%99 = OpLabel -%100 = OpLoad %8 %97 -%101 = OpFAdd %8 %100 %94 -OpStore %97 %101 -%102 = OpLoad %8 %97 -%103 = OpFSub %8 %102 %96 -OpStore %97 %103 -%104 = OpLoad %8 %97 -%105 = OpFDiv %8 %104 %76 -OpStore %97 %105 -%106 = OpLoad %8 %97 -OpReturnValue %106 +%94 = OpFunction %8 None %95 +%93 = OpLabel +%99 = OpVariable %100 Function %76 +OpBranch %101 +%101 = OpLabel +%102 = OpLoad %8 %99 +%103 = OpFAdd %8 %102 %96 +OpStore %99 %103 +%104 = OpLoad %8 %99 +%105 = OpFSub %8 %104 %98 +OpStore %99 %105 +%106 = OpLoad %8 %99 +%107 = OpFDiv %8 %106 %78 +OpStore %99 %107 +%108 = OpLoad %8 %99 +OpReturnValue %108 OpFunctionEnd -%109 = OpFunction %9 None %110 -%108 = OpFunctionParameter %9 -%107 = OpLabel -OpBranch %111 -%111 = OpLabel -%114 = OpFUnordNotEqual %112 %108 %113 -%116 = OpSelect %9 %114 %115 %113 -OpReturnValue %116 +%111 = OpFunction %9 None %112 +%110 = OpFunctionParameter %9 +%109 = OpLabel +OpBranch %113 +%113 = OpLabel +%116 = OpFUnordNotEqual %114 %110 %115 +%118 = OpSelect %9 %116 %117 %115 +OpReturnValue %118 OpFunctionEnd -%118 = OpFunction %7 None %119 -%117 = OpLabel -OpBranch %120 -%120 = OpLabel +%120 = OpFunction %7 None %121 +%119 = OpLabel +OpBranch %122 +%122 = OpLabel OpReturnValue %24 OpFunctionEnd -%122 = OpFunction %7 None %119 -%121 = OpLabel -OpBranch %123 +%124 = OpFunction %7 None %121 %123 = OpLabel +OpBranch %125 +%125 = OpLabel OpReturnValue %23 OpFunctionEnd -%125 = OpFunction %7 None %119 -%124 = OpLabel -OpBranch %126 +%127 = OpFunction %7 None %121 %126 = OpLabel +OpBranch %128 +%128 = OpLabel OpReturnValue %24 OpFunctionEnd -%128 = OpFunction %7 None %119 -%127 = OpLabel -OpBranch %129 +%130 = OpFunction %7 None %121 %129 = OpLabel +OpBranch %131 +%131 = OpLabel OpReturnValue %23 OpFunctionEnd -%131 = OpFunction %2 None %132 -%130 = OpLabel -%148 = OpVariable %140 Function %149 -%142 = OpVariable %140 Function %143 -%152 = OpVariable %140 Function %153 -%146 = OpVariable %140 Function %147 -%139 = OpVariable %140 Function %141 -%150 = OpVariable %140 Function %151 -%144 = OpVariable %140 Function %145 -OpBranch %154 -%154 = OpLabel -%155 = OpLogicalNot %7 %24 -%156 = OpLogicalNot %133 %134 +%133 = OpFunction %2 None %134 +%132 = OpLabel +%150 = OpVariable %142 Function %151 +%144 = OpVariable %142 Function %145 +%154 = OpVariable %142 Function %155 +%148 = OpVariable %142 Function %149 +%141 = OpVariable %142 Function %143 +%152 = OpVariable %142 Function %153 +%146 = OpVariable %142 Function %147 +OpBranch %156 +%156 = OpLabel %157 = OpLogicalNot %7 %24 -OpSelectionMerge %158 None -OpBranchConditional %157 %159 %160 -%159 = OpLabel -OpStore %139 %23 -OpBranch %158 -%160 = OpLabel -OpStore %139 %24 -OpBranch %158 -%158 = OpLabel -%161 = OpLoad %7 %139 -OpSelectionMerge %162 None -OpBranchConditional %24 %163 %164 -%163 = OpLabel -OpStore %142 %23 -OpBranch %162 -%164 = OpLabel -OpStore %142 %23 -OpBranch %162 +%158 = OpLogicalNot %135 %136 +%159 = OpLogicalNot %7 %24 +OpSelectionMerge %160 None +OpBranchConditional %159 %161 %162 +%161 = OpLabel +OpStore %141 %23 +OpBranch %160 %162 = OpLabel -%165 = OpLoad %7 %142 -%166 = OpLogicalOr %7 %24 %23 -%167 = OpLogicalOr %112 %135 %136 -%168 = OpLogicalAnd %7 %24 %23 -%169 = OpLogicalAnd %34 %137 %138 -%170 = OpLogicalNot %7 %23 -OpSelectionMerge %171 None -OpBranchConditional %170 %172 %173 -%172 = OpLabel +OpStore %141 %24 +OpBranch %160 +%160 = OpLabel +%163 = OpLoad %7 %141 +OpSelectionMerge %164 None +OpBranchConditional %24 %165 %166 +%165 = OpLabel OpStore %144 %23 -OpBranch %171 -%173 = OpLabel -OpStore %144 %24 -OpBranch %171 -%171 = OpLabel -%174 = OpLoad %7 %144 -%175 = OpLogicalNot %7 %174 -%176 = OpFunctionCall %7 %118 -%177 = OpLogicalNot %7 %176 -OpSelectionMerge %178 None -OpBranchConditional %177 %179 %180 -%179 = OpLabel -%181 = OpFunctionCall %7 %122 -OpStore %146 %181 -OpBranch %178 -%180 = OpLabel +OpBranch %164 +%166 = OpLabel +OpStore %144 %23 +OpBranch %164 +%164 = OpLabel +%167 = OpLoad %7 %144 +%168 = OpLogicalOr %7 %24 %23 +%169 = OpLogicalOr %114 %137 %138 +%170 = OpLogicalAnd %7 %24 %23 +%171 = OpLogicalAnd %34 %139 %140 +%172 = OpLogicalNot %7 %23 +OpSelectionMerge %173 None +OpBranchConditional %172 %174 %175 +%174 = OpLabel +OpStore %146 %23 +OpBranch %173 +%175 = OpLabel OpStore %146 %24 -OpBranch %178 -%178 = OpLabel -%182 = OpLoad %7 %146 -OpSelectionMerge %183 None -OpBranchConditional %182 %184 %185 -%184 = OpLabel -%186 = OpFunctionCall %7 %125 -%187 = OpLogicalNot %7 %186 -OpSelectionMerge %188 None -OpBranchConditional %187 %189 %190 -%189 = OpLabel -%191 = OpFunctionCall %7 %128 -OpStore %150 %191 -OpBranch %188 -%190 = OpLabel -OpStore %150 %24 -OpBranch %188 -%188 = OpLabel -%192 = OpLoad %7 %150 -OpStore %148 %192 -OpBranch %183 -%185 = OpLabel -OpStore %148 %23 -OpBranch %183 -%183 = OpLabel -%193 = OpLoad %7 %148 -OpSelectionMerge %194 None -OpBranchConditional %23 %195 %196 -%195 = OpLabel -%197 = OpFunctionCall %7 %122 -OpStore %152 %197 -OpBranch %194 -%196 = OpLabel +OpBranch %173 +%173 = OpLabel +%176 = OpLoad %7 %146 +%177 = OpLogicalNot %7 %176 +%178 = OpFunctionCall %7 %120 +%179 = OpLogicalNot %7 %178 +OpSelectionMerge %180 None +OpBranchConditional %179 %181 %182 +%181 = OpLabel +%183 = OpFunctionCall %7 %124 +OpStore %148 %183 +OpBranch %180 +%182 = OpLabel +OpStore %148 %24 +OpBranch %180 +%180 = OpLabel +%184 = OpLoad %7 %148 +OpSelectionMerge %185 None +OpBranchConditional %184 %186 %187 +%186 = OpLabel +%188 = OpFunctionCall %7 %127 +%189 = OpLogicalNot %7 %188 +OpSelectionMerge %190 None +OpBranchConditional %189 %191 %192 +%191 = OpLabel +%193 = OpFunctionCall %7 %130 +OpStore %152 %193 +OpBranch %190 +%192 = OpLabel OpStore %152 %24 -OpBranch %194 -%194 = OpLabel -%198 = OpLoad %7 %152 +OpBranch %190 +%190 = OpLabel +%194 = OpLoad %7 %152 +OpStore %150 %194 +OpBranch %185 +%187 = OpLabel +OpStore %150 %23 +OpBranch %185 +%185 = OpLabel +%195 = OpLoad %7 %150 +OpSelectionMerge %196 None +OpBranchConditional %23 %197 %198 +%197 = OpLabel +%199 = OpFunctionCall %7 %124 +OpStore %154 %199 +OpBranch %196 +%198 = OpLabel +OpStore %154 %24 +OpBranch %196 +%196 = OpLabel +%200 = OpLoad %7 %154 OpReturn OpFunctionEnd -%199 = OpFunction %5 None %200 -%201 = OpFunctionParameter %5 -%202 = OpFunctionParameter %5 -%203 = OpLabel -%204 = OpIEqual %7 %202 %28 -%205 = OpIEqual %7 %201 %57 -%206 = OpIEqual %7 %202 %58 -%207 = OpLogicalAnd %7 %205 %206 -%208 = OpLogicalOr %7 %204 %207 -%209 = OpSelect %5 %208 %21 %202 -%210 = OpSDiv %5 %201 %209 -OpReturnValue %210 +%201 = OpFunction %5 None %202 +%203 = OpFunctionParameter %5 +%204 = OpFunctionParameter %5 +%205 = OpLabel +%206 = OpIEqual %7 %204 %28 +%207 = OpIEqual %7 %203 %57 +%208 = OpIEqual %7 %204 %58 +%209 = OpLogicalAnd %7 %207 %208 +%210 = OpLogicalOr %7 %206 %209 +%211 = OpSelect %5 %210 %21 %204 +%212 = OpSDiv %5 %203 %211 +OpReturnValue %212 OpFunctionEnd -%211 = OpFunction %11 None %212 -%213 = OpFunctionParameter %11 -%214 = OpFunctionParameter %11 -%215 = OpLabel -%217 = OpIEqual %7 %214 %216 -%219 = OpSelect %11 %217 %218 %214 -%220 = OpUDiv %11 %213 %219 -OpReturnValue %220 +%213 = OpFunction %11 None %214 +%215 = OpFunctionParameter %11 +%216 = OpFunctionParameter %11 +%217 = OpLabel +%219 = OpIEqual %7 %216 %218 +%221 = OpSelect %11 %219 %220 %216 +%222 = OpUDiv %11 %215 %221 +OpReturnValue %222 OpFunctionEnd -%222 = OpFunction %221 None %223 -%224 = OpFunctionParameter %221 -%225 = OpFunctionParameter %221 -%226 = OpLabel -%228 = OpIEqual %133 %225 %227 -%231 = OpIEqual %133 %224 %229 -%232 = OpIEqual %133 %225 %230 -%233 = OpLogicalAnd %133 %231 %232 -%234 = OpLogicalOr %133 %228 %233 -%236 = OpSelect %221 %234 %235 %225 -%237 = OpSDiv %221 %224 %236 -OpReturnValue %237 +%224 = OpFunction %223 None %225 +%226 = OpFunctionParameter %223 +%227 = OpFunctionParameter %223 +%228 = OpLabel +%230 = OpIEqual %135 %227 %229 +%233 = OpIEqual %135 %226 %231 +%234 = OpIEqual %135 %227 %232 +%235 = OpLogicalAnd %135 %233 %234 +%236 = OpLogicalOr %135 %230 %235 +%238 = OpSelect %223 %236 %237 %227 +%239 = OpSDiv %223 %226 %238 +OpReturnValue %239 OpFunctionEnd -%238 = OpFunction %10 None %239 -%240 = OpFunctionParameter %10 -%241 = OpFunctionParameter %10 -%242 = OpLabel -%244 = OpIEqual %112 %241 %243 -%246 = OpSelect %10 %244 %245 %241 -%247 = OpUDiv %10 %240 %246 -OpReturnValue %247 +%240 = OpFunction %10 None %241 +%242 = OpFunctionParameter %10 +%243 = OpFunctionParameter %10 +%244 = OpLabel +%246 = OpIEqual %114 %243 %245 +%248 = OpSelect %10 %246 %247 %243 +%249 = OpUDiv %10 %242 %248 +OpReturnValue %249 OpFunctionEnd -%248 = OpFunction %5 None %200 -%249 = OpFunctionParameter %5 -%250 = OpFunctionParameter %5 -%251 = OpLabel -%252 = OpIEqual %7 %250 %28 -%253 = OpIEqual %7 %249 %57 -%254 = OpIEqual %7 %250 %58 -%255 = OpLogicalAnd %7 %253 %254 -%256 = OpLogicalOr %7 %252 %255 -%257 = OpSelect %5 %256 %21 %250 -%258 = OpSRem %5 %249 %257 -OpReturnValue %258 +%250 = OpFunction %5 None %202 +%251 = OpFunctionParameter %5 +%252 = OpFunctionParameter %5 +%253 = OpLabel +%254 = OpIEqual %7 %252 %28 +%255 = OpIEqual %7 %251 %57 +%256 = OpIEqual %7 %252 %58 +%257 = OpLogicalAnd %7 %255 %256 +%258 = OpLogicalOr %7 %254 %257 +%259 = OpSelect %5 %258 %21 %252 +%260 = OpSDiv %5 %251 %259 +%261 = OpIMul %5 %260 %259 +%262 = OpISub %5 %251 %261 +OpReturnValue %262 OpFunctionEnd -%259 = OpFunction %11 None %212 -%260 = OpFunctionParameter %11 -%261 = OpFunctionParameter %11 -%262 = OpLabel -%263 = OpIEqual %7 %261 %216 -%264 = OpSelect %11 %263 %218 %261 -%265 = OpUMod %11 %260 %264 -OpReturnValue %265 +%263 = OpFunction %11 None %214 +%264 = OpFunctionParameter %11 +%265 = OpFunctionParameter %11 +%266 = OpLabel +%267 = OpIEqual %7 %265 %218 +%268 = OpSelect %11 %267 %220 %265 +%269 = OpUMod %11 %264 %268 +OpReturnValue %269 OpFunctionEnd -%266 = OpFunction %221 None %223 -%267 = OpFunctionParameter %221 -%268 = OpFunctionParameter %221 -%269 = OpLabel -%270 = OpIEqual %133 %268 %227 -%271 = OpIEqual %133 %267 %229 -%272 = OpIEqual %133 %268 %230 -%273 = OpLogicalAnd %133 %271 %272 -%274 = OpLogicalOr %133 %270 %273 -%275 = OpSelect %221 %274 %235 %268 -%276 = OpSRem %221 %267 %275 -OpReturnValue %276 +%270 = OpFunction %223 None %225 +%271 = OpFunctionParameter %223 +%272 = OpFunctionParameter %223 +%273 = OpLabel +%274 = OpIEqual %135 %272 %229 +%275 = OpIEqual %135 %271 %231 +%276 = OpIEqual %135 %272 %232 +%277 = OpLogicalAnd %135 %275 %276 +%278 = OpLogicalOr %135 %274 %277 +%279 = OpSelect %223 %278 %237 %272 +%280 = OpSDiv %223 %271 %279 +%281 = OpIMul %223 %280 %279 +%282 = OpISub %223 %271 %281 +OpReturnValue %282 OpFunctionEnd -%277 = OpFunction %10 None %239 -%278 = OpFunctionParameter %10 -%279 = OpFunctionParameter %10 -%280 = OpLabel -%281 = OpIEqual %112 %279 %243 -%282 = OpSelect %10 %281 %245 %279 -%283 = OpUMod %10 %278 %282 -OpReturnValue %283 +%283 = OpFunction %10 None %241 +%284 = OpFunctionParameter %10 +%285 = OpFunctionParameter %10 +%286 = OpLabel +%287 = OpIEqual %114 %285 %245 +%288 = OpSelect %10 %287 %247 %285 +%289 = OpUMod %10 %284 %288 +OpReturnValue %289 OpFunctionEnd -%285 = OpFunction %284 None %286 -%287 = OpFunctionParameter %284 -%288 = OpFunctionParameter %284 -%289 = OpLabel -%291 = OpIEqual %133 %288 %290 -%293 = OpSelect %284 %291 %292 %288 -%294 = OpUDiv %284 %287 %293 -OpReturnValue %294 +%291 = OpFunction %290 None %292 +%293 = OpFunctionParameter %290 +%294 = OpFunctionParameter %290 +%295 = OpLabel +%297 = OpIEqual %135 %294 %296 +%299 = OpSelect %290 %297 %298 %294 +%300 = OpUDiv %290 %293 %299 +OpReturnValue %300 OpFunctionEnd -%295 = OpFunction %284 None %286 -%296 = OpFunctionParameter %284 -%297 = OpFunctionParameter %284 -%298 = OpLabel -%299 = OpIEqual %133 %297 %290 -%300 = OpSelect %284 %299 %292 %297 -%301 = OpUMod %284 %296 %300 -OpReturnValue %301 +%301 = OpFunction %290 None %292 +%302 = OpFunctionParameter %290 +%303 = OpFunctionParameter %290 +%304 = OpLabel +%305 = OpIEqual %135 %303 %296 +%306 = OpSelect %290 %305 %298 %303 +%307 = OpUMod %290 %302 %306 +OpReturnValue %307 OpFunctionEnd -%303 = OpFunction %2 None %132 -%302 = OpLabel -%315 = OpVariable %316 Function %317 -%318 = OpVariable %316 Function %319 -OpBranch %320 -%320 = OpLabel -%321 = OpFNegate %3 %15 -%322 = OpSNegate %221 %235 -%323 = OpFNegate %8 %94 -%324 = OpIAdd %5 %79 %21 -%325 = OpIAdd %11 %304 %218 -%326 = OpFAdd %3 %73 %15 -%327 = OpIAdd %221 %305 %235 -%328 = OpIAdd %10 %306 %245 -%329 = OpFAdd %4 %307 %308 -%330 = OpISub %5 %79 %21 -%331 = OpISub %11 %304 %218 -%332 = OpFSub %3 %73 %15 -%333 = OpISub %221 %305 %235 -%334 = OpISub %10 %306 %245 -%335 = OpFSub %4 %307 %308 -%336 = OpIMul %5 %79 %21 -%337 = OpIMul %11 %304 %218 -%338 = OpFMul %3 %73 %15 -%339 = OpIMul %221 %305 %235 -%340 = OpIMul %10 %306 %245 -%341 = OpFMul %4 %307 %308 -%342 = OpFunctionCall %5 %199 %79 %21 -%343 = OpFunctionCall %11 %211 %304 %218 -%344 = OpFDiv %3 %73 %15 -%345 = OpFunctionCall %221 %222 %305 %235 -%346 = OpFunctionCall %10 %238 %306 %245 -%347 = OpFDiv %4 %307 %308 -%348 = OpFunctionCall %5 %248 %79 %21 -%349 = OpFunctionCall %11 %259 %304 %218 -%350 = OpFRem %3 %73 %15 -%351 = OpFunctionCall %221 %266 %305 %235 -%352 = OpFunctionCall %10 %277 %306 %245 -%353 = OpFRem %4 %307 %308 -OpBranch %354 -%354 = OpLabel -%356 = OpIAdd %221 %305 %235 -%357 = OpIAdd %221 %305 %235 -%358 = OpIAdd %284 %309 %292 -%359 = OpIAdd %284 %309 %292 -%360 = OpFAdd %8 %74 %94 -%361 = OpFAdd %8 %74 %94 -%362 = OpISub %221 %305 %235 -%363 = OpISub %221 %305 %235 -%364 = OpISub %284 %309 %292 -%365 = OpISub %284 %309 %292 -%366 = OpFSub %8 %74 %94 -%367 = OpFSub %8 %74 %94 -%369 = OpCompositeConstruct %221 %21 %21 -%368 = OpIMul %221 %305 %369 -%371 = OpCompositeConstruct %221 %79 %79 -%370 = OpIMul %221 %235 %371 -%373 = OpCompositeConstruct %284 %218 %218 -%372 = OpIMul %284 %309 %373 -%375 = OpCompositeConstruct %284 %304 %304 -%374 = OpIMul %284 %292 %375 -%376 = OpVectorTimesScalar %8 %74 %15 -%377 = OpVectorTimesScalar %8 %94 %73 -%378 = OpFunctionCall %221 %222 %305 %235 -%379 = OpFunctionCall %221 %222 %305 %235 -%380 = OpFunctionCall %284 %285 %309 %292 -%381 = OpFunctionCall %284 %285 %309 %292 -%382 = OpFDiv %8 %74 %94 -%383 = OpFDiv %8 %74 %94 -%384 = OpFunctionCall %221 %266 %305 %235 -%385 = OpFunctionCall %221 %266 %305 %235 -%386 = OpFunctionCall %284 %295 %309 %292 -%387 = OpFunctionCall %284 %295 %309 %292 -%388 = OpFRem %8 %74 %94 -%389 = OpFRem %8 %74 %94 -OpBranch %355 -%355 = OpLabel -%390 = OpMatrixTimesScalar %12 %312 %15 -%391 = OpMatrixTimesScalar %12 %312 %73 -%392 = OpMatrixTimesVector %9 %313 %308 -%393 = OpVectorTimesMatrix %4 %314 %313 -%394 = OpLoad %5 %315 -%395 = OpIAdd %5 %394 %57 -OpStore %318 %395 +%309 = OpFunction %2 None %134 +%308 = OpLabel +%321 = OpVariable %322 Function %323 +%324 = OpVariable %322 Function %325 +OpBranch %326 +%326 = OpLabel +%327 = OpFNegate %3 %15 +%328 = OpSNegate %223 %237 +%329 = OpFNegate %8 %96 +%330 = OpIAdd %5 %81 %21 +%331 = OpIAdd %11 %310 %220 +%332 = OpFAdd %3 %75 %15 +%333 = OpIAdd %223 %311 %237 +%334 = OpIAdd %10 %312 %247 +%335 = OpFAdd %4 %313 %314 +%336 = OpISub %5 %81 %21 +%337 = OpISub %11 %310 %220 +%338 = OpFSub %3 %75 %15 +%339 = OpISub %223 %311 %237 +%340 = OpISub %10 %312 %247 +%341 = OpFSub %4 %313 %314 +%342 = OpIMul %5 %81 %21 +%343 = OpIMul %11 %310 %220 +%344 = OpFMul %3 %75 %15 +%345 = OpIMul %223 %311 %237 +%346 = OpIMul %10 %312 %247 +%347 = OpFMul %4 %313 %314 +%348 = OpFunctionCall %5 %201 %81 %21 +%349 = OpFunctionCall %11 %213 %310 %220 +%350 = OpFDiv %3 %75 %15 +%351 = OpFunctionCall %223 %224 %311 %237 +%352 = OpFunctionCall %10 %240 %312 %247 +%353 = OpFDiv %4 %313 %314 +%354 = OpFunctionCall %5 %250 %81 %21 +%355 = OpFunctionCall %11 %263 %310 %220 +%356 = OpFRem %3 %75 %15 +%357 = OpFunctionCall %223 %270 %311 %237 +%358 = OpFunctionCall %10 %283 %312 %247 +%359 = OpFRem %4 %313 %314 +OpBranch %360 +%360 = OpLabel +%362 = OpIAdd %223 %311 %237 +%363 = OpIAdd %223 %311 %237 +%364 = OpIAdd %290 %315 %298 +%365 = OpIAdd %290 %315 %298 +%366 = OpFAdd %8 %76 %96 +%367 = OpFAdd %8 %76 %96 +%368 = OpISub %223 %311 %237 +%369 = OpISub %223 %311 %237 +%370 = OpISub %290 %315 %298 +%371 = OpISub %290 %315 %298 +%372 = OpFSub %8 %76 %96 +%373 = OpFSub %8 %76 %96 +%375 = OpCompositeConstruct %223 %21 %21 +%374 = OpIMul %223 %311 %375 +%377 = OpCompositeConstruct %223 %81 %81 +%376 = OpIMul %223 %237 %377 +%379 = OpCompositeConstruct %290 %220 %220 +%378 = OpIMul %290 %315 %379 +%381 = OpCompositeConstruct %290 %310 %310 +%380 = OpIMul %290 %298 %381 +%382 = OpVectorTimesScalar %8 %76 %15 +%383 = OpVectorTimesScalar %8 %96 %75 +%384 = OpFunctionCall %223 %224 %311 %237 +%385 = OpFunctionCall %223 %224 %311 %237 +%386 = OpFunctionCall %290 %291 %315 %298 +%387 = OpFunctionCall %290 %291 %315 %298 +%388 = OpFDiv %8 %76 %96 +%389 = OpFDiv %8 %76 %96 +%390 = OpFunctionCall %223 %270 %311 %237 +%391 = OpFunctionCall %223 %270 %311 %237 +%392 = OpFunctionCall %290 %301 %315 %298 +%393 = OpFunctionCall %290 %301 %315 %298 +%394 = OpFRem %8 %76 %96 +%395 = OpFRem %8 %76 %96 +OpBranch %361 +%361 = OpLabel +%396 = OpMatrixTimesScalar %12 %318 %15 +%397 = OpMatrixTimesScalar %12 %318 %75 +%398 = OpMatrixTimesVector %9 %319 %314 +%399 = OpVectorTimesMatrix %4 %320 %319 +%400 = OpLoad %5 %321 +%401 = OpIAdd %5 %400 %57 +OpStore %324 %401 OpReturn OpFunctionEnd -%397 = OpFunction %2 None %132 -%396 = OpLabel -OpBranch %398 -%398 = OpLabel -%399 = OpNot %5 %21 -%400 = OpNot %11 %218 -%401 = OpNot %221 %235 -%402 = OpNot %10 %245 -%403 = OpBitwiseOr %5 %79 %21 -%404 = OpBitwiseOr %11 %304 %218 -%405 = OpBitwiseOr %221 %305 %235 -%406 = OpBitwiseOr %10 %306 %245 -%407 = OpBitwiseAnd %5 %79 %21 -%408 = OpBitwiseAnd %11 %304 %218 -%409 = OpBitwiseAnd %221 %305 %235 -%410 = OpBitwiseAnd %10 %306 %245 -%411 = OpBitwiseXor %5 %79 %21 -%412 = OpBitwiseXor %11 %304 %218 -%413 = OpBitwiseXor %221 %305 %235 -%414 = OpBitwiseXor %10 %306 %245 -%415 = OpShiftLeftLogical %5 %79 %218 -%416 = OpShiftLeftLogical %11 %304 %218 -%417 = OpShiftLeftLogical %221 %305 %292 -%418 = OpShiftLeftLogical %10 %306 %245 -%419 = OpShiftRightArithmetic %5 %79 %218 -%420 = OpShiftRightLogical %11 %304 %218 -%421 = OpShiftRightArithmetic %221 %305 %292 -%422 = OpShiftRightLogical %10 %306 %245 +%403 = OpFunction %2 None %134 +%402 = OpLabel +OpBranch %404 +%404 = OpLabel +%405 = OpNot %5 %21 +%406 = OpNot %11 %220 +%407 = OpNot %223 %237 +%408 = OpNot %10 %247 +%409 = OpBitwiseOr %5 %81 %21 +%410 = OpBitwiseOr %11 %310 %220 +%411 = OpBitwiseOr %223 %311 %237 +%412 = OpBitwiseOr %10 %312 %247 +%413 = OpBitwiseAnd %5 %81 %21 +%414 = OpBitwiseAnd %11 %310 %220 +%415 = OpBitwiseAnd %223 %311 %237 +%416 = OpBitwiseAnd %10 %312 %247 +%417 = OpBitwiseXor %5 %81 %21 +%418 = OpBitwiseXor %11 %310 %220 +%419 = OpBitwiseXor %223 %311 %237 +%420 = OpBitwiseXor %10 %312 %247 +%421 = OpShiftLeftLogical %5 %81 %220 +%422 = OpShiftLeftLogical %11 %310 %220 +%423 = OpShiftLeftLogical %223 %311 %298 +%424 = OpShiftLeftLogical %10 %312 %247 +%425 = OpShiftRightArithmetic %5 %81 %220 +%426 = OpShiftRightLogical %11 %310 %220 +%427 = OpShiftRightArithmetic %223 %311 %298 +%428 = OpShiftRightLogical %10 %312 %247 OpReturn OpFunctionEnd -%424 = OpFunction %2 None %132 -%423 = OpLabel -OpBranch %425 -%425 = OpLabel -%426 = OpIEqual %7 %79 %21 -%427 = OpIEqual %7 %304 %218 -%428 = OpFOrdEqual %7 %73 %15 -%429 = OpIEqual %133 %305 %235 -%430 = OpIEqual %112 %306 %245 -%431 = OpFOrdEqual %34 %307 %308 -%432 = OpINotEqual %7 %79 %21 -%433 = OpINotEqual %7 %304 %218 -%434 = OpFOrdNotEqual %7 %73 %15 -%435 = OpINotEqual %133 %305 %235 -%436 = OpINotEqual %112 %306 %245 -%437 = OpFOrdNotEqual %34 %307 %308 -%438 = OpSLessThan %7 %79 %21 -%439 = OpULessThan %7 %304 %218 -%440 = OpFOrdLessThan %7 %73 %15 -%441 = OpSLessThan %133 %305 %235 -%442 = OpULessThan %112 %306 %245 -%443 = OpFOrdLessThan %34 %307 %308 -%444 = OpSLessThanEqual %7 %79 %21 -%445 = OpULessThanEqual %7 %304 %218 -%446 = OpFOrdLessThanEqual %7 %73 %15 -%447 = OpSLessThanEqual %133 %305 %235 -%448 = OpULessThanEqual %112 %306 %245 -%449 = OpFOrdLessThanEqual %34 %307 %308 -%450 = OpSGreaterThan %7 %79 %21 -%451 = OpUGreaterThan %7 %304 %218 -%452 = OpFOrdGreaterThan %7 %73 %15 -%453 = OpSGreaterThan %133 %305 %235 -%454 = OpUGreaterThan %112 %306 %245 -%455 = OpFOrdGreaterThan %34 %307 %308 -%456 = OpSGreaterThanEqual %7 %79 %21 -%457 = OpUGreaterThanEqual %7 %304 %218 -%458 = OpFOrdGreaterThanEqual %7 %73 %15 -%459 = OpSGreaterThanEqual %133 %305 %235 -%460 = OpUGreaterThanEqual %112 %306 %245 -%461 = OpFOrdGreaterThanEqual %34 %307 %308 +%430 = OpFunction %2 None %134 +%429 = OpLabel +OpBranch %431 +%431 = OpLabel +%432 = OpIEqual %7 %81 %21 +%433 = OpIEqual %7 %310 %220 +%434 = OpFOrdEqual %7 %75 %15 +%435 = OpIEqual %135 %311 %237 +%436 = OpIEqual %114 %312 %247 +%437 = OpFOrdEqual %34 %313 %314 +%438 = OpINotEqual %7 %81 %21 +%439 = OpINotEqual %7 %310 %220 +%440 = OpFOrdNotEqual %7 %75 %15 +%441 = OpINotEqual %135 %311 %237 +%442 = OpINotEqual %114 %312 %247 +%443 = OpFOrdNotEqual %34 %313 %314 +%444 = OpSLessThan %7 %81 %21 +%445 = OpULessThan %7 %310 %220 +%446 = OpFOrdLessThan %7 %75 %15 +%447 = OpSLessThan %135 %311 %237 +%448 = OpULessThan %114 %312 %247 +%449 = OpFOrdLessThan %34 %313 %314 +%450 = OpSLessThanEqual %7 %81 %21 +%451 = OpULessThanEqual %7 %310 %220 +%452 = OpFOrdLessThanEqual %7 %75 %15 +%453 = OpSLessThanEqual %135 %311 %237 +%454 = OpULessThanEqual %114 %312 %247 +%455 = OpFOrdLessThanEqual %34 %313 %314 +%456 = OpSGreaterThan %7 %81 %21 +%457 = OpUGreaterThan %7 %310 %220 +%458 = OpFOrdGreaterThan %7 %75 %15 +%459 = OpSGreaterThan %135 %311 %237 +%460 = OpUGreaterThan %114 %312 %247 +%461 = OpFOrdGreaterThan %34 %313 %314 +%462 = OpSGreaterThanEqual %7 %81 %21 +%463 = OpUGreaterThanEqual %7 %310 %220 +%464 = OpFOrdGreaterThanEqual %7 %75 %15 +%465 = OpSGreaterThanEqual %135 %311 %237 +%466 = OpUGreaterThanEqual %114 %312 %247 +%467 = OpFOrdGreaterThanEqual %34 %313 %314 OpReturn OpFunctionEnd -%463 = OpFunction %2 None %132 -%462 = OpLabel -%465 = OpVariable %316 Function %466 -%467 = OpVariable %468 Function %464 -OpBranch %469 -%469 = OpLabel -OpStore %465 %21 -%470 = OpLoad %5 %465 -%471 = OpIAdd %5 %470 %21 -OpStore %465 %471 -%472 = OpLoad %5 %465 -%473 = OpISub %5 %472 %21 -OpStore %465 %473 -%474 = OpLoad %5 %465 -%475 = OpLoad %5 %465 -%476 = OpIMul %5 %474 %475 -OpStore %465 %476 -%477 = OpLoad %5 %465 -%478 = OpLoad %5 %465 -%479 = OpFunctionCall %5 %199 %477 %478 -OpStore %465 %479 -%480 = OpLoad %5 %465 -%481 = OpFunctionCall %5 %248 %480 %21 -OpStore %465 %481 -%482 = OpLoad %5 %465 -%483 = OpBitwiseAnd %5 %482 %28 -OpStore %465 %483 -%484 = OpLoad %5 %465 -%485 = OpBitwiseOr %5 %484 %28 -OpStore %465 %485 -%486 = OpLoad %5 %465 -%487 = OpBitwiseXor %5 %486 %28 -OpStore %465 %487 -%488 = OpLoad %5 %465 -%489 = OpShiftLeftLogical %5 %488 %304 -OpStore %465 %489 -%490 = OpLoad %5 %465 -%491 = OpShiftRightArithmetic %5 %490 %218 -OpStore %465 %491 -%492 = OpLoad %5 %465 -%493 = OpIAdd %5 %492 %21 -OpStore %465 %493 -%494 = OpLoad %5 %465 -%495 = OpISub %5 %494 %21 -OpStore %465 %495 -%496 = OpAccessChain %316 %467 %218 -%497 = OpLoad %5 %496 -%498 = OpIAdd %5 %497 %21 -%499 = OpAccessChain %316 %467 %218 -OpStore %499 %498 -%500 = OpAccessChain %316 %467 %218 -%501 = OpLoad %5 %500 -%502 = OpISub %5 %501 %21 -%503 = OpAccessChain %316 %467 %218 -OpStore %503 %502 +%469 = OpFunction %2 None %134 +%468 = OpLabel +%471 = OpVariable %322 Function %472 +%473 = OpVariable %474 Function %470 +OpBranch %475 +%475 = OpLabel +OpStore %471 %21 +%476 = OpLoad %5 %471 +%477 = OpIAdd %5 %476 %21 +OpStore %471 %477 +%478 = OpLoad %5 %471 +%479 = OpISub %5 %478 %21 +OpStore %471 %479 +%480 = OpLoad %5 %471 +%481 = OpLoad %5 %471 +%482 = OpIMul %5 %480 %481 +OpStore %471 %482 +%483 = OpLoad %5 %471 +%484 = OpLoad %5 %471 +%485 = OpFunctionCall %5 %201 %483 %484 +OpStore %471 %485 +%486 = OpLoad %5 %471 +%487 = OpFunctionCall %5 %250 %486 %21 +OpStore %471 %487 +%488 = OpLoad %5 %471 +%489 = OpBitwiseAnd %5 %488 %28 +OpStore %471 %489 +%490 = OpLoad %5 %471 +%491 = OpBitwiseOr %5 %490 %28 +OpStore %471 %491 +%492 = OpLoad %5 %471 +%493 = OpBitwiseXor %5 %492 %28 +OpStore %471 %493 +%494 = OpLoad %5 %471 +%495 = OpShiftLeftLogical %5 %494 %310 +OpStore %471 %495 +%496 = OpLoad %5 %471 +%497 = OpShiftRightArithmetic %5 %496 %220 +OpStore %471 %497 +%498 = OpLoad %5 %471 +%499 = OpIAdd %5 %498 %21 +OpStore %471 %499 +%500 = OpLoad %5 %471 +%501 = OpISub %5 %500 %21 +OpStore %471 %501 +%502 = OpAccessChain %322 %473 %220 +%503 = OpLoad %5 %502 +%504 = OpIAdd %5 %503 %21 +%505 = OpAccessChain %322 %473 %220 +OpStore %505 %504 +%506 = OpAccessChain %322 %473 %220 +%507 = OpLoad %5 %506 +%508 = OpISub %5 %507 %21 +%509 = OpAccessChain %322 %473 %220 +OpStore %509 %508 OpReturn OpFunctionEnd -%505 = OpFunction %2 None %132 -%504 = OpLabel -OpBranch %506 -%506 = OpLabel -%507 = OpSNegate %5 %21 -%508 = OpSNegate %5 %21 -%509 = OpSNegate %5 %508 -%510 = OpSNegate %5 %21 -%511 = OpSNegate %5 %510 -%512 = OpSNegate %5 %21 -%513 = OpSNegate %5 %512 +%511 = OpFunction %2 None %134 +%510 = OpLabel +OpBranch %512 +%512 = OpLabel +%513 = OpSNegate %5 %21 %514 = OpSNegate %5 %21 %515 = OpSNegate %5 %514 -%516 = OpSNegate %5 %515 -%517 = OpSNegate %5 %21 -%518 = OpSNegate %5 %517 +%516 = OpSNegate %5 %21 +%517 = OpSNegate %5 %516 +%518 = OpSNegate %5 %21 %519 = OpSNegate %5 %518 -%520 = OpSNegate %5 %519 -%521 = OpSNegate %5 %21 +%520 = OpSNegate %5 %21 +%521 = OpSNegate %5 %520 %522 = OpSNegate %5 %521 -%523 = OpSNegate %5 %522 +%523 = OpSNegate %5 %21 %524 = OpSNegate %5 %523 %525 = OpSNegate %5 %524 -%526 = OpSNegate %5 %21 -%527 = OpSNegate %5 %526 +%526 = OpSNegate %5 %525 +%527 = OpSNegate %5 %21 %528 = OpSNegate %5 %527 %529 = OpSNegate %5 %528 %530 = OpSNegate %5 %529 -%531 = OpFNegate %3 %15 -%532 = OpFNegate %3 %15 -%533 = OpFNegate %3 %532 -%534 = OpFNegate %3 %15 -%535 = OpFNegate %3 %534 -%536 = OpFNegate %3 %15 -%537 = OpFNegate %3 %536 +%531 = OpSNegate %5 %530 +%532 = OpSNegate %5 %21 +%533 = OpSNegate %5 %532 +%534 = OpSNegate %5 %533 +%535 = OpSNegate %5 %534 +%536 = OpSNegate %5 %535 +%537 = OpFNegate %3 %15 %538 = OpFNegate %3 %15 %539 = OpFNegate %3 %538 -%540 = OpFNegate %3 %539 -%541 = OpFNegate %3 %15 -%542 = OpFNegate %3 %541 +%540 = OpFNegate %3 %15 +%541 = OpFNegate %3 %540 +%542 = OpFNegate %3 %15 %543 = OpFNegate %3 %542 -%544 = OpFNegate %3 %543 -%545 = OpFNegate %3 %15 +%544 = OpFNegate %3 %15 +%545 = OpFNegate %3 %544 %546 = OpFNegate %3 %545 -%547 = OpFNegate %3 %546 +%547 = OpFNegate %3 %15 %548 = OpFNegate %3 %547 %549 = OpFNegate %3 %548 -%550 = OpFNegate %3 %15 -%551 = OpFNegate %3 %550 +%550 = OpFNegate %3 %549 +%551 = OpFNegate %3 %15 %552 = OpFNegate %3 %551 %553 = OpFNegate %3 %552 %554 = OpFNegate %3 %553 +%555 = OpFNegate %3 %554 +%556 = OpFNegate %3 %15 +%557 = OpFNegate %3 %556 +%558 = OpFNegate %3 %557 +%559 = OpFNegate %3 %558 +%560 = OpFNegate %3 %559 OpReturn OpFunctionEnd -%559 = OpFunction %2 None %132 -%555 = OpLabel -%558 = OpLoad %10 %556 -OpBranch %561 +%565 = OpFunction %2 None %134 %561 = OpLabel -%562 = OpFunctionCall %4 %26 -%563 = OpCompositeExtract %11 %558 0 -%564 = OpConvertUToF %3 %563 -%565 = OpCompositeExtract %11 %558 1 -%566 = OpBitcast %5 %565 -%567 = OpFunctionCall %4 %71 %564 %566 -%568 = OpFunctionCall %8 %92 -%569 = OpFunctionCall %9 %109 %560 -%570 = OpFunctionCall %2 %131 -%571 = OpFunctionCall %2 %303 -%572 = OpFunctionCall %2 %397 -%573 = OpFunctionCall %2 %424 -%574 = OpFunctionCall %2 %463 -%575 = OpFunctionCall %2 %505 +%564 = OpLoad %10 %562 +OpBranch %567 +%567 = OpLabel +%568 = OpFunctionCall %4 %26 +%569 = OpCompositeExtract %11 %564 0 +%570 = OpConvertUToF %3 %569 +%571 = OpCompositeExtract %11 %564 1 +%572 = OpBitcast %5 %571 +%573 = OpFunctionCall %4 %73 %570 %572 +%574 = OpFunctionCall %8 %94 +%575 = OpFunctionCall %9 %111 %566 +%576 = OpFunctionCall %2 %133 +%577 = OpFunctionCall %2 %309 +%578 = OpFunctionCall %2 %403 +%579 = OpFunctionCall %2 %430 +%580 = OpFunctionCall %2 %469 +%581 = OpFunctionCall %2 %511 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/wgsl-operators.spvasm.glsl b/naga/tests/out/spv/wgsl-operators.spvasm.glsl index e4335007c..899b49273 100644 --- a/naga/tests/out/spv/wgsl-operators.spvasm.glsl +++ b/naga/tests/out/spv/wgsl-operators.spvasm.glsl @@ -13,283 +13,286 @@ ivec4 _50(ivec4 _52, ivec4 _53) bvec4 _61 = equal(_52, ivec4(int(0x80000000))); bvec4 _62 = equal(_53, ivec4(-1)); bvec4 _63 = bvec4(_61.x && _62.x, _61.y && _62.y, _61.z && _62.z, _61.w && _62.w); - return _52 - mix(_53, ivec4(1), bvec4(_56.x || _63.x, _56.y || _63.y, _56.z || _63.z, _56.w || _63.w)) * (_52 / mix(_53, ivec4(1), bvec4(_56.x || _63.x, _56.y || _63.y, _56.z || _63.z, _56.w || _63.w))); + ivec4 _66 = mix(_53, ivec4(1), bvec4(_56.x || _63.x, _56.y || _63.y, _56.z || _63.z, _56.w || _63.w)); + return _52 - ((_52 / _66) * _66); } -vec4 _71(float _69, int _70) +vec4 _73(float _71, int _72) { - return (((vec2(2.0) + vec2(_69)) - vec2(4.0)) / vec2(8.0)).xyxy + vec4(_50(ivec4(_70), ivec4(2))); + return (((vec2(2.0) + vec2(_71)) - vec2(4.0)) / vec2(8.0)).xyxy + vec4(_50(ivec4(_72), ivec4(2))); } -vec2 _92() +vec2 _94() { - vec2 _97 = vec2(2.0); - _97 += vec2(1.0); - _97 -= vec2(3.0); - _97 /= vec2(4.0); - return _97; + vec2 _99 = vec2(2.0); + _99 += vec2(1.0); + _99 -= vec2(3.0); + _99 /= vec2(4.0); + return _99; } -vec3 _109(vec3 _108) +vec3 _111(vec3 _110) { - return vec3(notEqual(_108, vec3(0.0))); + return vec3(notEqual(_110, vec3(0.0))); } -bool _118() +bool _120() { return true; } -bool _122() +bool _124() { return false; } -bool _125() +bool _127() { return true; } -bool _128() +bool _130() { return false; } -void _131() +void _133() { - bool _148 = false; - bool _142 = false; - bool _152 = false; - bool _146 = false; - bool _139 = false; bool _150 = false; bool _144 = false; + bool _154 = false; + bool _148 = false; + bool _141 = false; + bool _152 = false; + bool _146 = false; if (!true) { - _139 = false; + _141 = false; } else { - _139 = true; + _141 = true; } if (true) - { - _142 = false; - } - else - { - _142 = false; - } - if (!false) { _144 = false; } else { - _144 = true; + _144 = false; } - if (!_118()) + if (!false) { - _146 = _122(); + _146 = false; } else { _146 = true; } - if (_146) + if (!_120()) { - if (!_125()) + _148 = _124(); + } + else + { + _148 = true; + } + if (_148) + { + if (!_127()) { - _150 = _128(); + _152 = _130(); } else { - _150 = true; + _152 = true; } - _148 = _150; + _150 = _152; } else { - _148 = false; + _150 = false; } if (false) { - _152 = _122(); + _154 = _124(); } else { - _152 = true; + _154 = true; } } -int _199(int _201, int _202) +int _201(int _203, int _204) { - return _201 / (((_202 == 0) || ((_201 == int(0x80000000)) && (_202 == (-1)))) ? 1 : _202); + return _203 / (((_204 == 0) || ((_203 == int(0x80000000)) && (_204 == (-1)))) ? 1 : _204); } -uint _211(uint _213, uint _214) +uint _213(uint _215, uint _216) { - return _213 / ((_214 == 0u) ? 1u : _214); + return _215 / ((_216 == 0u) ? 1u : _216); } -ivec2 _222(ivec2 _224, ivec2 _225) +ivec2 _224(ivec2 _226, ivec2 _227) { - bvec2 _228 = equal(_225, ivec2(0)); - bvec2 _231 = equal(_224, ivec2(int(0x80000000))); - bvec2 _232 = equal(_225, ivec2(-1)); - bvec2 _233 = bvec2(_231.x && _232.x, _231.y && _232.y); - return _224 / mix(_225, ivec2(1), bvec2(_228.x || _233.x, _228.y || _233.y)); + bvec2 _230 = equal(_227, ivec2(0)); + bvec2 _233 = equal(_226, ivec2(int(0x80000000))); + bvec2 _234 = equal(_227, ivec2(-1)); + bvec2 _235 = bvec2(_233.x && _234.x, _233.y && _234.y); + return _226 / mix(_227, ivec2(1), bvec2(_230.x || _235.x, _230.y || _235.y)); } -uvec3 _238(uvec3 _240, uvec3 _241) +uvec3 _240(uvec3 _242, uvec3 _243) { - return _240 / mix(_241, uvec3(1u), equal(_241, uvec3(0u))); + return _242 / mix(_243, uvec3(1u), equal(_243, uvec3(0u))); } -int _248(int _249, int _250) +int _250(int _251, int _252) { - return _249 - (((_250 == 0) || ((_249 == int(0x80000000)) && (_250 == (-1)))) ? 1 : _250) * (_249 / (((_250 == 0) || ((_249 == int(0x80000000)) && (_250 == (-1)))) ? 1 : _250)); + int _259 = ((_252 == 0) || ((_251 == int(0x80000000)) && (_252 == (-1)))) ? 1 : _252; + return _251 - ((_251 / _259) * _259); } -uint _259(uint _260, uint _261) +uint _263(uint _264, uint _265) { - return _260 % ((_261 == 0u) ? 1u : _261); + return _264 % ((_265 == 0u) ? 1u : _265); } -ivec2 _266(ivec2 _267, ivec2 _268) +ivec2 _270(ivec2 _271, ivec2 _272) { - bvec2 _270 = equal(_268, ivec2(0)); - bvec2 _271 = equal(_267, ivec2(int(0x80000000))); - bvec2 _272 = equal(_268, ivec2(-1)); - bvec2 _273 = bvec2(_271.x && _272.x, _271.y && _272.y); - return _267 - mix(_268, ivec2(1), bvec2(_270.x || _273.x, _270.y || _273.y)) * (_267 / mix(_268, ivec2(1), bvec2(_270.x || _273.x, _270.y || _273.y))); + bvec2 _274 = equal(_272, ivec2(0)); + bvec2 _275 = equal(_271, ivec2(int(0x80000000))); + bvec2 _276 = equal(_272, ivec2(-1)); + bvec2 _277 = bvec2(_275.x && _276.x, _275.y && _276.y); + ivec2 _279 = mix(_272, ivec2(1), bvec2(_274.x || _277.x, _274.y || _277.y)); + return _271 - ((_271 / _279) * _279); } -uvec3 _277(uvec3 _278, uvec3 _279) +uvec3 _283(uvec3 _284, uvec3 _285) { - return _278 % mix(_279, uvec3(1u), equal(_279, uvec3(0u))); + return _284 % mix(_285, uvec3(1u), equal(_285, uvec3(0u))); } -uvec2 _285(uvec2 _287, uvec2 _288) +uvec2 _291(uvec2 _293, uvec2 _294) { - return _287 / mix(_288, uvec2(1u), equal(_288, uvec2(0u))); + return _293 / mix(_294, uvec2(1u), equal(_294, uvec2(0u))); } -uvec2 _295(uvec2 _296, uvec2 _297) +uvec2 _301(uvec2 _302, uvec2 _303) { - return _296 % mix(_297, uvec2(1u), equal(_297, uvec2(0u))); + return _302 % mix(_303, uvec2(1u), equal(_303, uvec2(0u))); } -void _303() +void _309() { - int _315 = 0; - int _318 = 0; - float _321 = -1.0; - ivec2 _322 = -ivec2(1); - vec2 _323 = -vec2(1.0); - int _324 = 2 + 1; - uint _325 = 2u + 1u; - float _326 = 2.0 + 1.0; - ivec2 _327 = ivec2(2) + ivec2(1); - uvec3 _328 = uvec3(2u) + uvec3(1u); - vec4 _329 = vec4(2.0) + vec4(1.0); - int _330 = 2 - 1; - uint _331 = 2u - 1u; - float _332 = 2.0 - 1.0; - ivec2 _333 = ivec2(2) - ivec2(1); - uvec3 _334 = uvec3(2u) - uvec3(1u); - vec4 _335 = vec4(2.0) - vec4(1.0); - int _336 = 2 * 1; - uint _337 = 2u * 1u; - float _338 = 2.0 * 1.0; - ivec2 _339 = ivec2(2) * ivec2(1); - uvec3 _340 = uvec3(2u) * uvec3(1u); - vec4 _341 = vec4(2.0) * vec4(1.0); - float _344 = 2.0 / 1.0; - vec4 _347 = vec4(2.0) / vec4(1.0); - float _350 = 2.0 - 1.0 * trunc(2.0 / 1.0); - vec4 _353 = vec4(2.0) - vec4(1.0) * trunc(vec4(2.0) / vec4(1.0)); - ivec2 _356 = ivec2(2) + ivec2(1); - ivec2 _357 = ivec2(2) + ivec2(1); - uvec2 _358 = uvec2(2u) + uvec2(1u); - uvec2 _359 = uvec2(2u) + uvec2(1u); - vec2 _360 = vec2(2.0) + vec2(1.0); - vec2 _361 = vec2(2.0) + vec2(1.0); - ivec2 _362 = ivec2(2) - ivec2(1); - ivec2 _363 = ivec2(2) - ivec2(1); - uvec2 _364 = uvec2(2u) - uvec2(1u); - uvec2 _365 = uvec2(2u) - uvec2(1u); - vec2 _366 = vec2(2.0) - vec2(1.0); - vec2 _367 = vec2(2.0) - vec2(1.0); - vec2 _376 = vec2(2.0) * 1.0; - vec2 _377 = vec2(1.0) * 2.0; - vec2 _382 = vec2(2.0) / vec2(1.0); - vec2 _383 = vec2(2.0) / vec2(1.0); - vec2 _388 = vec2(2.0) - vec2(1.0) * trunc(vec2(2.0) / vec2(1.0)); - vec2 _389 = vec2(2.0) - vec2(1.0) * trunc(vec2(2.0) / vec2(1.0)); - mat3 _390 = mat3(vec3(0.0), vec3(0.0), vec3(0.0)) * 1.0; - mat3 _391 = mat3(vec3(0.0), vec3(0.0), vec3(0.0)) * 2.0; - vec3 _392 = mat4x3(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0)) * vec4(1.0); - vec4 _393 = vec3(2.0) * mat4x3(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0)); - _318 = _315 + int(0x80000000); + int _321 = 0; + int _324 = 0; + float _327 = -1.0; + ivec2 _328 = -ivec2(1); + vec2 _329 = -vec2(1.0); + int _330 = 2 + 1; + uint _331 = 2u + 1u; + float _332 = 2.0 + 1.0; + ivec2 _333 = ivec2(2) + ivec2(1); + uvec3 _334 = uvec3(2u) + uvec3(1u); + vec4 _335 = vec4(2.0) + vec4(1.0); + int _336 = 2 - 1; + uint _337 = 2u - 1u; + float _338 = 2.0 - 1.0; + ivec2 _339 = ivec2(2) - ivec2(1); + uvec3 _340 = uvec3(2u) - uvec3(1u); + vec4 _341 = vec4(2.0) - vec4(1.0); + int _342 = 2 * 1; + uint _343 = 2u * 1u; + float _344 = 2.0 * 1.0; + ivec2 _345 = ivec2(2) * ivec2(1); + uvec3 _346 = uvec3(2u) * uvec3(1u); + vec4 _347 = vec4(2.0) * vec4(1.0); + float _350 = 2.0 / 1.0; + vec4 _353 = vec4(2.0) / vec4(1.0); + float _356 = 2.0 - 1.0 * trunc(2.0 / 1.0); + vec4 _359 = vec4(2.0) - vec4(1.0) * trunc(vec4(2.0) / vec4(1.0)); + ivec2 _362 = ivec2(2) + ivec2(1); + ivec2 _363 = ivec2(2) + ivec2(1); + uvec2 _364 = uvec2(2u) + uvec2(1u); + uvec2 _365 = uvec2(2u) + uvec2(1u); + vec2 _366 = vec2(2.0) + vec2(1.0); + vec2 _367 = vec2(2.0) + vec2(1.0); + ivec2 _368 = ivec2(2) - ivec2(1); + ivec2 _369 = ivec2(2) - ivec2(1); + uvec2 _370 = uvec2(2u) - uvec2(1u); + uvec2 _371 = uvec2(2u) - uvec2(1u); + vec2 _372 = vec2(2.0) - vec2(1.0); + vec2 _373 = vec2(2.0) - vec2(1.0); + vec2 _382 = vec2(2.0) * 1.0; + vec2 _383 = vec2(1.0) * 2.0; + vec2 _388 = vec2(2.0) / vec2(1.0); + vec2 _389 = vec2(2.0) / vec2(1.0); + vec2 _394 = vec2(2.0) - vec2(1.0) * trunc(vec2(2.0) / vec2(1.0)); + vec2 _395 = vec2(2.0) - vec2(1.0) * trunc(vec2(2.0) / vec2(1.0)); + mat3 _396 = mat3(vec3(0.0), vec3(0.0), vec3(0.0)) * 1.0; + mat3 _397 = mat3(vec3(0.0), vec3(0.0), vec3(0.0)) * 2.0; + vec3 _398 = mat4x3(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0)) * vec4(1.0); + vec4 _399 = vec3(2.0) * mat4x3(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0)); + _324 = _321 + int(0x80000000); } -void _397() +void _403() { } -void _424() +void _430() { } -void _463() +void _469() { - int _465 = 0; - ivec3 _467 = ivec3(0); - _465 = 1; - _465++; - _465--; - _465 *= _465; - _465 = _199(_465, _465); - _465 = _248(_465, 1); - _465 &= 0; - _465 |= 0; - _465 ^= 0; - _465 = _465 << int(2u); - _465 = _465 >> int(1u); - _465++; - _465--; - _467.y++; - _467.y--; + int _471 = 0; + ivec3 _473 = ivec3(0); + _471 = 1; + _471++; + _471--; + _471 *= _471; + _471 = _201(_471, _471); + _471 = _250(_471, 1); + _471 &= 0; + _471 |= 0; + _471 ^= 0; + _471 = _471 << int(2u); + _471 = _471 >> int(1u); + _471++; + _471--; + _473.y++; + _473.y--; } -void _505() +void _511() { - int _507 = -1; - int _508 = -1; - int _510 = -1; - int _512 = -1; + int _513 = -1; int _514 = -1; - int _517 = -1; - int _521 = -1; - int _526 = -1; - float _531 = -1.0; - float _532 = -1.0; - float _534 = -1.0; - float _536 = -1.0; + int _516 = -1; + int _518 = -1; + int _520 = -1; + int _523 = -1; + int _527 = -1; + int _532 = -1; + float _537 = -1.0; float _538 = -1.0; - float _541 = -1.0; - float _545 = -1.0; - float _550 = -1.0; + float _540 = -1.0; + float _542 = -1.0; + float _544 = -1.0; + float _547 = -1.0; + float _551 = -1.0; + float _556 = -1.0; } void main() { - _131(); - _303(); - _397(); - _424(); - _463(); - _505(); + _133(); + _309(); + _403(); + _430(); + _469(); + _511(); }