Skip to content

vkd3d-shader/d3dbc: Ensure that swizzles are compatible with signature masks.

In dd0ed989 we already made sure that a signature element usage mask is contained in its definition mask. We do so by dropping the usage mask component that do not appear in the definition mask. However, that could mean that swizzles appearing in the program might not be compatible with the usage mask anymore (i.e., a swizzle uses a component which is not enabled in the usage mask).

Here we fix this new inconsistency by tweaking the swizzle, replacing each component that doesn't appear in the signature mask with the first component that appears. For example, if v3 has mask .yzw the instruction:

mov r1.zw, v3.xyzw

is parsed instead as:

mov r1.zw, v3.yyzw

It is expected that mangled components are not meaningful (as in this example, where the first two components after swizzling are going to be ignored because of the write mask). If this is not the case, it means that the D3DBC code was invalid in the first place.

Merge request reports

Loading