vkd3d-shader/spirv: Handle all possible destination modifiers.

Historically the SPIR-V backend was only fed by the TPF parser,
which only generates _sat destination modifiers. Now it is fed
by the D3DBC parser too (among others), so it mustn't assert on
other modifiers.

Modifier _pp can be trivially ignored. Modifier _centroid would
probably require some handling, but I'm not immediately sure of
what should happen and it doesn't look like a very urgent thing
anyway, so I'm degrading the assertion to FIXME().
This commit is contained in:
Giovanni Mascellani 2024-10-02 09:48:02 +02:00 committed by Henri Verbeet
parent fc4c9b7a95
commit ae27fded1a
Notes: Henri Verbeet 2024-10-02 22:39:31 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1141

View File

@ -4544,9 +4544,24 @@ static uint32_t spirv_compiler_emit_sat(struct spirv_compiler *compiler,
static void spirv_compiler_emit_store_dst(struct spirv_compiler *compiler, static void spirv_compiler_emit_store_dst(struct spirv_compiler *compiler,
const struct vkd3d_shader_dst_param *dst, uint32_t val_id) const struct vkd3d_shader_dst_param *dst, uint32_t val_id)
{ {
VKD3D_ASSERT(!(dst->modifiers & ~VKD3DSPDM_SATURATE)); uint32_t modifiers = dst->modifiers;
if (dst->modifiers & VKD3DSPDM_SATURATE)
/* It is always legitimate to ignore _pp. */
modifiers &= ~VKD3DSPDM_PARTIALPRECISION;
if (modifiers & VKD3DSPDM_SATURATE)
{
val_id = spirv_compiler_emit_sat(compiler, &dst->reg, dst->write_mask, val_id); val_id = spirv_compiler_emit_sat(compiler, &dst->reg, dst->write_mask, val_id);
modifiers &= ~VKD3DSPDM_SATURATE;
}
if (dst->modifiers & VKD3DSPDM_MSAMPCENTROID)
{
FIXME("Ignoring _centroid modifier.\n");
modifiers &= ~VKD3DSPDM_MSAMPCENTROID;
}
VKD3D_ASSERT(!modifiers);
spirv_compiler_emit_store_reg(compiler, &dst->reg, dst->write_mask, val_id); spirv_compiler_emit_store_reg(compiler, &dst->reg, dst->write_mask, val_id);
} }