[Mesa-dev] [PATCH 10/30] mesa: Remove ad-hoc arrays of gl_shader_program.

Paul Berry stereotype441 at gmail.com
Thu Jan 9 18:19:11 PST 2014


Now that we have a ctx->Shader.CurrentProgram array, we can just use
it directly.
---
 src/mesa/main/context.c             | 6 +-----
 src/mesa/state_tracker/st_draw.c    | 6 +-----
 src/mesa/state_tracker/st_program.c | 6 +-----
 3 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 026d7aa..5855f15 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1853,13 +1853,9 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
 
 #ifdef DEBUG
    if (ctx->Shader.Flags & GLSL_LOG) {
-      struct gl_shader_program *shProg[MESA_SHADER_STAGES];
+      struct gl_shader_program **shProg = ctx->Shader.CurrentProgram;
       gl_shader_stage i;
 
-      shProg[MESA_SHADER_VERTEX] = ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX];
-      shProg[MESA_SHADER_GEOMETRY] = ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY];
-      shProg[MESA_SHADER_FRAGMENT] = ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT];
-
       for (i = 0; i < MESA_SHADER_STAGES; i++) {
 	 if (shProg[i] == NULL || shProg[i]->_Used
 	     || shProg[i]->_LinkedShaders[i] == NULL)
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 75a71f1..85677c3 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -131,11 +131,7 @@ setup_index_buffer(struct st_context *st,
 static void
 check_uniforms(struct gl_context *ctx)
 {
-   struct gl_shader_program *shProg[3] = {
-      ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX],
-      ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY],
-      ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT],
-   };
+   struct gl_shader_program **shProg = ctx->Shader.CurrentProgram;
    unsigned j;
 
    for (j = 0; j < 3; j++) {
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index fe3dafe..ef2abdb 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1195,11 +1195,7 @@ st_get_gp_variant(struct st_context *st,
 void
 st_print_shaders(struct gl_context *ctx)
 {
-   struct gl_shader_program *shProg[3] = {
-      ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX],
-      ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY],
-      ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT],
-   };
+   struct gl_shader_program **shProg = ctx->Shader.CurrentProgram;
    unsigned j;
 
    for (j = 0; j < 3; j++) {
-- 
1.8.5.2



More information about the mesa-dev mailing list