vulkan: Update components to Vulkan SDK 1.3.268.0
This commit is contained in:
136
thirdparty/spirv-reflect/spirv_reflect.c
vendored
136
thirdparty/spirv-reflect/spirv_reflect.c
vendored
@ -129,6 +129,9 @@ typedef struct SpvReflectPrvDecorations {
|
||||
bool is_flat;
|
||||
bool is_non_writable;
|
||||
bool is_non_readable;
|
||||
bool is_patch;
|
||||
bool is_per_vertex;
|
||||
bool is_per_task;
|
||||
SpvReflectPrvNumberDecoration set;
|
||||
SpvReflectPrvNumberDecoration binding;
|
||||
SpvReflectPrvNumberDecoration input_attachment_index;
|
||||
@ -515,6 +518,15 @@ static SpvReflectDecorationFlags ApplyDecorations(const SpvReflectPrvDecorations
|
||||
if (p_decoration_fields->is_non_readable) {
|
||||
decorations |= SPV_REFLECT_DECORATION_NON_READABLE;
|
||||
}
|
||||
if (p_decoration_fields->is_patch) {
|
||||
decorations |= SPV_REFLECT_DECORATION_PATCH;
|
||||
}
|
||||
if (p_decoration_fields->is_per_vertex) {
|
||||
decorations |= SPV_REFLECT_DECORATION_PER_VERTEX;
|
||||
}
|
||||
if (p_decoration_fields->is_per_task) {
|
||||
decorations |= SPV_REFLECT_DECORATION_PER_TASK;
|
||||
}
|
||||
return decorations;
|
||||
}
|
||||
|
||||
@ -528,6 +540,10 @@ static void ApplyArrayTraits(const SpvReflectTypeDescription* p_type, SpvReflect
|
||||
memcpy(p_array_traits, &p_type->traits.array, sizeof(p_type->traits.array));
|
||||
}
|
||||
|
||||
static bool IsSpecConstant(const SpvReflectPrvNode* p_node) {
|
||||
return (p_node->op == SpvOpSpecConstant || p_node->op == SpvOpSpecConstantOp);
|
||||
}
|
||||
|
||||
static SpvReflectPrvNode* FindNode(
|
||||
SpvReflectPrvParser* p_parser,
|
||||
uint32_t result_id)
|
||||
@ -599,6 +615,9 @@ static uint32_t FindBaseId(SpvReflectPrvParser* p_parser,
|
||||
}
|
||||
base_id = base_ac->base_id;
|
||||
base_node = FindNode(p_parser, base_id);
|
||||
if (IsNull(base_node)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return base_id;
|
||||
}
|
||||
@ -618,12 +637,15 @@ static SpvReflectBlockVariable* GetRefBlkVar(SpvReflectPrvParser* p_parser,
|
||||
|
||||
bool IsPointerToPointer(SpvReflectPrvParser* p_parser, uint32_t type_id) {
|
||||
SpvReflectPrvNode* ptr_node = FindNode(p_parser, type_id);
|
||||
if (ptr_node->op != SpvOpTypePointer) {
|
||||
if (IsNull(ptr_node) || (ptr_node->op != SpvOpTypePointer)) {
|
||||
return false;
|
||||
}
|
||||
uint32_t pte_id = 0;
|
||||
UNCHECKED_READU32(p_parser, ptr_node->word_offset + 3, pte_id);
|
||||
SpvReflectPrvNode* pte_node = FindNode(p_parser, pte_id);
|
||||
if (IsNull(pte_node)) {
|
||||
return false;
|
||||
}
|
||||
return pte_node->op == SpvOpTypePointer;
|
||||
}
|
||||
|
||||
@ -1493,6 +1515,9 @@ static SpvReflectResult ParseDecorations(SpvReflectPrvParser* p_parser)
|
||||
case SpvDecorationFlat:
|
||||
case SpvDecorationNonWritable:
|
||||
case SpvDecorationNonReadable:
|
||||
case SpvDecorationPatch:
|
||||
case SpvDecorationPerVertexKHR:
|
||||
case SpvDecorationPerTaskNV:
|
||||
case SpvDecorationLocation:
|
||||
case SpvDecorationComponent:
|
||||
case SpvDecorationBinding:
|
||||
@ -1597,6 +1622,18 @@ static SpvReflectResult ParseDecorations(SpvReflectPrvParser* p_parser)
|
||||
}
|
||||
break;
|
||||
|
||||
case SpvDecorationPatch: {
|
||||
p_target_decorations->is_patch = true;
|
||||
} break;
|
||||
|
||||
case SpvDecorationPerVertexKHR: {
|
||||
p_target_decorations->is_per_vertex = true;
|
||||
} break;
|
||||
|
||||
case SpvDecorationPerTaskNV: {
|
||||
p_target_decorations->is_per_task = true;
|
||||
} break;
|
||||
|
||||
case SpvDecorationLocation: {
|
||||
uint32_t word_offset = p_node->word_offset + member_offset + 3;
|
||||
CHECKED_READU32(p_parser, word_offset, p_target_decorations->location.value);
|
||||
@ -1846,8 +1883,7 @@ static SpvReflectResult ParseType(
|
||||
SpvReflectPrvNode* p_length_node = FindNode(p_parser, length_id);
|
||||
if (IsNotNull(p_length_node)) {
|
||||
uint32_t dim_index = p_type->traits.array.dims_count;
|
||||
if (p_length_node->op == SpvOpSpecConstant ||
|
||||
p_length_node->op == SpvOpSpecConstantOp) {
|
||||
if (IsSpecConstant(p_length_node)) {
|
||||
p_type->traits.array.dims[dim_index] =
|
||||
(uint32_t)SPV_REFLECT_ARRAY_DIM_SPEC_CONSTANT;
|
||||
p_type->traits.array.spec_constant_op_ids[dim_index] = length_id;
|
||||
@ -3131,7 +3167,7 @@ static SpvReflectResult ParseInterfaceVariables(
|
||||
}
|
||||
|
||||
SpvReflectTypeDescription* p_type = FindType(p_module, p_node->type_id);
|
||||
if (IsNull(p_node)) {
|
||||
if (IsNull(p_node) || IsNull(p_type)) {
|
||||
return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE;
|
||||
}
|
||||
// If the type is a pointer, resolve it
|
||||
@ -3533,7 +3569,8 @@ static SpvReflectResult ParseExecutionModes(
|
||||
if (IsNotNull(p_parser) && IsNotNull(p_parser->spirv_code) && IsNotNull(p_parser->nodes)) {
|
||||
for (size_t node_idx = 0; node_idx < p_parser->node_count; ++node_idx) {
|
||||
SpvReflectPrvNode* p_node = &(p_parser->nodes[node_idx]);
|
||||
if (p_node->op != SpvOpExecutionMode) {
|
||||
if (p_node->op != SpvOpExecutionMode &&
|
||||
p_node->op != SpvOpExecutionModeId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -3560,41 +3597,55 @@ static SpvReflectResult ParseExecutionModes(
|
||||
|
||||
// Parse execution mode
|
||||
switch (execution_mode) {
|
||||
default: {
|
||||
return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_EXECUTION_MODE;
|
||||
}
|
||||
break;
|
||||
|
||||
case SpvExecutionModeInvocations: {
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 3, p_entry_point->invocations);
|
||||
}
|
||||
break;
|
||||
|
||||
case SpvExecutionModeSpacingEqual:
|
||||
case SpvExecutionModeSpacingFractionalEven:
|
||||
case SpvExecutionModeSpacingFractionalOdd:
|
||||
case SpvExecutionModeVertexOrderCw:
|
||||
case SpvExecutionModeVertexOrderCcw:
|
||||
case SpvExecutionModePixelCenterInteger:
|
||||
case SpvExecutionModeOriginUpperLeft:
|
||||
case SpvExecutionModeOriginLowerLeft:
|
||||
case SpvExecutionModeEarlyFragmentTests:
|
||||
case SpvExecutionModePointMode:
|
||||
case SpvExecutionModeXfb:
|
||||
case SpvExecutionModeDepthReplacing:
|
||||
case SpvExecutionModeDepthGreater:
|
||||
case SpvExecutionModeDepthLess:
|
||||
case SpvExecutionModeDepthUnchanged:
|
||||
break;
|
||||
|
||||
case SpvExecutionModeLocalSize: {
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 3, p_entry_point->local_size.x);
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 4, p_entry_point->local_size.y);
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 5, p_entry_point->local_size.z);
|
||||
}
|
||||
break;
|
||||
case SpvExecutionModeLocalSizeId: {
|
||||
uint32_t local_size_x_id = 0;
|
||||
uint32_t local_size_y_id = 0;
|
||||
uint32_t local_size_z_id = 0;
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 3, local_size_x_id);
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 4, local_size_y_id);
|
||||
CHECKED_READU32(p_parser, p_node->word_offset + 5, local_size_z_id);
|
||||
|
||||
SpvReflectPrvNode* x_node = FindNode(p_parser, local_size_x_id);
|
||||
SpvReflectPrvNode* y_node = FindNode(p_parser, local_size_y_id);
|
||||
SpvReflectPrvNode* z_node = FindNode(p_parser, local_size_z_id);
|
||||
if (IsNotNull(x_node) && IsNotNull(y_node) && IsNotNull(z_node)) {
|
||||
if (IsSpecConstant(x_node)) {
|
||||
p_entry_point->local_size.x =
|
||||
(uint32_t)SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT;
|
||||
} else {
|
||||
CHECKED_READU32(p_parser, x_node->word_offset + 3,
|
||||
p_entry_point->local_size.x);
|
||||
}
|
||||
|
||||
if (IsSpecConstant(y_node)) {
|
||||
p_entry_point->local_size.y =
|
||||
(uint32_t)SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT;
|
||||
} else {
|
||||
CHECKED_READU32(p_parser, y_node->word_offset + 3,
|
||||
p_entry_point->local_size.y);
|
||||
}
|
||||
|
||||
if (IsSpecConstant(z_node)) {
|
||||
p_entry_point->local_size.z =
|
||||
(uint32_t)SPV_REFLECT_EXECUTION_MODE_SPEC_CONSTANT;
|
||||
} else {
|
||||
CHECKED_READU32(p_parser, z_node->word_offset + 3,
|
||||
p_entry_point->local_size.z);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case SpvExecutionModeLocalSizeHint:
|
||||
case SpvExecutionModeInputPoints:
|
||||
case SpvExecutionModeInputLines:
|
||||
case SpvExecutionModeInputLinesAdjacency:
|
||||
@ -3607,32 +3658,7 @@ static SpvReflectResult ParseExecutionModes(
|
||||
}
|
||||
break;
|
||||
|
||||
case SpvExecutionModeOutputPoints:
|
||||
case SpvExecutionModeOutputLineStrip:
|
||||
case SpvExecutionModeOutputTriangleStrip:
|
||||
case SpvExecutionModeVecTypeHint:
|
||||
case SpvExecutionModeContractionOff:
|
||||
case SpvExecutionModeInitializer:
|
||||
case SpvExecutionModeFinalizer:
|
||||
case SpvExecutionModeSubgroupSize:
|
||||
case SpvExecutionModeSubgroupsPerWorkgroup:
|
||||
case SpvExecutionModeSubgroupsPerWorkgroupId:
|
||||
case SpvExecutionModeLocalSizeId:
|
||||
case SpvExecutionModeLocalSizeHintId:
|
||||
case SpvExecutionModePostDepthCoverage:
|
||||
case SpvExecutionModeDenormPreserve:
|
||||
case SpvExecutionModeDenormFlushToZero:
|
||||
case SpvExecutionModeSignedZeroInfNanPreserve:
|
||||
case SpvExecutionModeRoundingModeRTE:
|
||||
case SpvExecutionModeRoundingModeRTZ:
|
||||
case SpvExecutionModeStencilRefReplacingEXT:
|
||||
case SpvExecutionModeOutputLinesNV:
|
||||
case SpvExecutionModeOutputPrimitivesNV:
|
||||
case SpvExecutionModeOutputTrianglesNV:
|
||||
case SpvExecutionModePixelInterlockOrderedEXT:
|
||||
case SpvExecutionModePixelInterlockUnorderedEXT:
|
||||
case SpvExecutionModeSampleInterlockOrderedEXT:
|
||||
case SpvExecutionModeSampleInterlockUnorderedEXT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
p_entry_point->execution_mode_count++;
|
||||
@ -3777,7 +3803,7 @@ static SpvReflectResult ParsePushConstantBlocks(
|
||||
}
|
||||
|
||||
SpvReflectTypeDescription* p_type = FindType(p_module, p_node->type_id);
|
||||
if (IsNull(p_node)) {
|
||||
if (IsNull(p_node) || IsNull(p_type)) {
|
||||
return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE;
|
||||
}
|
||||
// If the type is a pointer, resolve it
|
||||
|
||||
Reference in New Issue
Block a user