Mend git merge history for SPIRV-Headers and SPIRV-Tools
https://swiftshader-review.googlesource.com/c/SwiftShader/+/50749
squashed together the changes from two `git subtree pull` commands (for
SPIRV-Headers and SPIRV-Tools), which resulted in a change with a single
parent.
`git subtree` expects a merge commit with a single set of `git-subtree-*`
metadata tags. The squash resulted in a change description with two sets
of these, confusing `git subtree` even further.
The process to fix this is probably not the easiest, but the first one I found that works:
# Rollback to the parent change of 50749
git checkout 43bb60e1fa119d80b449c6550dd2b72328b101b9
# Perform the subtree pull again for SPIRV-Headers (to 104ecc356)
git subtree pull --prefix third_party/SPIRV-Headers https://github.com/KhronosGroup/SPIRV-Headers 104ecc356c1bea4476320faca64440cd1df655a3 --squash -m "Update SPIR-V Headers"
# Note the second parent of the merge for the SPIRV-Headers (Merge: 43bb60e1fa1 ded361b487d)
git show -1
# Perform the subtree pull again for SPIRV-Tools (to b0e22d28f)
git subtree pull --prefix third_party/SPIRV-Tools https://github.com/KhronosGroup/SPIRV-Tools b0e22d28f5ec891d6b256703575d08fce4228bd9 --squash -m "Update SPIR-V Tools"
# Note the second parent of the merge for the SPIRV-Tools (Merge: a00ce432a9d bdb9eea9049)
git show -1
# Jump back to master
git checkout origin/master
# Revert 50749
git revert 9dff6a3bb5950edd890e5141f2d3d2f3b4ef351e
# Re-merge the squashed update change for SPIRV-Headers
git merge -Xsubtree="third_party/SPIRV-Headers" ded361b487d
# Re-merge the squashed update change for SPIRV-Tools **this change**
git merge -Xsubtree="third_party/SPIRV-Tools" bdb9eea9049
Bug: b/174239232
Change-Id: I51ff23aa3b8a96ce45ada7f5f14f196196a236c3
diff --git a/third_party/SPIRV-Tools/DEPS b/third_party/SPIRV-Tools/DEPS
index ef3ee5d..350cfb4 100644
--- a/third_party/SPIRV-Tools/DEPS
+++ b/third_party/SPIRV-Tools/DEPS
@@ -6,7 +6,7 @@
'effcee_revision': '2ec8f8738118cc483b67c04a759fee53496c5659',
'googletest_revision': '3af06fe1664d30f98de1e78c53a7087e842a2547',
're2_revision': 'ca11026a032ce2a3de4b3c389ee53d2bdc8794d6',
- 'spirv_headers_revision': '05836bdba63e7debce9fa9feaed42f20cd43af9d',
+ 'spirv_headers_revision': '4de110ce1c78fda37932c735ef7f747e6f6cbee8',
}
deps = {
diff --git a/third_party/SPIRV-Tools/source/fuzz/force_render_red.cpp b/third_party/SPIRV-Tools/source/fuzz/force_render_red.cpp
index ed60bd0..fd0587a 100644
--- a/third_party/SPIRV-Tools/source/fuzz/force_render_red.cpp
+++ b/third_party/SPIRV-Tools/source/fuzz/force_render_red.cpp
@@ -212,7 +212,6 @@
auto new_exit_block = MakeUnique<opt::BasicBlock>(std::move(label));
new_exit_block->AddInstruction(MakeUnique<opt::Instruction>(
ir_context.get(), SpvOpReturn, 0, 0, opt::Instruction::OperandList()));
- new_exit_block->SetParent(entry_point_function);
entry_point_function->AddBasicBlock(std::move(new_exit_block));
}
diff --git a/third_party/SPIRV-Tools/source/fuzz/transformation_add_dead_block.cpp b/third_party/SPIRV-Tools/source/fuzz/transformation_add_dead_block.cpp
index 3d77a80..5dce356 100644
--- a/third_party/SPIRV-Tools/source/fuzz/transformation_add_dead_block.cpp
+++ b/third_party/SPIRV-Tools/source/fuzz/transformation_add_dead_block.cpp
@@ -153,7 +153,6 @@
: successor_block_id}}});
// Add the new block to the enclosing function.
- new_block->SetParent(enclosing_function);
enclosing_function->InsertBasicBlockAfter(std::move(new_block),
existing_block);
diff --git a/third_party/SPIRV-Tools/source/fuzz/transformation_add_early_terminator_wrapper.cpp b/third_party/SPIRV-Tools/source/fuzz/transformation_add_early_terminator_wrapper.cpp
index 0aa1214..9f86070 100644
--- a/third_party/SPIRV-Tools/source/fuzz/transformation_add_early_terminator_wrapper.cpp
+++ b/third_party/SPIRV-Tools/source/fuzz/transformation_add_early_terminator_wrapper.cpp
@@ -84,7 +84,6 @@
// Add the basic block to the function as the sole block, and add the function
// to the module.
- basic_block->SetParent(function.get());
function->AddBasicBlock(std::move(basic_block));
function->SetFunctionEnd(MakeUnique<opt::Instruction>(
ir_context, SpvOpFunctionEnd, 0, 0, opt::Instruction::OperandList()));
diff --git a/third_party/SPIRV-Tools/source/fuzz/transformation_add_function.cpp b/third_party/SPIRV-Tools/source/fuzz/transformation_add_function.cpp
index 214f741..9799373 100644
--- a/third_party/SPIRV-Tools/source/fuzz/transformation_add_function.cpp
+++ b/third_party/SPIRV-Tools/source/fuzz/transformation_add_function.cpp
@@ -276,12 +276,10 @@
// Invariant: we should always be at a label instruction at this point.
assert(message_.instruction(instruction_index).opcode() == SpvOpLabel);
- // Make a basic block using the label instruction, with the new function
- // as its parent.
+ // Make a basic block using the label instruction.
std::unique_ptr<opt::BasicBlock> block =
MakeUnique<opt::BasicBlock>(InstructionFromMessage(
ir_context, message_.instruction(instruction_index)));
- block->SetParent(new_function.get());
// Consider successive instructions until we hit another label or the end
// of the function, adding each such instruction to the block.
diff --git a/third_party/SPIRV-Tools/source/fuzz/transformation_composite_construct.cpp b/third_party/SPIRV-Tools/source/fuzz/transformation_composite_construct.cpp
index f6711f5..f0de1ae 100644
--- a/third_party/SPIRV-Tools/source/fuzz/transformation_composite_construct.cpp
+++ b/third_party/SPIRV-Tools/source/fuzz/transformation_composite_construct.cpp
@@ -283,15 +283,25 @@
ir_context->get_type_mgr()->GetType(message_.composite_type_id());
uint32_t index = 0;
for (auto component : message_.component()) {
+ auto component_type = ir_context->get_type_mgr()->GetType(
+ ir_context->get_def_use_mgr()->GetDef(component)->type_id());
+ // Whether the component is a vector being packed into a vector determines
+ // how we should keep track of the indices associated with components.
+ const bool packing_vector_into_vector =
+ composite_type->AsVector() && component_type->AsVector();
if (!fuzzerutil::CanMakeSynonymOf(
ir_context, *transformation_context,
ir_context->get_def_use_mgr()->GetDef(component))) {
- index++;
+ // We can't make a synonym of this component, so we skip on to the next
+ // component. In the case where we're packing a vector into a vector we
+ // have to skip as many components of the resulting vectors as there are
+ // elements of the component vector.
+ index += packing_vector_into_vector
+ ? component_type->AsVector()->element_count()
+ : 1;
continue;
}
- auto component_type = ir_context->get_type_mgr()->GetType(
- ir_context->get_def_use_mgr()->GetDef(component)->type_id());
- if (composite_type->AsVector() && component_type->AsVector()) {
+ if (packing_vector_into_vector) {
// The case where the composite being constructed is a vector and the
// component provided for construction is also a vector is special. It
// requires adding a synonym fact relating each element of the sub-vector
diff --git a/third_party/SPIRV-Tools/source/fuzz/transformation_flatten_conditional_branch.cpp b/third_party/SPIRV-Tools/source/fuzz/transformation_flatten_conditional_branch.cpp
index dec933c..fdee513 100644
--- a/third_party/SPIRV-Tools/source/fuzz/transformation_flatten_conditional_branch.cpp
+++ b/third_party/SPIRV-Tools/source/fuzz/transformation_flatten_conditional_branch.cpp
@@ -512,15 +512,31 @@
return false;
}
+ // The base objects for all data descriptors involved in synonym facts.
+ std::unordered_set<uint32_t> synonym_base_objects;
+ for (auto* synonym :
+ transformation_context.GetFactManager()->GetAllSynonyms()) {
+ synonym_base_objects.insert(synonym->object());
+ }
+
// Check all of the instructions in the block.
- bool all_instructions_compatible =
- block->WhileEachInst([ir_context, instructions_that_need_ids](
- opt::Instruction* instruction) {
+ bool all_instructions_compatible = block->WhileEachInst(
+ [ir_context, instructions_that_need_ids,
+ &synonym_base_objects](opt::Instruction* instruction) {
// We can ignore OpLabel instructions.
if (instruction->opcode() == SpvOpLabel) {
return true;
}
+ // If the instruction is the base object of some synonym then we
+ // conservatively bail out: if a synonym ends up depending on an
+ // instruction that needs to be enclosed in a side-effect wrapper then
+ // it might no longer hold after we flatten the conditional.
+ if (instruction->result_id() &&
+ synonym_base_objects.count(instruction->result_id())) {
+ return false;
+ }
+
// If the instruction is a branch, it must be an unconditional branch.
if (instruction->IsBranch()) {
return instruction->opcode() == SpvOpBranch;
diff --git a/third_party/SPIRV-Tools/source/fuzz/transformation_flatten_conditional_branch.h b/third_party/SPIRV-Tools/source/fuzz/transformation_flatten_conditional_branch.h
index e8cb414..9bdae93 100644
--- a/third_party/SPIRV-Tools/source/fuzz/transformation_flatten_conditional_branch.h
+++ b/third_party/SPIRV-Tools/source/fuzz/transformation_flatten_conditional_branch.h
@@ -41,6 +41,8 @@
// single-exit region.
// - The region must not contain barrier or OpSampledImage instructions.
// - The region must not contain selection or loop constructs.
+ // - The region must not define ids that are the base objects for existing
+ // synonym facts.
// - For each instruction that requires additional fresh ids, then:
// - if the instruction is mapped to the required ids for enclosing it by
// |message_.side_effect_wrapper_info|, these must be valid (the
diff --git a/third_party/SPIRV-Tools/source/fuzz/transformation_inline_function.cpp b/third_party/SPIRV-Tools/source/fuzz/transformation_inline_function.cpp
index f58b123..f997491 100644
--- a/third_party/SPIRV-Tools/source/fuzz/transformation_inline_function.cpp
+++ b/third_party/SPIRV-Tools/source/fuzz/transformation_inline_function.cpp
@@ -183,7 +183,6 @@
auto* cloned_block = block.Clone(ir_context);
cloned_block = caller_function->InsertBasicBlockBefore(
std::unique_ptr<opt::BasicBlock>(cloned_block), successor_block);
- cloned_block->SetParent(caller_function);
cloned_block->GetLabel()->SetResultId(result_id_map.at(cloned_block->id()));
fuzzerutil::UpdateModuleIdBound(ir_context, cloned_block->id());
diff --git a/third_party/SPIRV-Tools/source/fuzz/transformation_merge_function_returns.cpp b/third_party/SPIRV-Tools/source/fuzz/transformation_merge_function_returns.cpp
index 90578a2..c7cb557 100644
--- a/third_party/SPIRV-Tools/source/fuzz/transformation_merge_function_returns.cpp
+++ b/third_party/SPIRV-Tools/source/fuzz/transformation_merge_function_returns.cpp
@@ -579,7 +579,6 @@
}
// Insert the new return block at the end of the function.
- outer_return_block->SetParent(function);
function->AddBasicBlock(std::move(outer_return_block));
// All analyses must be invalidated because the structure of the module was
diff --git a/third_party/SPIRV-Tools/source/fuzz/transformation_outline_function.cpp b/third_party/SPIRV-Tools/source/fuzz/transformation_outline_function.cpp
index 26f9e0b..643fd69 100644
--- a/third_party/SPIRV-Tools/source/fuzz/transformation_outline_function.cpp
+++ b/third_party/SPIRV-Tools/source/fuzz/transformation_outline_function.cpp
@@ -778,7 +778,6 @@
MakeUnique<opt::BasicBlock>(MakeUnique<opt::Instruction>(
ir_context, SpvOpLabel, 0, message_.new_function_region_entry_block(),
opt::Instruction::OperandList()));
- outlined_region_entry_block->SetParent(outlined_function);
if (&original_region_entry_block == &original_region_exit_block) {
outlined_region_exit_block = outlined_region_entry_block.get();
@@ -815,8 +814,6 @@
outlined_region_exit_block = cloned_block.get();
}
- cloned_block->SetParent(outlined_function);
-
// Redirect any OpPhi operands whose predecessors are the original region
// entry block to become the new function entry block.
cloned_block->ForEachPhiInst([this](opt::Instruction* phi_inst) {
diff --git a/third_party/SPIRV-Tools/source/opcode.cpp b/third_party/SPIRV-Tools/source/opcode.cpp
index 8305bcf..c80e3a0 100644
--- a/third_party/SPIRV-Tools/source/opcode.cpp
+++ b/third_party/SPIRV-Tools/source/opcode.cpp
@@ -337,7 +337,7 @@
case SpvOpTypeCooperativeMatrixNV:
// case SpvOpTypeAccelerationStructureKHR: covered by
// SpvOpTypeAccelerationStructureNV
- case SpvOpTypeRayQueryProvisionalKHR:
+ case SpvOpTypeRayQueryKHR:
return true;
default:
// In particular, OpTypeForwardPointer does not generate a type,
diff --git a/third_party/SPIRV-Tools/source/opt/basic_block.cpp b/third_party/SPIRV-Tools/source/opt/basic_block.cpp
index 3608448..b7e122c 100644
--- a/third_party/SPIRV-Tools/source/opt/basic_block.cpp
+++ b/third_party/SPIRV-Tools/source/opt/basic_block.cpp
@@ -248,7 +248,8 @@
function_->InsertBasicBlockAfter(std::move(new_block_temp), this);
new_block->insts_.Splice(new_block->end(), &insts_, iter, end());
- new_block->SetParent(GetParent());
+ assert(new_block->GetParent() == GetParent() &&
+ "The parent should already be set appropriately.");
context->AnalyzeDefUse(new_block->GetLabelInst());
diff --git a/third_party/SPIRV-Tools/source/opt/debug_info_manager.cpp b/third_party/SPIRV-Tools/source/opt/debug_info_manager.cpp
index 87ef655..11b5131 100644
--- a/third_party/SPIRV-Tools/source/opt/debug_info_manager.cpp
+++ b/third_party/SPIRV-Tools/source/opt/debug_info_manager.cpp
@@ -31,9 +31,7 @@
static const uint32_t kDebugExpressOperandOperationIndex = 4;
static const uint32_t kDebugDeclareOperandLocalVariableIndex = 4;
static const uint32_t kDebugDeclareOperandVariableIndex = 5;
-static const uint32_t kDebugValueOperandLocalVariableIndex = 4;
static const uint32_t kDebugValueOperandExpressionIndex = 6;
-static const uint32_t kDebugValueOperandIndexesIndex = 7;
static const uint32_t kDebugOperationOperandOperationIndex = 4;
static const uint32_t kOpVariableOperandStorageClassIndex = 2;
static const uint32_t kDebugLocalVariableOperandParentIndex = 9;
@@ -479,44 +477,6 @@
return false;
}
-Instruction* DebugInfoManager::AddDebugValueWithIndex(
- uint32_t dbg_local_var_id, uint32_t value_id, uint32_t expr_id,
- uint32_t index_id, Instruction* insert_before) {
- uint32_t result_id = context()->TakeNextId();
- if (!result_id) return nullptr;
- std::unique_ptr<Instruction> new_dbg_value(new Instruction(
- context(), SpvOpExtInst, context()->get_type_mgr()->GetVoidTypeId(),
- result_id,
- {
- {spv_operand_type_t::SPV_OPERAND_TYPE_ID,
- {context()
- ->get_feature_mgr()
- ->GetExtInstImportId_OpenCL100DebugInfo()}},
- {spv_operand_type_t::SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER,
- {static_cast<uint32_t>(OpenCLDebugInfo100DebugValue)}},
- {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {dbg_local_var_id}},
- {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {value_id}},
- {spv_operand_type_t::SPV_OPERAND_TYPE_ID,
- {expr_id == 0 ? GetEmptyDebugExpression()->result_id() : expr_id}},
- }));
- if (index_id) {
- new_dbg_value->AddOperand(
- {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {index_id}});
- }
-
- Instruction* added_dbg_value =
- insert_before->InsertBefore(std::move(new_dbg_value));
- AnalyzeDebugInst(added_dbg_value);
- if (context()->AreAnalysesValid(IRContext::Analysis::kAnalysisDefUse))
- context()->get_def_use_mgr()->AnalyzeInstDefUse(added_dbg_value);
- if (context()->AreAnalysesValid(
- IRContext::Analysis::kAnalysisInstrToBlockMapping)) {
- auto insert_blk = context()->get_instr_block(insert_before);
- context()->set_instr_block(added_dbg_value, insert_blk);
- }
- return added_dbg_value;
-}
-
bool DebugInfoManager::AddDebugValueIfVarDeclIsVisible(
Instruction* scope_and_line, uint32_t variable_id, uint32_t value_id,
Instruction* insert_pos,
@@ -540,28 +500,15 @@
insert_before->opcode() == SpvOpVariable) {
insert_before = insert_before->NextNode();
}
-
- uint32_t index_id = 0;
- if (dbg_decl_or_val->NumOperands() > kDebugValueOperandIndexesIndex) {
- index_id =
- dbg_decl_or_val->GetSingleWordOperand(kDebugValueOperandIndexesIndex);
- }
-
- Instruction* added_dbg_value =
- AddDebugValueWithIndex(dbg_decl_or_val->GetSingleWordOperand(
- kDebugValueOperandLocalVariableIndex),
- value_id, 0, index_id, insert_before);
- assert(added_dbg_value != nullptr);
- added_dbg_value->UpdateDebugInfoFrom(scope_and_line);
- AnalyzeDebugInst(added_dbg_value);
- modified = true;
+ modified |= AddDebugValueForDecl(dbg_decl_or_val, value_id,
+ insert_before) != nullptr;
}
return modified;
}
-bool DebugInfoManager::AddDebugValueForDecl(Instruction* dbg_decl,
- uint32_t value_id) {
- if (dbg_decl == nullptr || !IsDebugDeclare(dbg_decl)) return false;
+Instruction* DebugInfoManager::AddDebugValueForDecl(
+ Instruction* dbg_decl, uint32_t value_id, Instruction* insert_before) {
+ if (dbg_decl == nullptr || !IsDebugDeclare(dbg_decl)) return nullptr;
std::unique_ptr<Instruction> dbg_val(dbg_decl->Clone(context()));
dbg_val->SetResultId(context()->TakeNextId());
@@ -571,16 +518,16 @@
dbg_val->SetOperand(kDebugValueOperandExpressionIndex,
{GetEmptyDebugExpression()->result_id()});
- auto* added_dbg_val = dbg_decl->InsertBefore(std::move(dbg_val));
+ auto* added_dbg_val = insert_before->InsertBefore(std::move(dbg_val));
AnalyzeDebugInst(added_dbg_val);
if (context()->AreAnalysesValid(IRContext::Analysis::kAnalysisDefUse))
context()->get_def_use_mgr()->AnalyzeInstDefUse(added_dbg_val);
if (context()->AreAnalysesValid(
IRContext::Analysis::kAnalysisInstrToBlockMapping)) {
- auto insert_blk = context()->get_instr_block(dbg_decl);
+ auto insert_blk = context()->get_instr_block(insert_before);
context()->set_instr_block(added_dbg_val, insert_blk);
}
- return true;
+ return added_dbg_val;
}
uint32_t DebugInfoManager::GetVariableIdOfDebugValueUsedForDeclare(
diff --git a/third_party/SPIRV-Tools/source/opt/debug_info_manager.h b/third_party/SPIRV-Tools/source/opt/debug_info_manager.h
index 630be4f..92b3818 100644
--- a/third_party/SPIRV-Tools/source/opt/debug_info_manager.h
+++ b/third_party/SPIRV-Tools/source/opt/debug_info_manager.h
@@ -151,17 +151,12 @@
Instruction* insert_pos,
std::unordered_set<Instruction*>* invisible_decls);
- // Generates a DebugValue instruction with |dbg_local_var_id|, |value_id|,
- // |expr_id|, |index_id| operands and inserts it before |insert_before|.
- Instruction* AddDebugValueWithIndex(uint32_t dbg_local_var_id,
- uint32_t value_id, uint32_t expr_id,
- uint32_t index_id,
- Instruction* insert_before);
-
- // Adds DebugValue for DebugDeclare |dbg_decl|. The new DebugValue has the
- // same line, scope, and operands but it uses |value_id| for value. Returns
- // weather it succeeds or not.
- bool AddDebugValueForDecl(Instruction* dbg_decl, uint32_t value_id);
+ // Creates a DebugValue for DebugDeclare |dbg_decl| and inserts it before
+ // |insert_before|. The new DebugValue has the same line, scope, and
+ // operands with DebugDeclare but it uses |value_id| for value. Returns
+ // the added DebugValue, or nullptr if it does not add a DebugValue.
+ Instruction* AddDebugValueForDecl(Instruction* dbg_decl, uint32_t value_id,
+ Instruction* insert_before);
// Erases |instr| from data structures of this class.
void ClearDebugInfo(Instruction* instr);
diff --git a/third_party/SPIRV-Tools/source/opt/decoration_manager.cpp b/third_party/SPIRV-Tools/source/opt/decoration_manager.cpp
index a10c992..8b4aee5 100644
--- a/third_party/SPIRV-Tools/source/opt/decoration_manager.cpp
+++ b/third_party/SPIRV-Tools/source/opt/decoration_manager.cpp
@@ -487,6 +487,13 @@
});
}
+bool DecorationManager::FindDecoration(
+ uint32_t id, uint32_t decoration,
+ std::function<bool(const Instruction&)> f) {
+ return !WhileEachDecoration(
+ id, decoration, [&f](const Instruction& inst) { return !f(inst); });
+}
+
void DecorationManager::CloneDecorations(uint32_t from, uint32_t to) {
const auto decoration_list = id_to_decoration_insts_.find(from);
if (decoration_list == id_to_decoration_insts_.end()) return;
diff --git a/third_party/SPIRV-Tools/source/opt/decoration_manager.h b/third_party/SPIRV-Tools/source/opt/decoration_manager.h
index 01244f2..e1ae8d5 100644
--- a/third_party/SPIRV-Tools/source/opt/decoration_manager.h
+++ b/third_party/SPIRV-Tools/source/opt/decoration_manager.h
@@ -102,6 +102,13 @@
bool WhileEachDecoration(uint32_t id, uint32_t decoration,
std::function<bool(const Instruction&)> f);
+ // |f| is run on each decoration instruction for |id| with decoration
+ // |decoration|. Processes all decoration which target |id| either directly or
+ // indirectly through decoration groups. If |f| returns true, iteration is
+ // terminated and this function returns true. Otherwise returns false.
+ bool FindDecoration(uint32_t id, uint32_t decoration,
+ std::function<bool(const Instruction&)> f);
+
// Clone all decorations from one id |from|.
// The cloned decorations are assigned to the given id |to| and are
// added to the module. The purpose is to decorate cloned instructions.
diff --git a/third_party/SPIRV-Tools/source/opt/eliminate_dead_members_pass.cpp b/third_party/SPIRV-Tools/source/opt/eliminate_dead_members_pass.cpp
index 5b8f4ec..ab28932 100644
--- a/third_party/SPIRV-Tools/source/opt/eliminate_dead_members_pass.cpp
+++ b/third_party/SPIRV-Tools/source/opt/eliminate_dead_members_pass.cpp
@@ -20,7 +20,7 @@
namespace {
const uint32_t kRemovedMember = 0xFFFFFFFF;
const uint32_t kSpecConstOpOpcodeIdx = 0;
-}
+} // namespace
namespace spvtools {
namespace opt {
diff --git a/third_party/SPIRV-Tools/source/opt/function.cpp b/third_party/SPIRV-Tools/source/opt/function.cpp
index 52054ea..38c6695 100644
--- a/third_party/SPIRV-Tools/source/opt/function.cpp
+++ b/third_party/SPIRV-Tools/source/opt/function.cpp
@@ -42,7 +42,6 @@
clone->blocks_.reserve(blocks_.size());
for (const auto& b : blocks_) {
std::unique_ptr<BasicBlock> bb(b->Clone(ctx));
- bb->SetParent(clone);
clone->AddBasicBlock(std::move(bb));
}
diff --git a/third_party/SPIRV-Tools/source/opt/function.h b/third_party/SPIRV-Tools/source/opt/function.h
index 4b20dcb..9e1c727 100644
--- a/third_party/SPIRV-Tools/source/opt/function.h
+++ b/third_party/SPIRV-Tools/source/opt/function.h
@@ -213,6 +213,7 @@
inline void Function::AddBasicBlock(std::unique_ptr<BasicBlock> b,
iterator ip) {
+ b->SetParent(this);
ip.InsertBefore(std::move(b));
}
diff --git a/third_party/SPIRV-Tools/source/opt/inst_bindless_check_pass.cpp b/third_party/SPIRV-Tools/source/opt/inst_bindless_check_pass.cpp
index 64d389c..7eb2d1b 100644
--- a/third_party/SPIRV-Tools/source/opt/inst_bindless_check_pass.cpp
+++ b/third_party/SPIRV-Tools/source/opt/inst_bindless_check_pass.cpp
@@ -267,34 +267,45 @@
uint32_t InstBindlessCheckPass::FindStride(uint32_t ty_id,
uint32_t stride_deco) {
uint32_t stride = 0xdeadbeef;
- bool found = !get_decoration_mgr()->WhileEachDecoration(
+ bool found = get_decoration_mgr()->FindDecoration(
ty_id, stride_deco, [&stride](const Instruction& deco_inst) {
stride = deco_inst.GetSingleWordInOperand(2u);
- return false;
+ return true;
});
USE_ASSERT(found && "stride not found");
return stride;
}
-uint32_t InstBindlessCheckPass::ByteSize(uint32_t ty_id) {
+uint32_t InstBindlessCheckPass::ByteSize(uint32_t ty_id, uint32_t matrix_stride,
+ bool col_major, bool in_matrix) {
analysis::TypeManager* type_mgr = context()->get_type_mgr();
const analysis::Type* sz_ty = type_mgr->GetType(ty_id);
if (sz_ty->kind() == analysis::Type::kPointer) {
// Assuming PhysicalStorageBuffer pointer
return 8;
}
- uint32_t size = 1;
if (sz_ty->kind() == analysis::Type::kMatrix) {
+ assert(matrix_stride != 0 && "missing matrix stride");
const analysis::Matrix* m_ty = sz_ty->AsMatrix();
- size = m_ty->element_count() * size;
- uint32_t stride = FindStride(ty_id, SpvDecorationMatrixStride);
- if (stride != 0) return size * stride;
- sz_ty = m_ty->element_type();
+ if (col_major) {
+ return m_ty->element_count() * matrix_stride;
+ } else {
+ const analysis::Vector* v_ty = m_ty->element_type()->AsVector();
+ return v_ty->element_count() * matrix_stride;
+ }
}
+ uint32_t size = 1;
if (sz_ty->kind() == analysis::Type::kVector) {
const analysis::Vector* v_ty = sz_ty->AsVector();
- size = v_ty->element_count() * size;
- sz_ty = v_ty->element_type();
+ size = v_ty->element_count();
+ const analysis::Type* comp_ty = v_ty->element_type();
+ // if vector in row major matrix, the vector is strided so return the
+ // number of bytes spanned by the vector
+ if (in_matrix && !col_major && matrix_stride > 0) {
+ uint32_t comp_ty_id = type_mgr->GetId(comp_ty);
+ return (size - 1) * matrix_stride + ByteSize(comp_ty_id, 0, false, false);
+ }
+ sz_ty = comp_ty;
}
switch (sz_ty->kind()) {
case analysis::Type::kFloat: {
@@ -333,21 +344,20 @@
// Process remaining access chain indices
Instruction* ac_inst = get_def_use_mgr()->GetDef(ref->ptr_id);
uint32_t curr_ty_id = buff_ty_id;
- uint32_t sum_id = 0;
+ uint32_t sum_id = 0u;
+ uint32_t matrix_stride = 0u;
+ bool col_major = false;
+ uint32_t matrix_stride_id = 0u;
+ bool in_matrix = false;
while (ac_in_idx < ac_inst->NumInOperands()) {
uint32_t curr_idx_id = ac_inst->GetSingleWordInOperand(ac_in_idx);
- Instruction* curr_idx_inst = get_def_use_mgr()->GetDef(curr_idx_id);
Instruction* curr_ty_inst = get_def_use_mgr()->GetDef(curr_ty_id);
uint32_t curr_offset_id = 0;
switch (curr_ty_inst->opcode()) {
case SpvOpTypeArray:
- case SpvOpTypeRuntimeArray:
- case SpvOpTypeMatrix: {
- // Get array/matrix stride and multiply by current index
- uint32_t stride_deco = (curr_ty_inst->opcode() == SpvOpTypeMatrix)
- ? SpvDecorationMatrixStride
- : SpvDecorationArrayStride;
- uint32_t arr_stride = FindStride(curr_ty_id, stride_deco);
+ case SpvOpTypeRuntimeArray: {
+ // Get array stride and multiply by current index
+ uint32_t arr_stride = FindStride(curr_ty_id, SpvDecorationArrayStride);
uint32_t arr_stride_id = builder->GetUintConstantId(arr_stride);
uint32_t curr_idx_32b_id = Gen32BitCvtCode(curr_idx_id, builder);
Instruction* curr_offset_inst = builder->AddBinaryOp(
@@ -356,34 +366,89 @@
// Get element type for next step
curr_ty_id = curr_ty_inst->GetSingleWordInOperand(0);
} break;
- case SpvOpTypeVector: {
- // Stride is size of component type
- uint32_t comp_ty_id = curr_ty_inst->GetSingleWordInOperand(0u);
- uint32_t vec_stride = ByteSize(comp_ty_id);
- uint32_t vec_stride_id = builder->GetUintConstantId(vec_stride);
+ case SpvOpTypeMatrix: {
+ assert(matrix_stride != 0 && "missing matrix stride");
+ matrix_stride_id = builder->GetUintConstantId(matrix_stride);
+ uint32_t vec_ty_id = curr_ty_inst->GetSingleWordInOperand(0);
+ // If column major, multiply column index by matrix stride, otherwise
+ // by vector component size and save matrix stride for vector (row)
+ // index
+ uint32_t col_stride_id;
+ if (col_major) {
+ col_stride_id = matrix_stride_id;
+ } else {
+ Instruction* vec_ty_inst = get_def_use_mgr()->GetDef(vec_ty_id);
+ uint32_t comp_ty_id = vec_ty_inst->GetSingleWordInOperand(0u);
+ uint32_t col_stride = ByteSize(comp_ty_id, 0u, false, false);
+ col_stride_id = builder->GetUintConstantId(col_stride);
+ }
uint32_t curr_idx_32b_id = Gen32BitCvtCode(curr_idx_id, builder);
Instruction* curr_offset_inst = builder->AddBinaryOp(
- GetUintId(), SpvOpIMul, vec_stride_id, curr_idx_32b_id);
+ GetUintId(), SpvOpIMul, col_stride_id, curr_idx_32b_id);
curr_offset_id = curr_offset_inst->result_id();
// Get element type for next step
+ curr_ty_id = vec_ty_id;
+ in_matrix = true;
+ } break;
+ case SpvOpTypeVector: {
+ // If inside a row major matrix type, multiply index by matrix stride,
+ // else multiply by component size
+ uint32_t comp_ty_id = curr_ty_inst->GetSingleWordInOperand(0u);
+ uint32_t curr_idx_32b_id = Gen32BitCvtCode(curr_idx_id, builder);
+ if (in_matrix && !col_major) {
+ Instruction* curr_offset_inst = builder->AddBinaryOp(
+ GetUintId(), SpvOpIMul, matrix_stride_id, curr_idx_32b_id);
+ curr_offset_id = curr_offset_inst->result_id();
+ } else {
+ uint32_t comp_ty_sz = ByteSize(comp_ty_id, 0u, false, false);
+ uint32_t comp_ty_sz_id = builder->GetUintConstantId(comp_ty_sz);
+ Instruction* curr_offset_inst = builder->AddBinaryOp(
+ GetUintId(), SpvOpIMul, comp_ty_sz_id, curr_idx_32b_id);
+ curr_offset_id = curr_offset_inst->result_id();
+ }
+ // Get element type for next step
curr_ty_id = comp_ty_id;
} break;
case SpvOpTypeStruct: {
// Get buffer byte offset for the referenced member
+ Instruction* curr_idx_inst = get_def_use_mgr()->GetDef(curr_idx_id);
assert(curr_idx_inst->opcode() == SpvOpConstant &&
"unexpected struct index");
uint32_t member_idx = curr_idx_inst->GetSingleWordInOperand(0);
uint32_t member_offset = 0xdeadbeef;
- bool found = !get_decoration_mgr()->WhileEachDecoration(
+ bool found = get_decoration_mgr()->FindDecoration(
curr_ty_id, SpvDecorationOffset,
[&member_idx, &member_offset](const Instruction& deco_inst) {
if (deco_inst.GetSingleWordInOperand(1u) != member_idx)
- return true;
+ return false;
member_offset = deco_inst.GetSingleWordInOperand(3u);
- return false;
+ return true;
});
USE_ASSERT(found && "member offset not found");
curr_offset_id = builder->GetUintConstantId(member_offset);
+ // Look for matrix stride for this member if there is one. The matrix
+ // stride is not on the matrix type, but in a OpMemberDecorate on the
+ // enclosing struct type at the member index. If none found, reset
+ // stride to 0.
+ found = get_decoration_mgr()->FindDecoration(
+ curr_ty_id, SpvDecorationMatrixStride,
+ [&member_idx, &matrix_stride](const Instruction& deco_inst) {
+ if (deco_inst.GetSingleWordInOperand(1u) != member_idx)
+ return false;
+ matrix_stride = deco_inst.GetSingleWordInOperand(3u);
+ return true;
+ });
+ if (!found) matrix_stride = 0;
+ // Look for column major decoration
+ found = get_decoration_mgr()->FindDecoration(
+ curr_ty_id, SpvDecorationColMajor,
+ [&member_idx, &col_major](const Instruction& deco_inst) {
+ if (deco_inst.GetSingleWordInOperand(1u) != member_idx)
+ return false;
+ col_major = true;
+ return true;
+ });
+ if (!found) col_major = false;
// Get element type for next step
curr_ty_id = curr_ty_inst->GetSingleWordInOperand(member_idx);
} break;
@@ -399,7 +464,7 @@
++ac_in_idx;
}
// Add in offset of last byte of referenced object
- uint32_t bsize = ByteSize(curr_ty_id);
+ uint32_t bsize = ByteSize(curr_ty_id, matrix_stride, col_major, in_matrix);
uint32_t last = bsize - 1;
uint32_t last_id = builder->GetUintConstantId(last);
Instruction* sum_inst =
diff --git a/third_party/SPIRV-Tools/source/opt/inst_bindless_check_pass.h b/third_party/SPIRV-Tools/source/opt/inst_bindless_check_pass.h
index 50dfd95..29da6f3 100644
--- a/third_party/SPIRV-Tools/source/opt/inst_bindless_check_pass.h
+++ b/third_party/SPIRV-Tools/source/opt/inst_bindless_check_pass.h
@@ -132,8 +132,10 @@
Instruction* ref_inst;
} ref_analysis;
- // Return size of type |ty_id| in bytes.
- uint32_t ByteSize(uint32_t ty_id);
+ // Return size of type |ty_id| in bytes. Use |matrix_stride| and |col_major|
+ // for matrix type, or for vector type if vector is |in_matrix|.
+ uint32_t ByteSize(uint32_t ty_id, uint32_t matrix_stride, bool col_major,
+ bool in_matrix);
// Return stride of type |ty_id| with decoration |stride_deco|. Return 0
// if not found
diff --git a/third_party/SPIRV-Tools/source/opt/inst_buff_addr_check_pass.cpp b/third_party/SPIRV-Tools/source/opt/inst_buff_addr_check_pass.cpp
index fa6c2c6..06acc7e 100644
--- a/third_party/SPIRV-Tools/source/opt/inst_buff_addr_check_pass.cpp
+++ b/third_party/SPIRV-Tools/source/opt/inst_buff_addr_check_pass.cpp
@@ -202,7 +202,6 @@
(void)builder.AddInstruction(MakeUnique<Instruction>(
context(), SpvOpBranch, 0, 0,
std::initializer_list<Operand>{{SPV_OPERAND_TYPE_ID, {hdr_blk_id}}}));
- first_blk_ptr->SetParent(&*input_func);
input_func->AddBasicBlock(std::move(first_blk_ptr));
// Linear search loop header block
// TODO(greg-lunarg): Implement binary search
@@ -246,7 +245,6 @@
(void)builder.AddInstruction(MakeUnique<Instruction>(
context(), SpvOpBranch, 0, 0,
std::initializer_list<Operand>{{SPV_OPERAND_TYPE_ID, {cont_blk_id}}}));
- hdr_blk_ptr->SetParent(&*input_func);
input_func->AddBasicBlock(std::move(hdr_blk_ptr));
// Continue/Work Block. Read next buffer pointer and break if greater
// than ref_ptr arg.
@@ -272,7 +270,6 @@
(void)builder.AddConditionalBranch(uptr_test_inst->result_id(),
bound_test_blk_id, hdr_blk_id,
kInvalidId, SpvSelectionControlMaskNone);
- cont_blk_ptr->SetParent(&*input_func);
input_func->AddBasicBlock(std::move(cont_blk_ptr));
// Bounds test block. Read length of selected buffer and test that
// all len arg bytes are in buffer.
@@ -333,7 +330,6 @@
std::initializer_list<Operand>{
{SPV_OPERAND_TYPE_ID, {len_test_inst->result_id()}}}));
// Close block
- bound_test_blk_ptr->SetParent(&*input_func);
input_func->AddBasicBlock(std::move(bound_test_blk_ptr));
// Close function and add function to module
std::unique_ptr<Instruction> func_end_inst(
diff --git a/third_party/SPIRV-Tools/source/opt/instrument_pass.cpp b/third_party/SPIRV-Tools/source/opt/instrument_pass.cpp
index e7d9778..ed34fb0 100644
--- a/third_party/SPIRV-Tools/source/opt/instrument_pass.cpp
+++ b/third_party/SPIRV-Tools/source/opt/instrument_pass.cpp
@@ -758,7 +758,6 @@
write_blk_id, merge_blk_id, merge_blk_id,
SpvSelectionControlMaskNone);
// Close safety test block and gen write block
- new_blk_ptr->SetParent(&*output_func);
output_func->AddBasicBlock(std::move(new_blk_ptr));
new_blk_ptr = MakeUnique<BasicBlock>(std::move(write_label));
builder.SetInsertPoint(&*new_blk_ptr);
@@ -773,13 +772,11 @@
}
// Close write block and gen merge block
(void)builder.AddBranch(merge_blk_id);
- new_blk_ptr->SetParent(&*output_func);
output_func->AddBasicBlock(std::move(new_blk_ptr));
new_blk_ptr = MakeUnique<BasicBlock>(std::move(merge_label));
builder.SetInsertPoint(&*new_blk_ptr);
// Close merge block and function and add function to module
(void)builder.AddNullaryOp(0, SpvOpReturn);
- new_blk_ptr->SetParent(&*output_func);
output_func->AddBasicBlock(std::move(new_blk_ptr));
std::unique_ptr<Instruction> func_end_inst(
new Instruction(get_module()->context(), SpvOpFunctionEnd, 0, 0, {}));
@@ -860,7 +857,6 @@
context(), SpvOpReturnValue, 0, 0,
std::initializer_list<Operand>{{SPV_OPERAND_TYPE_ID, {last_value_id}}}));
// Close block and function and add function to module
- new_blk_ptr->SetParent(&*input_func);
input_func->AddBasicBlock(std::move(new_blk_ptr));
std::unique_ptr<Instruction> func_end_inst(
new Instruction(get_module()->context(), SpvOpFunctionEnd, 0, 0, {}));
diff --git a/third_party/SPIRV-Tools/source/opt/ir_context.cpp b/third_party/SPIRV-Tools/source/opt/ir_context.cpp
index 3e610d7..82107b5 100644
--- a/third_party/SPIRV-Tools/source/opt/ir_context.cpp
+++ b/third_party/SPIRV-Tools/source/opt/ir_context.cpp
@@ -475,7 +475,7 @@
SpvOpTypeSampledImage,
SpvOpTypeAccelerationStructureNV,
SpvOpTypeAccelerationStructureKHR,
- SpvOpTypeRayQueryProvisionalKHR,
+ SpvOpTypeRayQueryKHR,
SpvOpTypeArray,
SpvOpTypeRuntimeArray,
SpvOpTypeStruct,
diff --git a/third_party/SPIRV-Tools/source/opt/local_single_store_elim_pass.cpp b/third_party/SPIRV-Tools/source/opt/local_single_store_elim_pass.cpp
index 99c0fb2..b8d9091 100644
--- a/third_party/SPIRV-Tools/source/opt/local_single_store_elim_pass.cpp
+++ b/third_party/SPIRV-Tools/source/opt/local_single_store_elim_pass.cpp
@@ -174,7 +174,8 @@
context()->GetDominatorAnalysis(store_block->GetParent());
for (auto* decl : invisible_decls) {
if (dominator_analysis->Dominates(store_inst, decl)) {
- context()->get_debug_info_mgr()->AddDebugValueForDecl(decl, value_id);
+ context()->get_debug_info_mgr()->AddDebugValueForDecl(decl, value_id,
+ decl);
modified = true;
}
}
diff --git a/third_party/SPIRV-Tools/source/opt/loop_peeling.cpp b/third_party/SPIRV-Tools/source/opt/loop_peeling.cpp
index 071c27c..34f0a8d 100644
--- a/third_party/SPIRV-Tools/source/opt/loop_peeling.cpp
+++ b/third_party/SPIRV-Tools/source/opt/loop_peeling.cpp
@@ -351,7 +351,6 @@
std::unique_ptr<BasicBlock> new_bb =
MakeUnique<BasicBlock>(std::unique_ptr<Instruction>(new Instruction(
context_, SpvOpLabel, 0, context_->TakeNextId(), {})));
- new_bb->SetParent(loop_utils_.GetFunction());
// Update the loop descriptor.
Loop* in_loop = (*loop_utils_.GetLoopDescriptor())[bb];
if (in_loop) {
diff --git a/third_party/SPIRV-Tools/source/opt/merge_return_pass.cpp b/third_party/SPIRV-Tools/source/opt/merge_return_pass.cpp
index b43eb31..f160104 100644
--- a/third_party/SPIRV-Tools/source/opt/merge_return_pass.cpp
+++ b/third_party/SPIRV-Tools/source/opt/merge_return_pass.cpp
@@ -182,7 +182,8 @@
context()->AnalyzeDefUse(final_return_block_->GetLabelInst());
context()->set_instr_block(final_return_block_->GetLabelInst(),
final_return_block_);
- final_return_block_->SetParent(function_);
+ assert(final_return_block_->GetParent() == function_ &&
+ "The function should have been set when the block was created.");
}
void MergeReturnPass::CreateReturn(BasicBlock* block) {
diff --git a/third_party/SPIRV-Tools/source/opt/reflect.h b/third_party/SPIRV-Tools/source/opt/reflect.h
index 2e253ad..d374e68 100644
--- a/third_party/SPIRV-Tools/source/opt/reflect.h
+++ b/third_party/SPIRV-Tools/source/opt/reflect.h
@@ -47,7 +47,7 @@
opcode == SpvOpTypePipeStorage || opcode == SpvOpTypeNamedBarrier ||
opcode == SpvOpTypeAccelerationStructureNV ||
opcode == SpvOpTypeAccelerationStructureKHR ||
- opcode == SpvOpTypeRayQueryProvisionalKHR ||
+ opcode == SpvOpTypeRayQueryKHR ||
opcode == SpvOpTypeCooperativeMatrixNV;
}
inline bool IsConstantInst(SpvOp opcode) {
diff --git a/third_party/SPIRV-Tools/source/opt/scalar_replacement_pass.cpp b/third_party/SPIRV-Tools/source/opt/scalar_replacement_pass.cpp
index d71d605..c8e0da5 100644
--- a/third_party/SPIRV-Tools/source/opt/scalar_replacement_pass.cpp
+++ b/third_party/SPIRV-Tools/source/opt/scalar_replacement_pass.cpp
@@ -25,7 +25,6 @@
#include "source/opt/types.h"
#include "source/util/make_unique.h"
-static const uint32_t kDebugDeclareOperandLocalVariableIndex = 4;
static const uint32_t kDebugValueOperandValueIndex = 5;
static const uint32_t kDebugValueOperandExpressionIndex = 6;
@@ -173,17 +172,19 @@
// Add DebugValue instruction with Indexes operand and Deref operation.
int32_t idx = 0;
for (const auto* var : replacements) {
- uint32_t dbg_local_variable =
- dbg_decl->GetSingleWordOperand(kDebugDeclareOperandLocalVariableIndex);
- uint32_t index_id = context()->get_constant_mgr()->GetSIntConst(idx);
-
Instruction* added_dbg_value =
- context()->get_debug_info_mgr()->AddDebugValueWithIndex(
- dbg_local_variable,
- /*value_id=*/var->result_id(), /*expr_id=*/deref_expr->result_id(),
- index_id, /*insert_before=*/var->NextNode());
+ context()->get_debug_info_mgr()->AddDebugValueForDecl(
+ dbg_decl, /*value_id=*/var->result_id(),
+ /*insert_before=*/var->NextNode());
if (added_dbg_value == nullptr) return false;
- added_dbg_value->UpdateDebugInfoFrom(dbg_decl);
+ added_dbg_value->AddOperand(
+ {SPV_OPERAND_TYPE_ID,
+ {context()->get_constant_mgr()->GetSIntConst(idx)}});
+ added_dbg_value->SetOperand(kDebugValueOperandExpressionIndex,
+ {deref_expr->result_id()});
+ if (context()->AreAnalysesValid(IRContext::Analysis::kAnalysisDefUse)) {
+ context()->get_def_use_mgr()->AnalyzeInstUse(added_dbg_value);
+ }
++idx;
}
return true;
diff --git a/third_party/SPIRV-Tools/source/opt/ssa_rewrite_pass.cpp b/third_party/SPIRV-Tools/source/opt/ssa_rewrite_pass.cpp
index 3ff0361..0489f03 100644
--- a/third_party/SPIRV-Tools/source/opt/ssa_rewrite_pass.cpp
+++ b/third_party/SPIRV-Tools/source/opt/ssa_rewrite_pass.cpp
@@ -680,8 +680,8 @@
// If |value| dominates |decl|, we can set it as DebugValue.
if (value && (pass_->context()->get_instr_block(value) == nullptr ||
dom_tree->Dominates(value, decl))) {
- if (!pass_->context()->get_debug_info_mgr()->AddDebugValueForDecl(
- decl, value->result_id())) {
+ if (pass_->context()->get_debug_info_mgr()->AddDebugValueForDecl(
+ decl, value->result_id(), decl) == nullptr) {
return Pass::Status::Failure;
}
} else {
@@ -689,8 +689,8 @@
// assign the value in the immediate dominator.
value_id = GetValueAtBlock(var_id, dom_tree->ImmediateDominator(bb));
if (value_id &&
- !pass_->context()->get_debug_info_mgr()->AddDebugValueForDecl(
- decl, value_id)) {
+ pass_->context()->get_debug_info_mgr()->AddDebugValueForDecl(
+ decl, value_id, decl) == nullptr) {
return Pass::Status::Failure;
}
}
diff --git a/third_party/SPIRV-Tools/source/opt/type_manager.cpp b/third_party/SPIRV-Tools/source/opt/type_manager.cpp
index 27c7199..ce9c2c1 100644
--- a/third_party/SPIRV-Tools/source/opt/type_manager.cpp
+++ b/third_party/SPIRV-Tools/source/opt/type_manager.cpp
@@ -862,8 +862,8 @@
inst.GetSingleWordInOperand(2),
inst.GetSingleWordInOperand(3));
break;
- case SpvOpTypeRayQueryProvisionalKHR:
- type = new RayQueryProvisionalKHR();
+ case SpvOpTypeRayQueryKHR:
+ type = new RayQueryKHR();
break;
default:
SPIRV_UNIMPLEMENTED(consumer_, "unhandled type");
diff --git a/third_party/SPIRV-Tools/source/opt/types.cpp b/third_party/SPIRV-Tools/source/opt/types.cpp
index 426d3ea..b1eb3a5 100644
--- a/third_party/SPIRV-Tools/source/opt/types.cpp
+++ b/third_party/SPIRV-Tools/source/opt/types.cpp
@@ -128,7 +128,7 @@
DeclareKindCase(NamedBarrier);
DeclareKindCase(AccelerationStructureNV);
DeclareKindCase(CooperativeMatrixNV);
- DeclareKindCase(RayQueryProvisionalKHR);
+ DeclareKindCase(RayQueryKHR);
#undef DeclareKindCase
default:
assert(false && "Unhandled type");
@@ -174,7 +174,7 @@
DeclareKindCase(NamedBarrier);
DeclareKindCase(AccelerationStructureNV);
DeclareKindCase(CooperativeMatrixNV);
- DeclareKindCase(RayQueryProvisionalKHR);
+ DeclareKindCase(RayQueryKHR);
#undef DeclareKindCase
default:
assert(false && "Unhandled type");
@@ -225,7 +225,7 @@
DeclareKindCase(NamedBarrier);
DeclareKindCase(AccelerationStructureNV);
DeclareKindCase(CooperativeMatrixNV);
- DeclareKindCase(RayQueryProvisionalKHR);
+ DeclareKindCase(RayQueryKHR);
#undef DeclareKindCase
default:
assert(false && "Unhandled type");
diff --git a/third_party/SPIRV-Tools/source/opt/types.h b/third_party/SPIRV-Tools/source/opt/types.h
index ebeb476..d5be9be 100644
--- a/third_party/SPIRV-Tools/source/opt/types.h
+++ b/third_party/SPIRV-Tools/source/opt/types.h
@@ -59,7 +59,7 @@
class NamedBarrier;
class AccelerationStructureNV;
class CooperativeMatrixNV;
-class RayQueryProvisionalKHR;
+class RayQueryKHR;
// Abstract class for a SPIR-V type. It has a bunch of As<sublcass>() methods,
// which is used as a way to probe the actual <subclass>.
@@ -96,7 +96,7 @@
kNamedBarrier,
kAccelerationStructureNV,
kCooperativeMatrixNV,
- kRayQueryProvisionalKHR
+ kRayQueryKHR
};
Type(Kind k) : kind_(k) {}
@@ -201,7 +201,7 @@
DeclareCastMethod(NamedBarrier)
DeclareCastMethod(AccelerationStructureNV)
DeclareCastMethod(CooperativeMatrixNV)
- DeclareCastMethod(RayQueryProvisionalKHR)
+ DeclareCastMethod(RayQueryKHR)
#undef DeclareCastMethod
protected:
@@ -662,7 +662,7 @@
DefineParameterlessType(PipeStorage, pipe_storage);
DefineParameterlessType(NamedBarrier, named_barrier);
DefineParameterlessType(AccelerationStructureNV, accelerationStructureNV);
-DefineParameterlessType(RayQueryProvisionalKHR, rayQueryProvisionalKHR);
+DefineParameterlessType(RayQueryKHR, rayQueryKHR);
#undef DefineParameterlessType
} // namespace analysis
diff --git a/third_party/SPIRV-Tools/source/opt/wrap_opkill.cpp b/third_party/SPIRV-Tools/source/opt/wrap_opkill.cpp
index ae1000c..51432a7 100644
--- a/third_party/SPIRV-Tools/source/opt/wrap_opkill.cpp
+++ b/third_party/SPIRV-Tools/source/opt/wrap_opkill.cpp
@@ -164,7 +164,6 @@
bb->AddInstruction(std::move(kill_inst));
// Add the bb to the function
- bb->SetParent((*killing_func).get());
(*killing_func)->AddBasicBlock(std::move(bb));
// Add the function to the module.
diff --git a/third_party/SPIRV-Tools/source/val/validate_builtins.cpp b/third_party/SPIRV-Tools/source/val/validate_builtins.cpp
index 2c5604c..d9e0666 100644
--- a/third_party/SPIRV-Tools/source/val/validate_builtins.cpp
+++ b/third_party/SPIRV-Tools/source/val/validate_builtins.cpp
@@ -403,6 +403,7 @@
// Validates that |built_in_inst| is not (even indirectly) referenced from
// within a function which can be called with |execution_model|.
//
+ // |vuid| - Vulkan ID for the error, or a negative value if none.
// |comment| - text explaining why the restriction was imposed.
// |decoration| - BuiltIn decoration which causes the restriction.
// |referenced_inst| - instruction which is dependent on |built_in_inst| and
@@ -410,7 +411,7 @@
// |referenced_from_inst| - instruction which references id defined by
// |referenced_inst| from within a function.
spv_result_t ValidateNotCalledWithExecutionModel(
- std::string comment, SpvExecutionModel execution_model,
+ int vuid, const char* comment, SpvExecutionModel execution_model,
const Decoration& decoration, const Instruction& built_in_inst,
const Instruction& referenced_inst,
const Instruction& referenced_from_inst);
@@ -909,7 +910,7 @@
}
spv_result_t BuiltInsValidator::ValidateNotCalledWithExecutionModel(
- std::string comment, SpvExecutionModel execution_model,
+ int vuid, const char* comment, SpvExecutionModel execution_model,
const Decoration& decoration, const Instruction& built_in_inst,
const Instruction& referenced_inst,
const Instruction& referenced_from_inst) {
@@ -920,7 +921,8 @@
const char* built_in_str = _.grammar().lookupOperandName(
SPV_OPERAND_TYPE_BUILT_IN, decoration.params()[0]);
return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst)
- << comment << " " << GetIdDesc(referenced_inst) << " depends on "
+ << (vuid < 0 ? std::string("") : _.VkErrorID(vuid)) << comment
+ << " " << GetIdDesc(referenced_inst) << " depends on "
<< GetIdDesc(built_in_inst) << " which is decorated with BuiltIn "
<< built_in_str << "."
<< " Id <" << referenced_inst.id() << "> is later referenced by "
@@ -932,7 +934,7 @@
// Propagate this rule to all dependant ids in the global scope.
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(
std::bind(&BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
- comment, execution_model, decoration, built_in_inst,
+ vuid, comment, execution_model, decoration, built_in_inst,
referenced_from_inst, std::placeholders::_1));
}
return SPV_SUCCESS;
@@ -968,7 +970,7 @@
if (storage_class == SpvStorageClassInput) {
assert(function_id_ == 0);
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
+ &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, -1,
"Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance to be "
"used for variables with Input storage class if execution model is "
"Vertex.",
@@ -979,7 +981,7 @@
if (storage_class == SpvStorageClassOutput) {
assert(function_id_ == 0);
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
+ &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, -1,
"Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance to be "
"used for variables with Output storage class if execution model is "
"Fragment.",
@@ -1619,12 +1621,10 @@
if (storage_class == SpvStorageClassInput) {
assert(function_id_ == 0);
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
- std::string(
- _.VkErrorID(4315) +
- "Vulkan spec doesn't allow BuiltIn PointSize to be used for "
- "variables with Input storage class if execution model is "
- "Vertex."),
+ &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4315,
+ "Vulkan spec doesn't allow BuiltIn PointSize to be used for "
+ "variables with Input storage class if execution model is "
+ "Vertex.",
SpvExecutionModelVertex, decoration, built_in_inst,
referenced_from_inst, std::placeholders::_1));
}
@@ -1737,11 +1737,10 @@
if (storage_class == SpvStorageClassInput) {
assert(function_id_ == 0);
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
- std::string(_.VkErrorID(4320) +
- "Vulkan spec doesn't allow BuiltIn Position to be used "
- "for variables "
- "with Input storage class if execution model is Vertex."),
+ &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4320,
+ "Vulkan spec doesn't allow BuiltIn Position to be used "
+ "for variables "
+ "with Input storage class if execution model is Vertex.",
SpvExecutionModelVertex, decoration, built_in_inst,
referenced_from_inst, std::placeholders::_1));
}
@@ -1928,30 +1927,24 @@
if (storage_class == SpvStorageClassOutput) {
assert(function_id_ == 0);
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
- std::string(
- _.VkErrorID(4334) +
- "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for "
- "variables with Output storage class if execution model is "
- "TessellationControl."),
+ &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4334,
+ "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for "
+ "variables with Output storage class if execution model is "
+ "TessellationControl.",
SpvExecutionModelTessellationControl, decoration, built_in_inst,
referenced_from_inst, std::placeholders::_1));
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
- std::string(
- _.VkErrorID(4334) +
- "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for "
- "variables with Output storage class if execution model is "
- "TessellationEvaluation."),
+ &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4334,
+ "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for "
+ "variables with Output storage class if execution model is "
+ "TessellationEvaluation.",
SpvExecutionModelTessellationEvaluation, decoration, built_in_inst,
referenced_from_inst, std::placeholders::_1));
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
- std::string(
- _.VkErrorID(4334) +
- "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for "
- "variables with Output storage class if execution model is "
- "Fragment."),
+ &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, 4334,
+ "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for "
+ "variables with Output storage class if execution model is "
+ "Fragment.",
SpvExecutionModelFragment, decoration, built_in_inst,
referenced_from_inst, std::placeholders::_1));
}
@@ -2304,7 +2297,7 @@
if (storage_class == SpvStorageClassInput) {
assert(function_id_ == 0);
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
+ &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, -1,
"Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be "
"used "
"for variables with Input storage class if execution model is "
@@ -2316,7 +2309,7 @@
if (storage_class == SpvStorageClassOutput) {
assert(function_id_ == 0);
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
+ &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, -1,
"Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be "
"used "
"for variables with Output storage class if execution model is "
@@ -2382,10 +2375,9 @@
spv_result_t BuiltInsValidator::ValidateVertexIdOrInstanceIdAtDefinition(
const Decoration& decoration, const Instruction& inst) {
const SpvBuiltIn label = SpvBuiltIn(decoration.params()[0]);
- bool allow_instance_id =
- (_.HasCapability(SpvCapabilityRayTracingNV) ||
- _.HasCapability(SpvCapabilityRayTracingProvisionalKHR)) &&
- label == SpvBuiltInInstanceId;
+ bool allow_instance_id = (_.HasCapability(SpvCapabilityRayTracingNV) ||
+ _.HasCapability(SpvCapabilityRayTracingKHR)) &&
+ label == SpvBuiltInInstanceId;
if (spvIsVulkanEnv(_.context()->target_env) && !allow_instance_id) {
return _.diag(SPV_ERROR_INVALID_DATA, &inst)
@@ -2605,32 +2597,30 @@
{SpvExecutionModelVertex, SpvExecutionModelTessellationEvaluation,
SpvExecutionModelGeometry, SpvExecutionModelMeshNV}) {
id_to_at_reference_checks_[referenced_from_inst.id()].push_back(
- std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
- std::string(
- _.VkErrorID((operand == SpvBuiltInLayer) ? 4274 : 4406) +
- "Vulkan spec doesn't allow BuiltIn Layer and "
- "ViewportIndex to be "
- "used for variables with Input storage class if "
- "execution model is Vertex, TessellationEvaluation, "
- "Geometry, or MeshNV."),
- em, decoration, built_in_inst, referenced_from_inst,
- std::placeholders::_1));
+ std::bind(&BuiltInsValidator::ValidateNotCalledWithExecutionModel,
+ this, ((operand == SpvBuiltInLayer) ? 4274 : 4406),
+ "Vulkan spec doesn't allow BuiltIn Layer and "
+ "ViewportIndex to be "
+ "used for variables with Input storage class if "
+ "execution model is Vertex, TessellationEvaluation, "
+ "Geometry, or MeshNV.",
+ em, decoration, built_in_inst, referenced_from_inst,
+ std::placeholders::_1));
}
}
if (storage_class == SpvStorageClassOutput) {
assert(function_id_ == 0);
- id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind(
- &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this,
- std::string(_.VkErrorID((operand == SpvBuiltInLayer) ? 4275 : 4407) +
- "Vulkan spec doesn't allow BuiltIn Layer and "
- "ViewportIndex to be "
- "used for variables with Output storage class if "
- "execution model is "
- "Fragment."),
- SpvExecutionModelFragment, decoration, built_in_inst,
- referenced_from_inst, std::placeholders::_1));
+ id_to_at_reference_checks_[referenced_from_inst.id()].push_back(
+ std::bind(&BuiltInsValidator::ValidateNotCalledWithExecutionModel,
+ this, ((operand == SpvBuiltInLayer) ? 4275 : 4407),
+ "Vulkan spec doesn't allow BuiltIn Layer and "
+ "ViewportIndex to be "
+ "used for variables with Output storage class if "
+ "execution model is "
+ "Fragment.",
+ SpvExecutionModelFragment, decoration, built_in_inst,
+ referenced_from_inst, std::placeholders::_1));
}
for (const SpvExecutionModel execution_model : execution_models_) {
diff --git a/third_party/SPIRV-Tools/source/val/validate_cfg.cpp b/third_party/SPIRV-Tools/source/val/validate_cfg.cpp
index 8babd35..45edd0c 100644
--- a/third_party/SPIRV-Tools/source/val/validate_cfg.cpp
+++ b/third_party/SPIRV-Tools/source/val/validate_cfg.cpp
@@ -1110,6 +1110,8 @@
case SpvOpReturnValue:
case SpvOpUnreachable:
case SpvOpTerminateInvocation:
+ case SpvOpIgnoreIntersectionKHR:
+ case SpvOpTerminateRayKHR:
_.current_function().RegisterBlockEnd(std::vector<uint32_t>());
if (opcode == SpvOpKill) {
_.current_function().RegisterExecutionModelLimitation(
@@ -1121,6 +1123,17 @@
SpvExecutionModelFragment,
"OpTerminateInvocation requires Fragment execution model");
}
+ if (opcode == SpvOpIgnoreIntersectionKHR) {
+ _.current_function().RegisterExecutionModelLimitation(
+ SpvExecutionModelAnyHitKHR,
+ "OpIgnoreIntersectionKHR requires AnyHit execution model");
+ }
+ if (opcode == SpvOpTerminateRayKHR) {
+ _.current_function().RegisterExecutionModelLimitation(
+ SpvExecutionModelAnyHitKHR,
+ "OpTerminateRayKHR requires AnyHit execution model");
+ }
+
break;
default:
break;
diff --git a/third_party/SPIRV-Tools/source/val/validate_memory.cpp b/third_party/SPIRV-Tools/source/val/validate_memory.cpp
index 1e1a38d..d9f8b99 100644
--- a/third_party/SPIRV-Tools/source/val/validate_memory.cpp
+++ b/third_party/SPIRV-Tools/source/val/validate_memory.cpp
@@ -536,8 +536,7 @@
_, pointee,
{SpvOpTypeImage, SpvOpTypeSampler, SpvOpTypeSampledImage,
SpvOpTypeAccelerationStructureNV,
- SpvOpTypeAccelerationStructureKHR,
- SpvOpTypeRayQueryProvisionalKHR})) {
+ SpvOpTypeAccelerationStructureKHR, SpvOpTypeRayQueryKHR})) {
return _.diag(SPV_ERROR_INVALID_ID, inst)
<< "UniformConstant OpVariable <id> '" << _.getIdName(inst->id())
<< "' has illegal type.\n"
@@ -547,7 +546,7 @@
<< "variables must be typed as OpTypeImage, OpTypeSampler, "
<< "OpTypeSampledImage, OpTypeAccelerationStructureNV, "
"OpTypeAccelerationStructureKHR, "
- "OpTypeRayQueryProvisionalKHR, "
+ "OpTypeRayQueryKHR, "
<< "or an array of one of these types.";
}
}
diff --git a/third_party/SPIRV-Tools/test/fuzz/transformation_composite_construct_test.cpp b/third_party/SPIRV-Tools/test/fuzz/transformation_composite_construct_test.cpp
index d2a18b0..edbfe3b 100644
--- a/third_party/SPIRV-Tools/test/fuzz/transformation_composite_construct_test.cpp
+++ b/third_party/SPIRV-Tools/test/fuzz/transformation_composite_construct_test.cpp
@@ -1643,6 +1643,55 @@
MakeDataDescriptor(100, {2}), MakeDataDescriptor(10, {})));
}
+TEST(TransformationCompositeConstructTest, IrrelevantVec2ThenFloat) {
+ std::string shader = R"(
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main"
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeFloat 32
+ %7 = OpTypeVector %6 2
+ %8 = OpTypeVector %6 3
+ %9 = OpConstant %6 0
+ %11 = OpConstant %6 1
+ %12 = OpConstant %6 2
+ %10 = OpConstantComposite %7 %11 %12
+ %4 = OpFunction %2 None %3
+ %5 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ )";
+
+ const auto env = SPV_ENV_UNIVERSAL_1_3;
+ const auto consumer = nullptr;
+ const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption);
+ spvtools::ValidatorOptions validator_options;
+ ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
+ kConsoleMessageConsumer));
+ TransformationContext transformation_context(
+ MakeUnique<FactManager>(context.get()), validator_options);
+
+ transformation_context.GetFactManager()->AddFactIdIsIrrelevant(10);
+
+ TransformationCompositeConstruct transformation(
+ 8, {10, 9}, MakeInstructionDescriptor(5, SpvOpReturn, 0), 100);
+ ASSERT_TRUE(
+ transformation.IsApplicable(context.get(), transformation_context));
+ ApplyAndCheckFreshIds(transformation, context.get(), &transformation_context);
+ ASSERT_FALSE(transformation_context.GetFactManager()->IsSynonymous(
+ MakeDataDescriptor(100, {0}), MakeDataDescriptor(10, {0})));
+ ASSERT_FALSE(transformation_context.GetFactManager()->IsSynonymous(
+ MakeDataDescriptor(100, {1}), MakeDataDescriptor(10, {1})));
+ ASSERT_TRUE(transformation_context.GetFactManager()->IsSynonymous(
+ MakeDataDescriptor(100, {2}), MakeDataDescriptor(9, {})));
+ ASSERT_FALSE(transformation_context.GetFactManager()->IsSynonymous(
+ MakeDataDescriptor(100, {1}), MakeDataDescriptor(9, {})));
+}
+
} // namespace
} // namespace fuzz
} // namespace spvtools
diff --git a/third_party/SPIRV-Tools/test/fuzz/transformation_flatten_conditional_branch_test.cpp b/third_party/SPIRV-Tools/test/fuzz/transformation_flatten_conditional_branch_test.cpp
index e0697d4..540275a 100644
--- a/third_party/SPIRV-Tools/test/fuzz/transformation_flatten_conditional_branch_test.cpp
+++ b/third_party/SPIRV-Tools/test/fuzz/transformation_flatten_conditional_branch_test.cpp
@@ -2135,6 +2135,62 @@
.IsApplicable(context.get(), transformation_context));
}
+TEST(TransformationFlattenConditionalBranchTest, ContainsSynonymCreation) {
+ std::string shader = R"(
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %4 "main"
+ OpExecutionMode %4 OriginUpperLeft
+ OpSource ESSL 320
+ OpName %4 "main"
+ %2 = OpTypeVoid
+ %3 = OpTypeFunction %2
+ %6 = OpTypeBool
+ %7 = OpConstantFalse %6
+ %8 = OpTypeInt 32 0
+ %9 = OpTypePointer Function %8
+ %10 = OpConstant %8 42
+ %80 = OpConstant %8 0
+ %4 = OpFunction %2 None %3
+ %11 = OpLabel
+ %20 = OpVariable %9 Function
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %31 None
+ OpBranchConditional %7 %30 %31
+ %30 = OpLabel
+ OpStore %20 %10
+ %21 = OpLoad %8 %20
+ OpBranch %31
+ %31 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ )";
+
+ const auto env = SPV_ENV_UNIVERSAL_1_3;
+ const auto consumer = nullptr;
+ const auto context = BuildModule(env, consumer, shader, kFuzzAssembleOption);
+ spvtools::ValidatorOptions validator_options;
+ ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
+ kConsoleMessageConsumer));
+ TransformationContext transformation_context(
+ MakeUnique<FactManager>(context.get()), validator_options);
+
+ transformation_context.GetFactManager()->AddFactDataSynonym(
+ MakeDataDescriptor(10, {}), MakeDataDescriptor(21, {}));
+ ASSERT_FALSE(TransformationFlattenConditionalBranch(
+ 12, true, 0, 0, 0,
+ {MakeSideEffectWrapperInfo(
+ MakeInstructionDescriptor(30, SpvOpStore, 0), 100, 101),
+ MakeSideEffectWrapperInfo(
+ MakeInstructionDescriptor(21, SpvOpLoad, 0), 102, 103,
+ 104, 105, 106, 80)})
+ .IsApplicable(context.get(), transformation_context));
+}
+
} // namespace
} // namespace fuzz
} // namespace spvtools
diff --git a/third_party/SPIRV-Tools/test/operand_capabilities_test.cpp b/third_party/SPIRV-Tools/test/operand_capabilities_test.cpp
index addb08a..0aec791 100644
--- a/third_party/SPIRV-Tools/test/operand_capabilities_test.cpp
+++ b/third_party/SPIRV-Tools/test/operand_capabilities_test.cpp
@@ -498,11 +498,11 @@
CASE1(BUILT_IN, BuiltInCullDistance, CullDistance), // Bug 1407, 15234
CASE1(BUILT_IN, BuiltInVertexId, Shader),
CASE1(BUILT_IN, BuiltInInstanceId, Shader),
- CASE4(BUILT_IN, BuiltInPrimitiveId, Geometry, Tessellation,
- RayTracingNV, RayTracingProvisionalKHR),
+ CASE5(BUILT_IN, BuiltInPrimitiveId, Geometry, Tessellation,
+ RayTracingNV, RayTracingKHR, MeshShadingNV),
CASE2(BUILT_IN, BuiltInInvocationId, Geometry, Tessellation),
- CASE2(BUILT_IN, BuiltInLayer, Geometry, ShaderViewportIndexLayerEXT),
- CASE2(BUILT_IN, BuiltInViewportIndex, MultiViewport, ShaderViewportIndexLayerEXT), // Bug 15234
+ CASE3(BUILT_IN, BuiltInLayer, Geometry, ShaderViewportIndexLayerEXT, MeshShadingNV),
+ CASE3(BUILT_IN, BuiltInViewportIndex, MultiViewport, ShaderViewportIndexLayerEXT, MeshShadingNV), // Bug 15234
CASE1(BUILT_IN, BuiltInTessLevelOuter, Tessellation),
CASE1(BUILT_IN, BuiltInTessLevelInner, Tessellation),
CASE1(BUILT_IN, BuiltInTessCoord, Tessellation),
@@ -545,10 +545,11 @@
Values(SPV_ENV_UNIVERSAL_1_5),
ValuesIn(std::vector<EnumCapabilityCase>{
// SPIR-V 1.5 adds new capabilities to enable these two builtins.
- CASE3(BUILT_IN, BuiltInLayer, Geometry, ShaderLayer,
- ShaderViewportIndexLayerEXT),
- CASE3(BUILT_IN, BuiltInViewportIndex, MultiViewport,
- ShaderViewportIndex, ShaderViewportIndexLayerEXT),
+ CASE4(BUILT_IN, BuiltInLayer, Geometry, ShaderLayer,
+ ShaderViewportIndexLayerEXT, MeshShadingNV),
+ CASE4(BUILT_IN, BuiltInViewportIndex, MultiViewport,
+ ShaderViewportIndex, ShaderViewportIndexLayerEXT,
+ MeshShadingNV),
})));
// See SPIR-V Section 3.22 Selection Control
diff --git a/third_party/SPIRV-Tools/test/opt/inst_bindless_check_test.cpp b/third_party/SPIRV-Tools/test/opt/inst_bindless_check_test.cpp
index 67a4968..691bc9a 100644
--- a/third_party/SPIRV-Tools/test/opt/inst_bindless_check_test.cpp
+++ b/third_party/SPIRV-Tools/test/opt/inst_bindless_check_test.cpp
@@ -8474,6 +8474,642 @@
false, true);
}
+TEST_F(InstBindlessTest, UniformMatrixRefRowMajor) {
+ // The buffer-oob row major matrix check
+ //
+ // #version 450
+ // #extension GL_EXT_scalar_block_layout : enable
+ //
+ // layout(location = 0) in highp vec4 a_position;
+ // layout(location = 0) out mediump float v_vtxResult;
+ //
+ // layout(set = 0, binding = 0, std430, row_major) uniform Block
+ // {
+ // lowp mat4x2 var;
+ // };
+ //
+ // void main (void)
+ // {
+ // v_vtxResult = var[2][1];
+ // }
+
+ const std::string text = R"(
+ OpCapability Shader
+;CHECK: OpExtension "SPV_KHR_storage_buffer_storage_class"
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %v_vtxResult %_ %a_position
+;CHECK: OpEntryPoint Vertex %main "main" %v_vtxResult %_ %a_position %45 %72 %gl_VertexIndex %gl_InstanceIndex
+ OpSource GLSL 450
+ OpSourceExtension "GL_EXT_scalar_block_layout"
+ OpName %main "main"
+ OpName %v_vtxResult "v_vtxResult"
+ OpName %Block "Block"
+ OpMemberName %Block 0 "var"
+ OpName %_ ""
+ OpName %a_position "a_position"
+ OpDecorate %v_vtxResult RelaxedPrecision
+ OpDecorate %v_vtxResult Location 0
+ OpMemberDecorate %Block 0 RowMajor
+ OpMemberDecorate %Block 0 RelaxedPrecision
+ OpMemberDecorate %Block 0 Offset 0
+ OpMemberDecorate %Block 0 MatrixStride 16
+ OpDecorate %Block Block
+ OpDecorate %_ DescriptorSet 0
+ OpDecorate %_ Binding 0
+ OpDecorate %21 RelaxedPrecision
+;CHECK-NOT: OpDecorate %21 RelaxedPrecision
+;CHECK: OpDecorate %116 RelaxedPrecision
+ OpDecorate %a_position Location 0
+;CHECK: OpDecorate %_runtimearr_uint ArrayStride 4
+;CHECK: OpDecorate %_struct_43 Block
+;CHECK: OpMemberDecorate %_struct_43 0 Offset 0
+;CHECK: OpDecorate %45 DescriptorSet 7
+;CHECK: OpDecorate %45 Binding 1
+;CHECK: OpDecorate %61 RelaxedPrecision
+;CHECK: OpDecorate %_struct_70 Block
+;CHECK: OpMemberDecorate %_struct_70 0 Offset 0
+;CHECK: OpMemberDecorate %_struct_70 1 Offset 4
+;CHECK: OpDecorate %72 DescriptorSet 7
+;CHECK: OpDecorate %72 Binding 0
+;CHECK: OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+;CHECK: OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+%v_vtxResult = OpVariable %_ptr_Output_float Output
+ %v2float = OpTypeVector %float 2
+%mat4v2float = OpTypeMatrix %v2float 4
+ %Block = OpTypeStruct %mat4v2float
+%_ptr_Uniform_Block = OpTypePointer Uniform %Block
+ %_ = OpVariable %_ptr_Uniform_Block Uniform
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+ %int_2 = OpConstant %int 2
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Uniform_float = OpTypePointer Uniform %float
+ %v4float = OpTypeVector %float 4
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+ %a_position = OpVariable %_ptr_Input_v4float Input
+;CHECK; %uint_0 = OpConstant %uint 0
+;CHECK; %uint_4 = OpConstant %uint 4
+;CHECK; %uint_3 = OpConstant %uint 3
+;CHECK; %37 = OpTypeFunction %uint %uint %uint %uint
+;CHECK;%_runtimearr_uint = OpTypeRuntimeArray %uint
+;CHECK; %_struct_43 = OpTypeStruct %_runtimearr_uint
+;CHECK;%_ptr_StorageBuffer__struct_43 = OpTypePointer StorageBuffer %_struct_43
+;CHECK; %45 = OpVariable %_ptr_StorageBuffer__struct_43 StorageBuffer
+;CHECK;%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+;CHECK; %bool = OpTypeBool
+;CHECK; %63 = OpTypeFunction %void %uint %uint %uint %uint %uint
+;CHECK; %_struct_70 = OpTypeStruct %uint %_runtimearr_uint
+;CHECK;%_ptr_StorageBuffer__struct_70 = OpTypePointer StorageBuffer %_struct_70
+;CHECK; %72 = OpVariable %_ptr_StorageBuffer__struct_70 StorageBuffer
+;CHECK; %uint_11 = OpConstant %uint 11
+;CHECK; %uint_23 = OpConstant %uint 23
+;CHECK; %uint_2 = OpConstant %uint 2
+;CHECK;%_ptr_Input_uint = OpTypePointer Input %uint
+;CHECK;%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
+;CHECK;%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
+;CHECK; %uint_5 = OpConstant %uint 5
+;CHECK; %uint_7 = OpConstant %uint 7
+;CHECK; %uint_8 = OpConstant %uint 8
+;CHECK; %uint_9 = OpConstant %uint 9
+;CHECK; %uint_10 = OpConstant %uint 10
+;CHECK; %uint_45 = OpConstant %uint 45
+;CHECK; %115 = OpConstantNull %float
+;CHECK; %uint_27 = OpConstant %uint 27
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+;CHECK: %55 = OpFunctionCall %uint %36 %uint_1 %uint_0 %uint_0
+ %20 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 %uint_1
+ %21 = OpLoad %float %20
+;CHECK-NOT: %21 = OpLoad %float %20
+;CHECK: %30 = OpIMul %uint %uint_4 %int_2
+;CHECK: %31 = OpIAdd %uint %uint_0 %30
+;CHECK: %32 = OpIMul %uint %uint_16 %uint_1
+;CHECK: %33 = OpIAdd %uint %31 %32
+;CHECK: %35 = OpIAdd %uint %33 %uint_3
+;CHECK: %57 = OpULessThan %bool %35 %55
+;CHECK: OpSelectionMerge %58 None
+;CHECK: OpBranchConditional %57 %59 %60
+;CHECK: %59 = OpLabel
+;CHECK: %61 = OpLoad %float %20
+;CHECK: OpBranch %58
+;CHECK: %60 = OpLabel
+;CHECK: %114 = OpFunctionCall %void %62 %uint_45 %uint_3 %uint_0 %35 %55
+;CHECK: OpBranch %58
+;CHECK: %58 = OpLabel
+;CHECK: %116 = OpPhi %float %61 %59 %115 %60
+ OpStore %v_vtxResult %21
+;CHECK-NOT: OpStore %v_vtxResult %21
+;CHECK: OpStore %v_vtxResult %116
+ OpReturn
+ OpFunctionEnd
+;CHECK: %36 = OpFunction %uint None %37
+;CHECK: %38 = OpFunctionParameter %uint
+;CHECK: %39 = OpFunctionParameter %uint
+;CHECK: %40 = OpFunctionParameter %uint
+;CHECK: %41 = OpLabel
+;CHECK: %47 = OpAccessChain %_ptr_StorageBuffer_uint %45 %uint_0 %38
+;CHECK: %48 = OpLoad %uint %47
+;CHECK: %49 = OpIAdd %uint %48 %39
+;CHECK: %50 = OpAccessChain %_ptr_StorageBuffer_uint %45 %uint_0 %49
+;CHECK: %51 = OpLoad %uint %50
+;CHECK: %52 = OpIAdd %uint %51 %40
+;CHECK: %53 = OpAccessChain %_ptr_StorageBuffer_uint %45 %uint_0 %52
+;CHECK: %54 = OpLoad %uint %53
+;CHECK: OpReturnValue %54
+;CHECK: OpFunctionEnd
+;CHECK: %62 = OpFunction %void None %63
+;CHECK: %64 = OpFunctionParameter %uint
+;CHECK: %65 = OpFunctionParameter %uint
+;CHECK: %66 = OpFunctionParameter %uint
+;CHECK: %67 = OpFunctionParameter %uint
+;CHECK: %68 = OpFunctionParameter %uint
+;CHECK: %69 = OpLabel
+;CHECK: %73 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_0
+;CHECK: %75 = OpAtomicIAdd %uint %73 %uint_4 %uint_0 %uint_11
+;CHECK: %76 = OpIAdd %uint %75 %uint_11
+;CHECK: %77 = OpArrayLength %uint %72 1
+;CHECK: %78 = OpULessThanEqual %bool %76 %77
+;CHECK: OpSelectionMerge %79 None
+;CHECK: OpBranchConditional %78 %80 %79
+;CHECK: %80 = OpLabel
+;CHECK: %81 = OpIAdd %uint %75 %uint_0
+;CHECK: %82 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %81
+;CHECK: OpStore %82 %uint_11
+;CHECK: %84 = OpIAdd %uint %75 %uint_1
+;CHECK: %85 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %84
+;CHECK: OpStore %85 %uint_23
+;CHECK: %87 = OpIAdd %uint %75 %uint_2
+;CHECK: %88 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %87
+;CHECK: OpStore %88 %64
+;CHECK: %89 = OpIAdd %uint %75 %uint_3
+;CHECK: %90 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %89
+;CHECK: OpStore %90 %uint_0
+;CHECK: %93 = OpLoad %uint %gl_VertexIndex
+;CHECK: %94 = OpIAdd %uint %75 %uint_4
+;CHECK: %95 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %94
+;CHECK: OpStore %95 %93
+;CHECK: %97 = OpLoad %uint %gl_InstanceIndex
+;CHECK: %99 = OpIAdd %uint %75 %uint_5
+;CHECK: %100 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %99
+;CHECK: OpStore %100 %97
+;CHECK: %102 = OpIAdd %uint %75 %uint_7
+;CHECK: %103 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %102
+;CHECK: OpStore %103 %65
+;CHECK: %105 = OpIAdd %uint %75 %uint_8
+;CHECK: %106 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %105
+;CHECK: OpStore %106 %66
+;CHECK: %108 = OpIAdd %uint %75 %uint_9
+;CHECK: %109 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %108
+;CHECK: OpStore %109 %67
+;CHECK: %111 = OpIAdd %uint %75 %uint_10
+;CHECK: %112 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %111
+;CHECK: OpStore %112 %68
+;CHECK: OpBranch %79
+;CHECK: %79 = OpLabel
+;CHECK: OpReturn
+;CHECK: OpFunctionEnd
+ )";
+
+ SetTargetEnv(SPV_ENV_VULKAN_1_2);
+ SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
+ SinglePassRunAndMatch<InstBindlessCheckPass>(text, true, 7u, 23u, false,
+ false, true);
+}
+
+TEST_F(InstBindlessTest, UniformMatrixRefColumnMajor) {
+ // The buffer-oob column major matrix check
+ //
+ // #version 450
+ // #extension GL_EXT_scalar_block_layout : enable
+ //
+ // layout(location = 0) in highp vec4 a_position;
+ // layout(location = 0) out mediump float v_vtxResult;
+ //
+ // layout(set = 0, binding = 0, std430, column_major) uniform Block
+ // {
+ // lowp mat4x2 var;
+ // };
+ //
+ // void main (void)
+ // {
+ // v_vtxResult = var[2][1];
+ // }
+
+ const std::string text = R"(
+ OpCapability Shader
+;CHECK: OpExtension "SPV_KHR_storage_buffer_storage_class"
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %v_vtxResult %_ %a_position
+;CHECK: OpEntryPoint Vertex %main "main" %v_vtxResult %_ %a_position %45 %72 %gl_VertexIndex %gl_InstanceIndex
+ OpSource GLSL 450
+ OpSourceExtension "GL_EXT_scalar_block_layout"
+ OpName %main "main"
+ OpName %v_vtxResult "v_vtxResult"
+ OpName %Block "Block"
+ OpMemberName %Block 0 "var"
+ OpName %_ ""
+ OpName %a_position "a_position"
+ OpDecorate %v_vtxResult RelaxedPrecision
+ OpDecorate %v_vtxResult Location 0
+ OpMemberDecorate %Block 0 ColMajor
+ OpMemberDecorate %Block 0 RelaxedPrecision
+ OpMemberDecorate %Block 0 Offset 0
+ OpMemberDecorate %Block 0 MatrixStride 8
+ OpDecorate %Block Block
+ OpDecorate %_ DescriptorSet 0
+ OpDecorate %_ Binding 0
+ OpDecorate %21 RelaxedPrecision
+;CHECK-NOT: OpDecorate %21 RelaxedPrecision
+;CHECK: OpDecorate %115 RelaxedPrecision
+ OpDecorate %a_position Location 0
+;CHECK: OpDecorate %_runtimearr_uint ArrayStride 4
+;CHECK: OpDecorate %_struct_43 Block
+;CHECK: OpMemberDecorate %_struct_43 0 Offset 0
+;CHECK: OpDecorate %45 DescriptorSet 7
+;CHECK: OpDecorate %45 Binding 1
+;CHECK: OpDecorate %61 RelaxedPrecision
+;CHECK: OpDecorate %_struct_70 Block
+;CHECK: OpMemberDecorate %_struct_70 0 Offset 0
+;CHECK: OpMemberDecorate %_struct_70 1 Offset 4
+;CHECK: OpDecorate %72 DescriptorSet 7
+;CHECK: OpDecorate %72 Binding 0
+;CHECK: OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+;CHECK: OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+%v_vtxResult = OpVariable %_ptr_Output_float Output
+ %v2float = OpTypeVector %float 2
+%mat4v2float = OpTypeMatrix %v2float 4
+ %Block = OpTypeStruct %mat4v2float
+%_ptr_Uniform_Block = OpTypePointer Uniform %Block
+ %_ = OpVariable %_ptr_Uniform_Block Uniform
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+ %int_2 = OpConstant %int 2
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Uniform_float = OpTypePointer Uniform %float
+ %v4float = OpTypeVector %float 4
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+ %a_position = OpVariable %_ptr_Input_v4float Input
+;CHECK: %uint_0 = OpConstant %uint 0
+;CHECK: %uint_8 = OpConstant %uint 8
+;CHECK: %uint_4 = OpConstant %uint 4
+;CHECK: %uint_3 = OpConstant %uint 3
+;CHECK: %37 = OpTypeFunction %uint %uint %uint %uint
+;CHECK:%_runtimearr_uint = OpTypeRuntimeArray %uint
+;CHECK: %_struct_43 = OpTypeStruct %_runtimearr_uint
+;CHECK:%_ptr_StorageBuffer__struct_43 = OpTypePointer StorageBuffer %_struct_43
+;CHECK: %45 = OpVariable %_ptr_StorageBuffer__struct_43 StorageBuffer
+;CHECK:%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+;CHECK: %bool = OpTypeBool
+;CHECK: %63 = OpTypeFunction %void %uint %uint %uint %uint %uint
+;CHECK: %_struct_70 = OpTypeStruct %uint %_runtimearr_uint
+;CHECK:%_ptr_StorageBuffer__struct_70 = OpTypePointer StorageBuffer %_struct_70
+;CHECK: %72 = OpVariable %_ptr_StorageBuffer__struct_70 StorageBuffer
+;CHECK: %uint_11 = OpConstant %uint 11
+;CHECK: %uint_23 = OpConstant %uint 23
+;CHECK: %uint_2 = OpConstant %uint 2
+;CHECK:%_ptr_Input_uint = OpTypePointer Input %uint
+;CHECK:%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
+;CHECK:%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
+;CHECK: %uint_5 = OpConstant %uint 5
+;CHECK: %uint_7 = OpConstant %uint 7
+;CHECK: %uint_9 = OpConstant %uint 9
+;CHECK: %uint_10 = OpConstant %uint 10
+;CHECK: %uint_45 = OpConstant %uint 45
+%main = OpFunction %void None %3
+ %5 = OpLabel
+;CHECK: %55 = OpFunctionCall %uint %36 %uint_1 %uint_0 %uint_0
+ %20 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2 %uint_1
+ %21 = OpLoad %float %20
+;CHECK-NOT: %21 = OpLoad %float %20
+;CHECK: %29 = OpIMul %uint %uint_8 %int_2
+;CHECK: %30 = OpIAdd %uint %uint_0 %29
+;CHECK: %32 = OpIMul %uint %uint_4 %uint_1
+;CHECK: %33 = OpIAdd %uint %30 %32
+;CHECK: %35 = OpIAdd %uint %33 %uint_3
+;CHECK: %57 = OpULessThan %bool %35 %55
+;CHECK: OpSelectionMerge %58 None
+;CHECK: OpBranchConditional %57 %59 %60
+;CHECK: %59 = OpLabel
+;CHECK: %61 = OpLoad %float %20
+;CHECK: OpBranch %58
+;CHECK: %60 = OpLabel
+;CHECK: %113 = OpFunctionCall %void %62 %uint_45 %uint_3 %uint_0 %35 %55
+;CHECK: OpBranch %58
+;CHECK: %58 = OpLabel
+;CHECK: %115 = OpPhi %float %61 %59 %114 %60
+ OpStore %v_vtxResult %21
+;CHECK-NOT: OpStore %v_vtxResult %21
+;CHECK: OpStore %v_vtxResult %115
+ OpReturn
+ OpFunctionEnd
+;CHECK: %36 = OpFunction %uint None %37
+;CHECK: %38 = OpFunctionParameter %uint
+;CHECK: %39 = OpFunctionParameter %uint
+;CHECK: %40 = OpFunctionParameter %uint
+;CHECK: %41 = OpLabel
+;CHECK: %47 = OpAccessChain %_ptr_StorageBuffer_uint %45 %uint_0 %38
+;CHECK: %48 = OpLoad %uint %47
+;CHECK: %49 = OpIAdd %uint %48 %39
+;CHECK: %50 = OpAccessChain %_ptr_StorageBuffer_uint %45 %uint_0 %49
+;CHECK: %51 = OpLoad %uint %50
+;CHECK: %52 = OpIAdd %uint %51 %40
+;CHECK: %53 = OpAccessChain %_ptr_StorageBuffer_uint %45 %uint_0 %52
+;CHECK: %54 = OpLoad %uint %53
+;CHECK: OpReturnValue %54
+;CHECK: OpFunctionEnd
+;CHECK: %62 = OpFunction %void None %63
+;CHECK: %64 = OpFunctionParameter %uint
+;CHECK: %65 = OpFunctionParameter %uint
+;CHECK: %66 = OpFunctionParameter %uint
+;CHECK: %67 = OpFunctionParameter %uint
+;CHECK: %68 = OpFunctionParameter %uint
+;CHECK: %69 = OpLabel
+;CHECK: %73 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_0
+;CHECK: %75 = OpAtomicIAdd %uint %73 %uint_4 %uint_0 %uint_11
+;CHECK: %76 = OpIAdd %uint %75 %uint_11
+;CHECK: %77 = OpArrayLength %uint %72 1
+;CHECK: %78 = OpULessThanEqual %bool %76 %77
+;CHECK: OpSelectionMerge %79 None
+;CHECK: OpBranchConditional %78 %80 %79
+;CHECK: %80 = OpLabel
+;CHECK: %81 = OpIAdd %uint %75 %uint_0
+;CHECK: %82 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %81
+;CHECK: OpStore %82 %uint_11
+;CHECK: %84 = OpIAdd %uint %75 %uint_1
+;CHECK: %85 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %84
+;CHECK: OpStore %85 %uint_23
+;CHECK: %87 = OpIAdd %uint %75 %uint_2
+;CHECK: %88 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %87
+;CHECK: OpStore %88 %64
+;CHECK: %89 = OpIAdd %uint %75 %uint_3
+;CHECK: %90 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %89
+;CHECK: OpStore %90 %uint_0
+;CHECK: %93 = OpLoad %uint %gl_VertexIndex
+;CHECK: %94 = OpIAdd %uint %75 %uint_4
+;CHECK: %95 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %94
+;CHECK: OpStore %95 %93
+;CHECK: %97 = OpLoad %uint %gl_InstanceIndex
+;CHECK: %99 = OpIAdd %uint %75 %uint_5
+;CHECK: %100 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %99
+;CHECK: OpStore %100 %97
+;CHECK: %102 = OpIAdd %uint %75 %uint_7
+;CHECK: %103 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %102
+;CHECK: OpStore %103 %65
+;CHECK: %104 = OpIAdd %uint %75 %uint_8
+;CHECK: %105 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %104
+;CHECK: OpStore %105 %66
+;CHECK: %107 = OpIAdd %uint %75 %uint_9
+;CHECK: %108 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %107
+;CHECK: OpStore %108 %67
+;CHECK: %110 = OpIAdd %uint %75 %uint_10
+;CHECK: %111 = OpAccessChain %_ptr_StorageBuffer_uint %72 %uint_1 %110
+;CHECK: OpStore %111 %68
+;CHECK: OpBranch %79
+;CHECK: %79 = OpLabel
+;CHECK: OpReturn
+;CHECK: OpFunctionEnd
+ )";
+
+ SetTargetEnv(SPV_ENV_VULKAN_1_2);
+ SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
+ SinglePassRunAndMatch<InstBindlessCheckPass>(text, true, 7u, 23u, false,
+ false, true);
+}
+
+TEST_F(InstBindlessTest, UniformMatrixVecRefRowMajor) {
+ // The buffer-oob row major matrix vector ref check
+ //
+ // #version 450
+ // #extension GL_EXT_scalar_block_layout : enable
+ //
+ // layout(location = 0) in highp vec4 a_position;
+ // layout(location = 0) out highp vec2 v_vtxResult;
+ //
+ // layout(set = 0, binding = 0, std430, row_major) uniform Block
+ // {
+ // lowp mat2 var[3][4];
+ // };
+ //
+ // void main (void)
+ // {
+ // v_vtxResult = var[2][3][1];
+ // }
+
+ const std::string text = R"(
+ OpCapability Shader
+;CHECK: OpExtension "SPV_KHR_storage_buffer_storage_class"
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %v_vtxResult %_ %a_position
+;CHECK: OpEntryPoint Vertex %main "main" %v_vtxResult %_ %a_position %54 %81 %gl_VertexIndex %gl_InstanceIndex
+ OpSource GLSL 450
+ OpSourceExtension "GL_EXT_scalar_block_layout"
+ OpName %main "main"
+ OpName %v_vtxResult "v_vtxResult"
+ OpName %Block "Block"
+ OpMemberName %Block 0 "var"
+ OpName %_ ""
+ OpName %a_position "a_position"
+ OpDecorate %v_vtxResult Location 0
+ OpDecorate %_arr_mat2v2float_uint_4 ArrayStride 32
+ OpDecorate %_arr__arr_mat2v2float_uint_4_uint_3 ArrayStride 128
+ OpMemberDecorate %Block 0 RowMajor
+ OpMemberDecorate %Block 0 RelaxedPrecision
+ OpMemberDecorate %Block 0 Offset 0
+ OpMemberDecorate %Block 0 MatrixStride 16
+ OpDecorate %Block Block
+ OpDecorate %_ DescriptorSet 0
+ OpDecorate %_ Binding 0
+ OpDecorate %26 RelaxedPrecision
+;CHECK-NOT: OpDecorate %26 RelaxedPrecision
+;CHECK: OpDecorate %125 RelaxedPrecision
+ OpDecorate %a_position Location 0
+;CHECK: OpDecorate %_runtimearr_uint ArrayStride 4
+;CHECK: OpDecorate %_struct_52 Block
+;CHECK: OpMemberDecorate %_struct_52 0 Offset 0
+;CHECK: OpDecorate %54 DescriptorSet 7
+;CHECK: OpDecorate %54 Binding 1
+;CHECK: OpDecorate %70 RelaxedPrecision
+;CHECK: OpDecorate %_struct_79 Block
+;CHECK: OpMemberDecorate %_struct_79 0 Offset 0
+;CHECK: OpMemberDecorate %_struct_79 1 Offset 4
+;CHECK: OpDecorate %81 DescriptorSet 7
+;CHECK: OpDecorate %81 Binding 0
+;CHECK: OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+;CHECK: OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%_ptr_Output_v2float = OpTypePointer Output %v2float
+%v_vtxResult = OpVariable %_ptr_Output_v2float Output
+%mat2v2float = OpTypeMatrix %v2float 2
+ %uint = OpTypeInt 32 0
+ %uint_4 = OpConstant %uint 4
+%_arr_mat2v2float_uint_4 = OpTypeArray %mat2v2float %uint_4
+ %uint_3 = OpConstant %uint 3
+%_arr__arr_mat2v2float_uint_4_uint_3 = OpTypeArray %_arr_mat2v2float_uint_4 %uint_3
+ %Block = OpTypeStruct %_arr__arr_mat2v2float_uint_4_uint_3
+%_ptr_Uniform_Block = OpTypePointer Uniform %Block
+ %_ = OpVariable %_ptr_Uniform_Block Uniform
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+ %int_2 = OpConstant %int 2
+ %int_3 = OpConstant %int 3
+ %int_1 = OpConstant %int 1
+%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
+ %v4float = OpTypeVector %float 4
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+ %a_position = OpVariable %_ptr_Input_v4float Input
+;CHECK: %uint_0 = OpConstant %uint 0
+;CHECK: %uint_128 = OpConstant %uint 128
+;CHECK: %uint_32 = OpConstant %uint 32
+;CHECK: %uint_16 = OpConstant %uint 16
+;CHECK: %uint_19 = OpConstant %uint 19
+;CHECK: %uint_1 = OpConstant %uint 1
+;CHECK: %46 = OpTypeFunction %uint %uint %uint %uint
+;CHECK:%_runtimearr_uint = OpTypeRuntimeArray %uint
+;CHECK: %_struct_52 = OpTypeStruct %_runtimearr_uint
+;CHECK:%_ptr_StorageBuffer__struct_52 = OpTypePointer StorageBuffer %_struct_52
+;CHECK: %54 = OpVariable %_ptr_StorageBuffer__struct_52 StorageBuffer
+;CHECK:%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+;CHECK: %bool = OpTypeBool
+;CHECK: %72 = OpTypeFunction %void %uint %uint %uint %uint %uint
+;CHECK: %_struct_79 = OpTypeStruct %uint %_runtimearr_uint
+;CHECK:%_ptr_StorageBuffer__struct_79 = OpTypePointer StorageBuffer %_struct_79
+;CHECK: %81 = OpVariable %_ptr_StorageBuffer__struct_79 StorageBuffer
+;CHECK: %uint_11 = OpConstant %uint 11
+;CHECK: %uint_23 = OpConstant %uint 23
+;CHECK: %uint_2 = OpConstant %uint 2
+;CHECK:%_ptr_Input_uint = OpTypePointer Input %uint
+;CHECK:%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
+;CHECK:%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
+;CHECK: %uint_5 = OpConstant %uint 5
+;CHECK: %uint_7 = OpConstant %uint 7
+;CHECK: %uint_8 = OpConstant %uint 8
+;CHECK: %uint_9 = OpConstant %uint 9
+;CHECK: %uint_10 = OpConstant %uint 10
+;CHECK: %uint_51 = OpConstant %uint 51
+;CHECK: %124 = OpConstantNull %v2float
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+;CHECK: %64 = OpFunctionCall %uint %45 %uint_1 %uint_0 %uint_0
+;CHECK: OpBranch %31
+;CHECK: %31 = OpLabel
+;CHECK: OpBranch %30
+;CHECK: %30 = OpLabel
+ %25 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 %int_2 %int_3 %int_1
+ %26 = OpLoad %v2float %25
+ OpStore %v_vtxResult %26
+;CHECK-NOT: %26 = OpLoad %v2float %25
+;CHECK-NOT: OpStore %v_vtxResult %26
+;CHECK: %34 = OpIMul %uint %uint_128 %int_2
+;CHECK: %35 = OpIAdd %uint %uint_0 %34
+;CHECK: %37 = OpIMul %uint %uint_32 %int_3
+;CHECK: %38 = OpIAdd %uint %35 %37
+;CHECK: %40 = OpIMul %uint %uint_4 %int_1
+;CHECK: %41 = OpIAdd %uint %38 %40
+;CHECK: %43 = OpIAdd %uint %41 %uint_19
+;CHECK: %66 = OpULessThan %bool %43 %64
+;CHECK: OpSelectionMerge %67 None
+;CHECK: OpBranchConditional %66 %68 %69
+;CHECK: %68 = OpLabel
+;CHECK: %70 = OpLoad %v2float %25
+;CHECK: OpBranch %67
+;CHECK: %69 = OpLabel
+;CHECK: %123 = OpFunctionCall %void %71 %uint_51 %uint_3 %uint_0 %43 %64
+;CHECK: OpBranch %67
+;CHECK: %67 = OpLabel
+;CHECK: %125 = OpPhi %v2float %70 %68 %124 %69
+;CHECK: OpStore %v_vtxResult %125
+ OpReturn
+ OpFunctionEnd
+;CHECK: %45 = OpFunction %uint None %46
+;CHECK: %47 = OpFunctionParameter %uint
+;CHECK: %48 = OpFunctionParameter %uint
+;CHECK: %49 = OpFunctionParameter %uint
+;CHECK: %50 = OpLabel
+;CHECK: %56 = OpAccessChain %_ptr_StorageBuffer_uint %54 %uint_0 %47
+;CHECK: %57 = OpLoad %uint %56
+;CHECK: %58 = OpIAdd %uint %57 %48
+;CHECK: %59 = OpAccessChain %_ptr_StorageBuffer_uint %54 %uint_0 %58
+;CHECK: %60 = OpLoad %uint %59
+;CHECK: %61 = OpIAdd %uint %60 %49
+;CHECK: %62 = OpAccessChain %_ptr_StorageBuffer_uint %54 %uint_0 %61
+;CHECK: %63 = OpLoad %uint %62
+;CHECK: OpReturnValue %63
+;CHECK: OpFunctionEnd
+;CHECK: %71 = OpFunction %void None %72
+;CHECK: %73 = OpFunctionParameter %uint
+;CHECK: %74 = OpFunctionParameter %uint
+;CHECK: %75 = OpFunctionParameter %uint
+;CHECK: %76 = OpFunctionParameter %uint
+;CHECK: %77 = OpFunctionParameter %uint
+;CHECK: %78 = OpLabel
+;CHECK: %82 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_0
+;CHECK: %84 = OpAtomicIAdd %uint %82 %uint_4 %uint_0 %uint_11
+;CHECK: %85 = OpIAdd %uint %84 %uint_11
+;CHECK: %86 = OpArrayLength %uint %81 1
+;CHECK: %87 = OpULessThanEqual %bool %85 %86
+;CHECK: OpSelectionMerge %88 None
+;CHECK: OpBranchConditional %87 %89 %88
+;CHECK: %89 = OpLabel
+;CHECK: %90 = OpIAdd %uint %84 %uint_0
+;CHECK: %91 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_1 %90
+;CHECK: OpStore %91 %uint_11
+;CHECK: %93 = OpIAdd %uint %84 %uint_1
+;CHECK: %94 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_1 %93
+;CHECK: OpStore %94 %uint_23
+;CHECK: %96 = OpIAdd %uint %84 %uint_2
+;CHECK: %97 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_1 %96
+;CHECK: OpStore %97 %73
+;CHECK: %98 = OpIAdd %uint %84 %uint_3
+;CHECK: %99 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_1 %98
+;CHECK: OpStore %99 %uint_0
+;CHECK: %102 = OpLoad %uint %gl_VertexIndex
+;CHECK: %103 = OpIAdd %uint %84 %uint_4
+;CHECK: %104 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_1 %103
+;CHECK: OpStore %104 %102
+;CHECK: %106 = OpLoad %uint %gl_InstanceIndex
+;CHECK: %108 = OpIAdd %uint %84 %uint_5
+;CHECK: %109 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_1 %108
+;CHECK: OpStore %109 %106
+;CHECK: %111 = OpIAdd %uint %84 %uint_7
+;CHECK: %112 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_1 %111
+;CHECK: OpStore %112 %74
+;CHECK: %114 = OpIAdd %uint %84 %uint_8
+;CHECK: %115 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_1 %114
+;CHECK: OpStore %115 %75
+;CHECK: %117 = OpIAdd %uint %84 %uint_9
+;CHECK: %118 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_1 %117
+;CHECK: OpStore %118 %76
+;CHECK: %120 = OpIAdd %uint %84 %uint_10
+;CHECK: %121 = OpAccessChain %_ptr_StorageBuffer_uint %81 %uint_1 %120
+;CHECK: OpStore %121 %77
+;CHECK: OpBranch %88
+;CHECK: %88 = OpLabel
+;CHECK: OpReturn
+;CHECK: OpFunctionEnd
+ )";
+
+ SetTargetEnv(SPV_ENV_VULKAN_1_2);
+ SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
+ SinglePassRunAndMatch<InstBindlessCheckPass>(text, true, 7u, 23u, false,
+ false, true);
+}
+
// TODO(greg-lunarg): Add tests to verify handling of these cases:
//
// Compute shader
diff --git a/third_party/SPIRV-Tools/test/opt/local_ssa_elim_test.cpp b/third_party/SPIRV-Tools/test/opt/local_ssa_elim_test.cpp
index ff42193..9baf8da 100644
--- a/third_party/SPIRV-Tools/test/opt/local_ssa_elim_test.cpp
+++ b/third_party/SPIRV-Tools/test/opt/local_ssa_elim_test.cpp
@@ -2371,6 +2371,154 @@
SinglePassRunAndMatch<SSARewritePass>(text, true);
}
+TEST_F(LocalSSAElimTest, DebugValueWithIndexesInForLoop) {
+ // #version 140
+ //
+ // in vec4 BC;
+ // out float fo;
+ //
+ // struct T {
+ // float a;
+ // float f;
+ // };
+ //
+ // struct value {
+ // int x;
+ // int y;
+ // T z;
+ // };
+ //
+ // void main()
+ // {
+ // value v;
+ // v.z.f = 0.0;
+ // for (int i=0; i<4; i++) {
+ // v.z.f = v.z.f + BC[i];
+ // }
+ // fo = v.z.f;
+ // }
+
+ const std::string text = R"(
+; CHECK: [[f_name:%\w+]] = OpString "f"
+; CHECK: [[dbg_f:%\w+]] = OpExtInst %void [[ext:%\d+]] DebugLocalVariable [[f_name]]
+
+; CHECK: OpStore %f %float_0
+; CHECK-NEXT: OpExtInst %void [[ext]] DebugValue [[dbg_f]] %float_0 [[null_expr:%\d+]] %int_2 %int_1
+
+; CHECK-NOT: DebugDeclare
+
+; CHECK: [[loop_head:%\w+]] = OpLabel
+; CHECK: [[phi0:%\w+]] = OpPhi %float %float_0
+; CHECK: OpExtInst %void [[ext]] DebugValue [[dbg_f]] [[phi0]] [[null_expr]] %int_2 %int_1
+; CHECK: OpLoopMerge [[loop_merge:%\w+]] [[loop_cont:%\w+]] None
+; CHECK-NEXT: OpBranch [[loop_body:%\w+]]
+
+; CHECK-NEXT: [[loop_body]] = OpLabel
+; CHECK: OpBranchConditional {{%\w+}} [[bb:%\w+]] [[loop_merge]]
+
+; CHECK: [[bb]] = OpLabel
+; CHECK: OpStore %f [[f_val:%\w+]]
+; CHECK-NEXT: OpExtInst %void [[ext]] DebugValue [[dbg_f]] [[f_val]] [[null_expr]] %int_2 %int_1
+; CHECK-NEXT: OpBranch [[loop_cont]]
+
+; CHECK: [[loop_cont]] = OpLabel
+; CHECK: OpBranch [[loop_head]]
+
+; CHECK: [[loop_merge]] = OpLabel
+
+OpCapability Shader
+%1 = OpExtInstImport "GLSL.std.450"
+%ext = OpExtInstImport "OpenCL.DebugInfo.100"
+OpMemoryModel Logical GLSL450
+OpEntryPoint Fragment %main "main" %BC %fo
+OpExecutionMode %main OriginUpperLeft
+%file_name = OpString "test"
+OpSource GLSL 140
+%float_name = OpString "float"
+%main_name = OpString "main"
+%f_name = OpString "f"
+%i_name = OpString "i"
+OpName %main "main"
+OpName %f "f"
+OpName %i "i"
+OpName %BC "BC"
+OpName %fo "fo"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+%float_0 = OpConstant %float 0
+%int = OpTypeInt 32 1
+%uint = OpTypeInt 32 0
+%uint_32 = OpConstant %uint 32
+%_ptr_Function_int = OpTypePointer Function %int
+%int_0 = OpConstant %int 0
+%int_4 = OpConstant %int 4
+%bool = OpTypeBool
+%v4float = OpTypeVector %float 4
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%BC = OpVariable %_ptr_Input_v4float Input
+%_ptr_Input_float = OpTypePointer Input %float
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%_ptr_Output_float = OpTypePointer Output %float
+%fo = OpVariable %_ptr_Output_float Output
+%deref = OpExtInst %void %ext DebugOperation Deref
+%null_expr = OpExtInst %void %ext DebugExpression
+%deref_expr = OpExtInst %void %ext DebugExpression %deref
+%src = OpExtInst %void %ext DebugSource %file_name
+%cu = OpExtInst %void %ext DebugCompilationUnit 1 4 %src HLSL
+%dbg_tf = OpExtInst %void %ext DebugTypeBasic %float_name %uint_32 Float
+%dbg_v4f = OpExtInst %void %ext DebugTypeVector %dbg_tf 4
+%main_ty = OpExtInst %void %ext DebugTypeFunction FlagIsProtected|FlagIsPrivate %dbg_v4f %dbg_v4f
+%dbg_main = OpExtInst %void %ext DebugFunction %main_name %main_ty %src 0 0 %cu %main_name FlagIsProtected|FlagIsPrivate 10 %main
+%dbg_f = OpExtInst %void %ext DebugLocalVariable %f_name %dbg_v4f %src 0 0 %dbg_main FlagIsLocal
+%dbg_i = OpExtInst %void %ext DebugLocalVariable %i_name %dbg_v4f %src 0 0 %dbg_main FlagIsLocal
+%main = OpFunction %void None %8
+%22 = OpLabel
+%s0 = OpExtInst %void %ext DebugScope %dbg_main
+%f = OpVariable %_ptr_Function_float Function
+%i = OpVariable %_ptr_Function_int Function
+OpStore %f %float_0
+OpStore %i %int_0
+%decl0 = OpExtInst %void %ext DebugValue %dbg_f %f %deref_expr %int_2 %int_1
+%decl1 = OpExtInst %void %ext DebugDeclare %dbg_i %i %null_expr
+OpBranch %23
+%23 = OpLabel
+%s1 = OpExtInst %void %ext DebugScope %dbg_main
+OpLoopMerge %24 %25 None
+OpBranch %26
+%26 = OpLabel
+%s2 = OpExtInst %void %ext DebugScope %dbg_main
+%27 = OpLoad %int %i
+%28 = OpSLessThan %bool %27 %int_4
+OpBranchConditional %28 %29 %24
+%29 = OpLabel
+%s3 = OpExtInst %void %ext DebugScope %dbg_main
+%30 = OpLoad %float %f
+%31 = OpLoad %int %i
+%32 = OpAccessChain %_ptr_Input_float %BC %31
+%33 = OpLoad %float %32
+%34 = OpFAdd %float %30 %33
+OpStore %f %34
+OpBranch %25
+%25 = OpLabel
+%s4 = OpExtInst %void %ext DebugScope %dbg_main
+%35 = OpLoad %int %i
+%36 = OpIAdd %int %35 %int_1
+OpStore %i %36
+OpBranch %23
+%24 = OpLabel
+%s5 = OpExtInst %void %ext DebugScope %dbg_main
+%37 = OpLoad %float %f
+OpStore %fo %37
+OpReturn
+OpFunctionEnd
+)";
+
+ SinglePassRunAndMatch<SSARewritePass>(text, true);
+}
+
TEST_F(LocalSSAElimTest, PartiallyKillDebugDeclare) {
// For a reference variable e.g., int i in the following example,
// we do not propagate DebugValue for a store or phi instruction
diff --git a/third_party/SPIRV-Tools/test/opt/scalar_replacement_test.cpp b/third_party/SPIRV-Tools/test/opt/scalar_replacement_test.cpp
index 2130f69..1073855 100644
--- a/third_party/SPIRV-Tools/test/opt/scalar_replacement_test.cpp
+++ b/third_party/SPIRV-Tools/test/opt/scalar_replacement_test.cpp
@@ -2079,6 +2079,124 @@
SinglePassRunAndMatch<ScalarReplacementPass>(text, true);
}
+TEST_F(ScalarReplacementTest, DebugValueWithIndex) {
+ const std::string text = R"(
+OpCapability Shader
+OpCapability Linkage
+%ext = OpExtInstImport "OpenCL.DebugInfo.100"
+OpMemoryModel Logical GLSL450
+%test = OpString "test"
+OpName %6 "simple_struct"
+%1 = OpTypeVoid
+%2 = OpTypeInt 32 0
+%uint_32 = OpConstant %2 32
+%3 = OpTypeStruct %2 %2 %2 %2
+%4 = OpTypePointer Function %3
+%5 = OpTypePointer Function %2
+%6 = OpTypeFunction %2
+%7 = OpConstantNull %3
+%8 = OpConstant %2 0
+%9 = OpConstant %2 1
+%10 = OpConstant %2 2
+%11 = OpConstant %2 3
+%deref = OpExtInst %1 %ext DebugOperation Deref
+%deref_expr = OpExtInst %1 %ext DebugExpression %deref
+%null_expr = OpExtInst %1 %ext DebugExpression
+%src = OpExtInst %1 %ext DebugSource %test
+%cu = OpExtInst %1 %ext DebugCompilationUnit 1 4 %src HLSL
+%dbg_tf = OpExtInst %1 %ext DebugTypeBasic %test %uint_32 Float
+%main_ty = OpExtInst %1 %ext DebugTypeFunction FlagIsProtected|FlagIsPrivate %1
+%dbg_main = OpExtInst %1 %ext DebugFunction %test %main_ty %src 0 0 %cu %test FlagIsProtected|FlagIsPrivate 0 %12
+%dbg_foo = OpExtInst %1 %ext DebugLocalVariable %test %dbg_tf %src 0 0 %dbg_main FlagIsLocal
+%12 = OpFunction %2 None %6
+%13 = OpLabel
+%scope = OpExtInst %1 %ext DebugScope %dbg_main
+%14 = OpVariable %4 Function %7
+
+; CHECK: [[deref:%\w+]] = OpExtInst %void [[ext:%\w+]] DebugOperation Deref
+; CHECK: [[deref_expr:%\w+]] = OpExtInst %void [[ext]] DebugExpression [[deref]]
+; CHECK: [[dbg_local_var:%\w+]] = OpExtInst %void [[ext]] DebugLocalVariable
+; CHECK: [[repl3:%\w+]] = OpVariable %_ptr_Function_uint Function
+; CHECK: [[repl2:%\w+]] = OpVariable %_ptr_Function_uint Function
+; CHECK: [[repl1:%\w+]] = OpVariable %_ptr_Function_uint Function
+; CHECK: [[repl0:%\w+]] = OpVariable %_ptr_Function_uint Function
+; CHECK: OpExtInst %void [[ext]] DebugValue [[dbg_local_var]] [[repl0]] [[deref_expr]] %uint_0 %uint_1 %uint_2 %int_0
+; CHECK: OpExtInst %void [[ext]] DebugValue [[dbg_local_var]] [[repl1]] [[deref_expr]] %uint_0 %uint_1 %uint_2 %int_1
+; CHECK: OpExtInst %void [[ext]] DebugValue [[dbg_local_var]] [[repl2]] [[deref_expr]] %uint_0 %uint_1 %uint_2 %int_2
+; CHECK: OpExtInst %void [[ext]] DebugValue [[dbg_local_var]] [[repl3]] [[deref_expr]] %uint_0 %uint_1 %uint_2 %int_3
+%value = OpExtInst %1 %ext DebugValue %dbg_foo %14 %deref_expr %8 %9 %10
+
+%15 = OpInBoundsAccessChain %5 %14 %8
+%16 = OpLoad %2 %15
+%17 = OpAccessChain %5 %14 %10
+%18 = OpLoad %2 %17
+%19 = OpIAdd %2 %16 %18
+OpReturnValue %19
+OpFunctionEnd
+)";
+
+ SinglePassRunAndMatch<ScalarReplacementPass>(text, true);
+}
+
+TEST_F(ScalarReplacementTest, DebugDeclareForVariableInOtherBB) {
+ const std::string text = R"(
+OpCapability Shader
+OpCapability Linkage
+%ext = OpExtInstImport "OpenCL.DebugInfo.100"
+OpMemoryModel Logical GLSL450
+%test = OpString "test"
+OpName %6 "simple_struct"
+%1 = OpTypeVoid
+%2 = OpTypeInt 32 0
+%uint_32 = OpConstant %2 32
+%3 = OpTypeStruct %2 %2 %2 %2
+%4 = OpTypePointer Function %3
+%5 = OpTypePointer Function %2
+%6 = OpTypeFunction %2
+%7 = OpConstantNull %3
+%8 = OpConstant %2 0
+%9 = OpConstant %2 1
+%10 = OpConstant %2 2
+%11 = OpConstant %2 3
+%deref = OpExtInst %1 %ext DebugOperation Deref
+%deref_expr = OpExtInst %1 %ext DebugExpression %deref
+%null_expr = OpExtInst %1 %ext DebugExpression
+%src = OpExtInst %1 %ext DebugSource %test
+%cu = OpExtInst %1 %ext DebugCompilationUnit 1 4 %src HLSL
+%dbg_tf = OpExtInst %1 %ext DebugTypeBasic %test %uint_32 Float
+%main_ty = OpExtInst %1 %ext DebugTypeFunction FlagIsProtected|FlagIsPrivate %1
+%dbg_main = OpExtInst %1 %ext DebugFunction %test %main_ty %src 0 0 %cu %test FlagIsProtected|FlagIsPrivate 0 %12
+%dbg_foo = OpExtInst %1 %ext DebugLocalVariable %test %dbg_tf %src 0 0 %dbg_main FlagIsLocal
+%12 = OpFunction %2 None %6
+%13 = OpLabel
+%scope = OpExtInst %1 %ext DebugScope %dbg_main
+%14 = OpVariable %4 Function %7
+
+; CHECK: [[dbg_local_var:%\w+]] = OpExtInst %void [[ext:%\w+]] DebugLocalVariable
+; CHECK: [[repl3:%\w+]] = OpVariable %_ptr_Function_uint Function
+; CHECK: OpExtInst %void [[ext]] DebugValue [[dbg_local_var]] [[repl3]] [[deref_expr:%\w+]] %int_3
+; CHECK: [[repl2:%\w+]] = OpVariable %_ptr_Function_uint Function
+; CHECK: OpExtInst %void [[ext]] DebugValue [[dbg_local_var]] [[repl2]] [[deref_expr]] %int_2
+; CHECK: [[repl1:%\w+]] = OpVariable %_ptr_Function_uint Function
+; CHECK: OpExtInst %void [[ext]] DebugValue [[dbg_local_var]] [[repl1]] [[deref_expr]] %int_1
+; CHECK: [[repl0:%\w+]] = OpVariable %_ptr_Function_uint Function
+; CHECK: OpExtInst %void [[ext]] DebugValue [[dbg_local_var]] [[repl0]] [[deref_expr]] %int_0
+
+OpBranch %20
+%20 = OpLabel
+%value = OpExtInst %1 %ext DebugDeclare %dbg_foo %14 %null_expr
+%15 = OpInBoundsAccessChain %5 %14 %8
+%16 = OpLoad %2 %15
+%17 = OpAccessChain %5 %14 %10
+%18 = OpLoad %2 %17
+%19 = OpIAdd %2 %16 %18
+OpReturnValue %19
+OpFunctionEnd
+)";
+
+ SinglePassRunAndMatch<ScalarReplacementPass>(text, true);
+}
+
} // namespace
} // namespace opt
} // namespace spvtools
diff --git a/third_party/SPIRV-Tools/test/val/val_barriers_test.cpp b/third_party/SPIRV-Tools/test/val/val_barriers_test.cpp
index 3643883..8bd10d4 100644
--- a/third_party/SPIRV-Tools/test/val/val_barriers_test.cpp
+++ b/third_party/SPIRV-Tools/test/val/val_barriers_test.cpp
@@ -1595,7 +1595,7 @@
// capabilities_and_extensions
R"(
OpCapability VulkanMemoryModelKHR
- OpCapability RayTracingProvisionalKHR
+ OpCapability RayTracingKHR
OpExtension "SPV_KHR_vulkan_memory_model"
OpExtension "SPV_KHR_ray_tracing"
)",
@@ -1642,7 +1642,7 @@
// capabilities_and_extensions
R"(
OpCapability VulkanMemoryModelKHR
- OpCapability RayTracingProvisionalKHR
+ OpCapability RayTracingKHR
OpExtension "SPV_KHR_vulkan_memory_model"
OpExtension "SPV_KHR_ray_tracing"
)",
diff --git a/third_party/SPIRV-Tools/test/val/val_memory_test.cpp b/third_party/SPIRV-Tools/test/val/val_memory_test.cpp
index b32867b..e541890 100644
--- a/third_party/SPIRV-Tools/test/val/val_memory_test.cpp
+++ b/third_party/SPIRV-Tools/test/val/val_memory_test.cpp
@@ -58,7 +58,7 @@
"are used only as handles to refer to opaque resources. Such "
"variables must be typed as OpTypeImage, OpTypeSampler, "
"OpTypeSampledImage, OpTypeAccelerationStructureNV, "
- "OpTypeAccelerationStructureKHR, OpTypeRayQueryProvisionalKHR, "
+ "OpTypeAccelerationStructureKHR, OpTypeRayQueryKHR, "
"or an array of one of these types."));
}
@@ -112,7 +112,7 @@
"are used only as handles to refer to opaque resources. Such "
"variables must be typed as OpTypeImage, OpTypeSampler, "
"OpTypeSampledImage, OpTypeAccelerationStructureNV, "
- "OpTypeAccelerationStructureKHR, OpTypeRayQueryProvisionalKHR, "
+ "OpTypeAccelerationStructureKHR, OpTypeRayQueryKHR, "
"or an array of one of these types."));
}
diff --git a/third_party/SPIRV-Tools/utils/vscode/src/schema/schema.go b/third_party/SPIRV-Tools/utils/vscode/src/schema/schema.go
index 0d57cb1..0fde3fe 100755
--- a/third_party/SPIRV-Tools/utils/vscode/src/schema/schema.go
+++ b/third_party/SPIRV-Tools/utils/vscode/src/schema/schema.go
@@ -477,7 +477,7 @@
"OpTraceRayKHR": OpTraceRayKHR,
"OpTypeAccelerationStructureNV": OpTypeAccelerationStructureNV,
"OpTypeAccelerationStructureKHR": OpTypeAccelerationStructureKHR,
- "OpTypeRayQueryProvisionalKHR": OpTypeRayQueryProvisionalKHR,
+ "OpTypeRayQueryKHR": OpTypeRayQueryKHR,
"OpRayQueryInitializeKHR": OpRayQueryInitializeKHR,
"OpRayQueryTerminateKHR": OpRayQueryTerminateKHR,
"OpRayQueryGenerateIntersectionKHR": OpRayQueryGenerateIntersectionKHR,
@@ -10807,8 +10807,8 @@
},
},
}
- OpTypeRayQueryProvisionalKHR = &Opcode {
- Opname: "OpTypeRayQueryProvisionalKHR",
+ OpTypeRayQueryKHR = &Opcode {
+ Opname: "OpTypeRayQueryKHR",
Class: "Reserved",
Opcode: 4472,
Operands: []Operand {
@@ -20183,77 +20183,77 @@
Enumerant{
Enumerant: "NoneKHR",
Value: 0x0000,
- Capabilities: []string{"RayQueryProvisionalKHR","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR","RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "OpaqueKHR",
Value: 0x0001,
- Capabilities: []string{"RayQueryProvisionalKHR","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR","RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "NoOpaqueKHR",
Value: 0x0002,
- Capabilities: []string{"RayQueryProvisionalKHR","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR","RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "TerminateOnFirstHitKHR",
Value: 0x0004,
- Capabilities: []string{"RayQueryProvisionalKHR","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR","RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "SkipClosestHitShaderKHR",
Value: 0x0008,
- Capabilities: []string{"RayQueryProvisionalKHR","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR","RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "CullBackFacingTrianglesKHR",
Value: 0x0010,
- Capabilities: []string{"RayQueryProvisionalKHR","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR","RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "CullFrontFacingTrianglesKHR",
Value: 0x0020,
- Capabilities: []string{"RayQueryProvisionalKHR","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR","RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "CullOpaqueKHR",
Value: 0x0040,
- Capabilities: []string{"RayQueryProvisionalKHR","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR","RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "CullNoOpaqueKHR",
Value: 0x0080,
- Capabilities: []string{"RayQueryProvisionalKHR","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR","RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "SkipTrianglesKHR",
Value: 0x0100,
- Capabilities: []string{"RayTraversalPrimitiveCullingProvisionalKHR",},
+ Capabilities: []string{"RayTraversalPrimitiveCullingKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "SkipAABBsKHR",
Value: 0x0200,
- Capabilities: []string{"RayTraversalPrimitiveCullingProvisionalKHR",},
+ Capabilities: []string{"RayTraversalPrimitiveCullingKHR",},
Parameters: []Parameter{},
Version: "",
},
@@ -20379,84 +20379,84 @@
Enumerant{
Enumerant: "RayGenerationNV",
Value: 5313,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "RayGenerationKHR",
Value: 5313,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "IntersectionNV",
Value: 5314,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "IntersectionKHR",
Value: 5314,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "AnyHitNV",
Value: 5315,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "AnyHitKHR",
Value: 5315,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "ClosestHitNV",
Value: 5316,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "ClosestHitKHR",
Value: 5316,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "MissNV",
Value: 5317,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "MissKHR",
Value: 5317,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "CallableNV",
Value: 5318,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "CallableKHR",
Value: 5318,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
@@ -21044,84 +21044,84 @@
Enumerant{
Enumerant: "CallableDataNV",
Value: 5328,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "CallableDataKHR",
Value: 5328,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "IncomingCallableDataNV",
Value: 5329,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "IncomingCallableDataKHR",
Value: 5329,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "RayPayloadNV",
Value: 5338,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "RayPayloadKHR",
Value: 5338,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "HitAttributeNV",
Value: 5339,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "HitAttributeKHR",
Value: 5339,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "IncomingRayPayloadNV",
Value: 5342,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "IncomingRayPayloadKHR",
Value: 5342,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "ShaderRecordBufferNV",
Value: 5343,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "ShaderRecordBufferKHR",
Value: 5343,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
@@ -22507,7 +22507,7 @@
Enumerant{
Enumerant: "PrimitiveId",
Value: 7,
- Capabilities: []string{"Geometry","Tessellation","RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"Geometry","Tessellation","RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
@@ -23053,203 +23053,203 @@
Enumerant{
Enumerant: "LaunchIdNV",
Value: 5319,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "LaunchIdKHR",
Value: 5319,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "LaunchSizeNV",
Value: 5320,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "LaunchSizeKHR",
Value: 5320,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "WorldRayOriginNV",
Value: 5321,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "WorldRayOriginKHR",
Value: 5321,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "WorldRayDirectionNV",
Value: 5322,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "WorldRayDirectionKHR",
Value: 5322,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "ObjectRayOriginNV",
Value: 5323,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "ObjectRayOriginKHR",
Value: 5323,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "ObjectRayDirectionNV",
Value: 5324,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "ObjectRayDirectionKHR",
Value: 5324,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "RayTminNV",
Value: 5325,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "RayTminKHR",
Value: 5325,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "RayTmaxNV",
Value: 5326,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "RayTmaxKHR",
Value: 5326,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "InstanceCustomIndexNV",
Value: 5327,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "InstanceCustomIndexKHR",
Value: 5327,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "ObjectToWorldNV",
Value: 5330,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "ObjectToWorldKHR",
Value: 5330,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "WorldToObjectNV",
Value: 5331,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "WorldToObjectKHR",
Value: 5331,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "HitTNV",
Value: 5332,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "HitTKHR",
Value: 5332,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "HitKindNV",
Value: 5333,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "HitKindKHR",
Value: 5333,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "IncomingRayFlagsNV",
Value: 5351,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "IncomingRayFlagsKHR",
Value: 5351,
- Capabilities: []string{"RayTracingNV","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingNV","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
Enumerant: "RayGeometryIndexKHR",
Value: 5352,
- Capabilities: []string{"RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
@@ -23340,7 +23340,7 @@
Enumerant{
Enumerant: "ShaderCallKHR",
Value: 6,
- Capabilities: []string{"RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayTracingKHR",},
Parameters: []Parameter{},
Version: "",
},
@@ -24080,16 +24080,16 @@
Version: "1.4",
},
Enumerant{
- Enumerant: "RayQueryProvisionalKHR",
+ Enumerant: "RayQueryKHR",
Value: 4471,
Capabilities: []string{"Shader",},
Parameters: []Parameter{},
Version: "None",
},
Enumerant{
- Enumerant: "RayTraversalPrimitiveCullingProvisionalKHR",
+ Enumerant: "RayTraversalPrimitiveCullingKHR",
Value: 4478,
- Capabilities: []string{"RayQueryProvisionalKHR","RayTracingProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR","RayTracingKHR",},
Parameters: []Parameter{},
Version: "None",
},
@@ -24465,7 +24465,7 @@
Version: "None",
},
Enumerant{
- Enumerant: "RayTracingProvisionalKHR",
+ Enumerant: "RayTracingKHR",
Value: 5353,
Capabilities: []string{"Shader",},
Parameters: []Parameter{},
@@ -24579,14 +24579,14 @@
Enumerant{
Enumerant: "RayQueryCandidateIntersectionKHR",
Value: 0,
- Capabilities: []string{"RayQueryProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "RayQueryCommittedIntersectionKHR",
Value: 1,
- Capabilities: []string{"RayQueryProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR",},
Parameters: []Parameter{},
Version: "",
},
@@ -24600,21 +24600,21 @@
Enumerant{
Enumerant: "RayQueryCommittedIntersectionNoneKHR",
Value: 0,
- Capabilities: []string{"RayQueryProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "RayQueryCommittedIntersectionTriangleKHR",
Value: 1,
- Capabilities: []string{"RayQueryProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "RayQueryCommittedIntersectionGeneratedKHR",
Value: 2,
- Capabilities: []string{"RayQueryProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR",},
Parameters: []Parameter{},
Version: "",
},
@@ -24628,14 +24628,14 @@
Enumerant{
Enumerant: "RayQueryCandidateIntersectionTriangleKHR",
Value: 0,
- Capabilities: []string{"RayQueryProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR",},
Parameters: []Parameter{},
Version: "",
},
Enumerant{
Enumerant: "RayQueryCandidateIntersectionAABBKHR",
Value: 1,
- Capabilities: []string{"RayQueryProvisionalKHR",},
+ Capabilities: []string{"RayQueryKHR",},
Parameters: []Parameter{},
Version: "",
},