mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 06:50:59 +01:00
Simplify `naga::back::spv::LocalType` to have only one variant for representing pointers, and use the SPIR-V type as the base type, so that `LocalType` values are equal when the SPIR-V pointer types they map to would be equal as well. This avoids emitting multiple `OpTypePointer` instructions, which SPIR-V would interpret as distinct types, for equivalent Naga IR pointer types. Change the `get_pointer_type_id` utility function accordingly, and adjust its callers. Change `LocalType::from_inner` into `Writer::localtype_from_inner`, so that it can call `Writer` methods to build base types. Adjust users.
342 lines
8.1 KiB
Plaintext
342 lines
8.1 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.1
|
|
; Generator: rspirv
|
|
; Bound: 218
|
|
OpCapability Shader
|
|
OpCapability Linkage
|
|
OpExtension "SPV_KHR_storage_buffer_storage_class"
|
|
%1 = OpExtInstImport "GLSL.std.450"
|
|
OpMemoryModel Logical GLSL450
|
|
OpDecorate %4 ArrayStride 4
|
|
OpDecorate %9 ArrayStride 4
|
|
OpMemberDecorate %10 0 Offset 0
|
|
OpMemberDecorate %10 1 Offset 48
|
|
OpMemberDecorate %10 2 Offset 64
|
|
OpMemberDecorate %10 2 ColMajor
|
|
OpMemberDecorate %10 2 MatrixStride 16
|
|
OpMemberDecorate %10 3 Offset 112
|
|
OpDecorate %10 Block
|
|
OpDecorate %12 DescriptorSet 0
|
|
OpDecorate %12 Binding 0
|
|
%2 = OpTypeVoid
|
|
%3 = OpTypeFloat 32
|
|
%6 = OpTypeInt 32 0
|
|
%5 = OpConstant %6 10
|
|
%4 = OpTypeArray %3 %5
|
|
%7 = OpTypeVector %3 4
|
|
%8 = OpTypeMatrix %7 3
|
|
%9 = OpTypeRuntimeArray %3
|
|
%10 = OpTypeStruct %4 %7 %8 %9
|
|
%11 = OpTypeInt 32 1
|
|
%13 = OpTypePointer StorageBuffer %10
|
|
%12 = OpVariable %13 StorageBuffer
|
|
%17 = OpTypeFunction %3 %11
|
|
%19 = OpTypePointer StorageBuffer %4
|
|
%20 = OpTypePointer StorageBuffer %3
|
|
%22 = OpTypeBool
|
|
%23 = OpConstant %6 0
|
|
%25 = OpConstantNull %3
|
|
%34 = OpTypePointer StorageBuffer %9
|
|
%37 = OpConstant %6 3
|
|
%47 = OpTypePointer StorageBuffer %7
|
|
%48 = OpConstant %6 4
|
|
%50 = OpConstant %6 1
|
|
%60 = OpTypeFunction %3 %7 %11
|
|
%70 = OpTypeFunction %7 %11
|
|
%72 = OpTypePointer StorageBuffer %8
|
|
%74 = OpConstant %6 2
|
|
%76 = OpConstantNull %7
|
|
%85 = OpTypeFunction %3 %11 %11
|
|
%98 = OpConstant %3 100.0
|
|
%113 = OpTypeFunction %3
|
|
%115 = OpConstant %6 9
|
|
%128 = OpTypeFunction %2 %11 %3
|
|
%157 = OpTypeFunction %2 %11 %7
|
|
%168 = OpTypeFunction %2 %11 %11 %3
|
|
%193 = OpTypeFunction %2 %3
|
|
%202 = OpConstant %6 1000
|
|
%16 = OpFunction %3 None %17
|
|
%15 = OpFunctionParameter %11
|
|
%14 = OpLabel
|
|
OpBranch %18
|
|
%18 = OpLabel
|
|
%21 = OpULessThan %22 %15 %5
|
|
OpSelectionMerge %26 None
|
|
OpBranchConditional %21 %27 %26
|
|
%27 = OpLabel
|
|
%24 = OpAccessChain %20 %12 %23 %15
|
|
%28 = OpLoad %3 %24
|
|
OpBranch %26
|
|
%26 = OpLabel
|
|
%29 = OpPhi %3 %25 %18 %28 %27
|
|
OpReturnValue %29
|
|
OpFunctionEnd
|
|
%32 = OpFunction %3 None %17
|
|
%31 = OpFunctionParameter %11
|
|
%30 = OpLabel
|
|
OpBranch %33
|
|
%33 = OpLabel
|
|
%35 = OpArrayLength %6 %12 3
|
|
%36 = OpULessThan %22 %31 %35
|
|
OpSelectionMerge %39 None
|
|
OpBranchConditional %36 %40 %39
|
|
%40 = OpLabel
|
|
%38 = OpAccessChain %20 %12 %37 %31
|
|
%41 = OpLoad %3 %38
|
|
OpBranch %39
|
|
%39 = OpLabel
|
|
%42 = OpPhi %3 %25 %33 %41 %40
|
|
OpReturnValue %42
|
|
OpFunctionEnd
|
|
%45 = OpFunction %3 None %17
|
|
%44 = OpFunctionParameter %11
|
|
%43 = OpLabel
|
|
OpBranch %46
|
|
%46 = OpLabel
|
|
%49 = OpULessThan %22 %44 %48
|
|
OpSelectionMerge %52 None
|
|
OpBranchConditional %49 %53 %52
|
|
%53 = OpLabel
|
|
%51 = OpAccessChain %20 %12 %50 %44
|
|
%54 = OpLoad %3 %51
|
|
OpBranch %52
|
|
%52 = OpLabel
|
|
%55 = OpPhi %3 %25 %46 %54 %53
|
|
OpReturnValue %55
|
|
OpFunctionEnd
|
|
%59 = OpFunction %3 None %60
|
|
%57 = OpFunctionParameter %7
|
|
%58 = OpFunctionParameter %11
|
|
%56 = OpLabel
|
|
OpBranch %61
|
|
%61 = OpLabel
|
|
%62 = OpULessThan %22 %58 %48
|
|
OpSelectionMerge %63 None
|
|
OpBranchConditional %62 %64 %63
|
|
%64 = OpLabel
|
|
%65 = OpVectorExtractDynamic %3 %57 %58
|
|
OpBranch %63
|
|
%63 = OpLabel
|
|
%66 = OpPhi %3 %25 %61 %65 %64
|
|
OpReturnValue %66
|
|
OpFunctionEnd
|
|
%69 = OpFunction %7 None %70
|
|
%68 = OpFunctionParameter %11
|
|
%67 = OpLabel
|
|
OpBranch %71
|
|
%71 = OpLabel
|
|
%73 = OpULessThan %22 %68 %37
|
|
OpSelectionMerge %77 None
|
|
OpBranchConditional %73 %78 %77
|
|
%78 = OpLabel
|
|
%75 = OpAccessChain %47 %12 %74 %68
|
|
%79 = OpLoad %7 %75
|
|
OpBranch %77
|
|
%77 = OpLabel
|
|
%80 = OpPhi %7 %76 %71 %79 %78
|
|
OpReturnValue %80
|
|
OpFunctionEnd
|
|
%84 = OpFunction %3 None %85
|
|
%82 = OpFunctionParameter %11
|
|
%83 = OpFunctionParameter %11
|
|
%81 = OpLabel
|
|
OpBranch %86
|
|
%86 = OpLabel
|
|
%87 = OpULessThan %22 %83 %48
|
|
%88 = OpULessThan %22 %82 %37
|
|
%89 = OpLogicalAnd %22 %87 %88
|
|
OpSelectionMerge %91 None
|
|
OpBranchConditional %89 %92 %91
|
|
%92 = OpLabel
|
|
%90 = OpAccessChain %20 %12 %74 %82 %83
|
|
%93 = OpLoad %3 %90
|
|
OpBranch %91
|
|
%91 = OpLabel
|
|
%94 = OpPhi %3 %25 %86 %93 %92
|
|
OpReturnValue %94
|
|
OpFunctionEnd
|
|
%97 = OpFunction %3 None %17
|
|
%96 = OpFunctionParameter %11
|
|
%95 = OpLabel
|
|
OpBranch %99
|
|
%99 = OpLabel
|
|
%100 = OpConvertSToF %3 %96
|
|
%101 = OpFDiv %3 %100 %98
|
|
%102 = OpExtInst %3 %1 Sin %101
|
|
%103 = OpFMul %3 %102 %98
|
|
%104 = OpConvertFToS %11 %103
|
|
%105 = OpULessThan %22 %104 %5
|
|
OpSelectionMerge %107 None
|
|
OpBranchConditional %105 %108 %107
|
|
%108 = OpLabel
|
|
%106 = OpAccessChain %20 %12 %23 %104
|
|
%109 = OpLoad %3 %106
|
|
OpBranch %107
|
|
%107 = OpLabel
|
|
%110 = OpPhi %3 %25 %99 %109 %108
|
|
OpReturnValue %110
|
|
OpFunctionEnd
|
|
%112 = OpFunction %3 None %113
|
|
%111 = OpLabel
|
|
OpBranch %114
|
|
%114 = OpLabel
|
|
%116 = OpAccessChain %20 %12 %23 %115
|
|
%117 = OpLoad %3 %116
|
|
%118 = OpAccessChain %20 %12 %50 %37
|
|
%119 = OpLoad %3 %118
|
|
%120 = OpFAdd %3 %117 %119
|
|
%121 = OpAccessChain %20 %12 %74 %74 %37
|
|
%122 = OpLoad %3 %121
|
|
%123 = OpFAdd %3 %120 %122
|
|
OpReturnValue %123
|
|
OpFunctionEnd
|
|
%127 = OpFunction %2 None %128
|
|
%125 = OpFunctionParameter %11
|
|
%126 = OpFunctionParameter %3
|
|
%124 = OpLabel
|
|
OpBranch %129
|
|
%129 = OpLabel
|
|
%130 = OpULessThan %22 %125 %5
|
|
OpSelectionMerge %132 None
|
|
OpBranchConditional %130 %133 %132
|
|
%133 = OpLabel
|
|
%131 = OpAccessChain %20 %12 %23 %125
|
|
OpStore %131 %126
|
|
OpBranch %132
|
|
%132 = OpLabel
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%137 = OpFunction %2 None %128
|
|
%135 = OpFunctionParameter %11
|
|
%136 = OpFunctionParameter %3
|
|
%134 = OpLabel
|
|
OpBranch %138
|
|
%138 = OpLabel
|
|
%139 = OpArrayLength %6 %12 3
|
|
%140 = OpULessThan %22 %135 %139
|
|
OpSelectionMerge %142 None
|
|
OpBranchConditional %140 %143 %142
|
|
%143 = OpLabel
|
|
%141 = OpAccessChain %20 %12 %37 %135
|
|
OpStore %141 %136
|
|
OpBranch %142
|
|
%142 = OpLabel
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%147 = OpFunction %2 None %128
|
|
%145 = OpFunctionParameter %11
|
|
%146 = OpFunctionParameter %3
|
|
%144 = OpLabel
|
|
OpBranch %148
|
|
%148 = OpLabel
|
|
%149 = OpULessThan %22 %145 %48
|
|
OpSelectionMerge %151 None
|
|
OpBranchConditional %149 %152 %151
|
|
%152 = OpLabel
|
|
%150 = OpAccessChain %20 %12 %50 %145
|
|
OpStore %150 %146
|
|
OpBranch %151
|
|
%151 = OpLabel
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%156 = OpFunction %2 None %157
|
|
%154 = OpFunctionParameter %11
|
|
%155 = OpFunctionParameter %7
|
|
%153 = OpLabel
|
|
OpBranch %158
|
|
%158 = OpLabel
|
|
%159 = OpULessThan %22 %154 %37
|
|
OpSelectionMerge %161 None
|
|
OpBranchConditional %159 %162 %161
|
|
%162 = OpLabel
|
|
%160 = OpAccessChain %47 %12 %74 %154
|
|
OpStore %160 %155
|
|
OpBranch %161
|
|
%161 = OpLabel
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%167 = OpFunction %2 None %168
|
|
%164 = OpFunctionParameter %11
|
|
%165 = OpFunctionParameter %11
|
|
%166 = OpFunctionParameter %3
|
|
%163 = OpLabel
|
|
OpBranch %169
|
|
%169 = OpLabel
|
|
%170 = OpULessThan %22 %165 %48
|
|
%171 = OpULessThan %22 %164 %37
|
|
%172 = OpLogicalAnd %22 %170 %171
|
|
OpSelectionMerge %174 None
|
|
OpBranchConditional %172 %175 %174
|
|
%175 = OpLabel
|
|
%173 = OpAccessChain %20 %12 %74 %164 %165
|
|
OpStore %173 %166
|
|
OpBranch %174
|
|
%174 = OpLabel
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%179 = OpFunction %2 None %128
|
|
%177 = OpFunctionParameter %11
|
|
%178 = OpFunctionParameter %3
|
|
%176 = OpLabel
|
|
OpBranch %180
|
|
%180 = OpLabel
|
|
%181 = OpConvertSToF %3 %177
|
|
%182 = OpFDiv %3 %181 %98
|
|
%183 = OpExtInst %3 %1 Sin %182
|
|
%184 = OpFMul %3 %183 %98
|
|
%185 = OpConvertFToS %11 %184
|
|
%186 = OpULessThan %22 %185 %5
|
|
OpSelectionMerge %188 None
|
|
OpBranchConditional %186 %189 %188
|
|
%189 = OpLabel
|
|
%187 = OpAccessChain %20 %12 %23 %185
|
|
OpStore %187 %178
|
|
OpBranch %188
|
|
%188 = OpLabel
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%192 = OpFunction %2 None %193
|
|
%191 = OpFunctionParameter %3
|
|
%190 = OpLabel
|
|
OpBranch %194
|
|
%194 = OpLabel
|
|
%195 = OpAccessChain %20 %12 %23 %115
|
|
OpStore %195 %191
|
|
%196 = OpAccessChain %20 %12 %50 %37
|
|
OpStore %196 %191
|
|
%197 = OpAccessChain %20 %12 %74 %74 %37
|
|
OpStore %197 %191
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%199 = OpFunction %3 None %113
|
|
%198 = OpLabel
|
|
OpBranch %200
|
|
%200 = OpLabel
|
|
%201 = OpArrayLength %6 %12 3
|
|
%203 = OpULessThan %22 %202 %201
|
|
OpSelectionMerge %205 None
|
|
OpBranchConditional %203 %206 %205
|
|
%206 = OpLabel
|
|
%204 = OpAccessChain %20 %12 %37 %202
|
|
%207 = OpLoad %3 %204
|
|
OpBranch %205
|
|
%205 = OpLabel
|
|
%208 = OpPhi %3 %25 %200 %207 %206
|
|
OpReturnValue %208
|
|
OpFunctionEnd
|
|
%211 = OpFunction %2 None %193
|
|
%210 = OpFunctionParameter %3
|
|
%209 = OpLabel
|
|
OpBranch %212
|
|
%212 = OpLabel
|
|
%213 = OpArrayLength %6 %12 3
|
|
%214 = OpULessThan %22 %202 %213
|
|
OpSelectionMerge %216 None
|
|
OpBranchConditional %214 %217 %216
|
|
%217 = OpLabel
|
|
%215 = OpAccessChain %20 %12 %37 %202
|
|
OpStore %215 %210
|
|
OpBranch %216
|
|
%216 = OpLabel
|
|
OpReturn
|
|
OpFunctionEnd |