mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Validate usage masks in shader signatures.
This commit is contained in:
parent
71dccc0132
commit
6e14d7ab90
Notes:
Henri Verbeet
2024-10-10 20:09:41 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1167
@ -6518,6 +6518,30 @@ static void vsir_validate_signature_element(struct validation_context *ctx,
|
||||
if (element->mask == 0 || (element->mask & ~0xf))
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE,
|
||||
"element %u of %s signature: Invalid mask %#x.", idx, signature_type, element->mask);
|
||||
|
||||
/* Here we'd likely want to validate that the usage mask is a subset of the
|
||||
* signature mask. Unfortunately the D3DBC parser sometimes violates this.
|
||||
* For example I've seen a shader like this:
|
||||
* ps_3_0
|
||||
* [...]
|
||||
* dcl_texcoord0 v0
|
||||
* [...]
|
||||
* texld r2.xyzw, v0.xyzw, s1.xyzw
|
||||
* [...]
|
||||
*
|
||||
* The dcl_textcoord0 instruction secretly has a .xy mask, which is used to
|
||||
* compute the signature mask, but the texld instruction apparently uses all
|
||||
* the components. Of course the last two components are ignored, but
|
||||
* formally they seem to be used. So we end up with a signature element with
|
||||
* mask .xy and usage mask .xyzw.
|
||||
*
|
||||
* The correct fix would probably be to make the D3DBC parser aware of which
|
||||
* components are really used for each instruction, but that would take some
|
||||
* time. */
|
||||
if (element->used_mask & ~0xf)
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE,
|
||||
"element %u of %s signature: Invalid usage mask %#x.",
|
||||
idx, signature_type, element->used_mask);
|
||||
}
|
||||
|
||||
static void vsir_validate_signature(struct validation_context *ctx,
|
||||
|
Loading…
Reference in New Issue
Block a user