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 b825a63feeffc42af3afff7c456a64855ca2356f..6ef394fe7300a1fd72c71be4bb912b97c3bd24ce 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 71236f9d67c4c5807c685a03fdb75dab9e00f5ee..c7183b39935a2323ccb61ca3fde853bcc2dc0122 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 d9559baeff7974ced9b11a7dcc4d1c8bb03d0984..c70fda1e205fba51ef7b623f4e7a6efe39d0329d 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 f5f5e701a4113ccd64d8725c6c9a04be73970675..bebf736911fde11a6584f720de07b213755f6fab 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 ab7250f3fc193b0c0fb2aca33ed69bf8aeeecc26..80502e59af79bba08d0c630b7ad3248febf6583e 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 28a3beef596fd64f05dfda89fb59a5c66b7803b0..1e395f7bbed5bc53f9a21eb701888d6bbbc15ca0 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 652e7067d57d695e5bcbef615dad1373440343fb..ddc4ab83364054cc929c28f0cff1da2640c4177f 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 01e4d88baf78654d1595e560eee5c85734b8ce26..56bc7f8fac5b654d834a333755b883303fa8997f 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 5211043de0415c1207cac034e9b48896fd0c8c02..ba9980854d0883d5861dcd3bb608b819909d2bd9 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: