mesa: add api to write subroutine indicies to the program storage.
authorDave Airlie <airlied@redhat.com>
Tue, 7 Jun 2016 05:25:56 +0000 (15:25 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 23 Aug 2016 01:03:45 +0000 (11:03 +1000)
This writes the subroutine indicies to the program storage for
a stage. This API is intended to be used by drivers to update
the uniform storage before uploading to the hw.

This isn't the most thread safe effort, but it will be significantly
more multi-context safe.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
src/mesa/main/shaderapi.c
src/mesa/main/shaderapi.h

index 6631f1e..733fee6 100644 (file)
@@ -2838,6 +2838,16 @@ _mesa_shader_write_subroutine_index(struct gl_context *ctx,
    } while(i < sh->NumSubroutineUniformRemapTable);
 }
 
+void
+_mesa_shader_write_subroutine_indices(struct gl_context *ctx,
+                                      gl_shader_stage stage)
+{
+   if (ctx->_Shader->CurrentProgram[stage] &&
+       ctx->_Shader->CurrentProgram[stage]->_LinkedShaders[stage])
+      _mesa_shader_write_subroutine_index(ctx,
+                                          ctx->_Shader->CurrentProgram[stage]->_LinkedShaders[stage]);
+}
+
 static void
 _mesa_shader_init_subroutine_defaults(struct gl_context *ctx,
                                       struct gl_linked_shader *sh)
index b3de5fa..4297bfa 100644 (file)
@@ -69,6 +69,9 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg);
 extern size_t
 _mesa_longest_attribute_name_length(struct gl_shader_program *shProg);
 
+extern void
+_mesa_shader_write_subroutine_indices(struct gl_context *ctx,
+                                      gl_shader_stage stage);
 extern void GLAPIENTRY
 _mesa_AttachObjectARB(GLhandleARB, GLhandleARB);