aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-01-26 13:49:27 +1300
committerMark Lobodzinski <mark@lunarg.com>2016-01-27 15:52:52 -0700
commitc0743ce1f34ef4cc58862303399c30bfdbf29458 (patch)
tree4dea04f1ccf95e48716f49966b94e18f1e37df77
parent41304acdc1194a3277ad4896589897a261dc5887 (diff)
downloadusermoji-c0743ce1f34ef4cc58862303399c30bfdbf29458.tar.xz
layers: MR159, Collect offsets of instructions producing constants
We're about to need to be able to look these up by <id> for proper array size handling.
-rw-r--r--layers/draw_state.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 45d2217e..4ec408ae 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -346,6 +346,7 @@ build_def_index(shader_module *module)
{
for (auto insn : *module) {
switch (insn.opcode()) {
+ /* Types */
case spv::OpTypeVoid:
case spv::OpTypeBool:
case spv::OpTypeInt:
@@ -369,8 +370,27 @@ build_def_index(shader_module *module)
module->def_index[insn.word(1)] = insn.offset();
break;
+ /* Fixed constants */
+ case spv::OpConstantTrue:
+ case spv::OpConstantFalse:
+ case spv::OpConstant:
+ case spv::OpConstantComposite:
+ case spv::OpConstantSampler:
+ case spv::OpConstantNull:
+ module->def_index[insn.word(2)] = insn.offset();
+ break;
+
+ /* Specialization constants */
+ case spv::OpSpecConstantTrue:
+ case spv::OpSpecConstantFalse:
+ case spv::OpSpecConstant:
+ case spv::OpSpecConstantComposite:
+ case spv::OpSpecConstantOp:
+ module->def_index[insn.word(2)] = insn.offset();
+ break;
+
default:
- /* We only care about type definitions */
+ /* We don't care about any other defs for now. */
break;
}
}