diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2019-04-24 14:12:50 +0200 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2019-04-26 11:43:51 +0200 |
commit | 2cc374a0c816a292956db0945ef0adae359256dd (patch) | |
tree | 4019931bb1c3228cbaf14b2a89f93534d4a22c4e /spirv_parser.cpp | |
parent | f940b6c0c56f68d1114435f74901bebffd7eceec (diff) | |
download | SPIRV-Cross-2cc374a0c816a292956db0945ef0adae359256dd.tar.gz SPIRV-Cross-2cc374a0c816a292956db0945ef0adae359256dd.tar.bz2 SPIRV-Cross-2cc374a0c816a292956db0945ef0adae359256dd.zip |
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.
Diffstat (limited to 'spirv_parser.cpp')
-rw-r--r-- | spirv_parser.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spirv_parser.cpp b/spirv_parser.cpp index 1372df60..ea356a6a 100644 --- a/spirv_parser.cpp +++ b/spirv_parser.cpp @@ -158,7 +158,6 @@ void Parser::parse(const Instruction &instruction) switch (op) { - case OpMemoryModel: case OpSourceContinued: case OpSourceExtension: case OpNop: @@ -168,6 +167,11 @@ void Parser::parse(const Instruction &instruction) case OpModuleProcessed: break; + case OpMemoryModel: + ir.addressing_model = static_cast<AddressingModel>(ops[0]); + ir.memory_model = static_cast<MemoryModel>(ops[1]); + break; + case OpSource: { auto lang = static_cast<SourceLanguage>(ops[0]); @@ -598,6 +602,20 @@ void Parser::parse(const Instruction &instruction) break; } + case OpTypeForwardPointer: + { + uint32_t id = ops[0]; + auto &ptrbase = set<SPIRType>(id); + ptrbase.pointer = true; + ptrbase.pointer_depth++; + ptrbase.storage = static_cast<StorageClass>(ops[1]); + + if (ptrbase.storage == StorageClassAtomicCounter) + ptrbase.basetype = SPIRType::AtomicCounter; + + break; + } + case OpTypeStruct: { uint32_t id = ops[0]; |