summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp')
-rw-r--r--3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp79
1 files changed, 54 insertions, 25 deletions
diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp
index b53f991e87d..d5823219d93 100644
--- a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp
+++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp
@@ -17,6 +17,7 @@
#include <cassert>
#include "DebugInfo.h"
+#include "NonSemanticShaderDebugInfo100.h"
#include "OpenCLDebugInfo100.h"
#include "source/diagnostic.h"
#include "source/opcode.h"
@@ -37,17 +38,7 @@ spv_result_t ModuleScopedInstructions(ValidationState_t& _,
const Instruction* inst, SpvOp opcode) {
switch (opcode) {
case SpvOpExtInst:
- if (spvExtInstIsNonSemantic(inst->ext_inst_type())) {
- // non-semantic extinst opcodes are allowed beginning in the types
- // section, but since they must name a return type they cannot be the
- // first instruction in the types section. Therefore check that we are
- // already in it.
- if (_.current_layout_section() < kLayoutTypes) {
- return _.diag(SPV_ERROR_INVALID_LAYOUT, inst)
- << "Non-semantic OpExtInst must not appear before types "
- << "section";
- }
- } else if (spvExtInstIsDebugInfo(inst->ext_inst_type())) {
+ if (spvExtInstIsDebugInfo(inst->ext_inst_type())) {
const uint32_t ext_inst_index = inst->word(4);
bool local_debug_info = false;
if (inst->ext_inst_type() == SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100) {
@@ -59,6 +50,20 @@ spv_result_t ModuleScopedInstructions(ValidationState_t& _,
ext_inst_key == OpenCLDebugInfo100DebugValue) {
local_debug_info = true;
}
+ } else if (inst->ext_inst_type() ==
+ SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100) {
+ const NonSemanticShaderDebugInfo100Instructions ext_inst_key =
+ NonSemanticShaderDebugInfo100Instructions(ext_inst_index);
+ if (ext_inst_key == NonSemanticShaderDebugInfo100DebugScope ||
+ ext_inst_key == NonSemanticShaderDebugInfo100DebugNoScope ||
+ ext_inst_key == NonSemanticShaderDebugInfo100DebugDeclare ||
+ ext_inst_key == NonSemanticShaderDebugInfo100DebugValue ||
+ ext_inst_key == NonSemanticShaderDebugInfo100DebugLine ||
+ ext_inst_key == NonSemanticShaderDebugInfo100DebugNoLine ||
+ ext_inst_key ==
+ NonSemanticShaderDebugInfo100DebugFunctionDefinition) {
+ local_debug_info = true;
+ }
} else {
const DebugInfoInstructions ext_inst_key =
DebugInfoInstructions(ext_inst_index);
@@ -94,6 +99,16 @@ spv_result_t ModuleScopedInstructions(ValidationState_t& _,
<< "declarations)";
}
}
+ } else if (spvExtInstIsNonSemantic(inst->ext_inst_type())) {
+ // non-semantic extinst opcodes are allowed beginning in the types
+ // section, but since they must name a return type they cannot be the
+ // first instruction in the types section. Therefore check that we are
+ // already in it.
+ if (_.current_layout_section() < kLayoutTypes) {
+ return _.diag(SPV_ERROR_INVALID_LAYOUT, inst)
+ << "Non-semantic OpExtInst must not appear before types "
+ << "section";
+ }
} else {
// otherwise they must be used in a block
if (_.current_layout_section() < kLayoutFunctionDefinitions) {
@@ -230,20 +245,7 @@ spv_result_t FunctionScopedInstructions(ValidationState_t& _,
break;
case SpvOpExtInst:
- if (spvExtInstIsNonSemantic(inst->ext_inst_type())) {
- // non-semantic extinst opcodes are allowed beginning in the types
- // section, but must either be placed outside a function declaration,
- // or inside a block.
- if (_.current_layout_section() < kLayoutTypes) {
- return _.diag(SPV_ERROR_INVALID_LAYOUT, inst)
- << "Non-semantic OpExtInst must not appear before types "
- << "section";
- } else if (_.in_function_body() && _.in_block() == false) {
- return _.diag(SPV_ERROR_INVALID_LAYOUT, inst)
- << "Non-semantic OpExtInst within function definition must "
- "appear in a block";
- }
- } else if (spvExtInstIsDebugInfo(inst->ext_inst_type())) {
+ if (spvExtInstIsDebugInfo(inst->ext_inst_type())) {
const uint32_t ext_inst_index = inst->word(4);
bool local_debug_info = false;
if (inst->ext_inst_type() == SPV_EXT_INST_TYPE_OPENCL_DEBUGINFO_100) {
@@ -255,6 +257,20 @@ spv_result_t FunctionScopedInstructions(ValidationState_t& _,
ext_inst_key == OpenCLDebugInfo100DebugValue) {
local_debug_info = true;
}
+ } else if (inst->ext_inst_type() ==
+ SPV_EXT_INST_TYPE_NONSEMANTIC_SHADER_DEBUGINFO_100) {
+ const NonSemanticShaderDebugInfo100Instructions ext_inst_key =
+ NonSemanticShaderDebugInfo100Instructions(ext_inst_index);
+ if (ext_inst_key == NonSemanticShaderDebugInfo100DebugScope ||
+ ext_inst_key == NonSemanticShaderDebugInfo100DebugNoScope ||
+ ext_inst_key == NonSemanticShaderDebugInfo100DebugDeclare ||
+ ext_inst_key == NonSemanticShaderDebugInfo100DebugValue ||
+ ext_inst_key == NonSemanticShaderDebugInfo100DebugLine ||
+ ext_inst_key == NonSemanticShaderDebugInfo100DebugNoLine ||
+ ext_inst_key ==
+ NonSemanticShaderDebugInfo100DebugFunctionDefinition) {
+ local_debug_info = true;
+ }
} else {
const DebugInfoInstructions ext_inst_key =
DebugInfoInstructions(ext_inst_index);
@@ -290,6 +306,19 @@ spv_result_t FunctionScopedInstructions(ValidationState_t& _,
<< "declarations)";
}
}
+ } else if (spvExtInstIsNonSemantic(inst->ext_inst_type())) {
+ // non-semantic extinst opcodes are allowed beginning in the types
+ // section, but must either be placed outside a function declaration,
+ // or inside a block.
+ if (_.current_layout_section() < kLayoutTypes) {
+ return _.diag(SPV_ERROR_INVALID_LAYOUT, inst)
+ << "Non-semantic OpExtInst must not appear before types "
+ << "section";
+ } else if (_.in_function_body() && _.in_block() == false) {
+ return _.diag(SPV_ERROR_INVALID_LAYOUT, inst)
+ << "Non-semantic OpExtInst within function definition must "
+ "appear in a block";
+ }
} else {
// otherwise they must be used in a block
if (_.in_block() == false) {