From c3626a91cee5034528f3f92c802a8e5947ea5f92 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 1 Nov 2005 17:25:49 +0000 Subject: Several fp and vp tweaks: - Renumber VERT_RESULT_* values so that they match the numbers of the corresponding FRAG_ATTRIB_ values. - Add ctx->VertexProgram._Current and FragmentProgram._Current values which point to either the current client-supplied program if enabled, or otherwise to the current mesa-internal program. Thus this program is always the correct one for the current state, providing that the mesa flags to turn on automatic generation are enabled. - Add callbacks to ctx->Driver.BindProgram() in texenvprogram.c and t_vp_build.c so that the driver knows when the generated program changes. This is cleaner than trying to code all the possible _NEW_* flags into the driver, and more precise as well. - Add a UsesKill flag to identify fragment programs with that instruction, as these can require special treatment. - Move the FRAG_OUTPUT values to mtypes.h, near to similar defn's. --- src/mesa/main/mtypes.h | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) (limited to 'src/mesa/main/mtypes.h') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index aadd0a7e7f..d77759df25 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -195,18 +195,18 @@ enum #define VERT_RESULT_HPOS 0 #define VERT_RESULT_COL0 1 #define VERT_RESULT_COL1 2 -#define VERT_RESULT_BFC0 3 -#define VERT_RESULT_BFC1 4 -#define VERT_RESULT_FOGC 5 -#define VERT_RESULT_PSIZ 6 -#define VERT_RESULT_TEX0 7 -#define VERT_RESULT_TEX1 8 -#define VERT_RESULT_TEX2 9 -#define VERT_RESULT_TEX3 10 -#define VERT_RESULT_TEX4 11 -#define VERT_RESULT_TEX5 12 -#define VERT_RESULT_TEX6 13 -#define VERT_RESULT_TEX7 14 +#define VERT_RESULT_FOGC 3 +#define VERT_RESULT_TEX0 4 +#define VERT_RESULT_TEX1 5 +#define VERT_RESULT_TEX2 6 +#define VERT_RESULT_TEX3 7 +#define VERT_RESULT_TEX4 8 +#define VERT_RESULT_TEX5 9 +#define VERT_RESULT_TEX6 10 +#define VERT_RESULT_TEX7 11 +#define VERT_RESULT_PSIZ 12 +#define VERT_RESULT_BFC0 13 +#define VERT_RESULT_BFC1 14 #define VERT_RESULT_MAX 15 @@ -226,7 +226,9 @@ enum FRAG_ATTRIB_TEX4 = 8, FRAG_ATTRIB_TEX5 = 9, FRAG_ATTRIB_TEX6 = 10, - FRAG_ATTRIB_TEX7 = 11 + FRAG_ATTRIB_TEX7 = 11, + + FRAG_ATTRIB_MAX = 12 }; /* @@ -257,6 +259,14 @@ enum /*@}*/ +/* Fragment program results + */ +#define FRAG_OUTPUT_COLR 0 +#define FRAG_OUTPUT_COLH 1 +#define FRAG_OUTPUT_DEPR 2 +#define FRAG_OUTPUT_MAX 3 + + /** * Indexes for all renderbuffers */ @@ -1791,6 +1801,7 @@ struct fragment_program GLuint NumNativeTexIndirections; GLenum FogOption; struct program_parameter_list *Parameters; /**< array [NumParameters] */ + GLboolean UsesKill; #ifdef USE_TCC char c_str[4096]; /* experimental... */ @@ -1835,6 +1846,9 @@ struct gl_vertex_program_state GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */ GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */ struct vertex_program *Current; /**< ptr to currently bound program */ + struct vertex_program *_Current; /**< ptr to currently bound + program, including internal + (t_vp_build.c) programs */ GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; @@ -1865,7 +1879,8 @@ struct gl_fragment_program_state GLboolean _Enabled; /* Really enabled? */ GLboolean _Active; /* Really really enabled? */ struct fragment_program *Current; /* ptr to currently bound program */ - struct fragment_program *_Current; /* ptr to currently active program */ + struct fragment_program *_Current; /* ptr to currently active program + (including internal programs) */ struct fp_machine Machine; /* machine state */ GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */ -- cgit v1.2.3