diff options
author | Paul Berry <[email protected]> | 2013-02-23 09:00:58 -0800 |
---|---|---|
committer | Paul Berry <[email protected]> | 2013-03-15 09:26:17 -0700 |
commit | eed6baf7621fa94e7888f8079b155fc67a08540c (patch) | |
tree | 216270e7f3222fcb11b8b3fa1def330908f05a21 /src/mesa/main | |
parent | f117abe66414e25be4f7bc61ca0df9e83ddaf543 (diff) |
Replace gl_frag_attrib enum with gl_varying_slot.
This patch makes the following search-and-replace changes:
gl_frag_attrib -> gl_varying_slot
FRAG_ATTRIB_* -> VARYING_SLOT_*
FRAG_BIT_* -> VARYING_BIT_*
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Tested-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/context.c | 4 | ||||
-rw-r--r-- | src/mesa/main/ff_fragment_shader.cpp | 38 | ||||
-rw-r--r-- | src/mesa/main/ffvertex_prog.c | 14 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 62 | ||||
-rw-r--r-- | src/mesa/main/state.h | 2 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 2 |
6 files changed, 30 insertions, 92 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 40950ccc63a..05399342153 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -344,7 +344,6 @@ dummy_enum_func(void) { gl_buffer_index bi = BUFFER_FRONT_LEFT; gl_face_index fi = FACE_POS_X; - gl_frag_attrib fa = FRAG_ATTRIB_WPOS; gl_frag_result fr = FRAG_RESULT_DEPTH; gl_texture_index ti = TEXTURE_2D_ARRAY_INDEX; gl_vert_attrib va = VERT_ATTRIB_POS; @@ -352,7 +351,6 @@ dummy_enum_func(void) (void) bi; (void) fi; - (void) fa; (void) fr; (void) ti; (void) va; @@ -675,7 +673,7 @@ check_context_limits(struct gl_context *ctx) /* check that we don't exceed the size of various bitfields */ assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten))); - assert(FRAG_ATTRIB_MAX <= + assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead))); assert(MAX_COMBINED_TEXTURE_IMAGE_UNITS <= 8 * sizeof(GLbitfield)); diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 1aea6e36d60..186988bbd70 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -333,7 +333,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) } else if (ctx->RenderMode == GL_FEEDBACK) { /* _NEW_RENDERMODE */ - fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0); + fp_inputs = (VARYING_BIT_COL0 | VARYING_BIT_TEX0); } else if (!(vertexProgram || vertexShader)) { /* Fixed function vertex logic */ @@ -345,33 +345,33 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) */ /* _NEW_POINT */ if (ctx->Point.PointSprite) - varying_inputs |= FRAG_BITS_TEX_ANY; + varying_inputs |= VARYING_BITS_TEX_ANY; /* First look at what values may be computed by the generated * vertex program: */ /* _NEW_LIGHT */ if (ctx->Light.Enabled) { - fp_inputs |= FRAG_BIT_COL0; + fp_inputs |= VARYING_BIT_COL0; if (texenv_doing_secondary_color(ctx)) - fp_inputs |= FRAG_BIT_COL1; + fp_inputs |= VARYING_BIT_COL1; } /* _NEW_TEXTURE */ fp_inputs |= (ctx->Texture._TexGenEnabled | - ctx->Texture._TexMatEnabled) << FRAG_ATTRIB_TEX0; + ctx->Texture._TexMatEnabled) << VARYING_SLOT_TEX0; /* Then look at what might be varying as a result of enabled * arrays, etc: */ if (varying_inputs & VERT_BIT_COLOR0) - fp_inputs |= FRAG_BIT_COL0; + fp_inputs |= VARYING_BIT_COL0; if (varying_inputs & VERT_BIT_COLOR1) - fp_inputs |= FRAG_BIT_COL1; + fp_inputs |= VARYING_BIT_COL1; fp_inputs |= (((varying_inputs & VERT_BIT_TEX_ANY) >> VERT_ATTRIB_TEX0) - << FRAG_ATTRIB_TEX0); + << VARYING_SLOT_TEX0); } else { @@ -395,15 +395,15 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) */ /* _NEW_POINT */ if (ctx->Point.PointSprite) - vp_outputs |= FRAG_BITS_TEX_ANY; + vp_outputs |= VARYING_BITS_TEX_ANY; if (vp_outputs & (1 << VARYING_SLOT_COL0)) - fp_inputs |= FRAG_BIT_COL0; + fp_inputs |= VARYING_BIT_COL0; if (vp_outputs & (1 << VARYING_SLOT_COL1)) - fp_inputs |= FRAG_BIT_COL1; + fp_inputs |= VARYING_BIT_COL1; fp_inputs |= (((vp_outputs & VARYING_BITS_TEX_ANY) >> VARYING_SLOT_TEX0) - << FRAG_ATTRIB_TEX0); + << VARYING_SLOT_TEX0); } return fp_inputs; @@ -417,7 +417,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) { GLuint i, j; - GLbitfield inputs_referenced = FRAG_BIT_COL0; + GLbitfield inputs_referenced = VARYING_BIT_COL0; const GLbitfield inputs_available = get_fp_input_mask( ctx ); GLuint keySize; @@ -440,7 +440,7 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) key->unit[i].enabled = 1; key->enabled_units |= (1<<i); key->nr_enabled_units = i + 1; - inputs_referenced |= FRAG_BIT_TEX(i); + inputs_referenced |= VARYING_BIT_TEX(i); key->unit[i].source_index = translate_tex_src_bit(texUnit->_ReallyEnabled); @@ -482,14 +482,14 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) /* _NEW_LIGHT | _NEW_FOG */ if (texenv_doing_secondary_color(ctx)) { key->separate_specular = 1; - inputs_referenced |= FRAG_BIT_COL1; + inputs_referenced |= VARYING_BIT_COL1; } /* _NEW_FOG */ if (ctx->Fog.Enabled) { key->fog_enabled = 1; key->fog_mode = translate_fog_mode(ctx->Fog.Mode); - inputs_referenced |= FRAG_BIT_FOGC; /* maybe */ + inputs_referenced |= VARYING_BIT_FOGC; /* maybe */ } /* _NEW_BUFFERS */ @@ -553,7 +553,7 @@ get_current_attrib(texenv_fragment_program *p, GLuint attrib) static ir_rvalue * get_gl_Color(texenv_fragment_program *p) { - if (p->state->inputs_available & FRAG_BIT_COL0) { + if (p->state->inputs_available & VARYING_BIT_COL0) { ir_variable *var = p->shader->symbols->get_variable("gl_Color"); assert(var); return new(p->mem_ctx) ir_dereference_variable(var); @@ -918,7 +918,7 @@ static void load_texture( texenv_fragment_program *p, GLuint unit ) const GLuint texTarget = p->state->unit[unit].source_index; ir_rvalue *texcoord; - if (!(p->state->inputs_available & (FRAG_BIT_TEX0 << unit))) { + if (!(p->state->inputs_available & (VARYING_BIT_TEX0 << unit))) { texcoord = get_current_attrib(p, VERT_ATTRIB_TEX0 + unit); } else if (p->texcoord_tex[unit]) { texcoord = new(p->mem_ctx) ir_dereference_variable(p->texcoord_tex[unit]); @@ -1253,7 +1253,7 @@ emit_instructions(texenv_fragment_program *p) p->emit(assign(spec_result, cf)); ir_rvalue *secondary; - if (p->state->inputs_available & FRAG_BIT_COL1) { + if (p->state->inputs_available & VARYING_BIT_COL1) { ir_variable *var = p->shader->symbols->get_variable("gl_SecondaryColor"); assert(var); diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 3f08b098469..093bc6651a9 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -165,7 +165,7 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key ) if (ctx->RenderMode == GL_FEEDBACK) { /* make sure the vertprog emits color and tex0 */ - key->fragprog_inputs_read |= (FRAG_BIT_COL0 | FRAG_BIT_TEX0); + key->fragprog_inputs_read |= (VARYING_BIT_COL0 | VARYING_BIT_TEX0); } key->separate_specular = (ctx->Light.Model.ColorControl == @@ -1407,7 +1407,7 @@ static void build_texture_transform( struct tnl_program *p ) for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { - if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i))) + if (!(p->state->fragprog_inputs_read & VARYING_BIT_TEX(i))) continue; if (p->state->unit[i].coord_replace) @@ -1575,22 +1575,22 @@ static void build_tnl_program( struct tnl_program *p ) /* Lighting calculations: */ - if (p->state->fragprog_inputs_read & (FRAG_BIT_COL0|FRAG_BIT_COL1)) { + if (p->state->fragprog_inputs_read & (VARYING_BIT_COL0|VARYING_BIT_COL1)) { if (p->state->light_global_enabled) build_lighting(p); else { - if (p->state->fragprog_inputs_read & FRAG_BIT_COL0) + if (p->state->fragprog_inputs_read & VARYING_BIT_COL0) emit_passthrough(p, VERT_ATTRIB_COLOR0, VARYING_SLOT_COL0); - if (p->state->fragprog_inputs_read & FRAG_BIT_COL1) + if (p->state->fragprog_inputs_read & VARYING_BIT_COL1) emit_passthrough(p, VERT_ATTRIB_COLOR1, VARYING_SLOT_COL1); } } - if (p->state->fragprog_inputs_read & FRAG_BIT_FOGC) + if (p->state->fragprog_inputs_read & VARYING_BIT_FOGC) build_fog(p); - if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY) + if (p->state->fragprog_inputs_read & VARYING_BITS_TEX_ANY) build_texture_transform(p); if (p->state->point_attenuated) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 9c431af74d6..83b6c898466 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -286,32 +286,6 @@ typedef enum /*********************************************/ /** - * Indexes for fragment program input attributes. - */ -typedef enum -{ - FRAG_ATTRIB_WPOS = VARYING_SLOT_POS, - FRAG_ATTRIB_COL0 = VARYING_SLOT_COL0, - FRAG_ATTRIB_COL1 = VARYING_SLOT_COL1, - FRAG_ATTRIB_FOGC = VARYING_SLOT_FOGC, - FRAG_ATTRIB_TEX0 = VARYING_SLOT_TEX0, - FRAG_ATTRIB_TEX1 = VARYING_SLOT_TEX1, - FRAG_ATTRIB_TEX2 = VARYING_SLOT_TEX2, - FRAG_ATTRIB_TEX3 = VARYING_SLOT_TEX3, - FRAG_ATTRIB_TEX4 = VARYING_SLOT_TEX4, - FRAG_ATTRIB_TEX5 = VARYING_SLOT_TEX5, - FRAG_ATTRIB_TEX6 = VARYING_SLOT_TEX6, - FRAG_ATTRIB_TEX7 = VARYING_SLOT_TEX7, - FRAG_ATTRIB_FACE = VARYING_SLOT_FACE, /**< front/back face */ - FRAG_ATTRIB_PNTC = VARYING_SLOT_PNTC, /**< sprite/point coord */ - FRAG_ATTRIB_CLIP_DIST0 = VARYING_SLOT_CLIP_DIST0, - FRAG_ATTRIB_CLIP_DIST1 = VARYING_SLOT_CLIP_DIST1, - FRAG_ATTRIB_VAR0 = VARYING_SLOT_VAR0, /**< shader varying */ - FRAG_ATTRIB_MAX = VARYING_SLOT_MAX -} gl_frag_attrib; - - -/** * Determine if the given gl_varying_slot appears in the fragment shader. */ static inline GLboolean @@ -332,40 +306,6 @@ _mesa_varying_slot_in_fs(gl_varying_slot slot) /** - * Bitflags for fragment program input attributes. - */ -/*@{*/ -#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS) -#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0) -#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1) -#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC) -#define FRAG_BIT_FACE (1 << FRAG_ATTRIB_FACE) -#define FRAG_BIT_PNTC (1 << FRAG_ATTRIB_PNTC) -#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0) -#define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1) -#define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2) -#define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3) -#define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4) -#define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5) -#define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6) -#define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7) -#define FRAG_BIT_VAR0 (1 << FRAG_ATTRIB_VAR0) - -#define FRAG_BIT_TEX(U) (FRAG_BIT_TEX0 << (U)) -#define FRAG_BIT_VAR(V) (FRAG_BIT_VAR0 << (V)) - -#define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \ - FRAG_BIT_TEX1| \ - FRAG_BIT_TEX2| \ - FRAG_BIT_TEX3| \ - FRAG_BIT_TEX4| \ - FRAG_BIT_TEX5| \ - FRAG_BIT_TEX6| \ - FRAG_BIT_TEX7) -/*@}*/ - - -/** * Fragment program results */ typedef enum @@ -2016,7 +1956,7 @@ struct gl_fragment_program * For inputs that do not have an interpolation qualifier specified in * GLSL, the value is INTERP_QUALIFIER_NONE. */ - enum glsl_interp_qualifier InterpQualifier[FRAG_ATTRIB_MAX]; + enum glsl_interp_qualifier InterpQualifier[VARYING_SLOT_MAX]; /** * Bitfield indicating, for each fragment shader input, 1 if that input diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h index 29a25409268..7b3121b4e33 100644 --- a/src/mesa/main/state.h +++ b/src/mesa/main/state.h @@ -66,7 +66,7 @@ _mesa_need_secondary_color(const struct gl_context *ctx) if (ctx->FragmentProgram._Current && (ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) && - (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1)) + (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL1)) return GL_TRUE; return GL_FALSE; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 1bd9f911f9e..d44cd7cf9a6 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -661,7 +661,7 @@ update_texture_state( struct gl_context *ctx ) if (fprog) { const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1; ctx->Texture._EnabledCoordUnits - = (fprog->InputsRead >> FRAG_ATTRIB_TEX0) & coordMask; + = (fprog->InputsRead >> VARYING_SLOT_TEX0) & coordMask; } else { ctx->Texture._EnabledCoordUnits = enabledFragUnits; |