mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-23 16:01:04 +01:00
189 lines
5.1 KiB
Plaintext
189 lines
5.1 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.1
|
|
; Generator: rspirv
|
|
; Bound: 101
|
|
OpCapability Shader
|
|
OpCapability ImageQuery
|
|
OpCapability Linkage
|
|
OpExtension "SPV_KHR_storage_buffer_storage_class"
|
|
%1 = OpExtInstImport "GLSL.std.450"
|
|
OpMemoryModel Logical GLSL450
|
|
%3 = OpString "policy-mix.wgsl"
|
|
OpSource Unknown 0 %3 "// Tests that the index, buffer, and texture bounds checks policies are
|
|
// implemented separately.
|
|
|
|
// Storage and Uniform storage classes
|
|
struct InStorage {
|
|
a: array<vec4<f32>, 10>
|
|
}
|
|
@group(0) @binding(0) var<storage> in_storage: InStorage;
|
|
|
|
struct InUniform {
|
|
a: array<vec4<f32>, 20>
|
|
}
|
|
@group(0) @binding(1) var<uniform> in_uniform: InUniform;
|
|
|
|
// Textures automatically land in the `handle` storage class.
|
|
@group(0) @binding(2) var image_2d_array: texture_2d_array<f32>;
|
|
|
|
// None of the above.
|
|
var<workgroup> in_workgroup: array<f32, 30>;
|
|
var<private> in_private: array<f32, 40>;
|
|
|
|
fn mock_function(c: vec2<i32>, i: i32, l: i32) -> vec4<f32> {
|
|
var in_function: array<vec4<f32>, 2> =
|
|
array<vec4<f32>, 2>(vec4<f32>(0.707, 0.0, 0.0, 1.0),
|
|
vec4<f32>(0.0, 0.707, 0.0, 1.0));
|
|
|
|
return (in_storage.a[i] +
|
|
in_uniform.a[i] +
|
|
textureLoad(image_2d_array, c, i, l) +
|
|
in_workgroup[i] +
|
|
in_private[i] +
|
|
in_function[i]);
|
|
}
|
|
"
|
|
OpMemberName %9 0 "a"
|
|
OpName %9 "InStorage"
|
|
OpMemberName %12 0 "a"
|
|
OpName %12 "InUniform"
|
|
OpName %22 "in_storage"
|
|
OpName %25 "in_uniform"
|
|
OpName %28 "image_2d_array"
|
|
OpName %30 "in_workgroup"
|
|
OpName %32 "in_private"
|
|
OpName %36 "c"
|
|
OpName %37 "i"
|
|
OpName %38 "l"
|
|
OpName %39 "mock_function"
|
|
OpName %53 "in_function"
|
|
OpDecorate %6 ArrayStride 16
|
|
OpMemberDecorate %9 0 Offset 0
|
|
OpDecorate %10 ArrayStride 16
|
|
OpMemberDecorate %12 0 Offset 0
|
|
OpDecorate %14 ArrayStride 4
|
|
OpDecorate %16 ArrayStride 4
|
|
OpDecorate %20 ArrayStride 16
|
|
OpDecorate %22 NonWritable
|
|
OpDecorate %22 DescriptorSet 0
|
|
OpDecorate %22 Binding 0
|
|
OpDecorate %23 Block
|
|
OpMemberDecorate %23 0 Offset 0
|
|
OpDecorate %25 DescriptorSet 0
|
|
OpDecorate %25 Binding 1
|
|
OpDecorate %26 Block
|
|
OpMemberDecorate %26 0 Offset 0
|
|
OpDecorate %28 DescriptorSet 0
|
|
OpDecorate %28 Binding 2
|
|
%2 = OpTypeVoid
|
|
%4 = OpTypeFloat 32
|
|
%5 = OpTypeVector %4 4
|
|
%8 = OpTypeInt 32 0
|
|
%7 = OpConstant %8 10
|
|
%6 = OpTypeArray %5 %7
|
|
%9 = OpTypeStruct %6
|
|
%11 = OpConstant %8 20
|
|
%10 = OpTypeArray %5 %11
|
|
%12 = OpTypeStruct %10
|
|
%13 = OpTypeImage %4 2D 0 1 0 1 Unknown
|
|
%15 = OpConstant %8 30
|
|
%14 = OpTypeArray %4 %15
|
|
%17 = OpConstant %8 40
|
|
%16 = OpTypeArray %4 %17
|
|
%18 = OpTypeInt 32 1
|
|
%19 = OpTypeVector %18 2
|
|
%21 = OpConstant %8 2
|
|
%20 = OpTypeArray %5 %21
|
|
%23 = OpTypeStruct %9
|
|
%24 = OpTypePointer StorageBuffer %23
|
|
%22 = OpVariable %24 StorageBuffer
|
|
%26 = OpTypeStruct %12
|
|
%27 = OpTypePointer Uniform %26
|
|
%25 = OpVariable %27 Uniform
|
|
%29 = OpTypePointer UniformConstant %13
|
|
%28 = OpVariable %29 UniformConstant
|
|
%31 = OpTypePointer Workgroup %14
|
|
%30 = OpVariable %31 Workgroup
|
|
%33 = OpTypePointer Private %16
|
|
%34 = OpConstantNull %16
|
|
%32 = OpVariable %33 Private %34
|
|
%40 = OpTypeFunction %5 %19 %18 %18
|
|
%41 = OpTypePointer StorageBuffer %9
|
|
%42 = OpConstant %8 0
|
|
%44 = OpTypePointer Uniform %12
|
|
%47 = OpConstant %4 0.707
|
|
%48 = OpConstant %4 0.0
|
|
%49 = OpConstant %4 1.0
|
|
%50 = OpConstantComposite %5 %47 %48 %48 %49
|
|
%51 = OpConstantComposite %5 %48 %47 %48 %49
|
|
%52 = OpConstantComposite %20 %50 %51
|
|
%54 = OpTypePointer Function %20
|
|
%56 = OpTypePointer StorageBuffer %6
|
|
%57 = OpTypePointer StorageBuffer %5
|
|
%60 = OpTypePointer Uniform %10
|
|
%61 = OpTypePointer Uniform %5
|
|
%65 = OpTypeVector %18 3
|
|
%67 = OpTypeBool
|
|
%68 = OpConstantNull %5
|
|
%74 = OpTypeVector %67 3
|
|
%81 = OpTypePointer Workgroup %4
|
|
%82 = OpConstant %8 29
|
|
%88 = OpTypePointer Private %4
|
|
%89 = OpConstant %8 39
|
|
%95 = OpTypePointer Function %5
|
|
%96 = OpConstant %8 1
|
|
%39 = OpFunction %5 None %40
|
|
%36 = OpFunctionParameter %19
|
|
%37 = OpFunctionParameter %18
|
|
%38 = OpFunctionParameter %18
|
|
%35 = OpLabel
|
|
%53 = OpVariable %54 Function %52
|
|
%43 = OpAccessChain %41 %22 %42
|
|
%45 = OpAccessChain %44 %25 %42
|
|
%46 = OpLoad %13 %28
|
|
OpBranch %55
|
|
%55 = OpLabel
|
|
OpLine %3 24 25
|
|
OpLine %3 24 5
|
|
OpLine %3 27 11
|
|
%58 = OpAccessChain %57 %43 %42 %37
|
|
%59 = OpLoad %5 %58
|
|
OpLine %3 27 11
|
|
%62 = OpAccessChain %61 %45 %42 %37
|
|
%63 = OpLoad %5 %62
|
|
%64 = OpFAdd %5 %59 %63
|
|
OpLine %3 27 11
|
|
%66 = OpCompositeConstruct %65 %36 %37
|
|
%69 = OpImageQueryLevels %18 %46
|
|
%70 = OpULessThan %67 %38 %69
|
|
OpSelectionMerge %71 None
|
|
OpBranchConditional %70 %72 %71
|
|
%72 = OpLabel
|
|
%73 = OpImageQuerySizeLod %65 %46 %38
|
|
%75 = OpULessThan %74 %66 %73
|
|
%76 = OpAll %67 %75
|
|
OpBranchConditional %76 %77 %71
|
|
%77 = OpLabel
|
|
%78 = OpImageFetch %5 %46 %66 Lod %38
|
|
OpBranch %71
|
|
%71 = OpLabel
|
|
%79 = OpPhi %5 %68 %55 %68 %72 %78 %77
|
|
%80 = OpFAdd %5 %64 %79
|
|
OpLine %3 27 11
|
|
%83 = OpExtInst %8 %1 UMin %37 %82
|
|
%84 = OpAccessChain %81 %30 %83
|
|
%85 = OpLoad %4 %84
|
|
%86 = OpCompositeConstruct %5 %85 %85 %85 %85
|
|
%87 = OpFAdd %5 %80 %86
|
|
OpLine %3 27 11
|
|
%90 = OpExtInst %8 %1 UMin %37 %89
|
|
%91 = OpAccessChain %88 %32 %90
|
|
%92 = OpLoad %4 %91
|
|
%93 = OpCompositeConstruct %5 %92 %92 %92 %92
|
|
%94 = OpFAdd %5 %87 %93
|
|
%97 = OpExtInst %8 %1 UMin %37 %96
|
|
%98 = OpAccessChain %95 %53 %97
|
|
%99 = OpLoad %5 %98
|
|
%100 = OpFAdd %5 %94 %99
|
|
OpReturnValue %100
|
|
OpFunctionEnd |