freedreno/ir3: enable shareable shaders
authorRob Clark <robclark@freedesktop.org>
Tue, 1 Mar 2016 22:51:36 +0000 (17:51 -0500)
committerRob Clark <robclark@freedesktop.org>
Wed, 2 Mar 2016 00:21:45 +0000 (19:21 -0500)
Now that we are no longer using the pctx reference in the shader, drop
it and turn on shareable shaders.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/a3xx/fd3_program.c
src/gallium/drivers/freedreno/a4xx/fd4_program.c
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/freedreno/ir3/ir3_shader.c
src/gallium/drivers/freedreno/ir3/ir3_shader.h

index a64ecf16eabc26165c974a873e874a7a8bd13fb6..a0fa40d1c25be7c3e62f78cb4048071f5a4ea119 100644 (file)
@@ -51,7 +51,8 @@ create_shader_stateobj(struct pipe_context *pctx, const struct pipe_shader_state
                enum shader_t type)
 {
        struct fd3_shader_stateobj *so = CALLOC_STRUCT(fd3_shader_stateobj);
-       so->shader = ir3_shader_create(pctx, cso, type);
+       struct ir3_compiler *compiler = fd_context(pctx)->screen->compiler;
+       so->shader = ir3_shader_create(compiler, cso, type);
        return so;
 }
 
index 74716fb733f1b59cdc08f9fe029039c7a51343fc..037c67f59ddfce4bd58bac21b8e5f77d75bac85e 100644 (file)
@@ -51,7 +51,8 @@ create_shader_stateobj(struct pipe_context *pctx, const struct pipe_shader_state
                enum shader_t type)
 {
        struct fd4_shader_stateobj *so = CALLOC_STRUCT(fd4_shader_stateobj);
-       so->shader = ir3_shader_create(pctx, cso, type);
+       struct ir3_compiler *compiler = fd_context(pctx)->screen->compiler;
+       so->shader = ir3_shader_create(compiler, cso, type);
        return so;
 }
 
index 2b3ecfe664e7a48911119a7e2e5b6cc0cb4360b3..1565a1da38d2c0edc13b755f5835182d84b76581 100644 (file)
@@ -241,7 +241,6 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_DEPTH_BOUNDS_TEST:
        case PIPE_CAP_TGSI_TXQS:
        case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
-       case PIPE_CAP_SHAREABLE_SHADERS:
        case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
        case PIPE_CAP_CLEAR_TEXTURE:
        case PIPE_CAP_DRAW_PARAMETERS:
@@ -257,6 +256,11 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_MAX_VIEWPORTS:
                return 1;
 
+       case PIPE_CAP_SHAREABLE_SHADERS:
+               if (is_ir3(screen))
+                       return 1;
+               return 0;
+
        /* Stream output. */
        case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
                if (is_ir3(screen))
index d79e05b9fe52aac72e3e1c99b4381e88eae5d581..4d0fcca6b92d536fdb888ea27479b0da119811ed 100644 (file)
@@ -266,14 +266,13 @@ ir3_shader_destroy(struct ir3_shader *shader)
 }
 
 struct ir3_shader *
-ir3_shader_create(struct pipe_context *pctx,
+ir3_shader_create(struct ir3_compiler *compiler,
                const struct pipe_shader_state *cso,
                enum shader_t type)
 {
        struct ir3_shader *shader = CALLOC_STRUCT(ir3_shader);
-       shader->compiler = fd_context(pctx)->screen->compiler;
+       shader->compiler = compiler;
        shader->id = ++shader->compiler->shader_count;
-       shader->pctx = pctx;
        shader->type = type;
        if (fd_mesa_debug & FD_DBG_DISASM) {
                DBG("dump tgsi: type=%d", shader->type);
index f3e7c44f3c746dba3a7087eaecc201c84e9ebe04..c6819b17761b07d2eff5757fadc72ade5a8d47e9 100644 (file)
@@ -241,7 +241,6 @@ struct ir3_shader {
 
        struct ir3_compiler *compiler;
 
-       struct pipe_context *pctx;    /* TODO replace w/ pipe_screen */
        nir_shader *nir;
        struct pipe_stream_output_info stream_output;
 
@@ -250,7 +249,7 @@ struct ir3_shader {
 
 void * ir3_shader_assemble(struct ir3_shader_variant *v, uint32_t gpu_id);
 
-struct ir3_shader * ir3_shader_create(struct pipe_context *pctx,
+struct ir3_shader * ir3_shader_create(struct ir3_compiler *compiler,
                const struct pipe_shader_state *cso, enum shader_t type);
 void ir3_shader_destroy(struct ir3_shader *shader);
 struct ir3_shader_variant * ir3_shader_variant(struct ir3_shader *shader,