From: Mikko Rasa Date: Sun, 10 Oct 2021 14:03:02 +0000 (+0300) Subject: Reflect builtin decorators from SPIR-V modules X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=271760e6099bf5f4ad90894697dab911c236a0a3 Reflect builtin decorators from SPIR-V modules --- diff --git a/source/core/module.cpp b/source/core/module.cpp index eaed8a45..2326a5e7 100644 --- a/source/core/module.cpp +++ b/source/core/module.cpp @@ -37,6 +37,7 @@ enum SpirVConstants DECO_SPEC_ID = 1, DECO_ARRAY_STRIDE = 6, DECO_MATRIX_STRIDE = 7, + DECO_BUILTIN = 11, DECO_LOCATION = 30, DECO_BINDING = 33, DECO_DESCRIPTOR_SET = 34, @@ -504,6 +505,9 @@ void SpirVModule::Reflection::reflect_decorate(CodeIterator op) case DECO_ARRAY_STRIDE: types[id].array_stride = *op; break; + case DECO_BUILTIN: + variables[id].builtin = static_cast(*op); + break; case DECO_LOCATION: variables[id].location = *op; break; @@ -531,6 +535,9 @@ void SpirVModule::Reflection::reflect_member_decorate(CodeIterator op) case DECO_MATRIX_STRIDE: member.matrix_stride = *op; break; + case DECO_BUILTIN: + member.builtin = static_cast(*op); + break; case DECO_OFFSET: member.offset = *op; break; diff --git a/source/core/module.h b/source/core/module.h index 7713d3ce..9ac54d32 100644 --- a/source/core/module.h +++ b/source/core/module.h @@ -79,6 +79,15 @@ public: OUTPUT = 3 }; + enum BuiltinSemantic + { + NOT_BUILTIN = -1, + POSITION = 0, + CLIP_DISTANCE = 3, + LAYER = 9, + FRAG_DEPTH = 22 + }; + struct Constant; struct Structure; struct Variable; @@ -100,6 +109,7 @@ public: const Constant *array_size_spec = 0; unsigned array_stride = 0; unsigned matrix_stride = 0; + BuiltinSemantic builtin = NOT_BUILTIN; }; struct Structure @@ -120,6 +130,7 @@ public: int location = -1; int descriptor_set = -1; int binding = -1; + BuiltinSemantic builtin = NOT_BUILTIN; bool operator==(const Variable &) const; };