On 05/18/2015 02:08 PM, Marek Olšák wrote:
Technically speaking, nothing needs to be destroyed. It's the
responsibility of the driver to clean up after itself.

The answer is no, because the compute shader isn't used by cso_context
and st/mesa.

Sounds good to me. Thanks for your answer Marek.

This patch is :

Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>


Marek

On Mon, May 18, 2015 at 1:15 PM, Samuel Pitoiset
<samuel.pitoi...@gmail.com> wrote:

On 05/18/2015 11:29 AM, Marek Olšák wrote:
From: Marek Olšák <marek.ol...@amd.com>

This fixes a crash in nouveau which can't handle
set_constant_buffer(PIPE_SHADER_TESS_*).
---
   src/gallium/auxiliary/cso_cache/cso_context.c | 7 +++++++
   src/mesa/state_tracker/st_context.c           | 6 ------
   2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c
b/src/gallium/auxiliary/cso_cache/cso_context.c
index 59bad2c..744b00c 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -300,6 +300,8 @@ void cso_destroy_context( struct cso_context *ctx )
      unsigned i, shader;
        if (ctx->pipe) {
+      ctx->pipe->set_index_buffer(ctx->pipe, NULL);
+
         ctx->pipe->bind_blend_state( ctx->pipe, NULL );
         ctx->pipe->bind_rasterizer_state( ctx->pipe, NULL );
   @@ -326,13 +328,18 @@ void cso_destroy_context( struct cso_context *ctx
)
           ctx->pipe->bind_depth_stencil_alpha_state( ctx->pipe, NULL );
         ctx->pipe->bind_fs_state( ctx->pipe, NULL );
+      ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0,
NULL);
         ctx->pipe->bind_vs_state( ctx->pipe, NULL );
+      ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_VERTEX, 0,
NULL);
         if (ctx->has_geometry_shader) {
            ctx->pipe->bind_gs_state(ctx->pipe, NULL);
+         ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_GEOMETRY,
0, NULL);
         }
         if (ctx->has_tessellation) {
            ctx->pipe->bind_tcs_state(ctx->pipe, NULL);
+         ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_TESS_CTRL,
0, NULL);
            ctx->pipe->bind_tes_state(ctx->pipe, NULL);
+         ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_TESS_EVAL,
0, NULL);
         }
         ctx->pipe->bind_vertex_elements_state( ctx->pipe, NULL );
   diff --git a/src/mesa/state_tracker/st_context.c
b/src/mesa/state_tracker/st_context.c
index fa87dd7..ef4ad1b 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -378,12 +378,6 @@ void st_destroy_context( struct st_context *st )
      }
      pipe_surface_reference(&st->state.framebuffer.zsbuf, NULL);
   -   pipe->set_index_buffer(pipe, NULL);
-
-   for (i = 0; i < PIPE_SHADER_TYPES; i++) {
-      pipe->set_constant_buffer(pipe, i, 0, NULL);
-   }
-
      _mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache);
        _vbo_DestroyContext(st->ctx);

PIPE_SHADER_COMPUTE doesn't need to be destroyed?


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to