Prevents an unhandled flag from causing all flags to be skipped. Based in part on a vkd3d-proton patch by Philip Rebohle.
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d-shader/dxbc.c | 13 ++++++++----- libs/vkd3d-shader/sm4.h | 8 ++++---- 2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index fab19046..412b9267 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -1133,8 +1133,9 @@ static bool shader_sm4_read_param(struct vkd3d_sm4_data *priv, const DWORD **ptr return false; } m = *(*ptr)++; + m = (m & VKD3D_SM4_REGISTER_MODIFIER_MASK) >> VKD3D_SM4_REGISTER_MODIFIER_SHIFT;
- switch (m) + switch (m & (VKD3D_SM4_REGISTER_MODIFIER_ABS | VKD3D_SM4_REGISTER_MODIFIER_NEGATE)) { case VKD3D_SM4_REGISTER_MODIFIER_NEGATE: *modifier = VKD3DSPSM_NEG; @@ -1144,17 +1145,19 @@ static bool shader_sm4_read_param(struct vkd3d_sm4_data *priv, const DWORD **ptr *modifier = VKD3DSPSM_ABS; break;
- case VKD3D_SM4_REGISTER_MODIFIER_ABS_NEGATE: + case VKD3D_SM4_REGISTER_MODIFIER_ABS | VKD3D_SM4_REGISTER_MODIFIER_NEGATE: *modifier = VKD3DSPSM_ABSNEG; break;
default: - FIXME("Skipping modifier 0x%08x.\n", m); - /* fall-through */ - case VKD3D_SM4_REGISTER_MODIFIER_NONE: *modifier = VKD3DSPSM_NONE; break; } + m &= ~(VKD3D_SM4_REGISTER_MODIFIER_ABS | VKD3D_SM4_REGISTER_MODIFIER_NEGATE); + + if (m) + FIXME("Skipping modifier flags 0x%08x.\n", m); + } else { diff --git a/libs/vkd3d-shader/sm4.h b/libs/vkd3d-shader/sm4.h index 335f0161..e8dbeb4b 100644 --- a/libs/vkd3d-shader/sm4.h +++ b/libs/vkd3d-shader/sm4.h @@ -94,6 +94,8 @@ #define VKD3D_SM4_OPCODE_MASK 0xff
#define VKD3D_SM4_REGISTER_MODIFIER (0x1u << 31) +#define VKD3D_SM4_REGISTER_MODIFIER_SHIFT 1 +#define VKD3D_SM4_REGISTER_MODIFIER_MASK (0x7FFFFFFF << VKD3D_SM4_REGISTER_MODIFIER_SHIFT)
#define VKD3D_SM4_ADDRESSING_SHIFT2 28 #define VKD3D_SM4_ADDRESSING_MASK2 (0x3u << VKD3D_SM4_ADDRESSING_SHIFT2) @@ -383,10 +385,8 @@ enum vkd3d_sm4_register_type
enum vkd3d_sm4_register_modifier { - VKD3D_SM4_REGISTER_MODIFIER_NONE = 0x01, - VKD3D_SM4_REGISTER_MODIFIER_NEGATE = 0x41, - VKD3D_SM4_REGISTER_MODIFIER_ABS = 0x81, - VKD3D_SM4_REGISTER_MODIFIER_ABS_NEGATE = 0xc1, + VKD3D_SM4_REGISTER_MODIFIER_NEGATE = 0x20, + VKD3D_SM4_REGISTER_MODIFIER_ABS = 0x40, };
enum vkd3d_sm4_output_primitive_type