Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/dxil.c:
- for (i = 0; i < block->child_block_count; ++i)
value_count = sm6_parser_compute_max_value_count(sm6, block->child_blocks[i], value_count);
- switch (block->id)
- {
case FUNCTION_BLOCK:
sm6->value_capacity = max(sm6->value_capacity, value_count);
/* The value count returns to its previous value after handling a function. */
value_count = old_value_count;
break;
default:
break;
- }
- return value_count;
+}
I don't understand what this function is supposed to calculate. At least for the moment, unless I'm missing something, the number of values that get allocated should exactly be the number of `MODULE_CODE_FUNCTION` records in the root block: why can't you just compute that thing and need something more complicated?
Relatedly, and even more if we need this complicated function to decide how many values we need to store, maybe `sm6_parser_get_current_value()` could `assert()` that we're not overflowing.