brw/algebraic: Optimize derivative of convergent value

This is mostly defensive. If a convergent value ever ended up as a
source of a DDX or DDY, the eu_emit code will ignore the stride. This
will result in bad code being generated.

No shader-db or fossil-db changes on any Intel platform.

v2: DDX and DDY will always be float, but brw_imm_for_type only works
with integer types.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Suggested-by: Ken
Fixes: d5d7ae22ae ("brw/nir: Fix up handling of sources that might be convergent vectors")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33007>
This commit is contained in:
Ian Romanick
2025-03-31 16:13:50 -07:00
committed by Marge Bot
parent 5656682344
commit dee49f4206
+11
View File
@@ -324,6 +324,17 @@ brw_opt_constant_fold_instruction(const intel_device_info *devinfo, brw_inst *in
}
break;
case FS_OPCODE_DDX_COARSE:
case FS_OPCODE_DDX_FINE:
case FS_OPCODE_DDY_COARSE:
case FS_OPCODE_DDY_FINE:
if (is_uniform(inst->src[0]) || inst->src[0].is_scalar) {
inst->opcode = BRW_OPCODE_MOV;
inst->src[0] = retype(brw_imm_uq(0), inst->dst.type);
progress = true;
}
break;
default:
break;
}