]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/module.cpp
Reflect builtin decorators from SPIR-V modules
[libs/gl.git] / source / core / module.cpp
index ed5f02823f0bf34671a7ee4a31e7dad4035f0dc9..2326a5e7fd3dcf73c8a9f4e73ba191cd2a0acda3 100644 (file)
@@ -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,
@@ -245,30 +246,6 @@ void SpirVModule::reflect()
 }
 
 
-SpirVModule::EntryPoint::EntryPoint():
-       stage(VERTEX)
-{ }
-
-
-SpirVModule::StructMember::StructMember():
-       type(VOID),
-       struct_type(0),
-       offset(0),
-       array_size(0),
-       array_size_spec(0),
-       array_stride(0),
-       matrix_stride(0)
-{ }
-
-
-SpirVModule::Variable::Variable():
-       type(VOID),
-       struct_type(0),
-       location(-1),
-       descriptor_set(-1),
-       binding(-1)
-{ }
-
 bool SpirVModule::Variable::operator==(const Variable &other) const
 {
        if(storage!=UNIFORM_CONSTANT && storage!=UNIFORM)
@@ -281,16 +258,6 @@ bool SpirVModule::Variable::operator==(const Variable &other) const
 }
 
 
-SpirVModule::TypeInfo::TypeInfo():
-       type(VOID),
-       struct_type(0),
-       array_size_spec(0),
-       array_size(0),
-       array_stride(0),
-       storage(static_cast<StorageClass>(-1))
-{ }
-
-
 uint32_t SpirVModule::Reflection::get_opcode(uint32_t op)
 {
        return op&0xFFFF;
@@ -538,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<BuiltinSemantic>(*op);
+               break;
        case DECO_LOCATION:
                variables[id].location = *op;
                break;
@@ -565,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<BuiltinSemantic>(*op);
+               break;
        case DECO_OFFSET:
                member.offset = *op;
                break;