intel/brw: Pull lower_derivatives out of fs_visitor

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26887>
This commit is contained in:
Caio Oliveira 2024-01-03 16:05:16 -08:00 committed by Marge Bot
parent 7b7da31c45
commit 89866b6259
2 changed files with 12 additions and 12 deletions

View file

@ -5191,10 +5191,10 @@ brw_fs_lower_barycentrics(fs_visitor &s)
* swizzles of the source, specified as \p swz0 and \p swz1.
*/
static bool
lower_derivative(fs_visitor *v, bblock_t *block, fs_inst *inst,
lower_derivative(fs_visitor &s, bblock_t *block, fs_inst *inst,
unsigned swz0, unsigned swz1)
{
const fs_builder ubld = fs_builder(v, block, inst).exec_all();
const fs_builder ubld = fs_builder(&s, block, inst).exec_all();
const fs_reg tmp0 = ubld.vgrf(inst->src[0].type);
const fs_reg tmp1 = ubld.vgrf(inst->src[0].type);
@ -5214,33 +5214,33 @@ lower_derivative(fs_visitor *v, bblock_t *block, fs_inst *inst,
* them efficiently (i.e. XeHP).
*/
bool
fs_visitor::lower_derivatives()
brw_fs_lower_derivatives(fs_visitor &s)
{
bool progress = false;
if (devinfo->verx10 < 125)
if (s.devinfo->verx10 < 125)
return false;
foreach_block_and_inst(block, fs_inst, inst, cfg) {
foreach_block_and_inst(block, fs_inst, inst, s.cfg) {
if (inst->opcode == FS_OPCODE_DDX_COARSE)
progress |= lower_derivative(this, block, inst,
progress |= lower_derivative(s, block, inst,
BRW_SWIZZLE_XXXX, BRW_SWIZZLE_YYYY);
else if (inst->opcode == FS_OPCODE_DDX_FINE)
progress |= lower_derivative(this, block, inst,
progress |= lower_derivative(s, block, inst,
BRW_SWIZZLE_XXZZ, BRW_SWIZZLE_YYWW);
else if (inst->opcode == FS_OPCODE_DDY_COARSE)
progress |= lower_derivative(this, block, inst,
progress |= lower_derivative(s, block, inst,
BRW_SWIZZLE_XXXX, BRW_SWIZZLE_ZZZZ);
else if (inst->opcode == FS_OPCODE_DDY_FINE)
progress |= lower_derivative(this, block, inst,
progress |= lower_derivative(s, block, inst,
BRW_SWIZZLE_XYXY, BRW_SWIZZLE_ZWZW);
}
if (progress)
invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
s.invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
return progress;
}
@ -5764,7 +5764,7 @@ fs_visitor::optimize()
OPT(brw_fs_lower_sub_sat, *this);
progress = false;
OPT(lower_derivatives);
OPT(brw_fs_lower_derivatives, *this);
OPT(lower_regioning);
if (progress) {
if (OPT(brw_fs_opt_copy_propagation, *this))

View file

@ -274,7 +274,6 @@ public:
bool lower_uniform_pull_constant_loads();
bool lower_load_payload();
bool lower_regioning();
bool lower_derivatives();
bool lower_find_live_channel();
bool lower_scoreboard();
@ -596,6 +595,7 @@ void nir_to_brw(fs_visitor *s);
bool brw_fs_lower_barycentrics(fs_visitor &s);
bool brw_fs_lower_constant_loads(fs_visitor &s);
bool brw_fs_lower_derivatives(fs_visitor &s);
bool brw_fs_lower_integer_multiplication(fs_visitor &s);
bool brw_fs_lower_logical_sends(fs_visitor &s);
bool brw_fs_lower_pack(fs_visitor &s);