Files
wgpu/naga/tests/out/spv/storage-textures.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

76 lines
2.0 KiB
Plaintext

; SPIR-V
; Version: 1.1
; Generator: rspirv
; Bound: 39
OpCapability Shader
OpCapability StorageImageExtendedFormats
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %17 "csLoad"
OpEntryPoint GLCompute %32 "csStore"
OpExecutionMode %17 LocalSize 1 1 1
OpExecutionMode %32 LocalSize 1 1 1
OpDecorate %7 NonWritable
OpDecorate %7 DescriptorSet 0
OpDecorate %7 Binding 0
OpDecorate %9 NonWritable
OpDecorate %9 DescriptorSet 0
OpDecorate %9 Binding 1
OpDecorate %11 NonWritable
OpDecorate %11 DescriptorSet 0
OpDecorate %11 Binding 2
OpDecorate %13 NonReadable
OpDecorate %13 DescriptorSet 1
OpDecorate %13 Binding 0
OpDecorate %14 NonReadable
OpDecorate %14 DescriptorSet 1
OpDecorate %14 Binding 1
OpDecorate %15 NonReadable
OpDecorate %15 DescriptorSet 1
OpDecorate %15 Binding 2
%2 = OpTypeVoid
%4 = OpTypeFloat 32
%3 = OpTypeImage %4 2D 0 0 0 2 R32f
%5 = OpTypeImage %4 2D 0 0 0 2 Rg32f
%6 = OpTypeImage %4 2D 0 0 0 2 Rgba32f
%8 = OpTypePointer UniformConstant %3
%7 = OpVariable %8 UniformConstant
%10 = OpTypePointer UniformConstant %5
%9 = OpVariable %10 UniformConstant
%12 = OpTypePointer UniformConstant %6
%11 = OpVariable %12 UniformConstant
%13 = OpVariable %8 UniformConstant
%14 = OpVariable %10 UniformConstant
%15 = OpVariable %12 UniformConstant
%18 = OpTypeFunction %2
%22 = OpTypeInt 32 0
%23 = OpConstant %22 0
%24 = OpTypeVector %22 2
%25 = OpConstantComposite %24 %23 %23
%27 = OpTypeVector %4 4
%36 = OpConstant %4 0.0
%37 = OpConstantComposite %27 %36 %36 %36 %36
%17 = OpFunction %2 None %18
%16 = OpLabel
%19 = OpLoad %3 %7
%20 = OpLoad %5 %9
%21 = OpLoad %6 %11
OpBranch %26
%26 = OpLabel
%28 = OpImageRead %27 %19 %25
%29 = OpImageRead %27 %20 %25
%30 = OpImageRead %27 %21 %25
OpReturn
OpFunctionEnd
%32 = OpFunction %2 None %18
%31 = OpLabel
%33 = OpLoad %3 %13
%34 = OpLoad %5 %14
%35 = OpLoad %6 %15
OpBranch %38
%38 = OpLabel
OpImageWrite %33 %25 %37
OpImageWrite %34 %25 %37
OpImageWrite %35 %25 %37
OpReturn
OpFunctionEnd