st,zink,sfn: Use nir_foreach_def instead of nir_foreach_dest

It's basically the same code in all three.

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658>
This commit is contained in:
Faith Ekstrand
2023-08-12 19:18:51 -05:00
committed by Marge Bot
parent 6203750d78
commit 369270906b
3 changed files with 9 additions and 9 deletions
@@ -1471,9 +1471,9 @@ check_64_bit_op_src(nir_src *src, void *state)
}
static bool
check_64_bit_op_dest(nir_dest *dest, void *state)
check_64_bit_op_def(nir_def *def, void *state)
{
if (nir_dest_bit_size(*dest) == 64) {
if (def->bit_size == 64) {
*(bool *)state = true;
return false;
}
@@ -1486,7 +1486,7 @@ AluInstr::from_nir(nir_alu_instr *alu, Shader& shader)
bool is_64bit_op = false;
nir_foreach_src(&alu->instr, check_64_bit_op_src, &is_64bit_op);
if (!is_64bit_op)
nir_foreach_dest(&alu->instr, check_64_bit_op_dest, &is_64bit_op);
nir_foreach_def(&alu->instr, check_64_bit_op_def, &is_64bit_op);
if (is_64bit_op) {
switch (alu->op) {
+3 -3
View File
@@ -1420,10 +1420,10 @@ zink_tgsi_to_nir(struct pipe_screen *screen, const struct tgsi_token *tokens)
static bool
dest_is_64bit(nir_dest *dest, void *state)
def_is_64bit(nir_def *def, void *state)
{
bool *lower = (bool *)state;
if (dest && (nir_dest_bit_size(*dest) == 64)) {
if (def && (def->bit_size == 64)) {
*lower = true;
return false;
}
@@ -1449,7 +1449,7 @@ filter_64_bit_instr(const nir_instr *const_instr, UNUSED const void *data)
* doesn't have const variants, so do the ugly const_cast here. */
nir_instr *instr = (nir_instr *)const_instr;
nir_foreach_dest(instr, dest_is_64bit, &lower);
nir_foreach_def(instr, def_is_64bit, &lower);
if (lower)
return true;
nir_foreach_src(instr, src_is_64bit, &lower);
+3 -3
View File
@@ -231,10 +231,10 @@ st_nir_assign_uniform_locations(struct gl_context *ctx,
}
static bool
dest_is_64bit(nir_dest *dest, void *state)
def_is_64bit(nir_def *def, void *state)
{
bool *lower = (bool *)state;
if (dest && (nir_dest_bit_size(*dest) == 64)) {
if (def && (def->bit_size == 64)) {
*lower = true;
return false;
}
@@ -260,7 +260,7 @@ filter_64_bit_instr(const nir_instr *const_instr, UNUSED const void *data)
* doesn't have const variants, so do the ugly const_cast here. */
nir_instr *instr = const_cast<nir_instr *>(const_instr);
nir_foreach_dest(instr, dest_is_64bit, &lower);
nir_foreach_def(instr, def_is_64bit, &lower);
if (lower)
return true;
nir_foreach_src(instr, src_is_64bit, &lower);