r600g: Enable reusing of compute state
authorTom Stellard <thomas.stellard@amd.com>
Wed, 6 Jun 2012 23:44:09 +0000 (19:44 -0400)
committerTom Stellard <thomas.stellard@amd.com>
Thu, 21 Jun 2012 20:42:07 +0000 (20:42 +0000)
src/gallium/drivers/r600/evergreen_compute.c

index 3bb3895bf7348b5f73341dc3eb2a11a9e2b6b373..b2af26d8255bd1db5b6c2d17637c83db1d1a9200 100644 (file)
@@ -147,18 +147,21 @@ static void evergreen_bind_compute_state(struct pipe_context *ctx_, void *state)
 
        ctx->cs_shader = (struct r600_pipe_compute *)state;
 
-       assert(!ctx->cs_shader->shader_code_bo);
+       if (!ctx->cs_shader->shader_code_bo) {
 
-       ctx->cs_shader->shader_code_bo =
-               r600_compute_buffer_alloc_vram(ctx->screen,
+               ctx->cs_shader->shader_code_bo =
+                       r600_compute_buffer_alloc_vram(ctx->screen,
                                        ctx->cs_shader->bc.ndw * 4);
 
-       void *p = ctx->ws->buffer_map(ctx->cs_shader->shader_code_bo->cs_buf,
+               void *p = ctx->ws->buffer_map(
+                                       ctx->cs_shader->shader_code_bo->cs_buf,
                                        ctx->cs, PIPE_TRANSFER_WRITE);
 
-       memcpy(p, ctx->cs_shader->bc.bytecode, ctx->cs_shader->bc.ndw * 4);
+               memcpy(p, ctx->cs_shader->bc.bytecode, ctx->cs_shader->bc.ndw * 4);
 
-       ctx->ws->buffer_unmap(ctx->cs_shader->shader_code_bo->cs_buf);
+               ctx->ws->buffer_unmap(ctx->cs_shader->shader_code_bo->cs_buf);
+
+       }
 
        evergreen_compute_init_config(ctx);