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:
parent
eaa7057768
commit
051f18c0cc
10 changed files with 1468 additions and 1359 deletions
|
|
@ -0,0 +1,35 @@
|
|||
spv.intrinsicsSpirvTypeWithTypeSpecifier.vert
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000b
|
||||
// Id's are bound by 14
|
||||
|
||||
Capability Shader
|
||||
Capability Int64
|
||||
Capability PhysicalStorageBufferAddressesEXT
|
||||
Extension "SPV_EXT_physical_storage_buffer"
|
||||
Extension "SPV_KHR_physical_storage_buffer"
|
||||
Extension "SPV_KHR_variable_pointers"
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel PhysicalStorageBuffer64EXT GLSL450
|
||||
EntryPoint Vertex 4 "main"
|
||||
Source GLSL 450
|
||||
SourceExtension "GL_ARB_gpu_shader_int64"
|
||||
SourceExtension "GL_EXT_buffer_reference"
|
||||
SourceExtension "GL_EXT_spirv_intrinsics"
|
||||
Name 4 "main"
|
||||
Name 8 "value"
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 0
|
||||
7: TypePointer Function 6(int)
|
||||
9: TypeInt 64 0
|
||||
10: 9(int64_t) Constant 1 0
|
||||
11: TypePointer PhysicalStorageBufferEXT 6(int)
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
8(value): 7(ptr) Variable Function
|
||||
12: 11(ptr) ConvertUToPtr 10
|
||||
13: 6(int) Load 12 Aligned 32
|
||||
Store 8(value) 13
|
||||
Return
|
||||
FunctionEnd
|
||||
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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue