The declaration instruction register contains id, range first, and range
last. The backend includes range first in the variable name. After commit
e8b3561252 it was always zero, and since commit 67f0196c33 it is
UINT_MAX, so constant buffers are named, e.g., "%cb0_4294967295".
Adding extra bits to instr->opcode doesn't seem correct, given that it
is an enum.
For instance, get_opcode_info() would return NULL if additional bits are
added to instr->opcode. This is not a problem now because that function
is called when reading and not writing.
Components only span across a single regset, so instead of expecting the
regset as input for the offset, hlsl_type_get_component_offset() can
actually retrieve it.
vkd3d-shader/tpf.c:3810:39: warning: passing argument 2 of ‘sm4_register_from_node’ from incompatible pointer type [-Wincompatible-pointer-types]
vkd3d-shader/tpf.c:4750:59: warning: passing argument 3 of ‘sm4_register_from_deref’ from incompatible pointer type [-Wincompatible-pointer-types]
Change to use uint32_t as requested.
This change ensures that we don't dump the writemask for registers that
have a scalar dimension.
For instance, for this shader:
float r;
float4 main(out float d : DEPTH) : sv_target
{
d = r;
return 0;
}
we now correctly dump
dcl_output oDepth
instead of
dcl_output oDepth.x
The assumption that sampler registers never have a swizzle is not
totally correct.
For instance, for the following shader:
Texture2D tex;
sampler sam;
float4 main() : sv_target
{
return tex.GatherGreen(sam, float2(0, 0));
}
the gather instruction is being disassembled as
gather4_indexable(texture2d) o0.xyzw, l(0.0, 0.0, 0.0, 0.0), t0.xyzw, s0
instead of
gather4_indexable(texture2d)(float,float,float,float) o0.xyzw, l(0.0, 0.0, 0.0, 0.0), t0.xyzw, s0.y
(notice the missing swizzle in the last parameter s0).
This is because the Gather instructions give the sampler register a vec4
dimension (and scalar swizzle type) to indicate the channel for the
gather operation.
The solution is using the new vkd3d_shader_register.dimension instead of
checking the swizzle type.
This matches what is done in the upstream headers; end users
including d3d12.h don't need to explicitly include d3d12sdklayers.h.
Signed-off-by: Martin Storsjö <martin@martin.st>
Nowadays vkd3d is probably most commonly used compiled as PE rather then
ELF, so it makes sense to at least ensure that compilation succeeds.
In the future it would be nice to somehow test these binaries as well.