st/mesa: save currently bound vertex samplers and sampler views in st_context
authorMarek Olšák <marek.olsak@amd.com>
Wed, 27 Nov 2019 20:10:27 +0000 (15:10 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 10 Dec 2019 02:09:28 +0000 (21:09 -0500)
for st_draw_feedback.c

Reviewed-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h

index ad25d7a8cc153529c019841e7199804fc460117a..86113c93c4988a7f7faf21f8d97345f28164da87 100644 (file)
@@ -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);
 }
 
 
index fac61591b21de3b25aae496ffc2b77393e32212d..070e5609157023b852d64204b2cff6d44e0cf601 100644 (file)
@@ -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);
    }
 }
 
index 45043e6048eb11986309181e39f26bddbbb65e53..e13bc71d1858b991f48fae2f64378a4f06a836a8 100644 (file)
@@ -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);
    }
 
index 3778bbd4528f2926726cf843e4d7df07201cf86a..bf77f3e77578e98d09a60ae560fdb051a7efe3b0 100644 (file)
@@ -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;