[Mesa-dev] [PATCH 01/10] mesa: s/MESA_GEOMETRY_PROGRAM/GL_GEOMETRY_PROGRAM_NV

Luca Barbieri luca at luca-barbieri.com
Sun Sep 5 18:30:43 PDT 2010


There is a published extension with a token, so let's use it.
---
 src/mesa/main/context.c                 |    4 ++--
 src/mesa/main/mtypes.h                  |    8 --------
 src/mesa/main/state.c                   |    2 +-
 src/mesa/program/prog_print.c           |    2 +-
 src/mesa/program/prog_uniform.c         |    2 +-
 src/mesa/program/program.c              |   12 ++++++------
 src/mesa/state_tracker/st_atom_shader.c |    2 +-
 src/mesa/state_tracker/st_cb_program.c  |    8 ++++----
 8 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 8e34ec4..86318ca 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -497,7 +497,7 @@ init_program_limits(GLenum type, struct gl_program_constants *prog)
       prog->MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS;
       prog->MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS;
       break;
-   case MESA_GEOMETRY_PROGRAM:
+   case GL_GEOMETRY_PROGRAM_NV:
       prog->MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS;
       prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
       prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
@@ -577,7 +577,7 @@ _mesa_init_constants(GLcontext *ctx)
    init_program_limits(GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.FragmentProgram);
 #endif
 #if FEATURE_ARB_geometry_shader4
-   init_program_limits(MESA_GEOMETRY_PROGRAM, &ctx->Const.GeometryProgram);
+   init_program_limits(GL_GEOMETRY_PROGRAM_NV, &ctx->Const.GeometryProgram);
 #endif
    ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES;
    ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 40f12eb..6605d2f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -42,14 +42,6 @@
 #include "main/simple_list.h"	/* struct simple_node */
 
 /**
- * Internal token
- *  Must be simply different than GL_VERTEX_PROGRAM
- *    and GL_FRAGMENT_PROGRAM_ARB
- *  FIXME: this will have to be a real GL extension
- */
-#define MESA_GEOMETRY_PROGRAM 0x9999
-
-/**
  * Color channel data type.
  */
 #if CHAN_BITS == 8
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 4a3dffe..a5158c4 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -341,7 +341,7 @@ update_program(GLcontext *ctx)
    if (ctx->GeometryProgram._Current != prevGP) {
       new_state |= _NEW_PROGRAM;
       if (ctx->Driver.BindProgram) {
-         ctx->Driver.BindProgram(ctx, MESA_GEOMETRY_PROGRAM,
+         ctx->Driver.BindProgram(ctx, GL_GEOMETRY_PROGRAM_NV,
                             (struct gl_program *) ctx->GeometryProgram._Current);
       }
    }
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index 00aa6de..5afaaa6 100644
--- a/src/mesa/program/prog_print.c
+++ b/src/mesa/program/prog_print.c
@@ -856,7 +856,7 @@ _mesa_fprint_program_opt(FILE *f,
       else
          fprintf(f, "# Fragment Program/Shader %u\n", prog->Id);
       break;
-   case MESA_GEOMETRY_PROGRAM:
+   case GL_GEOMETRY_PROGRAM_NV:
       fprintf(f, "# Geometry Shader\n");
    }
 
diff --git a/src/mesa/program/prog_uniform.c b/src/mesa/program/prog_uniform.c
index 28acb88..1d12278 100644
--- a/src/mesa/program/prog_uniform.c
+++ b/src/mesa/program/prog_uniform.c
@@ -66,7 +66,7 @@ _mesa_append_uniform(struct gl_uniform_list *list,
 
    assert(target == GL_VERTEX_PROGRAM_ARB ||
           target == GL_FRAGMENT_PROGRAM_ARB ||
-          target == MESA_GEOMETRY_PROGRAM);
+          target == GL_GEOMETRY_PROGRAM_NV);
 
    index = _mesa_lookup_uniform(list, name);
    if (index < 0) {
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 06b9539..10011b9 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -352,7 +352,7 @@ _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id)
                                          CALLOC_STRUCT(gl_fragment_program),
                                          target, id );
       break;
-   case MESA_GEOMETRY_PROGRAM:
+   case GL_GEOMETRY_PROGRAM_NV:
       prog = _mesa_init_geometry_program(ctx,
                                          CALLOC_STRUCT(gl_geometry_program),
                                          target, id);
