Files
wgpu/naga/tests/out/spv/workgroup-uniform-load.spvasm
T
Jim Blandy 1b09a44af5 [naga spv-out] Avoid duplicating SPIR-V OpTypePointer instructions.
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.
2025-03-06 09:58:25 -08:00

65 lines
1.5 KiB
Plaintext

; SPIR-V
; Version: 1.1
; Generator: rspirv
; Bound: 39
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %14 "test_workgroupUniformLoad" %11 %19
OpExecutionMode %14 LocalSize 4 1 1
OpDecorate %5 ArrayStride 4
OpDecorate %11 BuiltIn WorkgroupId
OpDecorate %19 BuiltIn LocalInvocationId
%2 = OpTypeVoid
%3 = OpTypeInt 32 0
%4 = OpTypeInt 32 1
%6 = OpConstant %3 128
%5 = OpTypeArray %4 %6
%7 = OpTypeVector %3 3
%9 = OpTypePointer Workgroup %5
%8 = OpVariable %9 Workgroup
%12 = OpTypePointer Input %7
%11 = OpVariable %12 Input
%15 = OpTypeFunction %2
%16 = OpConstant %4 10
%18 = OpConstantNull %5
%19 = OpVariable %12 Input
%21 = OpConstantNull %7
%23 = OpTypeBool
%22 = OpTypeVector %23 3
%28 = OpConstant %3 2
%29 = OpConstant %3 264
%32 = OpTypePointer Workgroup %4
%14 = OpFunction %2 None %15
%10 = OpLabel
%13 = OpLoad %7 %11
OpBranch %17
%17 = OpLabel
%20 = OpLoad %7 %19
%24 = OpIEqual %22 %20 %21
%25 = OpAll %23 %24
OpSelectionMerge %26 None
OpBranchConditional %25 %27 %26
%27 = OpLabel
OpStore %8 %18
OpBranch %26
%26 = OpLabel
OpControlBarrier %28 %28 %29
OpBranch %30
%30 = OpLabel
%31 = OpCompositeExtract %3 %13 0
OpControlBarrier %28 %28 %29
%33 = OpAccessChain %32 %8 %31
%34 = OpLoad %4 %33
OpControlBarrier %28 %28 %29
%35 = OpSGreaterThan %23 %34 %16
OpSelectionMerge %36 None
OpBranchConditional %35 %37 %38
%37 = OpLabel
OpControlBarrier %28 %28 %29
OpReturn
%38 = OpLabel
OpReturn
%36 = OpLabel
OpReturn
OpFunctionEnd