Spirv_intrinsics: Add support of type specifier to spirv_type
Previously, spirv_type doesn't accept type specifier as its parameter. With this change, we can input non-array type specifier. This is because some SPIR-V type definition intructions often need to reference other SPIR-V types as its source operands. We add the support to facilitate such usage.
This commit is contained in:
25
Test/spv.intrinsicsSpirvTypeWithTypeSpecifier.vert
Normal file
25
Test/spv.intrinsicsSpirvTypeWithTypeSpecifier.vert
Normal file
@@ -0,0 +1,25 @@
|
||||
#version 450 core
|
||||
|
||||
#extension GL_ARB_gpu_shader_int64: enable
|
||||
#extension GL_EXT_buffer_reference: enable
|
||||
#extension GL_EXT_spirv_intrinsics: enable
|
||||
|
||||
#define CapabilityPhysicalStorageBufferAddresses 5347
|
||||
#define StorageClassPhysicalStorageBuffer 5349
|
||||
#define OpTypePointer 32
|
||||
#define OpLoad 61
|
||||
#define OpConvertUToPtr 120
|
||||
|
||||
#define uintStoragePtr spirv_type(extensions = ["SPV_EXT_physical_storage_buffer", "SPV_KHR_variable_pointers"], capabilities = [CapabilityPhysicalStorageBufferAddresses], id = OpTypePointer, StorageClassPhysicalStorageBuffer, uint)
|
||||
|
||||
// Just to enable the memory model of physical storage buffer
|
||||
layout(buffer_reference, std430) buffer Dummy {
|
||||
uint dummy;
|
||||
};
|
||||
|
||||
spirv_instruction(id = OpLoad) uint loadUint(uintStoragePtr pointer, spirv_literal uint memoryOperands, spirv_literal uint alignment);
|
||||
spirv_instruction(id = OpConvertUToPtr) uintStoragePtr convertToPtr(uint64_t value);
|
||||
|
||||
void main() {
|
||||
uint value = loadUint(convertToPtr(1), 0x2, 32);
|
||||
}
|
||||
Reference in New Issue
Block a user