]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/module.cpp
Support compute shaders and compute operations
[libs/gl.git] / source / core / module.cpp
index 0870c4782c9f90d620b8ecda500d985f8bd363ab..8c69cd7e256673bb1887c61a9f82da31539f2cfb 100644 (file)
@@ -48,6 +48,8 @@ enum SpirVConstants
        OP_RETURN_VALUE = 254,
        OP_UNREACHABLE = 255,
 
+       EXEC_LOCAL_SIZE = 17,
+
        DECO_SPEC_ID = 1,
        DECO_ARRAY_STRIDE = 6,
        DECO_MATRIX_STRIDE = 7,
@@ -513,6 +515,7 @@ void SpirVModule::Reflection::reflect_code(const vector<uint32_t> &code)
                case OP_NAME: reflect_name(op); break;
                case OP_MEMBER_NAME: reflect_member_name(op); break;
                case OP_ENTRY_POINT: reflect_entry_point(op); break;
+               case OP_EXECUTION_MODE: reflect_execution_mode(op); break;
                case OP_TYPE_VOID: reflect_void_type(op); break;
                case OP_TYPE_BOOL: reflect_bool_type(op); break;
                case OP_TYPE_INT: reflect_int_type(op); break;
@@ -579,6 +582,18 @@ void SpirVModule::Reflection::reflect_entry_point(CodeIterator op)
                entry.globals.push_back(&variables[*op]);
 }
 
+void SpirVModule::Reflection::reflect_execution_mode(CodeIterator op)
+{
+       EntryPoint &entry = entry_points[*(op+1)];
+       unsigned mode = *(op+2);
+       if(mode==EXEC_LOCAL_SIZE)
+       {
+               entry.compute_local_size.x = *(op+3);
+               entry.compute_local_size.y = *(op+4);
+               entry.compute_local_size.z = *(op+5);
+       }
+}
+
 void SpirVModule::Reflection::reflect_void_type(CodeIterator op)
 {
        types[*(op+1)].type = VOID;