|
|
@@ -907,6 +907,28 @@ remove_unused_variables() {
|
|
|
Instruction op = *it;
|
|
|
|
|
|
switch (op.opcode) {
|
|
|
+ case spv::OpEntryPoint:
|
|
|
+ {
|
|
|
+ // Skip the string literal by skipping words until we have a zero byte.
|
|
|
+ uint32_t i = 2;
|
|
|
+ while (i < op.nargs
|
|
|
+ && (op.args[i] & 0x000000ff) != 0
|
|
|
+ && (op.args[i] & 0x0000ff00) != 0
|
|
|
+ && (op.args[i] & 0x00ff0000) != 0
|
|
|
+ && (op.args[i] & 0xff000000) != 0) {
|
|
|
+ ++i;
|
|
|
+ }
|
|
|
+ // Remove the deleted IDs from the entry point interface.
|
|
|
+ while (i < (*it).nargs) {
|
|
|
+ if (delete_ids.count((*it).args[i])) {
|
|
|
+ it = _instructions.erase_arg(it, i);
|
|
|
+ } else {
|
|
|
+ ++i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
case spv::OpName:
|
|
|
case spv::OpMemberName:
|
|
|
case spv::OpDecorate:
|
|
|
@@ -921,6 +943,7 @@ remove_unused_variables() {
|
|
|
case spv::OpVariable:
|
|
|
if (op.nargs >= 2 && delete_ids.count(op.args[1])) {
|
|
|
it = _instructions.erase(it);
|
|
|
+ continue;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
@@ -934,6 +957,7 @@ remove_unused_variables() {
|
|
|
if (delete_ids.count(op.args[2])) {
|
|
|
delete_ids.insert(op.args[1]);
|
|
|
it = _instructions.erase(it);
|
|
|
+ continue;
|
|
|
}
|
|
|
break;
|
|
|
|