nir: use IO intrinsics in nir_lower_bitmap

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32779>
This commit is contained in:
Marek Olšák
2024-12-24 13:27:00 -05:00
committed by Marge Bot
parent a7ad1b302b
commit 0de28a9fd0

View File

@@ -48,8 +48,6 @@
*
* If L8_UNORM, options->swizzle_xxxx is true. Otherwise we can just use
* the .w comp.
*
* Run before nir_lower_io.
*/
static void
@@ -60,8 +58,17 @@ lower_bitmap(nir_shader *shader, nir_builder *b,
nir_tex_instr *tex;
nir_def *cond;
texcoord = nir_load_var(b, nir_get_variable_with_location(shader, nir_var_shader_in,
VARYING_SLOT_TEX0, glsl_vec4_type()));
if (shader->info.io_lowered) {
nir_def *baryc =
nir_load_barycentric_pixel(b, 32, .interp_mode = INTERP_MODE_SMOOTH);
texcoord = nir_load_interpolated_input(b, 4, 32, baryc, nir_imm_int(b, 0),
.io_semantics.location = VARYING_SLOT_TEX0);
} else {
nir_variable *var =
nir_get_variable_with_location(shader, nir_var_shader_in,
VARYING_SLOT_TEX0, glsl_vec4_type());
texcoord = nir_load_var(b, var);
}
const struct glsl_type *sampler2D =
glsl_sampler_type(GLSL_SAMPLER_DIM_2D, false, false, GLSL_TYPE_FLOAT);