@@ -431,8 +431,8 @@ _mesa_reference_program(GLcontext *ctx,
       else if ((*ptr)->Target == GL_FRAGMENT_PROGRAM_ARB)
          ASSERT(prog->Target == GL_FRAGMENT_PROGRAM_ARB ||
                 prog->Target == GL_FRAGMENT_PROGRAM_NV);
-      else if ((*ptr)->Target == MESA_GEOMETRY_PROGRAM)
-         ASSERT(prog->Target == MESA_GEOMETRY_PROGRAM);
+      else if ((*ptr)->Target == GL_GEOMETRY_PROGRAM_NV)
+         ASSERT(prog->Target == GL_GEOMETRY_PROGRAM_NV);
    }
    if (*ptr == prog) {
       return;  /* no change */
@@ -445,7 +445,7 @@ _mesa_reference_program(GLcontext *ctx,
       printf("Program %p ID=%u Target=%s  Refcount-- to %d\n",
              *ptr, (*ptr)->Id,
              ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB ? "VP" :
-              ((*ptr)->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
+              ((*ptr)->Target == GL_GEOMETRY_PROGRAM_NV ? "GP" : "FP")),
              (*ptr)->RefCount - 1);
 #endif
       ASSERT((*ptr)->RefCount > 0);
@@ -470,7 +470,7 @@ _mesa_reference_program(GLcontext *ctx,
       printf("Program %p ID=%u Target=%s  Refcount++ to %d\n",
              prog, prog->Id,
              (prog->Target == GL_VERTEX_PROGRAM_ARB ? "VP" :
-              (prog->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
+              (prog->Target == GL_GEOMETRY_PROGRAM_NV ? "GP" : "FP")),
              prog->RefCount);
 #endif
       /*_glthread_UNLOCK_MUTEX(prog->Mutex);*/
@@ -559,7 +559,7 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog)
          fpc->PixelCenterInteger = fp->PixelCenterInteger;
       }
       break;
-   case MESA_GEOMETRY_PROGRAM:
+   case GL_GEOMETRY_PROGRAM_NV:
       {
          const struct gl_geometry_program *gp
             = (const struct gl_geometry_program *) prog;
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 05442ef..e4e8c24 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -246,7 +246,7 @@ update_gp( struct st_context *st )
    }
 
    stgp = st_geometry_program(st->ctx->GeometryProgram._Current);
-   assert(stgp->Base.Base.Target == MESA_GEOMETRY_PROGRAM);
+   assert(stgp->Base.Base.Target == GL_GEOMETRY_PROGRAM_NV);
 
    translate_gp(st, stgp);
 
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 6aa7e79..3956ca6 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -66,7 +66,7 @@ static void st_bind_program( GLcontext *ctx,
    case GL_FRAGMENT_PROGRAM_ARB:
       st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
       break;
-   case MESA_GEOMETRY_PROGRAM:
+   case GL_GEOMETRY_PROGRAM_NV:
       st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
       break;
    }
@@ -120,7 +120,7 @@ static struct gl_program *st_new_program( GLcontext *ctx,
 					  id );
    }
 
-   case MESA_GEOMETRY_PROGRAM: {
+   case GL_GEOMETRY_PROGRAM_NV: {
       struct st_geometry_program *prog = ST_CALLOC_STRUCT(st_geometry_program);
 
       prog->serialNo = SerialNo++;
@@ -150,7 +150,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog)
          st_vp_release_varients( st, stvp );
       }
       break;
-   case MESA_GEOMETRY_PROGRAM:
+   case GL_GEOMETRY_PROGRAM_NV:
       {
          struct st_geometry_program *stgp = (struct st_geometry_program *) prog;
 
@@ -227,7 +227,7 @@ static GLboolean st_program_string_notify( GLcontext *ctx,
       if (st->fp == stfp)
 	 st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
    }
-   else if (target == MESA_GEOMETRY_PROGRAM) {
+   else if (target == GL_GEOMETRY_PROGRAM_NV) {
       struct st_geometry_program *stgp = (struct st_geometry_program *) prog;
 
       stgp->serialNo++;
-- 
1.7.0.4



More information about the mesa-dev mailing list