The idea is that sm6_value and related structures should not commit
to a specific vsir register representation yet, because at the time
they are created some information might be still unavailable. For
instance, it might be not yet known whether the program is using
native 16-bit types or minimum precision types. vsir registers
should only be synthesized during instruction emission.
Field "reg" in struct sm6_value will be handled in a later commit.
All stream output objects need to have a stream index allocated,
whether they are used or not.
We allocate stream outputs here, before other objects are allocated,
because the stream index is needed to create the appropriate output
semantic variables during append_output_copy(), which will be called
in a lowering pass for the Append() method.
Currently program errors might result on instructions that use
ctx->error_instr as src. In case we hit YYABORT while parsing another
part of the HLSL source, we have to make sure that the block that
contains the instruction is properly cleaned up, or we might hit the
vkd3d:590273:err:hlsl_free_instr Failed assertion: list_empty(&node->uses)
assertion when hlsl_ctx_cleanup() is called after the YYABORT.
Consider the following shader:
float4 main() : sv_target
{
// Statement A
int p = foo; // initializer argument is ERROR.
// Statement B
undeclared_fun(); // triggers YYABORT.
}
Statement A will src the ctx->error_instr because of the undeclared
identifier and Statement B will trigger an YYABORT because of the
undeclared function.