|
@@ -1,18 +1,18 @@
|
|
|
diff --git a/thirdparty/spirv-reflect/spirv_reflect.c b/thirdparty/spirv-reflect/spirv_reflect.c
|
|
|
-index 0fc979a8a4..3e3643717a 100644
|
|
|
+index 1c94a2e00e..2786a7f3ad 100644
|
|
|
--- a/thirdparty/spirv-reflect/spirv_reflect.c
|
|
|
+++ b/thirdparty/spirv-reflect/spirv_reflect.c
|
|
|
-@@ -124,6 +124,9 @@ typedef struct Decorations {
|
|
|
- NumberDecoration location;
|
|
|
- NumberDecoration offset;
|
|
|
- NumberDecoration uav_counter_buffer;
|
|
|
+@@ -124,6 +124,9 @@ typedef struct SpvReflectPrvDecorations {
|
|
|
+ SpvReflectPrvNumberDecoration location;
|
|
|
+ SpvReflectPrvNumberDecoration offset;
|
|
|
+ SpvReflectPrvNumberDecoration uav_counter_buffer;
|
|
|
+// -- GODOT begin --
|
|
|
-+ NumberDecoration specialization_constant;
|
|
|
++ SpvReflectPrvNumberDecoration specialization_constant;
|
|
|
+// -- GODOT end --
|
|
|
- StringDecoration semantic;
|
|
|
- uint32_t array_stride;
|
|
|
- uint32_t matrix_stride;
|
|
|
-@@ -610,6 +613,9 @@ static SpvReflectResult ParseNodes(Parser* p_parser)
|
|
|
+ SpvReflectPrvStringDecoration semantic;
|
|
|
+ uint32_t array_stride;
|
|
|
+ uint32_t matrix_stride;
|
|
|
+@@ -629,6 +632,9 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser)
|
|
|
p_parser->nodes[i].decorations.offset.value = (uint32_t)INVALID_VALUE;
|
|
|
p_parser->nodes[i].decorations.uav_counter_buffer.value = (uint32_t)INVALID_VALUE;
|
|
|
p_parser->nodes[i].decorations.built_in = (SpvBuiltIn)INVALID_VALUE;
|
|
@@ -22,7 +22,7 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
}
|
|
|
// Mark source file id node
|
|
|
p_parser->source_file_id = (uint32_t)INVALID_VALUE;
|
|
|
-@@ -800,10 +806,16 @@ static SpvReflectResult ParseNodes(Parser* p_parser)
|
|
|
+@@ -819,10 +825,16 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser)
|
|
|
CHECKED_READU32(p_parser, p_node->word_offset + 2, p_node->result_id);
|
|
|
}
|
|
|
break;
|
|
@@ -41,7 +41,16 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
case SpvOpSpecConstantComposite:
|
|
|
case SpvOpSpecConstantOp: {
|
|
|
CHECKED_READU32(p_parser, p_node->word_offset + 1, p_node->result_type_id);
|
|
|
-@@ -1309,6 +1321,9 @@ static SpvReflectResult ParseDecorations(Parser* p_parser)
|
|
|
+@@ -854,7 +866,7 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser)
|
|
|
+ CHECKED_READU32(p_parser, p_node->word_offset + 3, p_access_chain->base_id);
|
|
|
+ //
|
|
|
+ // SPIRV_ACCESS_CHAIN_INDEX_OFFSET (4) is the number of words up until the first index:
|
|
|
+- // [Node, Result Type Id, Result Id, Base Id, <Indexes>]
|
|
|
++ // [SpvReflectPrvNode, Result Type Id, Result Id, Base Id, <Indexes>]
|
|
|
+ //
|
|
|
+ p_access_chain->index_count = (node_word_count - SPIRV_ACCESS_CHAIN_INDEX_OFFSET);
|
|
|
+ if (p_access_chain->index_count > 0) {
|
|
|
+@@ -1334,6 +1346,9 @@ static SpvReflectResult ParseDecorations(SpvReflectPrvParser* p_parser)
|
|
|
skip = true;
|
|
|
}
|
|
|
break;
|
|
@@ -51,7 +60,7 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
case SpvDecorationBlock:
|
|
|
case SpvDecorationBufferBlock:
|
|
|
case SpvDecorationColMajor:
|
|
|
-@@ -1441,7 +1456,14 @@ static SpvReflectResult ParseDecorations(Parser* p_parser)
|
|
|
+@@ -1466,7 +1481,14 @@ static SpvReflectResult ParseDecorations(SpvReflectPrvParser* p_parser)
|
|
|
p_target_decorations->input_attachment_index.word_offset = word_offset;
|
|
|
}
|
|
|
break;
|
|
@@ -67,7 +76,7 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
case SpvReflectDecorationHlslCounterBufferGOOGLE: {
|
|
|
uint32_t word_offset = p_node->word_offset + member_offset+ 3;
|
|
|
CHECKED_READU32(p_parser, word_offset, p_target_decorations->uav_counter_buffer.value);
|
|
|
-@@ -1731,6 +1753,13 @@ static SpvReflectResult ParseType(
|
|
|
+@@ -1766,6 +1788,13 @@ static SpvReflectResult ParseType(
|
|
|
p_type->type_flags |= SPV_REFLECT_TYPE_FLAG_EXTERNAL_ACCELERATION_STRUCTURE;
|
|
|
}
|
|
|
break;
|
|
@@ -81,17 +90,17 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
}
|
|
|
|
|
|
if (result == SPV_REFLECT_RESULT_SUCCESS) {
|
|
|
-@@ -3187,6 +3216,69 @@ static SpvReflectResult ParseExecutionModes(Parser* p_parser, SpvReflectShaderMo
|
|
|
+@@ -3236,6 +3265,69 @@ static SpvReflectResult ParseExecutionModes(
|
|
|
return SPV_REFLECT_RESULT_SUCCESS;
|
|
|
}
|
|
|
|
|
|
+// -- GODOT begin --
|
|
|
-+static SpvReflectResult ParseSpecializationConstants(Parser* p_parser, SpvReflectShaderModule* p_module)
|
|
|
++static SpvReflectResult ParseSpecializationConstants(SpvReflectPrvParser* p_parser, SpvReflectShaderModule* p_module)
|
|
|
+{
|
|
|
+ p_module->specialization_constant_count = 0;
|
|
|
+ p_module->specialization_constants = NULL;
|
|
|
+ for (size_t i = 0; i < p_parser->node_count; ++i) {
|
|
|
-+ Node* p_node = &(p_parser->nodes[i]);
|
|
|
++ SpvReflectPrvNode* p_node = &(p_parser->nodes[i]);
|
|
|
+ if (p_node->op == SpvOpSpecConstantTrue || p_node->op == SpvOpSpecConstantFalse || p_node->op == SpvOpSpecConstant) {
|
|
|
+ p_module->specialization_constant_count++;
|
|
|
+ }
|
|
@@ -106,7 +115,7 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
+ uint32_t index = 0;
|
|
|
+
|
|
|
+ for (size_t i = 0; i < p_parser->node_count; ++i) {
|
|
|
-+ Node* p_node = &(p_parser->nodes[i]);
|
|
|
++ SpvReflectPrvNode* p_node = &(p_parser->nodes[i]);
|
|
|
+ switch(p_node->op) {
|
|
|
+ default: continue;
|
|
|
+ case SpvOpSpecConstantTrue: {
|
|
@@ -124,7 +133,7 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
+ IF_READU32(result, p_parser, p_node->word_offset + 1, element_type_id);
|
|
|
+ IF_READU32(result, p_parser, p_node->word_offset + 3, default_value);
|
|
|
+
|
|
|
-+ Node* p_next_node = FindNode(p_parser, element_type_id);
|
|
|
++ SpvReflectPrvNode* p_next_node = FindNode(p_parser, element_type_id);
|
|
|
+
|
|
|
+ if (p_next_node->op == SpvOpTypeInt) {
|
|
|
+ p_module->specialization_constants[index].constant_type = SPV_REFLECT_SPECIALIZATION_CONSTANT_INT;
|
|
@@ -148,10 +157,10 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
+}
|
|
|
+// -- GODOT end --
|
|
|
+
|
|
|
- static SpvReflectResult ParsePushConstantBlocks(Parser* p_parser, SpvReflectShaderModule* p_module)
|
|
|
- {
|
|
|
- for (size_t i = 0; i < p_parser->node_count; ++i) {
|
|
|
-@@ -3562,6 +3654,12 @@ SpvReflectResult spvReflectCreateShaderModule(
|
|
|
+ static SpvReflectResult ParsePushConstantBlocks(
|
|
|
+ SpvReflectPrvParser* p_parser,
|
|
|
+ SpvReflectShaderModule* p_module)
|
|
|
+@@ -3613,6 +3705,12 @@ SpvReflectResult spvReflectCreateShaderModule(
|
|
|
result = ParsePushConstantBlocks(&parser, p_module);
|
|
|
SPV_REFLECT_ASSERT(result == SPV_REFLECT_RESULT_SUCCESS);
|
|
|
}
|
|
@@ -164,7 +173,7 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
if (result == SPV_REFLECT_RESULT_SUCCESS) {
|
|
|
result = ParseEntryPoints(&parser, p_module);
|
|
|
SPV_REFLECT_ASSERT(result == SPV_REFLECT_RESULT_SUCCESS);
|
|
|
-@@ -3691,6 +3789,9 @@ void spvReflectDestroyShaderModule(SpvReflectShaderModule* p_module)
|
|
|
+@@ -3742,6 +3840,9 @@ void spvReflectDestroyShaderModule(SpvReflectShaderModule* p_module)
|
|
|
SafeFree(p_entry->used_push_constants);
|
|
|
}
|
|
|
SafeFree(p_module->entry_points);
|
|
@@ -174,14 +183,14 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
|
|
|
// Push constants
|
|
|
for (size_t i = 0; i < p_module->push_constant_block_count; ++i) {
|
|
|
-@@ -3959,6 +4060,38 @@ SpvReflectResult spvReflectEnumerateEntryPointInterfaceVariables(
|
|
|
+@@ -4010,6 +4111,38 @@ SpvReflectResult spvReflectEnumerateEntryPointInterfaceVariables(
|
|
|
return SPV_REFLECT_RESULT_SUCCESS;
|
|
|
}
|
|
|
|
|
|
+// -- GODOT begin --
|
|
|
+SpvReflectResult spvReflectEnumerateSpecializationConstants(
|
|
|
-+ const SpvReflectShaderModule* p_module,
|
|
|
-+ uint32_t* p_count,
|
|
|
++ const SpvReflectShaderModule* p_module,
|
|
|
++ uint32_t* p_count,
|
|
|
+ SpvReflectSpecializationConstant** pp_constants
|
|
|
+)
|
|
|
+{
|
|
@@ -214,7 +223,7 @@ index 0fc979a8a4..3e3643717a 100644
|
|
|
const SpvReflectShaderModule* p_module,
|
|
|
uint32_t* p_count,
|
|
|
diff --git a/thirdparty/spirv-reflect/spirv_reflect.h b/thirdparty/spirv-reflect/spirv_reflect.h
|
|
|
-index a5a956e9e8..21f8160770 100644
|
|
|
+index da05400973..50cc65222b 100644
|
|
|
--- a/thirdparty/spirv-reflect/spirv_reflect.h
|
|
|
+++ b/thirdparty/spirv-reflect/spirv_reflect.h
|
|
|
@@ -292,6 +292,28 @@ typedef struct SpvReflectTypeDescription {
|
|
@@ -247,9 +256,9 @@ index a5a956e9e8..21f8160770 100644
|
|
|
/*! @struct SpvReflectInterfaceVariable
|
|
|
|
|
|
@@ -439,6 +461,10 @@ typedef struct SpvReflectShaderModule {
|
|
|
- SpvReflectInterfaceVariable* interface_variables;
|
|
|
- uint32_t push_constant_block_count;
|
|
|
- SpvReflectBlockVariable* push_constant_blocks;
|
|
|
+ SpvReflectInterfaceVariable* interface_variables; // Uses value(s) from first entry point
|
|
|
+ uint32_t push_constant_block_count; // Uses value(s) from first entry point
|
|
|
+ SpvReflectBlockVariable* push_constant_blocks; // Uses value(s) from first entry point
|
|
|
+ // -- GODOT begin --
|
|
|
+ uint32_t specialization_constant_count;
|
|
|
+ SpvReflectSpecializationConstant* specialization_constants;
|