It's not obvious what this last remaining use of
sm6_parser_require_space() is preallocating space for, and that's as
good of a reason as any to get rid of it.
Only calls to sm6_parser_add_instruction() where we are using the
returned vkd3d_shader_instruction are checked for, since these return
values might cause NULL dereferences if unchecked.
Other calls to sm6_parser_add_instruction() can be left alone since the
error is still recorded via sm6->p.status.
In order to allocate it properly we have to ensure it is the first
register to be processed. The current algorithm fails to do so, so
a more explicit approach is introduced.
Primarily to avoid -Warray-bounds warnings from newer gcc, specifically
for the first vsir_instruction_init() call in vsir_update_dcl_temps().
This seems to be a false positive created by the interaction between
vsir_program_iterator_insert_after() and vsir_program_iterator_next()
error handling; it may be possible to avoid that by rearranging things,
but it doesn't seem worth it.
The SPIR-V, GLSL and MSL backends implicitly handle swizzles on
immediate constants, but the TPF and d3d-asm backends assume a default
swizzle. In principle there's no reason those couldn't support swizzles
on immediate constants, but they're a little pointless.
We will move the dst_params and src_params fields from struct
vkd3d_shader_instruction_array to the vsir program next, so we need to
widen the scope of this pointer to the whole vsir program.
We stop storing a shallow copy of the vsir_program.instructions on
control_point_normaliser.instructions since
vkd3d_shader_instruction_array is not meant to be copied by value, which
is evidenced by the fact that the struct has to always be copied back to
program->instructions before returning.