mesa: Use gl_shader_program::_LinkedShaders instead of GeometryProgram
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 20 Aug 2011 21:26:12 +0000 (14:26 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 7 Oct 2011 23:39:50 +0000 (16:39 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/context.c
src/mesa/main/mtypes.h
src/mesa/main/shaderapi.c
src/mesa/main/shaderobj.c
src/mesa/main/state.c
src/mesa/main/uniforms.c
src/mesa/program/ir_to_mesa.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp
src/mesa/state_tracker/st_program.c

index b825a63..6ef394f 100644 (file)
@@ -1856,8 +1856,7 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
            break;
 
         case GL_GEOMETRY_SHADER_ARB:
-           _mesa_append_uniforms_to_file(sh,
-                                         &shProg[i]->GeometryProgram->Base);
+           _mesa_append_uniforms_to_file(sh, sh->Program);
            break;
 
         case GL_FRAGMENT_SHADER:
index 71236f9..c7183b3 100644 (file)
@@ -2172,7 +2172,6 @@ struct gl_shader_program
 
    /* post-link info: */
    struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
-   struct gl_geometry_program *GeometryProgram; /**< Linked geometry prog */
    struct gl_uniform_list *Uniforms;
    struct gl_program_parameter_list *Varying;
    GLboolean LinkStatus;   /**< GL_LINK_STATUS */
index d9559ba..c70fda1 100644 (file)
@@ -813,8 +813,9 @@ print_shader_info(const struct gl_shader_program *shProg)
             shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program->Id);
    if (shProg->FragmentProgram)
       printf("  frag prog %u\n", shProg->FragmentProgram->Base.Id);
-   if (shProg->GeometryProgram)
-      printf("  geom prog %u\n", shProg->GeometryProgram->Base.Id);
+   if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY])
+      printf("  geom prog %u\n",
+            shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->Id);
 }
 
 
@@ -965,7 +966,7 @@ validate_shader_program(const struct gl_shader_program *shProg,
                         char *errMsg)
 {
    const struct gl_shader *vs = shProg->_LinkedShaders[MESA_SHADER_VERTEX];
-   const struct gl_geometry_program *gp = shProg->GeometryProgram;
+   const struct gl_shader *gs = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY];
    const struct gl_fragment_program *fp = shProg->FragmentProgram;
 
    if (!shProg->LinkStatus) {
@@ -995,7 +996,7 @@ validate_shader_program(const struct gl_shader_program *shProg,
    if (vs && !validate_samplers(vs->Program, errMsg)) {
       return GL_FALSE;
    }
-   if (gp && !validate_samplers(&gp->Base, errMsg)) {
+   if (gs && !validate_samplers(gs->Program, errMsg)) {
       return GL_FALSE;
    }
    if (fp && !validate_samplers(&fp->Base, errMsg)) {
index f5f5e70..bebf736 100644 (file)
@@ -276,7 +276,6 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
                                 struct gl_shader_program *shProg)
 {
    _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
-   _mesa_reference_geomprog(ctx, &shProg->GeometryProgram, NULL);
 
    if (shProg->Uniforms) {
       _mesa_free_uniform_list(shProg->Uniforms);
index ab7250f..80502e5 100644 (file)
@@ -268,10 +268,12 @@ update_program(struct gl_context *ctx)
       _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
    }
 
-   if (gsProg && gsProg->LinkStatus && gsProg->GeometryProgram) {
+   if (gsProg && gsProg->LinkStatus
+       && gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
       /* Use GLSL geometry shader */
       _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current,
-                               gsProg->GeometryProgram);
+                              (struct gl_geometry_program *)
+                              gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program);
    } else {
       /* No geometry program */
       _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, NULL);
index 28a3bee..1e395f7 100644 (file)
@@ -190,7 +190,7 @@ find_uniform_parameter_pos(struct gl_shader_program *shProg, GLint index,
       else {
          pos = shProg->Uniforms->Uniforms[index].GeomPos;
          if (pos >= 0) {
-            prog = &shProg->GeometryProgram->Base;
+            prog = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program;
          }
       }
    }
@@ -930,11 +930,12 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
       }
    }
 
-   if (shProg->GeometryProgram) {
+   if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
       /* convert uniform location to program parameter index */
       GLint index = uniform->GeomPos;
       if (index >= 0) {
-         set_program_uniform(ctx, &shProg->GeometryProgram->Base,
+         set_program_uniform(ctx,
+                            shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program,
                              index, offset, type, count, elems, values);
       }
    }
@@ -1078,11 +1079,12 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
       }
    }
 
-   if (shProg->GeometryProgram) {
+   if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
       /* convert uniform location to program parameter index */
       GLint index = uniform->GeomPos;
       if (index >= 0) {
-         set_program_uniform_matrix(ctx, &shProg->GeometryProgram->Base,
+         set_program_uniform_matrix(ctx,
+                                    shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program,
                                     index, offset,
                                     count, rows, cols, transpose, values);
       }
index 652e706..ddc4ab8 100644 (file)
@@ -3306,8 +3306,8 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
                                                  linked_prog);
             break;
          case GL_GEOMETRY_SHADER:
-            _mesa_reference_geomprog(ctx, &prog->GeometryProgram,
-                                     (struct gl_geometry_program *)linked_prog);
+            _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+                                   linked_prog);
             ok = ctx->Driver.ProgramStringNotify(ctx, GL_GEOMETRY_PROGRAM_NV,
                                                  linked_prog);
             break;
@@ -3428,7 +3428,6 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
    }
 
    _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL);
-   _mesa_reference_geomprog(ctx, &prog->GeometryProgram, NULL);
 
    if (prog->LinkStatus) {
       link_shaders(ctx, prog);
index 01e4d88..56bc7f8 100644 (file)
@@ -5202,8 +5202,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
             }
             break;
          case GL_GEOMETRY_SHADER:
-            _mesa_reference_geomprog(ctx, &prog->GeometryProgram,
-                                     (struct gl_geometry_program *)linked_prog);
+            _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+                                   linked_prog);
             ok = ctx->Driver.ProgramStringNotify(ctx, GL_GEOMETRY_PROGRAM_NV,
                                                  linked_prog);
             if (!ok) {
index 5211043..ba99808 100644 (file)
@@ -1157,8 +1157,8 @@ destroy_shader_program_variants_cb(GLuint key, void *data, void *userData)
                                   shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
          destroy_program_variants(st, (struct gl_program *)
                                   shProg->FragmentProgram);
-         destroy_program_variants(st, (struct gl_program *)
-                                  shProg->GeometryProgram);
+         destroy_program_variants(st,
+                                  shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program);
       }
       break;
    case GL_VERTEX_SHADER: