From 2891c4b2e2cc45d2aba89b2260c46ea1fe75a505 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 27 Nov 2019 15:10:27 -0500 Subject: [PATCH] st/mesa: save currently bound vertex samplers and sampler views in st_context for st_draw_feedback.c Reviewed-by: Dave Airlie --- src/mesa/state_tracker/st_atom_sampler.c | 4 +++- src/mesa/state_tracker/st_atom_texture.c | 6 ++++-- src/mesa/state_tracker/st_context.c | 1 + src/mesa/state_tracker/st_context.h | 3 +++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index ad25d7a8cc1..86113c93c49 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -344,7 +344,9 @@ st_update_vertex_samplers(struct st_context *st) update_shader_samplers(st, PIPE_SHADER_VERTEX, - ctx->VertexProgram._Current, NULL, NULL); + ctx->VertexProgram._Current, + st->state.vert_samplers, + &st->state.num_vert_samplers); } diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index fac61591b21..070e5609157 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -262,8 +262,10 @@ st_update_vertex_textures(struct st_context *st) const struct gl_context *ctx = st->ctx; if (ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits > 0) { - update_textures_local(st, PIPE_SHADER_VERTEX, - ctx->VertexProgram._Current); + update_textures(st, + PIPE_SHADER_VERTEX, + ctx->VertexProgram._Current, + st->state.vert_sampler_views); } } diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 45043e6048e..e13bc71d185 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -453,6 +453,7 @@ st_destroy_context_priv(struct st_context *st, bool destroy_pipe) st_destroy_bound_image_handles(st); for (i = 0; i < ARRAY_SIZE(st->state.frag_sampler_views); i++) { + pipe_sampler_view_reference(&st->state.vert_sampler_views[i], NULL); pipe_sampler_view_reference(&st->state.frag_sampler_views[i], NULL); } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 3778bbd4528..bf77f3e7757 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -188,8 +188,11 @@ struct st_context struct pipe_blend_state blend; struct pipe_depth_stencil_alpha_state depth_stencil; struct pipe_rasterizer_state rasterizer; + struct pipe_sampler_state vert_samplers[PIPE_MAX_SAMPLERS]; struct pipe_sampler_state frag_samplers[PIPE_MAX_SAMPLERS]; + GLuint num_vert_samplers; GLuint num_frag_samplers; + struct pipe_sampler_view *vert_sampler_views[PIPE_MAX_SAMPLERS]; struct pipe_sampler_view *frag_sampler_views[PIPE_MAX_SAMPLERS]; GLuint num_sampler_views[PIPE_SHADER_TYPES]; struct pipe_clip_state clip; -- 2.30.2