st/mesa: pass gl_program to st_bind_ubos()
authorTimothy Arceri <timothy.arceri@collabora.com>
Wed, 9 Nov 2016 03:00:22 +0000 (14:00 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Mon, 9 Jan 2017 04:27:35 +0000 (15:27 +1100)
We no longer need anything from gl_linked_shader.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/state_tracker/st_atom_constbuf.c

index 45bb885359922787b6a25c178007ac78903ee78d..958b202eb7349437836aa97cb0aeb86a551af765 100644 (file)
@@ -238,21 +238,21 @@ const struct st_tracked_state st_update_cs_constants = {
    update_cs_constants                                 /* update */
 };
 
-static void st_bind_ubos(struct st_context *st,
-                           struct gl_linked_shader *shader,
-                           unsigned shader_type)
+static void st_bind_ubos(struct st_context *st, struct gl_program *prog,
+                         unsigned shader_type)
 {
    unsigned i;
    struct pipe_constant_buffer cb = { 0 };
 
-   if (!shader)
+   if (!prog)
       return;
 
-   for (i = 0; i < shader->Program->info.num_ubos; i++) {
+   for (i = 0; i < prog->info.num_ubos; i++) {
       struct gl_uniform_buffer_binding *binding;
       struct st_buffer_object *st_obj;
 
-      binding = &st->ctx->UniformBufferBindings[shader->Program->sh.UniformBlocks[i]->Binding];
+      binding =
+         &st->ctx->UniformBufferBindings[prog->sh.UniformBlocks[i]->Binding];
       st_obj = st_buffer_object(binding->BufferObject);
 
       cb.buffer = st_obj->buffer;
@@ -281,10 +281,10 @@ static void bind_vs_ubos(struct st_context *st)
    struct gl_shader_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
 
-   if (!prog)
+   if (!prog || !prog->_LinkedShaders[MESA_SHADER_VERTEX])
       return;
 
-   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_VERTEX], PIPE_SHADER_VERTEX);
+   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program, PIPE_SHADER_VERTEX);
 }
 
 const struct st_tracked_state st_bind_vs_ubos = {
@@ -296,10 +296,10 @@ static void bind_fs_ubos(struct st_context *st)
    struct gl_shader_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
 
-   if (!prog)
+   if (!prog || !prog->_LinkedShaders[MESA_SHADER_FRAGMENT])
       return;
 
-   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT], PIPE_SHADER_FRAGMENT);
+   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program, PIPE_SHADER_FRAGMENT);
 }
 
 const struct st_tracked_state st_bind_fs_ubos = {
@@ -311,10 +311,10 @@ static void bind_gs_ubos(struct st_context *st)
    struct gl_shader_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
 
-   if (!prog)
+   if (!prog || !prog->_LinkedShaders[MESA_SHADER_GEOMETRY])
       return;
 
-   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_GEOMETRY], PIPE_SHADER_GEOMETRY);
+   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program, PIPE_SHADER_GEOMETRY);
 }
 
 const struct st_tracked_state st_bind_gs_ubos = {
@@ -326,10 +326,10 @@ static void bind_tcs_ubos(struct st_context *st)
    struct gl_shader_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
 
-   if (!prog)
+   if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_CTRL])
       return;
 
-   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL], PIPE_SHADER_TESS_CTRL);
+   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program, PIPE_SHADER_TESS_CTRL);
 }
 
 const struct st_tracked_state st_bind_tcs_ubos = {
@@ -341,10 +341,10 @@ static void bind_tes_ubos(struct st_context *st)
    struct gl_shader_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
 
-   if (!prog)
+   if (!prog || !prog->_LinkedShaders[MESA_SHADER_TESS_EVAL])
       return;
 
-   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL], PIPE_SHADER_TESS_EVAL);
+   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program, PIPE_SHADER_TESS_EVAL);
 }
 
 const struct st_tracked_state st_bind_tes_ubos = {
@@ -356,10 +356,10 @@ static void bind_cs_ubos(struct st_context *st)
    struct gl_shader_program *prog =
       st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
 
-   if (!prog)
+   if (!prog || !prog->_LinkedShaders[MESA_SHADER_COMPUTE])
       return;
 
-   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_COMPUTE],
+   st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_COMPUTE]->Program,
                 PIPE_SHADER_COMPUTE);
 }