[Mesa-dev] [PATCH 24/53] st/mesa: pass gl_program to st_bind_ssbos()

Timothy Arceri timothy.arceri at collabora.com
Tue Jan 3 02:43:28 UTC 2017


We no longer need to pass gl_shader_program.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
 src/mesa/state_tracker/st_atom_storagebuf.c | 30 ++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_storagebuf.c b/src/mesa/state_tracker/st_atom_storagebuf.c
index e1efd62..bf87037 100644
--- a/src/mesa/state_tracker/st_atom_storagebuf.c
+++ b/src/mesa/state_tracker/st_atom_storagebuf.c
@@ -41,25 +41,25 @@
 #include "st_program.h"
 
 static void
-st_bind_ssbos(struct st_context *st, struct gl_linked_shader *shader,
+st_bind_ssbos(struct st_context *st, struct gl_program *prog,
               enum pipe_shader_type shader_type)
 {
    unsigned i;
    struct pipe_shader_buffer buffers[MAX_SHADER_STORAGE_BUFFERS];
    struct gl_program_constants *c;
 
-   if (!shader || !st->pipe->set_shader_buffers)
+   if (!prog || !st->pipe->set_shader_buffers)
       return;
 
-   c = &st->ctx->Const.Program[shader->Stage];
+   c = &st->ctx->Const.Program[prog->info.stage];
 
-   for (i = 0; i < shader->Program->info.num_ssbos; i++) {
+   for (i = 0; i < prog->info.num_ssbos; i++) {
       struct gl_shader_storage_buffer_binding *binding;
       struct st_buffer_object *st_obj;
       struct pipe_shader_buffer *sb = &buffers[i];
 
       binding = &st->ctx->ShaderStorageBufferBindings[
-            shader->Program->sh.ShaderStorageBlocks[i]->Binding];
+            prog->sh.ShaderStorageBlocks[i]->Binding];
       st_obj = st_buffer_object(binding->BufferObject);
 
       sb->buffer = st_obj->buffer;
@@ -80,13 +80,13 @@ st_bind_ssbos(struct st_context *st, struct gl_linked_shader *shader,
       }
    }
    st->pipe->set_shader_buffers(st->pipe, shader_type, c->MaxAtomicBuffers,
-                                shader->Program->info.num_ssbos, buffers);
+                                prog->info.num_ssbos, buffers);
    /* clear out any stale shader buffers */
-   if (shader->Program->info.num_ssbos < c->MaxShaderStorageBlocks)
+   if (prog->info.num_ssbos < c->MaxShaderStorageBlocks)
       st->pipe->set_shader_buffers(
             st->pipe, shader_type,
-            c->MaxAtomicBuffers + shader->Program->info.num_ssbos,
-            c->MaxShaderStorageBlocks - shader->Program->info.num_ssbos,
+            c->MaxAtomicBuffers + prog->info.num_ssbos,
+            c->MaxShaderStorageBlocks - prog->info.num_ssbos,
             NULL);
 }
 
@@ -98,7 +98,7 @@ static void bind_vs_ssbos(struct st_context *st)
    if (!prog)
       return;
 
-   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_VERTEX],
+   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
                  PIPE_SHADER_VERTEX);
 }
 
@@ -114,7 +114,7 @@ static void bind_fs_ssbos(struct st_context *st)
    if (!prog)
       return;
 
-   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT],
+   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
                  PIPE_SHADER_FRAGMENT);
 }
 
@@ -130,7 +130,7 @@ static void bind_gs_ssbos(struct st_context *st)
    if (!prog)
       return;
 
-   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_GEOMETRY],
+   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program,
                  PIPE_SHADER_GEOMETRY);
 }
 
@@ -146,7 +146,7 @@ static void bind_tcs_ssbos(struct st_context *st)
    if (!prog)
       return;
 
-   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL],
+   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program,
                  PIPE_SHADER_TESS_CTRL);
 }
 
@@ -162,7 +162,7 @@ static void bind_tes_ssbos(struct st_context *st)
    if (!prog)
       return;
 
-   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL],
+   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program,
                  PIPE_SHADER_TESS_EVAL);
 }
 
@@ -178,7 +178,7 @@ static void bind_cs_ssbos(struct st_context *st)
    if (!prog)
       return;
 
-   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_COMPUTE],
+   st_bind_ssbos(st, prog->_LinkedShaders[MESA_SHADER_COMPUTE]->Program,
                  PIPE_SHADER_COMPUTE);
 }
 
-- 
2.9.3



More information about the mesa-dev mailing list