-- v2: vkd3d-shader/dxil: Handle missing flags as zero for CMP2. vkd3d-shader/dxil: Handle missing flags as zero for BINOP.
From: Conor McCarthy cmccarthy@codeweavers.com
The flag operand is omitted if IEEE strictness is specified. --- libs/vkd3d-shader/dxil.c | 82 ++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 42 deletions(-)
diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 82308ff6e..0297be374 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -2821,8 +2821,9 @@ static void sm6_parser_emit_binop(struct sm6_parser *sm6, const struct dxil_reco struct vkd3d_shader_src_param *src_params; enum vkd3d_shader_opcode handler_idx; const struct sm6_value *a, *b; + uint64_t code, flags; + bool silence_warning; unsigned int i = 0; - uint64_t code;
a = sm6_parser_get_value_by_ref(sm6, record, NULL, &i); b = sm6_parser_get_value_by_ref(sm6, record, a->type, &i); @@ -2838,48 +2839,45 @@ static void sm6_parser_emit_binop(struct sm6_parser *sm6, const struct dxil_reco
vsir_instruction_init(ins, &sm6->p.location, handler_idx);
- if (record->operand_count > i && record->operands[i]) - { - uint64_t flags = record->operands[i]; - bool silence_warning = false; + flags = (record->operand_count > i) ? record->operands[i] : 0; + silence_warning = false;
- switch (handler_idx) - { - case VKD3DSIH_ADD: - case VKD3DSIH_MUL: - case VKD3DSIH_DIV: - case VKD3DSIH_FREM: - if (!(flags & FP_ALLOW_UNSAFE_ALGEBRA)) - ins->flags |= VKD3DSI_PRECISE_X; - flags &= ~FP_ALLOW_UNSAFE_ALGEBRA; - /* SPIR-V FPFastMathMode is only available in the Kernel executon model. */ - silence_warning = !(flags & ~(FP_NO_NAN | FP_NO_INF | FP_NO_SIGNED_ZEROS | FP_ALLOW_RECIPROCAL)); - break; - case VKD3DSIH_IADD: - case VKD3DSIH_UMUL: - case VKD3DSIH_ISHL: - silence_warning = !(flags & ~(OB_NO_UNSIGNED_WRAP | OB_NO_SIGNED_WRAP)); - break; - case VKD3DSIH_ISHR: - case VKD3DSIH_USHR: - case VKD3DSIH_IDIV: - case VKD3DSIH_UDIV: - silence_warning = !(flags & ~PEB_EXACT); - break; - default: - break; - } - /* The above flags are very common and cause warning spam. */ - if (flags && silence_warning) - { - TRACE("Ignoring flags %#"PRIx64".\n", flags); - } - else if (flags) - { - WARN("Ignoring flags %#"PRIx64".\n", flags); - vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS, - "Ignoring flags %#"PRIx64" for a binary operation.", flags); - } + switch (handler_idx) + { + case VKD3DSIH_ADD: + case VKD3DSIH_MUL: + case VKD3DSIH_DIV: + case VKD3DSIH_FREM: + if (!(flags & FP_ALLOW_UNSAFE_ALGEBRA)) + ins->flags |= VKD3DSI_PRECISE_X; + flags &= ~FP_ALLOW_UNSAFE_ALGEBRA; + /* SPIR-V FPFastMathMode is only available in the Kernel executon model. */ + silence_warning = !(flags & ~(FP_NO_NAN | FP_NO_INF | FP_NO_SIGNED_ZEROS | FP_ALLOW_RECIPROCAL)); + break; + case VKD3DSIH_IADD: + case VKD3DSIH_UMUL: + case VKD3DSIH_ISHL: + silence_warning = !(flags & ~(OB_NO_UNSIGNED_WRAP | OB_NO_SIGNED_WRAP)); + break; + case VKD3DSIH_ISHR: + case VKD3DSIH_USHR: + case VKD3DSIH_IDIV: + case VKD3DSIH_UDIV: + silence_warning = !(flags & ~PEB_EXACT); + break; + default: + break; + } + /* The above flags are very common and cause warning spam. */ + if (flags && silence_warning) + { + TRACE("Ignoring flags %#"PRIx64".\n", flags); + } + else if (flags) + { + WARN("Ignoring flags %#"PRIx64".\n", flags); + vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS, + "Ignoring flags %#"PRIx64" for a binary operation.", flags); }
src_params = instruction_src_params_alloc(ins, 2, sm6);
From: Conor McCarthy cmccarthy@codeweavers.com
The flag operand is omitted if IEEE strictness is specified. --- libs/vkd3d-shader/dxil.c | 45 +++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 24 deletions(-)
diff --git a/libs/vkd3d-shader/dxil.c b/libs/vkd3d-shader/dxil.c index 0297be374..04dfdf576 100644 --- a/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d-shader/dxil.c @@ -3494,11 +3494,11 @@ static void sm6_parser_emit_cmp2(struct sm6_parser *sm6, const struct dxil_recor { struct vkd3d_shader_src_param *src_params; const struct sm6_type *type_a, *type_b; + bool is_int, is_fp, silence_warning; const struct sm6_cmp_info *cmp; const struct sm6_value *a, *b; + uint64_t code, flags; unsigned int i = 0; - bool is_int, is_fp; - uint64_t code;
if (!(dst->type = sm6->bool_type)) { @@ -3549,29 +3549,26 @@ static void sm6_parser_emit_cmp2(struct sm6_parser *sm6, const struct dxil_recor
vsir_instruction_init(ins, &sm6->p.location, cmp->handler_idx);
- if (record->operand_count > i) - { - uint64_t flags = record->operands[i]; - bool silence_warning = false; + flags = (record->operand_count > i) ? record->operands[i] : 0; + silence_warning = false;
- if (is_fp) - { - if (!(flags & FP_ALLOW_UNSAFE_ALGEBRA)) - ins->flags |= VKD3DSI_PRECISE_X; - flags &= ~FP_ALLOW_UNSAFE_ALGEBRA; - /* SPIR-V FPFastMathMode is only available in the Kernel execution model. */ - silence_warning = !(flags & ~(FP_NO_NAN | FP_NO_INF | FP_NO_SIGNED_ZEROS | FP_ALLOW_RECIPROCAL)); - } - if (flags && silence_warning) - { - TRACE("Ignoring fast FP modifier %#"PRIx64".\n", flags); - } - else if (flags) - { - WARN("Ignoring flags %#"PRIx64".\n", flags); - vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS, - "Ignoring flags %#"PRIx64" for a comparison operation.", flags); - } + if (is_fp) + { + if (!(flags & FP_ALLOW_UNSAFE_ALGEBRA)) + ins->flags |= VKD3DSI_PRECISE_X; + flags &= ~FP_ALLOW_UNSAFE_ALGEBRA; + /* SPIR-V FPFastMathMode is only available in the Kernel execution model. */ + silence_warning = !(flags & ~(FP_NO_NAN | FP_NO_INF | FP_NO_SIGNED_ZEROS | FP_ALLOW_RECIPROCAL)); + } + if (flags && silence_warning) + { + TRACE("Ignoring fast FP modifier %#"PRIx64".\n", flags); + } + else if (flags) + { + WARN("Ignoring flags %#"PRIx64".\n", flags); + vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS, + "Ignoring flags %#"PRIx64" for a comparison operation.", flags); }
src_params = instruction_src_params_alloc(ins, 2, sm6);
This merge request was approved by Henri Verbeet.