SPIRV-Cross/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer.asm.nocompat.vk.comp
Hans-Kristian Arntzen 2cc374a0c8 GLSL: Implement GL_EXT_buffer_reference.
Buffer objects can contain arbitrary pointers to blocks.
We can also implement ConvertPtrToU and ConvertUToPtr.
The latter can cast a uint64_t to any type as it pleases,
so we will need to generate fake buffer reference blocks to be able to
cast the type.
2019-04-26 11:43:51 +02:00

52 lines
2.4 KiB
Plaintext

; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 27
; Schema: 0
OpCapability Shader
OpCapability Int64
OpCapability PhysicalStorageBufferAddressesEXT
OpExtension "SPV_EXT_physical_storage_buffer"
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel PhysicalStorageBuffer64EXT GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpSource GLSL 450
OpSourceExtension "GL_ARB_gpu_shader_int64"
OpSourceExtension "GL_EXT_buffer_reference"
OpDecorate %_runtimearr_uint ArrayStride 4
OpMemberDecorate %uintPtr 0 Offset 0
OpDecorate %uintPtr Block
OpDecorate %ptr AliasedPointerEXT
OpMemberDecorate %Registers 0 Offset 0
OpDecorate %Registers Block
%void = OpTypeVoid
%3 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%_runtimearr_uint = OpTypeRuntimeArray %uint
%uintPtr = OpTypeStruct %_runtimearr_uint
%_ptr_PhysicalStorageBufferEXT_uint_array = OpTypePointer PhysicalStorageBufferEXT %_runtimearr_uint
%_ptr_Function__ptr_PhysicalStorageBufferEXT_uint_array = OpTypePointer Function %_ptr_PhysicalStorageBufferEXT_uint_array
%ulong = OpTypeInt 64 0
%Registers = OpTypeStruct %ulong
%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers
%registers = OpVariable %_ptr_PushConstant_Registers PushConstant
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_PushConstant_ulong = OpTypePointer PushConstant %ulong
%int_10 = OpConstant %int 10
%uint_20 = OpConstant %uint 20
%_ptr_PhysicalStorageBufferEXT_uint = OpTypePointer PhysicalStorageBufferEXT %uint
%main = OpFunction %void None %3
%5 = OpLabel
%ptr = OpVariable %_ptr_Function__ptr_PhysicalStorageBufferEXT_uint_array Function
%19 = OpAccessChain %_ptr_PushConstant_ulong %registers %int_0
%20 = OpLoad %ulong %19
%21 = OpConvertUToPtr %_ptr_PhysicalStorageBufferEXT_uint_array %20
OpStore %ptr %21
%22 = OpLoad %_ptr_PhysicalStorageBufferEXT_uint_array %ptr
%26 = OpAccessChain %_ptr_PhysicalStorageBufferEXT_uint %22 %int_10
OpStore %26 %uint_20 Aligned 4
OpReturn
OpFunctionEnd