gallium/st: lower rectangle textures if not supported

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8898>
This commit is contained in:
Christian Gmeiner 2021-02-01 11:48:02 +01:00 committed by Marge Bot
parent 758a2d5343
commit 08e072015a
4 changed files with 16 additions and 0 deletions

View file

@ -728,6 +728,8 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
screen->get_param(screen, PIPE_CAP_CONDITIONAL_RENDER); screen->get_param(screen, PIPE_CAP_CONDITIONAL_RENDER);
st->lower_texcoord_replace = st->lower_texcoord_replace =
!screen->get_param(screen, PIPE_CAP_POINT_SPRITE); !screen->get_param(screen, PIPE_CAP_POINT_SPRITE);
st->lower_rect_tex =
!screen->get_param(screen, PIPE_CAP_TEXRECT);
st->allow_st_finalize_nir_twice = screen->finalize_nir != NULL; st->allow_st_finalize_nir_twice = screen->finalize_nir != NULL;
st->has_hw_atomics = st->has_hw_atomics =

View file

@ -161,6 +161,7 @@ struct st_context
boolean prefer_real_buffer_in_constbuf0; boolean prefer_real_buffer_in_constbuf0;
boolean has_conditional_render; boolean has_conditional_render;
boolean lower_texcoord_replace; boolean lower_texcoord_replace;
boolean lower_rect_tex;
/* There are consequences for drivers wanting to call st_finalize_nir /* There are consequences for drivers wanting to call st_finalize_nir
* twice, once before shader caching and once after lowering for shader * twice, once before shader caching and once after lowering for shader

View file

@ -1026,6 +1026,14 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
NIR_PASS_V(nir, nir_split_var_copies); NIR_PASS_V(nir, nir_split_var_copies);
NIR_PASS_V(nir, nir_lower_var_copies); NIR_PASS_V(nir, nir_lower_var_copies);
if (st->lower_rect_tex) {
struct nir_lower_tex_options opts = { 0 };
opts.lower_rect = true;
NIR_PASS_V(nir, nir_lower_tex, &opts);
}
st_nir_assign_varying_locations(st, nir); st_nir_assign_varying_locations(st, nir);
st_nir_assign_uniform_locations(st->ctx, prog, nir); st_nir_assign_uniform_locations(st->ctx, prog, nir);

View file

@ -53,6 +53,11 @@ st_nir_finish_builtin_shader(struct st_context *st,
NIR_PASS_V(nir, nir_lower_io_to_scalar_early, mask); NIR_PASS_V(nir, nir_lower_io_to_scalar_early, mask);
} }
if (st->lower_rect_tex) {
const struct nir_lower_tex_options opts = { .lower_rect = true, };
NIR_PASS_V(nir, nir_lower_tex, &opts);
}
nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir)); nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
st_nir_assign_vs_in_locations(nir); st_nir_assign_vs_in_locations(nir);