mesa: Remove ad-hoc arrays of gl_shader_program.
authorPaul Berry <stereotype441@gmail.com>
Thu, 9 Jan 2014 19:32:00 +0000 (11:32 -0800)
committerPaul Berry <stereotype441@gmail.com>
Wed, 22 Jan 2014 04:25:47 +0000 (20:25 -0800)
Now that we have a ctx->Shader.CurrentProgram array, we can just use
it directly.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/context.c
src/mesa/state_tracker/st_draw.c
src/mesa/state_tracker/st_program.c

index ec9f981e57aa94576eb16f9a09d0b4d7e6a302a1..7c3b2d74f7ca5691c7e6501c032ef21617a27e61 100644 (file)
@@ -1874,13 +1874,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)
index 6a7a4efd6e1784a7cdb3120de6c141ec97a89dd0..355c180f86de6bec447cbe84df09a30236731b33 100644 (file)
@@ -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++) {
index 1a00c314dda11fdba2b5f07a47ef48934f4e16af..7a15b23fa81d8b6ae873b3d8cb3ced552f0a22b6 100644 (file)
@@ -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++) {