Update Vulkan and related libraries to 1.3.250.0
This commit is contained in:
2977
thirdparty/spirv-reflect/include/spirv/unified1/spirv.h
vendored
2977
thirdparty/spirv-reflect/include/spirv/unified1/spirv.h
vendored
File diff suppressed because it is too large
Load Diff
@ -26,10 +26,10 @@ index 8c70ebecfb..c5ed7ab07d 100644
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 2, p_node->result_id);
|
||||
}
|
||||
break;
|
||||
-
|
||||
+// -- GODOT begin --
|
||||
|
||||
case SpvOpSpecConstantTrue:
|
||||
case SpvOpSpecConstantFalse:
|
||||
+// -- GODOT begin --
|
||||
- case SpvOpSpecConstant:
|
||||
+ case SpvOpSpecConstant: {
|
||||
+ CHECKED_READU32(p_parser, p_node->word_offset + 1, p_node->result_type_id);
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
diff --git a/thirdparty/spirv-reflect/spirv_reflect.c b/thirdparty/spirv-reflect/spirv_reflect.c
|
||||
index c5ed7ab07d..f2be1f8cae 100644
|
||||
--- a/thirdparty/spirv-reflect/spirv_reflect.c
|
||||
+++ b/thirdparty/spirv-reflect/spirv_reflect.c
|
||||
@@ -3368,12 +3368,18 @@ static SpvReflectResult ParseExecutionModes(
|
||||
}
|
||||
for (size_t entry_point_idx = 0; entry_point_idx < p_module->entry_point_count; ++entry_point_idx) {
|
||||
SpvReflectEntryPoint* p_entry_point = &p_module->entry_points[entry_point_idx];
|
||||
- p_entry_point->execution_modes =
|
||||
- (SpvExecutionMode*)calloc(p_entry_point->execution_mode_count, sizeof(*p_entry_point->execution_modes));
|
||||
- if (IsNull(p_entry_point->execution_modes)) {
|
||||
- SafeFree(indices);
|
||||
- return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
|
||||
+// -- GODOT begin --
|
||||
+ if (p_entry_point->execution_mode_count > 0) {
|
||||
+// -- GODOT end --
|
||||
+ p_entry_point->execution_modes =
|
||||
+ (SpvExecutionMode*)calloc(p_entry_point->execution_mode_count, sizeof(*p_entry_point->execution_modes));
|
||||
+ if (IsNull(p_entry_point->execution_modes)) {
|
||||
+ SafeFree(indices);
|
||||
+ return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
|
||||
+ }
|
||||
+// -- GODOT begin --
|
||||
}
|
||||
+// -- GODOT end --
|
||||
}
|
||||
|
||||
for (size_t node_idx = 0; node_idx < p_parser->node_count; ++node_idx) {
|
||||
197
thirdparty/spirv-reflect/spirv_reflect.c
vendored
197
thirdparty/spirv-reflect/spirv_reflect.c
vendored
@ -27,6 +27,12 @@
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#define FALLTHROUGH __attribute__((fallthrough))
|
||||
#else
|
||||
#define FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#if defined(SPIRV_REFLECT_ENABLE_ASSERTS)
|
||||
#define SPV_REFLECT_ASSERT(COND) \
|
||||
assert(COND);
|
||||
@ -126,7 +132,7 @@ typedef struct SpvReflectPrvDecorations {
|
||||
SpvReflectPrvNumberDecoration location;
|
||||
SpvReflectPrvNumberDecoration offset;
|
||||
SpvReflectPrvNumberDecoration uav_counter_buffer;
|
||||
// -- GODOT begin --
|
||||
// -- GODOT begin --
|
||||
SpvReflectPrvNumberDecoration specialization_constant;
|
||||
// -- GODOT end --
|
||||
SpvReflectPrvStringDecoration semantic;
|
||||
@ -186,10 +192,10 @@ typedef struct SpvReflectPrvAccessChain {
|
||||
// Pointing to the base of a composite object.
|
||||
// Generally the id of descriptor block variable
|
||||
uint32_t base_id;
|
||||
//
|
||||
//
|
||||
// From spec:
|
||||
// The first index in Indexes will select the
|
||||
// top-level member/element/component/element
|
||||
// The first index in Indexes will select the
|
||||
// top-level member/element/component/element
|
||||
// of the base composite
|
||||
uint32_t index_count;
|
||||
uint32_t* indexes;
|
||||
@ -222,7 +228,7 @@ typedef struct SpvReflectPrvParser {
|
||||
// clang-format on
|
||||
|
||||
static uint32_t Max(
|
||||
uint32_t a,
|
||||
uint32_t a,
|
||||
uint32_t b)
|
||||
{
|
||||
return a > b ? a : b;
|
||||
@ -249,7 +255,7 @@ static uint32_t RoundUp(
|
||||
}
|
||||
|
||||
static int SortCompareUint32(
|
||||
const void* a,
|
||||
const void* a,
|
||||
const void* b)
|
||||
{
|
||||
const uint32_t* p_a = (const uint32_t*)a;
|
||||
@ -281,8 +287,8 @@ static size_t DedupSortedUint32(uint32_t* arr, size_t size)
|
||||
}
|
||||
|
||||
static bool SearchSortedUint32(
|
||||
const uint32_t* arr,
|
||||
size_t size,
|
||||
const uint32_t* arr,
|
||||
size_t size,
|
||||
uint32_t target)
|
||||
{
|
||||
size_t lo = 0;
|
||||
@ -301,9 +307,9 @@ static bool SearchSortedUint32(
|
||||
}
|
||||
|
||||
static SpvReflectResult IntersectSortedUint32(
|
||||
const uint32_t* p_arr0,
|
||||
const uint32_t* p_arr0,
|
||||
size_t arr0_size,
|
||||
const uint32_t* p_arr1,
|
||||
const uint32_t* p_arr1,
|
||||
size_t arr1_size,
|
||||
uint32_t** pp_res,
|
||||
size_t* res_size
|
||||
@ -357,7 +363,7 @@ static SpvReflectResult IntersectSortedUint32(
|
||||
|
||||
|
||||
static bool InRange(
|
||||
const SpvReflectPrvParser* p_parser,
|
||||
const SpvReflectPrvParser* p_parser,
|
||||
uint32_t index)
|
||||
{
|
||||
bool in_range = false;
|
||||
@ -419,11 +425,11 @@ static SpvReflectResult ReadU32(
|
||||
}
|
||||
|
||||
static SpvReflectResult ReadStr(
|
||||
SpvReflectPrvParser* p_parser,
|
||||
uint32_t word_offset,
|
||||
uint32_t word_index,
|
||||
SpvReflectPrvParser* p_parser,
|
||||
uint32_t word_offset,
|
||||
uint32_t word_index,
|
||||
uint32_t word_count,
|
||||
uint32_t* p_buf_size,
|
||||
uint32_t* p_buf_size,
|
||||
char* p_buf
|
||||
)
|
||||
{
|
||||
@ -540,8 +546,8 @@ static SpvReflectTypeDescription* FindType(SpvReflectShaderModule* p_module, uin
|
||||
}
|
||||
|
||||
static SpvReflectResult CreateParser(
|
||||
size_t size,
|
||||
void* p_code,
|
||||
size_t size,
|
||||
void* p_code,
|
||||
SpvReflectPrvParser* p_parser)
|
||||
{
|
||||
if (p_code == NULL) {
|
||||
@ -644,7 +650,7 @@ 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;
|
||||
// -- GODOT begin --
|
||||
// -- GODOT begin --
|
||||
p_parser->nodes[i].decorations.specialization_constant.value = (SpvBuiltIn)INVALID_VALUE;
|
||||
// -- GODOT end --
|
||||
}
|
||||
@ -695,7 +701,7 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser)
|
||||
const char* p_source = (const char*)(p_parser->spirv_code + p_node->word_offset + 4);
|
||||
|
||||
const size_t source_len = strlen(p_source);
|
||||
char* p_source_temp = (char*)calloc(source_len + 1, sizeof(char*));
|
||||
char* p_source_temp = (char*)calloc(source_len + 1, sizeof(char));
|
||||
|
||||
if (IsNull(p_source_temp)) {
|
||||
return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
|
||||
@ -707,6 +713,7 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser)
|
||||
strcpy(p_source_temp, p_source);
|
||||
#endif
|
||||
|
||||
SafeFree(p_parser->source_embedded);
|
||||
p_parser->source_embedded = p_source_temp;
|
||||
}
|
||||
}
|
||||
@ -716,8 +723,8 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser)
|
||||
const char* p_source = (const char*)(p_parser->spirv_code + p_node->word_offset + 1);
|
||||
|
||||
const size_t source_len = strlen(p_source);
|
||||
const size_t embedded_source_len = strlen(p_parser->source_embedded);
|
||||
char* p_continued_source = (char*)calloc(source_len + embedded_source_len + 1, sizeof(char*));
|
||||
const size_t embedded_source_len = strlen(p_parser->source_embedded);
|
||||
char* p_continued_source = (char*)calloc(source_len + embedded_source_len + 1, sizeof(char));
|
||||
|
||||
if (IsNull(p_continued_source)) {
|
||||
return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
|
||||
@ -725,7 +732,7 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser)
|
||||
|
||||
#ifdef _WIN32
|
||||
strcpy_s(p_continued_source, embedded_source_len + 1, p_parser->source_embedded);
|
||||
strcat_s(p_continued_source, source_len + 1, p_source);
|
||||
strcat_s(p_continued_source, embedded_source_len + source_len + 1, p_source);
|
||||
#else
|
||||
strcpy(p_continued_source, p_parser->source_embedded);
|
||||
strcat(p_continued_source, p_source);
|
||||
@ -759,6 +766,7 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser)
|
||||
case SpvOpTypeStruct:
|
||||
{
|
||||
p_node->member_count = p_node->word_count - 2;
|
||||
FALLTHROUGH;
|
||||
} // Fall through
|
||||
case SpvOpTypeVoid:
|
||||
case SpvOpTypeBool:
|
||||
@ -843,9 +851,9 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser)
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 2, p_node->result_id);
|
||||
}
|
||||
break;
|
||||
// -- GODOT begin --
|
||||
case SpvOpSpecConstantTrue:
|
||||
case SpvOpSpecConstantFalse:
|
||||
// -- GODOT begin --
|
||||
case SpvOpSpecConstant: {
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 1, p_node->result_type_id);
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 2, p_node->result_id);
|
||||
@ -884,7 +892,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:
|
||||
// [SpvReflectPrvNode, Result Type Id, Result Id, Base Id, <Indexes>]
|
||||
// [Node, 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) {
|
||||
@ -931,6 +939,7 @@ static SpvReflectResult ParseNodes(SpvReflectPrvParser* p_parser)
|
||||
CHECKED_READU32(p_parser, p_func_node->word_offset + 2, p_func_node->result_id);
|
||||
++(p_parser->function_count);
|
||||
}
|
||||
FALLTHROUGH;
|
||||
} // Fall through
|
||||
|
||||
case SpvOpFunctionEnd:
|
||||
@ -964,7 +973,7 @@ static SpvReflectResult ParseStrings(SpvReflectPrvParser* p_parser)
|
||||
|
||||
if (IsNotNull(p_parser) && IsNotNull(p_parser->spirv_code) && IsNotNull(p_parser->nodes)) {
|
||||
// Allocate string storage
|
||||
p_parser->strings = (SpvReflectPrvString*)calloc(p_parser->string_count, sizeof(*(p_parser->strings)));
|
||||
p_parser->strings = (SpvReflectPrvString*)calloc(p_parser->string_count, sizeof(*(p_parser->strings)));
|
||||
|
||||
uint32_t string_index = 0;
|
||||
for (size_t i = 0; i < p_parser->node_count; ++i) {
|
||||
@ -991,7 +1000,7 @@ static SpvReflectResult ParseStrings(SpvReflectPrvParser* p_parser)
|
||||
++string_index;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return SPV_REFLECT_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1016,7 +1025,7 @@ static SpvReflectResult ParseSource(SpvReflectPrvParser* p_parser, SpvReflectSha
|
||||
if (IsNotNull(p_parser->source_embedded))
|
||||
{
|
||||
const size_t source_len = strlen(p_parser->source_embedded);
|
||||
char* p_source = (char*)calloc(source_len + 1, sizeof(char*));
|
||||
char* p_source = (char*)calloc(source_len + 1, sizeof(char));
|
||||
|
||||
if (IsNull(p_source)) {
|
||||
return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
|
||||
@ -1036,9 +1045,9 @@ static SpvReflectResult ParseSource(SpvReflectPrvParser* p_parser, SpvReflectSha
|
||||
}
|
||||
|
||||
static SpvReflectResult ParseFunction(
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectPrvNode* p_func_node,
|
||||
SpvReflectPrvFunction* p_func,
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectPrvNode* p_func_node,
|
||||
SpvReflectPrvFunction* p_func,
|
||||
size_t first_label_index)
|
||||
{
|
||||
p_func->id = p_func_node->result_id;
|
||||
@ -1163,7 +1172,7 @@ static SpvReflectResult ParseFunction(
|
||||
}
|
||||
|
||||
static int SortCompareFunctions(
|
||||
const void* a,
|
||||
const void* a,
|
||||
const void* b)
|
||||
{
|
||||
const SpvReflectPrvFunction* af = (const SpvReflectPrvFunction*)a;
|
||||
@ -1390,13 +1399,13 @@ static SpvReflectResult ParseDecorations(SpvReflectPrvParser* p_parser)
|
||||
case SpvReflectDecorationHlslSemanticGOOGLE: {
|
||||
skip = false;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
if (skip) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Find target target node
|
||||
}
|
||||
|
||||
// Find target target node
|
||||
uint32_t target_id = 0;
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 1, target_id);
|
||||
SpvReflectPrvNode* p_target_node = FindNode(p_parser, target_id);
|
||||
@ -1546,7 +1555,7 @@ static SpvReflectResult ParseDecorations(SpvReflectPrvParser* p_parser)
|
||||
|
||||
static SpvReflectResult EnumerateAllUniforms(
|
||||
SpvReflectShaderModule* p_module,
|
||||
size_t* p_uniform_count,
|
||||
size_t* p_uniform_count,
|
||||
uint32_t** pp_uniforms
|
||||
)
|
||||
{
|
||||
@ -1569,10 +1578,10 @@ static SpvReflectResult EnumerateAllUniforms(
|
||||
}
|
||||
|
||||
static SpvReflectResult ParseType(
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectPrvNode* p_node,
|
||||
SpvReflectPrvDecorations* p_struct_member_decorations,
|
||||
SpvReflectShaderModule* p_module,
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectPrvNode* p_node,
|
||||
SpvReflectPrvDecorations* p_struct_member_decorations,
|
||||
SpvReflectShaderModule* p_module,
|
||||
SpvReflectTypeDescription* p_type
|
||||
)
|
||||
{
|
||||
@ -1703,7 +1712,7 @@ static SpvReflectResult ParseType(
|
||||
result = ParseType(p_parser, p_next_node, NULL, p_module, p_type);
|
||||
}
|
||||
else {
|
||||
result = SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE;
|
||||
result = SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE;
|
||||
SPV_REFLECT_ASSERT(false);
|
||||
}
|
||||
}
|
||||
@ -1804,7 +1813,7 @@ static SpvReflectResult ParseType(
|
||||
if (result != SPV_REFLECT_RESULT_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
// This looks wrong
|
||||
// This looks wrong
|
||||
//p_member_type->type_name = p_member_node->name;
|
||||
p_member_type->struct_member_name = p_node->member_names[member_index];
|
||||
}
|
||||
@ -2210,7 +2219,7 @@ static SpvReflectResult ParseUAVCounterBindings(SpvReflectShaderModule* p_module
|
||||
else {
|
||||
const size_t descriptor_name_length = p_descriptor->name? strlen(p_descriptor->name): 0;
|
||||
|
||||
memset(name, 0, MAX_NODE_NAME_LENGTH);
|
||||
memset(name, 0, MAX_NODE_NAME_LENGTH);
|
||||
memcpy(name, p_descriptor->name, descriptor_name_length);
|
||||
#if defined(_WIN32)
|
||||
strcat_s(name, MAX_NODE_NAME_LENGTH, k_count_tag);
|
||||
@ -2239,9 +2248,9 @@ static SpvReflectResult ParseUAVCounterBindings(SpvReflectShaderModule* p_module
|
||||
}
|
||||
|
||||
static SpvReflectResult ParseDescriptorBlockVariable(
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectShaderModule* p_module,
|
||||
SpvReflectTypeDescription* p_type,
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectShaderModule* p_module,
|
||||
SpvReflectTypeDescription* p_type,
|
||||
SpvReflectBlockVariable* p_var
|
||||
)
|
||||
{
|
||||
@ -2276,7 +2285,7 @@ static SpvReflectResult ParseDescriptorBlockVariable(
|
||||
return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Parse members
|
||||
for (uint32_t member_index = 0; member_index < p_type->member_count; ++member_index) {
|
||||
SpvReflectTypeDescription* p_member_type = &p_type->members[member_index];
|
||||
@ -2301,6 +2310,7 @@ static SpvReflectResult ParseDescriptorBlockVariable(
|
||||
ApplyArrayTraits(p_member_type, &p_member_var->array);
|
||||
}
|
||||
|
||||
p_member_var->word_offset.offset = p_type_node->member_decorations[member_index].offset.word_offset;
|
||||
p_member_var->type_description = p_member_type;
|
||||
}
|
||||
}
|
||||
@ -2315,11 +2325,11 @@ static SpvReflectResult ParseDescriptorBlockVariable(
|
||||
}
|
||||
|
||||
static SpvReflectResult ParseDescriptorBlockVariableSizes(
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectShaderModule* p_module,
|
||||
bool is_parent_root,
|
||||
bool is_parent_aos,
|
||||
bool is_parent_rta,
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectShaderModule* p_module,
|
||||
bool is_parent_root,
|
||||
bool is_parent_aos,
|
||||
bool is_parent_rta,
|
||||
SpvReflectBlockVariable* p_var
|
||||
)
|
||||
{
|
||||
@ -2449,7 +2459,7 @@ static SpvReflectResult ParseDescriptorBlockVariableSizes(
|
||||
|
||||
static void MarkSelfAndAllMemberVarsAsUsed(SpvReflectBlockVariable* p_var)
|
||||
{
|
||||
// Clear the current variable's USED flag
|
||||
// Clear the current variable's UNUSED flag
|
||||
p_var->flags &= ~SPV_REFLECT_VARIABLE_FLAGS_UNUSED;
|
||||
|
||||
SpvOp op_type = p_var->type_description->op;
|
||||
@ -2485,7 +2495,7 @@ static SpvReflectResult ParseDescriptorBlockVariableUsage(
|
||||
|
||||
// Clear the current variable's UNUSED flag
|
||||
p_var->flags &= ~SPV_REFLECT_VARIABLE_FLAGS_UNUSED;
|
||||
|
||||
|
||||
// Parsing arrays requires overriding the op type for
|
||||
// for the lowest dim's element type.
|
||||
SpvOp op_type = p_var->type_description->op;
|
||||
@ -2514,14 +2524,14 @@ static SpvReflectResult ParseDescriptorBlockVariableUsage(
|
||||
// Next access chain index
|
||||
index_index += 1;
|
||||
}
|
||||
|
||||
|
||||
// Only continue parsing if there's remaining indices in the access
|
||||
// chain. If the end of the access chain has been reach then all
|
||||
// chain. If the end of the access chain has been reached then all
|
||||
// remaining variables (including those in struct hierarchies)
|
||||
// are considered USED.
|
||||
//
|
||||
// See: https://github.com/KhronosGroup/SPIRV-Reflect/issues/78
|
||||
//
|
||||
//
|
||||
if (index_index < p_access_chain->index_count) {
|
||||
// Parse current var again with a type override and advanced index index
|
||||
SpvReflectResult result = ParseDescriptorBlockVariableUsage(
|
||||
@ -2601,7 +2611,7 @@ static SpvReflectResult ParseDescriptorBlockVariableUsage(
|
||||
}
|
||||
|
||||
static SpvReflectResult ParseDescriptorBlocks(
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectShaderModule* p_module)
|
||||
{
|
||||
if (p_module->descriptor_binding_count == 0) {
|
||||
@ -2619,7 +2629,7 @@ static SpvReflectResult ParseDescriptorBlocks(
|
||||
|
||||
// Mark UNUSED
|
||||
p_descriptor->block.flags |= SPV_REFLECT_VARIABLE_FLAGS_UNUSED;
|
||||
// Parse descriptor block
|
||||
// Parse descriptor block
|
||||
SpvReflectResult result = ParseDescriptorBlockVariable(p_parser, p_module, p_type, &p_descriptor->block);
|
||||
if (result != SPV_REFLECT_RESULT_SUCCESS) {
|
||||
return result;
|
||||
@ -2642,7 +2652,7 @@ static SpvReflectResult ParseDescriptorBlocks(
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p_descriptor->block.name = p_descriptor->name;
|
||||
|
||||
bool is_parent_rta = (p_descriptor->descriptor_type == SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_BUFFER);
|
||||
@ -2680,7 +2690,7 @@ static SpvReflectResult ParseFormat(
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 64: {
|
||||
switch (component_count) {
|
||||
case 2: *p_format = SPV_REFLECT_FORMAT_R64G64_SFLOAT; break;
|
||||
@ -2701,7 +2711,7 @@ static SpvReflectResult ParseFormat(
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 64: {
|
||||
switch (component_count) {
|
||||
case 2: *p_format = signedness ? SPV_REFLECT_FORMAT_R64G64_SINT : SPV_REFLECT_FORMAT_R64G64_UINT; break;
|
||||
@ -2731,7 +2741,7 @@ static SpvReflectResult ParseFormat(
|
||||
break;
|
||||
case 64:
|
||||
*p_format = signedness ? SPV_REFLECT_FORMAT_R64_SINT : SPV_REFLECT_FORMAT_R64_UINT; break;
|
||||
}
|
||||
}
|
||||
result = SPV_REFLECT_RESULT_SUCCESS;
|
||||
}
|
||||
else if (p_type->type_flags & SPV_REFLECT_TYPE_FLAG_STRUCT) {
|
||||
@ -2816,14 +2826,14 @@ static SpvReflectResult ParseInterfaceVariables(
|
||||
|
||||
p_entry->interface_variable_count = interface_variable_count;
|
||||
p_entry->input_variable_count = 0;
|
||||
p_entry->output_variable_count = 0;
|
||||
p_entry->output_variable_count = 0;
|
||||
for (size_t i = 0; i < interface_variable_count; ++i) {
|
||||
uint32_t var_result_id = *(p_interface_variable_ids + i);
|
||||
SpvReflectPrvNode* p_node = FindNode(p_parser, var_result_id);
|
||||
if (IsNull(p_node)) {
|
||||
return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE;
|
||||
}
|
||||
|
||||
|
||||
if (p_node->storage_class == SpvStorageClassInput) {
|
||||
p_entry->input_variable_count += 1;
|
||||
}
|
||||
@ -2831,14 +2841,14 @@ static SpvReflectResult ParseInterfaceVariables(
|
||||
p_entry->output_variable_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (p_entry->input_variable_count > 0) {
|
||||
p_entry->input_variables = (SpvReflectInterfaceVariable**)calloc(p_entry->input_variable_count, sizeof(*(p_entry->input_variables)));
|
||||
if (IsNull(p_entry->input_variables)) {
|
||||
return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (p_entry->output_variable_count > 0) {
|
||||
p_entry->output_variables = (SpvReflectInterfaceVariable**)calloc(p_entry->output_variable_count, sizeof(*(p_entry->output_variables)));
|
||||
if (IsNull(p_entry->output_variables)) {
|
||||
@ -3044,8 +3054,8 @@ static SpvReflectResult ParseStaticallyUsedResources(
|
||||
|
||||
if (called_function_count > 0) {
|
||||
qsort(
|
||||
p_called_functions,
|
||||
called_function_count,
|
||||
p_called_functions,
|
||||
called_function_count,
|
||||
sizeof(*p_called_functions),
|
||||
SortCompareUint32);
|
||||
}
|
||||
@ -3086,7 +3096,7 @@ static SpvReflectResult ParseStaticallyUsedResources(
|
||||
qsort(used_variables, used_variable_count, sizeof(*used_variables),
|
||||
SortCompareUint32);
|
||||
}
|
||||
used_variable_count = (uint32_t)DedupSortedUint32(used_variables,
|
||||
used_variable_count = (uint32_t)DedupSortedUint32(used_variables,
|
||||
used_variable_count);
|
||||
|
||||
// Do set intersection to find the used uniform and push constants
|
||||
@ -3095,7 +3105,7 @@ static SpvReflectResult ParseStaticallyUsedResources(
|
||||
SpvReflectResult result0 = IntersectSortedUint32(
|
||||
used_variables,
|
||||
used_variable_count,
|
||||
uniforms,
|
||||
uniforms,
|
||||
uniform_count,
|
||||
&p_entry->used_uniforms,
|
||||
&used_uniform_count);
|
||||
@ -3103,9 +3113,9 @@ static SpvReflectResult ParseStaticallyUsedResources(
|
||||
size_t used_push_constant_count = 0;
|
||||
//
|
||||
SpvReflectResult result1 = IntersectSortedUint32(
|
||||
used_variables,
|
||||
used_variables,
|
||||
used_variable_count,
|
||||
push_constants,
|
||||
push_constants,
|
||||
push_constant_count,
|
||||
&p_entry->used_push_constants,
|
||||
&used_push_constant_count);
|
||||
@ -3136,7 +3146,7 @@ static SpvReflectResult ParseStaticallyUsedResources(
|
||||
}
|
||||
|
||||
static SpvReflectResult ParseEntryPoints(
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectShaderModule* p_module)
|
||||
{
|
||||
if (p_parser->entry_point_count == 0) {
|
||||
@ -3184,7 +3194,9 @@ static SpvReflectResult ParseEntryPoints(
|
||||
case SpvExecutionModelFragment : p_entry_point->shader_stage = SPV_REFLECT_SHADER_STAGE_FRAGMENT_BIT; break;
|
||||
case SpvExecutionModelGLCompute : p_entry_point->shader_stage = SPV_REFLECT_SHADER_STAGE_COMPUTE_BIT; break;
|
||||
case SpvExecutionModelTaskNV : p_entry_point->shader_stage = SPV_REFLECT_SHADER_STAGE_TASK_BIT_NV; break;
|
||||
case SpvExecutionModelTaskEXT : p_entry_point->shader_stage = SPV_REFLECT_SHADER_STAGE_TASK_BIT_EXT; break;
|
||||
case SpvExecutionModelMeshNV : p_entry_point->shader_stage = SPV_REFLECT_SHADER_STAGE_MESH_BIT_NV; break;
|
||||
case SpvExecutionModelMeshEXT : p_entry_point->shader_stage = SPV_REFLECT_SHADER_STAGE_MESH_BIT_EXT; break;
|
||||
case SpvExecutionModelRayGenerationKHR : p_entry_point->shader_stage = SPV_REFLECT_SHADER_STAGE_RAYGEN_BIT_KHR; break;
|
||||
case SpvExecutionModelIntersectionKHR : p_entry_point->shader_stage = SPV_REFLECT_SHADER_STAGE_INTERSECTION_BIT_KHR; break;
|
||||
case SpvExecutionModelAnyHitKHR : p_entry_point->shader_stage = SPV_REFLECT_SHADER_STAGE_ANY_HIT_BIT_KHR; break;
|
||||
@ -3368,18 +3380,14 @@ static SpvReflectResult ParseExecutionModes(
|
||||
}
|
||||
for (size_t entry_point_idx = 0; entry_point_idx < p_module->entry_point_count; ++entry_point_idx) {
|
||||
SpvReflectEntryPoint* p_entry_point = &p_module->entry_points[entry_point_idx];
|
||||
// -- GODOT begin --
|
||||
if (p_entry_point->execution_mode_count > 0) {
|
||||
// -- GODOT end --
|
||||
p_entry_point->execution_modes =
|
||||
(SpvExecutionMode*)calloc(p_entry_point->execution_mode_count, sizeof(*p_entry_point->execution_modes));
|
||||
if (IsNull(p_entry_point->execution_modes)) {
|
||||
SafeFree(indices);
|
||||
return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
|
||||
}
|
||||
// -- GODOT begin --
|
||||
}
|
||||
// -- GODOT end --
|
||||
}
|
||||
|
||||
for (size_t node_idx = 0; node_idx < p_parser->node_count; ++node_idx) {
|
||||
@ -3477,7 +3485,7 @@ static SpvReflectResult ParseSpecializationConstants(SpvReflectPrvParser* p_pars
|
||||
// -- GODOT end --
|
||||
|
||||
static SpvReflectResult ParsePushConstantBlocks(
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectPrvParser* p_parser,
|
||||
SpvReflectShaderModule* p_module)
|
||||
{
|
||||
for (size_t i = 0; i < p_parser->node_count; ++i) {
|
||||
@ -3534,6 +3542,25 @@ static SpvReflectResult ParsePushConstantBlocks(
|
||||
if (result != SPV_REFLECT_RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
for (uint32_t access_chain_index = 0;
|
||||
access_chain_index < p_parser->access_chain_count;
|
||||
++access_chain_index) {
|
||||
SpvReflectPrvAccessChain* p_access_chain =
|
||||
&(p_parser->access_chains[access_chain_index]);
|
||||
// Skip any access chains that aren't touching this push constant block
|
||||
if (p_push_constant->spirv_id != p_access_chain->base_id) {
|
||||
continue;
|
||||
}
|
||||
result = ParseDescriptorBlockVariableUsage(
|
||||
p_parser, p_module, p_access_chain, 0, (SpvOp)INVALID_VALUE,
|
||||
p_push_constant);
|
||||
if (result != SPV_REFLECT_RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
p_push_constant->name = p_node->name;
|
||||
result = ParseDescriptorBlockVariableSizes(p_parser, p_module, true, false, false, p_push_constant);
|
||||
if (result != SPV_REFLECT_RESULT_SUCCESS) {
|
||||
return result;
|
||||
@ -3784,7 +3811,11 @@ static SpvReflectResult CreateShaderModule(
|
||||
memcpy(p_module->_internal->spirv_code, p_code, size);
|
||||
}
|
||||
|
||||
SpvReflectPrvParser parser = { 0 };
|
||||
// Initialize everything to zero
|
||||
SpvReflectPrvParser parser;
|
||||
memset(&parser, 0, sizeof(SpvReflectPrvParser));
|
||||
|
||||
// Create parser
|
||||
SpvReflectResult result = CreateParser(p_module->_internal->spirv_size,
|
||||
p_module->_internal->spirv_code,
|
||||
&parser);
|
||||
@ -4601,7 +4632,7 @@ const SpvReflectDescriptorBinding* spvReflectGetEntryPointDescriptorBinding(
|
||||
for (uint32_t index = 0; index < p_module->descriptor_binding_count; ++index) {
|
||||
const SpvReflectDescriptorBinding* p_potential = &p_module->descriptor_bindings[index];
|
||||
bool found = SearchSortedUint32(
|
||||
p_entry->used_uniforms,
|
||||
p_entry->used_uniforms,
|
||||
p_entry->used_uniform_count,
|
||||
p_potential->spirv_id);
|
||||
if ((p_potential->binding == binding_number) && (p_potential->set == set_number) && found) {
|
||||
@ -5107,8 +5138,8 @@ SpvReflectResult spvReflectChangeDescriptorBindingNumber(
|
||||
)
|
||||
{
|
||||
return spvReflectChangeDescriptorBindingNumbers(
|
||||
p_module,p_descriptor_binding,
|
||||
new_binding_number,
|
||||
p_module,p_descriptor_binding,
|
||||
new_binding_number,
|
||||
optional_new_set_number);
|
||||
}
|
||||
|
||||
|
||||
7
thirdparty/spirv-reflect/spirv_reflect.h
vendored
7
thirdparty/spirv-reflect/spirv_reflect.h
vendored
@ -230,7 +230,9 @@ typedef enum SpvReflectShaderStageFlagBits {
|
||||
SPV_REFLECT_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, // = VK_SHADER_STAGE_FRAGMENT_BIT
|
||||
SPV_REFLECT_SHADER_STAGE_COMPUTE_BIT = 0x00000020, // = VK_SHADER_STAGE_COMPUTE_BIT
|
||||
SPV_REFLECT_SHADER_STAGE_TASK_BIT_NV = 0x00000040, // = VK_SHADER_STAGE_TASK_BIT_NV
|
||||
SPV_REFLECT_SHADER_STAGE_TASK_BIT_EXT = SPV_REFLECT_SHADER_STAGE_TASK_BIT_NV, // = VK_SHADER_STAGE_CALLABLE_BIT_EXT
|
||||
SPV_REFLECT_SHADER_STAGE_MESH_BIT_NV = 0x00000080, // = VK_SHADER_STAGE_MESH_BIT_NV
|
||||
SPV_REFLECT_SHADER_STAGE_MESH_BIT_EXT = SPV_REFLECT_SHADER_STAGE_MESH_BIT_NV, // = VK_SHADER_STAGE_CALLABLE_BIT_EXT
|
||||
SPV_REFLECT_SHADER_STAGE_RAYGEN_BIT_KHR = 0x00000100, // = VK_SHADER_STAGE_RAYGEN_BIT_KHR
|
||||
SPV_REFLECT_SHADER_STAGE_ANY_HIT_BIT_KHR = 0x00000200, // = VK_SHADER_STAGE_ANY_HIT_BIT_KHR
|
||||
SPV_REFLECT_SHADER_STAGE_CLOSEST_HIT_BIT_KHR = 0x00000400, // = VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR
|
||||
@ -401,6 +403,11 @@ typedef struct SpvReflectBlockVariable {
|
||||
struct SpvReflectBlockVariable* members;
|
||||
|
||||
SpvReflectTypeDescription* type_description;
|
||||
|
||||
struct {
|
||||
uint32_t offset;
|
||||
} word_offset;
|
||||
|
||||
} SpvReflectBlockVariable;
|
||||
|
||||
/*! @struct SpvReflectDescriptorBinding
|
||||
|
||||
Reference in New Issue
Block a user