mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
114 lines
2.4 KiB
Plaintext
114 lines
2.4 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.2
|
|
; Generator: rspirv
|
|
; Bound: 43
|
|
OpCapability Shader
|
|
OpCapability Linkage
|
|
OpExtension "SPV_KHR_storage_buffer_storage_class"
|
|
%1 = OpExtInstImport "GLSL.std.450"
|
|
OpMemoryModel Logical GLSL450
|
|
%3 = OpString "pointers.wgsl"
|
|
OpSource Unknown 0 %3 "fn f() {
|
|
var v: vec2<i32>;
|
|
let px = &v.x;
|
|
*px = 10;
|
|
}
|
|
|
|
struct DynamicArray {
|
|
arr: array<u32>
|
|
}
|
|
|
|
@group(0) @binding(0)
|
|
var<storage, read_write> dynamic_array: DynamicArray;
|
|
|
|
fn index_unsized(i: i32, v: u32) {
|
|
let p: ptr<storage, DynamicArray, read_write> = &dynamic_array;
|
|
|
|
let val = (*p).arr[i];
|
|
(*p).arr[i] = val + v;
|
|
}
|
|
|
|
fn index_dynamic_array(i: i32, v: u32) {
|
|
let p: ptr<storage, array<u32>, read_write> = &dynamic_array.arr;
|
|
|
|
let val = (*p)[i];
|
|
(*p)[i] = val + v;
|
|
}
|
|
"
|
|
OpMemberName %8 0 "arr"
|
|
OpName %8 "DynamicArray"
|
|
OpName %9 "dynamic_array"
|
|
OpName %12 "f"
|
|
OpName %15 "v"
|
|
OpName %23 "i"
|
|
OpName %24 "v"
|
|
OpName %25 "index_unsized"
|
|
OpName %35 "i"
|
|
OpName %36 "v"
|
|
OpName %37 "index_dynamic_array"
|
|
OpDecorate %7 ArrayStride 4
|
|
OpMemberDecorate %8 0 Offset 0
|
|
OpDecorate %8 Block
|
|
OpDecorate %9 DescriptorSet 0
|
|
OpDecorate %9 Binding 0
|
|
%2 = OpTypeVoid
|
|
%4 = OpTypeInt 32 1
|
|
%5 = OpTypeVector %4 2
|
|
%6 = OpTypeInt 32 0
|
|
%7 = OpTypeRuntimeArray %6
|
|
%8 = OpTypeStruct %7
|
|
%10 = OpTypePointer StorageBuffer %8
|
|
%9 = OpVariable %10 StorageBuffer
|
|
%13 = OpTypeFunction %2
|
|
%14 = OpConstant %4 10
|
|
%16 = OpTypePointer Function %5
|
|
%17 = OpConstantNull %5
|
|
%19 = OpTypePointer Function %4
|
|
%20 = OpConstant %6 0
|
|
%26 = OpTypeFunction %2 %4 %6
|
|
%28 = OpTypePointer StorageBuffer %7
|
|
%29 = OpTypePointer StorageBuffer %6
|
|
%12 = OpFunction %2 None %13
|
|
%11 = OpLabel
|
|
%15 = OpVariable %16 Function %17
|
|
OpBranch %18
|
|
%18 = OpLabel
|
|
OpLine %3 3 14
|
|
OpLine %3 4 4
|
|
%21 = OpAccessChain %19 %15 %20
|
|
OpStore %21 %14
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%25 = OpFunction %2 None %26
|
|
%23 = OpFunctionParameter %4
|
|
%24 = OpFunctionParameter %6
|
|
%22 = OpLabel
|
|
OpBranch %27
|
|
%27 = OpLabel
|
|
OpLine %3 17 14
|
|
%30 = OpAccessChain %29 %9 %20 %23
|
|
%31 = OpLoad %6 %30
|
|
OpLine %3 18 4
|
|
%32 = OpIAdd %6 %31 %24
|
|
OpLine %3 18 4
|
|
%33 = OpAccessChain %29 %9 %20 %23
|
|
OpStore %33 %32
|
|
OpReturn
|
|
OpFunctionEnd
|
|
%37 = OpFunction %2 None %26
|
|
%35 = OpFunctionParameter %4
|
|
%36 = OpFunctionParameter %6
|
|
%34 = OpLabel
|
|
OpBranch %38
|
|
%38 = OpLabel
|
|
OpLine %3 22 51
|
|
OpLine %3 24 14
|
|
%39 = OpAccessChain %29 %9 %20 %35
|
|
%40 = OpLoad %6 %39
|
|
OpLine %3 25 4
|
|
%41 = OpIAdd %6 %40 %36
|
|
OpLine %3 25 4
|
|
%42 = OpAccessChain %29 %9 %20 %35
|
|
OpStore %42 %41
|
|
OpReturn
|
|
OpFunctionEnd |