mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-29 09:34:09 +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.
257 lines
6.3 KiB
Plaintext
257 lines
6.3 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.1
|
|
; Generator: rspirv
|
|
; Bound: 178
|
|
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
|
|
%21 = OpConstant %6 9
|
|
%23 = OpConstant %6 0
|
|
%30 = OpTypePointer StorageBuffer %9
|
|
%32 = OpConstant %6 1
|
|
%35 = OpConstant %6 3
|
|
%42 = OpTypePointer StorageBuffer %7
|
|
%50 = OpTypeFunction %3 %7 %11
|
|
%57 = OpTypeFunction %7 %11
|
|
%59 = OpTypePointer StorageBuffer %8
|
|
%60 = OpConstant %6 2
|
|
%68 = OpTypeFunction %3 %11 %11
|
|
%77 = OpConstant %3 100.0
|
|
%89 = OpTypeFunction %3
|
|
%103 = OpTypeFunction %2 %11 %3
|
|
%127 = OpTypeFunction %2 %11 %7
|
|
%136 = OpTypeFunction %2 %11 %11 %3
|
|
%156 = OpTypeFunction %2 %3
|
|
%166 = OpConstant %6 1000
|
|
%16 = OpFunction %3 None %17
|
|
%15 = OpFunctionParameter %11
|
|
%14 = OpLabel
|
|
OpBranch %18
|
|
%18 = OpLabel
|
|
%22 = OpExtInst %6 %1 UMin %15 %21
|
|
%24 = OpAccessChain %20 %12 %23 %22
|
|
%25 = OpLoad %3 %24
|
|
OpReturnValue %25
|
|
OpFunctionEnd
|
|
%28 = OpFunction %3 None %17
|
|
%27 = OpFunctionParameter %11
|
|
%26 = OpLabel
|
|
OpBranch %29
|
|
%29 = OpLabel
|
|
%31 = OpArrayLength %6 %12 3
|
|
%33 = OpISub %6 %31 %32
|
|
%34 = OpExtInst %6 %1 UMin %27 %33
|
|
%36 = OpAccessChain %20 %12 %35 %34
|
|
%37 = OpLoad %3 %36
|
|
OpReturnValue %37
|
|
OpFunctionEnd
|
|
%40 = OpFunction %3 None %17
|
|
%39 = OpFunctionParameter %11
|
|
%38 = OpLabel
|
|
OpBranch %41
|
|
%41 = OpLabel
|
|
%43 = OpExtInst %6 %1 UMin %39 %35
|
|
%44 = OpAccessChain %20 %12 %32 %43
|
|
%45 = OpLoad %3 %44
|
|
OpReturnValue %45
|
|
OpFunctionEnd
|
|
%49 = OpFunction %3 None %50
|
|
%47 = OpFunctionParameter %7
|
|
%48 = OpFunctionParameter %11
|
|
%46 = OpLabel
|
|
OpBranch %51
|
|
%51 = OpLabel
|
|
%52 = OpExtInst %6 %1 UMin %48 %35
|
|
%53 = OpVectorExtractDynamic %3 %47 %52
|
|
OpReturnValue %53
|
|
OpFunctionEnd
|
|
%56 = OpFunction %7 None %57
|
|
%55 = OpFunctionParameter %11
|
|
%54 = OpLabel
|
|
OpBranch %58
|
|
%58 = OpLabel
|
|
%61 = OpExtInst %6 %1 UMin %55 %60
|
|
%62 = OpAccessChain %42 %12 %60 %61
|
|
%63 = OpLoad %7 %62
|
|
OpReturnValue %63
|
|
OpFunctionEnd
|
|
%67 = OpFunction %3 None %68
|
|
%65 = OpFunctionParameter %11
|
|
%66 = OpFunctionParameter %11
|
|
%64 = OpLabel
|
|
OpBranch %69
|
|
%69 = OpLabel
|
|
%70 = OpExtInst %6 %1 UMin %66 %35
|
|
%71 = OpExtInst %6 %1 UMin %65 %60
|
|
%72 = OpAccessChain %20 %12 %60 %71 %70
|
|
%73 = OpLoad %3 %72
|
|
OpReturnValue %73
|
|
OpFunctionEnd
|
|
%76 = OpFunction %3 None %17
|
|
%75 = OpFunctionParameter %11
|
|
%74 = OpLabel
|
|
OpBranch %78
|
|
%78 = OpLabel
|
|
%79 = OpConvertSToF %3 %75
|
|
%80 = OpFDiv %3 %79 %77
|
|
%81 = OpExtInst %3 %1 Sin %80
|
|
%82 = OpFMul %3 %81 %77
|
|
%83 = OpConvertFToS %11 %82
|
|
%84 = OpExtInst %6 %1 UMin %83 %21
|
|
%85 = OpAccessChain %20 %12 %23 %84
|
|
%86 = OpLoad %3 %85
|
|
OpReturnValue %86
|
|
OpFunctionEnd
|
|
%88 = OpFunction %3 None %89
|
|
%87 = OpLabel
|
|
OpBranch %90
|
|
%90 = OpLabel
|
|
%91 = OpAccessChain %20 %12 %23 %21
|
|
%92 = OpLoad %3 %91
|
|
%93 = OpAccessChain %20 %12 %32 %35
|
|
%94 = OpLoad %3 %93
|
|
%95 = OpFAdd %3 %92 %94
|
|
%96 = OpAccessChain %20 %12 %60 %60 %35
|
|
%97 = OpLoad %3 %96
|
|
%98 = OpFAdd %3 %95 %97
|
|
OpReturnValue %98
|
|
OpFunctionEnd
|
|
%102 = OpFunction %2 None %103
|
|
%100 = OpFunctionParameter %11
|
|
%101 = OpFunctionParameter %3
|
|
%99 = OpLabel
|
|
OpBranch %104
|
|
%104 = OpLabel
|
|
%105 = OpExtInst %6 %1 UMin %100 %21
|
|
%106 = OpAccessChain %20 %12 %23 %105
|
|
OpStore %106 %101
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%110 = OpFunction %2 None %103
|
|
%108 = OpFunctionParameter %11
|
|
%109 = OpFunctionParameter %3
|
|
%107 = OpLabel
|
|
OpBranch %111
|
|
%111 = OpLabel
|
|
%112 = OpArrayLength %6 %12 3
|
|
%113 = OpISub %6 %112 %32
|
|
%114 = OpExtInst %6 %1 UMin %108 %113
|
|
%115 = OpAccessChain %20 %12 %35 %114
|
|
OpStore %115 %109
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%119 = OpFunction %2 None %103
|
|
%117 = OpFunctionParameter %11
|
|
%118 = OpFunctionParameter %3
|
|
%116 = OpLabel
|
|
OpBranch %120
|
|
%120 = OpLabel
|
|
%121 = OpExtInst %6 %1 UMin %117 %35
|
|
%122 = OpAccessChain %20 %12 %32 %121
|
|
OpStore %122 %118
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%126 = OpFunction %2 None %127
|
|
%124 = OpFunctionParameter %11
|
|
%125 = OpFunctionParameter %7
|
|
%123 = OpLabel
|
|
OpBranch %128
|
|
%128 = OpLabel
|
|
%129 = OpExtInst %6 %1 UMin %124 %60
|
|
%130 = OpAccessChain %42 %12 %60 %129
|
|
OpStore %130 %125
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%135 = OpFunction %2 None %136
|
|
%132 = OpFunctionParameter %11
|
|
%133 = OpFunctionParameter %11
|
|
%134 = OpFunctionParameter %3
|
|
%131 = OpLabel
|
|
OpBranch %137
|
|
%137 = OpLabel
|
|
%138 = OpExtInst %6 %1 UMin %133 %35
|
|
%139 = OpExtInst %6 %1 UMin %132 %60
|
|
%140 = OpAccessChain %20 %12 %60 %139 %138
|
|
OpStore %140 %134
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%144 = OpFunction %2 None %103
|
|
%142 = OpFunctionParameter %11
|
|
%143 = OpFunctionParameter %3
|
|
%141 = OpLabel
|
|
OpBranch %145
|
|
%145 = OpLabel
|
|
%146 = OpConvertSToF %3 %142
|
|
%147 = OpFDiv %3 %146 %77
|
|
%148 = OpExtInst %3 %1 Sin %147
|
|
%149 = OpFMul %3 %148 %77
|
|
%150 = OpConvertFToS %11 %149
|
|
%151 = OpExtInst %6 %1 UMin %150 %21
|
|
%152 = OpAccessChain %20 %12 %23 %151
|
|
OpStore %152 %143
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%155 = OpFunction %2 None %156
|
|
%154 = OpFunctionParameter %3
|
|
%153 = OpLabel
|
|
OpBranch %157
|
|
%157 = OpLabel
|
|
%158 = OpAccessChain %20 %12 %23 %21
|
|
OpStore %158 %154
|
|
%159 = OpAccessChain %20 %12 %32 %35
|
|
OpStore %159 %154
|
|
%160 = OpAccessChain %20 %12 %60 %60 %35
|
|
OpStore %160 %154
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%162 = OpFunction %3 None %89
|
|
%161 = OpLabel
|
|
OpBranch %163
|
|
%163 = OpLabel
|
|
%164 = OpArrayLength %6 %12 3
|
|
%165 = OpISub %6 %164 %32
|
|
%167 = OpExtInst %6 %1 UMin %166 %165
|
|
%168 = OpAccessChain %20 %12 %35 %167
|
|
%169 = OpLoad %3 %168
|
|
OpReturnValue %169
|
|
OpFunctionEnd
|
|
%172 = OpFunction %2 None %156
|
|
%171 = OpFunctionParameter %3
|
|
%170 = OpLabel
|
|
OpBranch %173
|
|
%173 = OpLabel
|
|
%174 = OpArrayLength %6 %12 3
|
|
%175 = OpISub %6 %174 %32
|
|
%176 = OpExtInst %6 %1 UMin %166 %175
|
|
%177 = OpAccessChain %20 %12 %35 %176
|
|
OpStore %177 %171
|
|
OpReturn
|
|
OpFunctionEnd |