vkd3d-shader/tpf: Do not uninvert used masks for domain shader patch constants.

This commit is contained in:
Zebediah Figura 2023-10-23 20:52:24 -05:00 committed by Alexandre Julliard
parent 8876030590
commit cabf9996f9
Notes: Alexandre Julliard 2023-12-11 23:20:06 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/464
2 changed files with 16 additions and 4 deletions

View File

@ -431,10 +431,6 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
case TAG_OSG5:
if (e[i].sysval_semantic == VKD3D_SHADER_SV_NONE)
e[i].sysval_semantic = map_fragment_output_sysval(e[i].semantic_name);
/* Fall through. */
case TAG_PCSG:
case TAG_PSG1:
e[i].used_mask = e[i].mask & ~e[i].used_mask;
break;
}

View File

@ -2544,6 +2544,16 @@ static bool shader_sm4_init(struct vkd3d_shader_sm4_parser *sm4, const uint32_t
return true;
}
static void uninvert_used_masks(struct shader_signature *signature)
{
for (unsigned int i = 0; i < signature->element_count; ++i)
{
struct signature_element *e = &signature->elements[i];
e->used_mask = e->mask & ~e->used_mask;
}
}
static bool shader_sm4_parser_validate_signature(struct vkd3d_shader_sm4_parser *sm4,
const struct shader_signature *signature, unsigned int *masks, const char *name)
{
@ -2639,6 +2649,12 @@ int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compi
return VKD3D_ERROR_INVALID_ARGUMENT;
}
/* DXBC stores used masks inverted for output signatures, for some reason.
* We return them un-inverted. */
uninvert_used_masks(&shader_desc->output_signature);
if (sm4->p.shader_version.type == VKD3D_SHADER_TYPE_HULL)
uninvert_used_masks(&shader_desc->patch_constant_signature);
if (!shader_sm4_parser_validate_signature(sm4, &shader_desc->input_signature,
sm4->input_register_masks, "Input")
|| !shader_sm4_parser_validate_signature(sm4, &shader_desc->output_signature,