nir: Put the builder first in lower_input_attachments helpers

This is more idiomatic.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16482>
This commit is contained in:
Jason Ekstrand 2022-05-12 14:30:54 -05:00 committed by Marge Bot
parent 5410f4ee89
commit a170448a18
1 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@
#include "nir_builder.h"
static nir_ssa_def *
load_frag_coord(const nir_input_attachment_options *options, nir_builder *b)
load_frag_coord(nir_builder *b, const nir_input_attachment_options *options)
{
if (options->use_fragcoord_sysval)
return nir_load_frag_coord(b);
@ -51,7 +51,7 @@ load_frag_coord(const nir_input_attachment_options *options, nir_builder *b)
}
static nir_ssa_def *
load_layer_id(const nir_input_attachment_options *options, nir_builder *b)
load_layer_id(nir_builder *b, const nir_input_attachment_options *options)
{
if (options->use_layer_id_sysval) {
if (options->use_view_id_for_layer)
@ -94,12 +94,12 @@ try_lower_input_load(nir_function_impl *impl, nir_intrinsic_instr *load,
nir_builder_init(&b, impl);
b.cursor = nir_instr_remove(&load->instr);
nir_ssa_def *frag_coord = load_frag_coord(options, &b);
nir_ssa_def *frag_coord = load_frag_coord(&b, options);
frag_coord = nir_f2i32(&b, frag_coord);
nir_ssa_def *offset = nir_ssa_for_src(&b, load->src[1], 2);
nir_ssa_def *pos = nir_iadd(&b, frag_coord, offset);
nir_ssa_def *layer = load_layer_id(options, &b);
nir_ssa_def *layer = load_layer_id(&b, options);
nir_ssa_def *coord =
nir_vec3(&b, nir_channel(&b, pos, 0), nir_channel(&b, pos, 1), layer);
@ -166,10 +166,10 @@ try_lower_input_texop(nir_function_impl *impl, nir_tex_instr *tex,
nir_builder_init(&b, impl);
b.cursor = nir_before_instr(&tex->instr);
nir_ssa_def *frag_coord = load_frag_coord(options, &b);
nir_ssa_def *frag_coord = load_frag_coord(&b, options);
frag_coord = nir_f2i32(&b, frag_coord);
nir_ssa_def *layer = load_layer_id(options, &b);
nir_ssa_def *layer = load_layer_id(&b, options);
nir_ssa_def *coord = nir_vec3(&b, nir_channel(&b, frag_coord, 0),
nir_channel(&b, frag_coord, 1), layer);