diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/context.c | 6 | ||||
-rw-r--r-- | src/mesa/main/ff_fragment_shader.cpp | 7 | ||||
-rw-r--r-- | src/mesa/main/ffvertex_prog.c | 38 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 67 |
4 files changed, 42 insertions, 76 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b428d40fc1c..aa4bfa47963 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -348,7 +348,7 @@ dummy_enum_func(void) gl_frag_result fr = FRAG_RESULT_DEPTH; gl_texture_index ti = TEXTURE_2D_ARRAY_INDEX; gl_vert_attrib va = VERT_ATTRIB_POS; - gl_vert_result vr = VERT_RESULT_HPOS; + gl_varying_slot vs = VARYING_SLOT_POS; gl_geom_attrib ga = GEOM_ATTRIB_POSITION; gl_geom_result gr = GEOM_RESULT_POS; @@ -358,7 +358,7 @@ dummy_enum_func(void) (void) fr; (void) ti; (void) va; - (void) vr; + (void) vs; (void) ga; (void) gr; } @@ -677,7 +677,7 @@ static void check_context_limits(struct gl_context *ctx) { /* check that we don't exceed the size of various bitfields */ - assert(VERT_RESULT_MAX <= + assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten))); assert(FRAG_ATTRIB_MAX <= (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead))); diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 02b4707f078..1aea6e36d60 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -304,7 +304,6 @@ static GLuint translate_tex_src_bit( GLbitfield bit ) #define VERT_BIT_TEX_ANY (0xff << VERT_ATTRIB_TEX0) -#define VERT_RESULT_TEX_ANY (0xff << VERT_RESULT_TEX0) /** * Identify all possible varying inputs. The fragment program will @@ -398,12 +397,12 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) if (ctx->Point.PointSprite) vp_outputs |= FRAG_BITS_TEX_ANY; - if (vp_outputs & (1 << VERT_RESULT_COL0)) + if (vp_outputs & (1 << VARYING_SLOT_COL0)) fp_inputs |= FRAG_BIT_COL0; - if (vp_outputs & (1 << VERT_RESULT_COL1)) + if (vp_outputs & (1 << VARYING_SLOT_COL1)) fp_inputs |= FRAG_BIT_COL1; - fp_inputs |= (((vp_outputs & VERT_RESULT_TEX_ANY) >> VERT_RESULT_TEX0) + fp_inputs |= (((vp_outputs & VARYING_BITS_TEX_ANY) >> VARYING_SLOT_TEX0) << FRAG_ATTRIB_TEX0); } diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index efdca015e99..3f08b098469 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -456,7 +456,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input ) /** - * \param input one of VERT_RESULT_x tokens. + * \param input one of VARYING_SLOT_x tokens. */ static struct ureg register_output( struct tnl_program *p, GLuint output ) { @@ -833,7 +833,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p ) static void build_hpos( struct tnl_program *p ) { struct ureg pos = register_input( p, VERT_ATTRIB_POS ); - struct ureg hpos = register_output( p, VERT_RESULT_HPOS ); + struct ureg hpos = register_output( p, VARYING_SLOT_POS ); struct ureg mvp[4]; if (p->mvp_with_dp4) { @@ -1088,22 +1088,22 @@ static void build_lighting( struct tnl_program *p ) /* If no lights, still need to emit the scenecolor. */ { - struct ureg res0 = register_output( p, VERT_RESULT_COL0 ); + struct ureg res0 = register_output( p, VARYING_SLOT_COL0 ); emit_op1(p, OPCODE_MOV, res0, 0, _col0); } if (separate) { - struct ureg res1 = register_output( p, VERT_RESULT_COL1 ); + struct ureg res1 = register_output( p, VARYING_SLOT_COL1 ); emit_op1(p, OPCODE_MOV, res1, 0, _col1); } if (twoside) { - struct ureg res0 = register_output( p, VERT_RESULT_BFC0 ); + struct ureg res0 = register_output( p, VARYING_SLOT_BFC0 ); emit_op1(p, OPCODE_MOV, res0, 0, _bfc0); } if (twoside && separate) { - struct ureg res1 = register_output( p, VERT_RESULT_BFC1 ); + struct ureg res1 = register_output( p, VARYING_SLOT_BFC1 ); emit_op1(p, OPCODE_MOV, res1, 0, _bfc1); } @@ -1189,14 +1189,14 @@ static void build_lighting( struct tnl_program *p ) if (separate) { mask0 = WRITEMASK_XYZ; mask1 = WRITEMASK_XYZ; - res0 = register_output( p, VERT_RESULT_COL0 ); - res1 = register_output( p, VERT_RESULT_COL1 ); + res0 = register_output( p, VARYING_SLOT_COL0 ); + res1 = register_output( p, VARYING_SLOT_COL1 ); } else { mask0 = 0; mask1 = WRITEMASK_XYZ; res0 = _col0; - res1 = register_output( p, VERT_RESULT_COL0 ); + res1 = register_output( p, VARYING_SLOT_COL0 ); } } else { @@ -1244,14 +1244,14 @@ static void build_lighting( struct tnl_program *p ) if (separate) { mask0 = WRITEMASK_XYZ; mask1 = WRITEMASK_XYZ; - res0 = register_output( p, VERT_RESULT_BFC0 ); - res1 = register_output( p, VERT_RESULT_BFC1 ); + res0 = register_output( p, VARYING_SLOT_BFC0 ); + res1 = register_output( p, VARYING_SLOT_BFC1 ); } else { mask0 = 0; mask1 = WRITEMASK_XYZ; res0 = _bfc0; - res1 = register_output( p, VERT_RESULT_BFC0 ); + res1 = register_output( p, VARYING_SLOT_BFC0 ); } } else { @@ -1306,7 +1306,7 @@ static void build_lighting( struct tnl_program *p ) static void build_fog( struct tnl_program *p ) { - struct ureg fog = register_output(p, VERT_RESULT_FOGC); + struct ureg fog = register_output(p, VARYING_SLOT_FOGC); struct ureg input; if (p->state->fog_source_is_depth) { @@ -1417,7 +1417,7 @@ static void build_texture_transform( struct tnl_program *p ) p->state->unit[i].texmat_enabled) { GLuint texmat_enabled = p->state->unit[i].texmat_enabled; - struct ureg out = register_output(p, VERT_RESULT_TEX0 + i); + struct ureg out = register_output(p, VARYING_SLOT_TEX0 + i); struct ureg out_texgen = undef; if (p->state->unit[i].texgen_enabled) { @@ -1512,7 +1512,7 @@ static void build_texture_transform( struct tnl_program *p ) release_temps(p); } else { - emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i); + emit_passthrough(p, VERT_ATTRIB_TEX0+i, VARYING_SLOT_TEX0+i); } } } @@ -1526,7 +1526,7 @@ static void build_atten_pointsize( struct tnl_program *p ) struct ureg eye = get_eye_position_z(p); struct ureg state_size = register_param2(p, STATE_INTERNAL, STATE_POINT_SIZE_CLAMPED); struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION); - struct ureg out = register_output(p, VERT_RESULT_PSIZ); + struct ureg out = register_output(p, VARYING_SLOT_PSIZ); struct ureg ut = get_temp(p); /* dist = |eyez| */ @@ -1562,7 +1562,7 @@ static void build_atten_pointsize( struct tnl_program *p ) static void build_array_pointsize( struct tnl_program *p ) { struct ureg in = register_input(p, VERT_ATTRIB_POINT_SIZE); - struct ureg out = register_output(p, VERT_RESULT_PSIZ); + struct ureg out = register_output(p, VARYING_SLOT_PSIZ); emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, in); } @@ -1580,10 +1580,10 @@ static void build_tnl_program( struct tnl_program *p ) build_lighting(p); else { if (p->state->fragprog_inputs_read & FRAG_BIT_COL0) - emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0); + emit_passthrough(p, VERT_ATTRIB_COLOR0, VARYING_SLOT_COL0); if (p->state->fragprog_inputs_read & FRAG_BIT_COL1) - emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1); + emit_passthrough(p, VERT_ATTRIB_COLOR1, VARYING_SLOT_COL1); } } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 37cc2daa5ab..1e62e19d69d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -283,37 +283,6 @@ typedef enum /*@}*/ -/** - * Indexes for vertex program result attributes. Note that - * _mesa_vert_result_to_frag_attrib() and _mesa_frag_attrib_to_vert_result() make - * assumptions about the layout of this enum. - */ -typedef enum -{ - VERT_RESULT_HPOS = VARYING_SLOT_POS, - VERT_RESULT_COL0 = VARYING_SLOT_COL0, - VERT_RESULT_COL1 = VARYING_SLOT_COL1, - VERT_RESULT_FOGC = VARYING_SLOT_FOGC, - VERT_RESULT_TEX0 = VARYING_SLOT_TEX0, - VERT_RESULT_TEX1 = VARYING_SLOT_TEX1, - VERT_RESULT_TEX2 = VARYING_SLOT_TEX2, - VERT_RESULT_TEX3 = VARYING_SLOT_TEX3, - VERT_RESULT_TEX4 = VARYING_SLOT_TEX4, - VERT_RESULT_TEX5 = VARYING_SLOT_TEX5, - VERT_RESULT_TEX6 = VARYING_SLOT_TEX6, - VERT_RESULT_TEX7 = VARYING_SLOT_TEX7, - VERT_RESULT_PSIZ = VARYING_SLOT_PSIZ, - VERT_RESULT_BFC0 = VARYING_SLOT_BFC0, - VERT_RESULT_BFC1 = VARYING_SLOT_BFC1, - VERT_RESULT_EDGE = VARYING_SLOT_EDGE, - VERT_RESULT_CLIP_VERTEX = VARYING_SLOT_CLIP_VERTEX, - VERT_RESULT_CLIP_DIST0 = VARYING_SLOT_CLIP_DIST0, - VERT_RESULT_CLIP_DIST1 = VARYING_SLOT_CLIP_DIST1, - VERT_RESULT_VAR0 = VARYING_SLOT_VAR0, /**< shader varying */ - VERT_RESULT_MAX = VARYING_SLOT_MAX -} gl_vert_result; - - /*********************************************/ /** @@ -415,36 +384,34 @@ typedef enum /** - * Convert from a gl_vert_result value to the corresponding gl_frag_attrib. + * Convert from a gl_varying_slot value for a vertex output to the + * corresponding gl_frag_attrib. * - * VERT_RESULT_HPOS is converted to FRAG_ATTRIB_WPOS. - * - * gl_vert_result values which have no corresponding gl_frag_attrib - * (VERT_RESULT_PSIZ, VERT_RESULT_BFC0, VERT_RESULT_BFC1, and - * VERT_RESULT_EDGE) are converted to a value of -1. + * Varying output values which have no corresponding gl_frag_attrib + * (VARYING_SLOT_PSIZ, VARYING_SLOT_BFC0, VARYING_SLOT_BFC1, and + * VARYING_SLOT_EDGE) are converted to a value of -1. */ static inline int -_mesa_vert_result_to_frag_attrib(gl_vert_result vert_result) +_mesa_vert_result_to_frag_attrib(gl_varying_slot vert_result) { - if (vert_result <= VERT_RESULT_TEX7) + if (vert_result <= VARYING_SLOT_TEX7) return vert_result; - else if (vert_result < VERT_RESULT_CLIP_DIST0) + else if (vert_result < VARYING_SLOT_CLIP_DIST0) return -1; - else if (vert_result <= VERT_RESULT_CLIP_DIST1) - return vert_result - VERT_RESULT_CLIP_DIST0 + FRAG_ATTRIB_CLIP_DIST0; - else if (vert_result < VERT_RESULT_VAR0) + else if (vert_result <= VARYING_SLOT_CLIP_DIST1) + return vert_result - VARYING_SLOT_CLIP_DIST0 + FRAG_ATTRIB_CLIP_DIST0; + else if (vert_result < VARYING_SLOT_VAR0) return -1; else - return vert_result - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0; + return vert_result - VARYING_SLOT_VAR0 + FRAG_ATTRIB_VAR0; } /** - * Convert from a gl_frag_attrib value to the corresponding gl_vert_result. - * - * FRAG_ATTRIB_WPOS is converted to VERT_RESULT_HPOS. + * Convert from a gl_frag_attrib value to the corresponding gl_varying_slot + * for a vertex output. * - * gl_frag_attrib values which have no corresponding gl_vert_result + * gl_frag_attrib values which have no corresponding vertex output * (FRAG_ATTRIB_FACE and FRAG_ATTRIB_PNTC) are converted to a value of -1. */ static inline int @@ -455,9 +422,9 @@ _mesa_frag_attrib_to_vert_result(gl_frag_attrib frag_attrib) else if (frag_attrib < FRAG_ATTRIB_CLIP_DIST0) return -1; else if (frag_attrib <= FRAG_ATTRIB_CLIP_DIST1) - return frag_attrib - FRAG_ATTRIB_CLIP_DIST0 + VERT_RESULT_CLIP_DIST0; + return frag_attrib - FRAG_ATTRIB_CLIP_DIST0 + VARYING_SLOT_CLIP_DIST0; else /* frag_attrib >= FRAG_ATTRIB_VAR0 */ - return frag_attrib - FRAG_ATTRIB_VAR0 + VERT_RESULT_VAR0; + return frag_attrib - FRAG_ATTRIB_VAR0 + VARYING_SLOT_VAR0; } |