Rename FRAG_OUTPUT_* tokens to FRAG_RESULT_* to match vertex program convention

This commit is contained in:
Brian Paul
2005-11-02 18:06:12 +00:00
parent 5a02209cd2
commit 90ebb581e6
7 changed files with 30 additions and 27 deletions

View File

@@ -155,7 +155,7 @@ enum
VERT_ATTRIB_GENERIC1 = 17, VERT_ATTRIB_GENERIC1 = 17,
VERT_ATTRIB_GENERIC2 = 18, VERT_ATTRIB_GENERIC2 = 18,
VERT_ATTRIB_GENERIC3 = 19, VERT_ATTRIB_GENERIC3 = 19,
VERT_ATTRIB_MAX = 16 VERT_ATTRIB_MAX = 16 /* XXX not counting generic attribs yet */
}; };
/** /**
@@ -188,10 +188,10 @@ enum
#define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g))) #define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g)))
/*@}*/ /*@}*/
/** /**
* Indexes for vertex program result attributes * Indexes for vertex program result attributes
*/ */
/*@{*/
#define VERT_RESULT_HPOS 0 #define VERT_RESULT_HPOS 0
#define VERT_RESULT_COL0 1 #define VERT_RESULT_COL0 1
#define VERT_RESULT_COL1 2 #define VERT_RESULT_COL1 2
@@ -208,6 +208,7 @@ enum
#define VERT_RESULT_BFC0 13 #define VERT_RESULT_BFC0 13
#define VERT_RESULT_BFC1 14 #define VERT_RESULT_BFC1 14
#define VERT_RESULT_MAX 15 #define VERT_RESULT_MAX 15
/*@}*/
/** /**
@@ -227,12 +228,11 @@ enum
FRAG_ATTRIB_TEX5 = 9, FRAG_ATTRIB_TEX5 = 9,
FRAG_ATTRIB_TEX6 = 10, FRAG_ATTRIB_TEX6 = 10,
FRAG_ATTRIB_TEX7 = 11, FRAG_ATTRIB_TEX7 = 11,
FRAG_ATTRIB_MAX = 12 FRAG_ATTRIB_MAX = 12
}; };
/* /**
* Bitflags for fragment attributes. * Bitflags for fragment program input attributes.
*/ */
/*@{*/ /*@{*/
#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS) #define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS)
@@ -259,12 +259,15 @@ enum
/*@}*/ /*@}*/
/* Fragment program results /**
* Fragment program results
*/ */
#define FRAG_OUTPUT_COLR 0 /*@{*/
#define FRAG_OUTPUT_COLH 1 #define FRAG_RESULT_COLR 0
#define FRAG_OUTPUT_DEPR 2 #define FRAG_RESULT_COLH 1
#define FRAG_OUTPUT_MAX 3 #define FRAG_RESULT_DEPR 2
#define FRAG_RESULT_MAX 3
/*@}*/
/** /**

View File

@@ -857,7 +857,7 @@ static struct ureg emit_texenv( struct texenv_fragment_program *p, int unit )
rgb_shift) rgb_shift)
dest = get_temp( p ); dest = get_temp( p );
else else
dest = make_ureg(PROGRAM_OUTPUT, FRAG_OUTPUT_COLR); dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
/* Emit the RGB and A combine ops /* Emit the RGB and A combine ops
*/ */
@@ -1000,7 +1000,7 @@ static void create_new_program(struct state_key *key, GLcontext *ctx,
p.program->Parameters = _mesa_new_parameter_list(); p.program->Parameters = _mesa_new_parameter_list();
p.program->InputsRead = 0; p.program->InputsRead = 0;
p.program->OutputsWritten = 1 << FRAG_OUTPUT_COLR; p.program->OutputsWritten = 1 << FRAG_RESULT_COLR;
for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++)
p.src_texture[unit] = undef; p.src_texture[unit] = undef;
@@ -1030,7 +1030,7 @@ static void create_new_program(struct state_key *key, GLcontext *ctx,
} }
cf = get_source( &p, SRC_PREVIOUS, 0 ); cf = get_source( &p, SRC_PREVIOUS, 0 );
out = make_ureg( PROGRAM_OUTPUT, FRAG_OUTPUT_COLR ); out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLR );
if (key->separate_specular) { if (key->separate_specular) {
/* Emit specular add. /* Emit specular add.

View File

@@ -1537,7 +1537,7 @@ parse_attrib_binding(GLcontext * ctx, GLubyte ** inst,
* *
* \param inst The parsed tokens * \param inst The parsed tokens
* \param outputReg Returned index/number of the output register, * \param outputReg Returned index/number of the output register,
* one of the VERT_RESULT_* or FRAG_OUTPUT_* values. * one of the VERT_RESULT_* or FRAG_RESULT_* values.
*/ */
static GLuint static GLuint
parse_result_binding(GLcontext *ctx, GLubyte **inst, parse_result_binding(GLcontext *ctx, GLubyte **inst,
@@ -1555,7 +1555,7 @@ parse_result_binding(GLcontext *ctx, GLubyte **inst,
*/ */
parse_output_color_num(ctx, inst, Program, &out_color); parse_output_color_num(ctx, inst, Program, &out_color);
ASSERT(out_color < MAX_DRAW_BUFFERS); ASSERT(out_color < MAX_DRAW_BUFFERS);
*outputReg = FRAG_OUTPUT_COLR; *outputReg = FRAG_RESULT_COLR;
} }
else { else {
/* for vtx programs, this is VERTEX_RESULT_POSITION */ /* for vtx programs, this is VERTEX_RESULT_POSITION */
@@ -1566,7 +1566,7 @@ parse_result_binding(GLcontext *ctx, GLubyte **inst,
case FRAGMENT_RESULT_DEPTH: case FRAGMENT_RESULT_DEPTH:
if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
/* for frag programs, this is FRAGMENT_RESULT_DEPTH */ /* for frag programs, this is FRAGMENT_RESULT_DEPTH */
*outputReg = FRAG_OUTPUT_DEPR; *outputReg = FRAG_RESULT_DEPR;
} }
else { else {
/* for vtx programs, this is VERTEX_RESULT_COLOR */ /* for vtx programs, this is VERTEX_RESULT_COLOR */

View File

@@ -843,7 +843,7 @@ Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
/* try to match an output register name */ /* try to match an output register name */
for (j = 0; OutputRegisters[j]; j++) { for (j = 0; OutputRegisters[j]; j++) {
if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) { if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) {
static GLuint bothColors = (1 << FRAG_OUTPUT_COLR) | (1 << FRAG_OUTPUT_COLH); static GLuint bothColors = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_COLH);
*outputRegNum = j; *outputRegNum = j;
parseState->outputsWritten |= (1 << j); parseState->outputsWritten |= (1 << j);
if ((parseState->outputsWritten & bothColors) == bothColors) { if ((parseState->outputsWritten & bothColors) == bothColors) {

View File

@@ -123,10 +123,10 @@ struct fp_src_register
GLuint File:4; GLuint File:4;
GLuint Index:8; GLuint Index:8;
GLuint Swizzle:12; GLuint Swizzle:12;
GLuint NegateBase:4; /* ARB: negate/extended negate. GLuint NegateBase:4; /* ARB: negate/extended negate, per component.
NV: negate before absolute value? */ NV: negate before absolute value? */
GLuint Abs:1; /* NV: take absolute value? */ GLuint Abs:1; /* NV: take absolute value (all components) ? */
GLuint NegateAbs:1; /* NV: negate after absolute value? */ GLuint NegateAbs:1; /* NV: negate (all components) after absolute value? */
}; };

View File

@@ -1378,15 +1378,15 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
} }
else if (_mesa_strcmp(reg, "o[COLR]") == 0) { else if (_mesa_strcmp(reg, "o[COLR]") == 0) {
/* Fragment output color */ /* Fragment output color */
COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_COLR]); COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_RESULT_COLR]);
} }
else if (_mesa_strcmp(reg, "o[COLH]") == 0) { else if (_mesa_strcmp(reg, "o[COLH]") == 0) {
/* Fragment output color */ /* Fragment output color */
COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_COLH]); COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_RESULT_COLH]);
} }
else if (_mesa_strcmp(reg, "o[DEPR]") == 0) { else if (_mesa_strcmp(reg, "o[DEPR]") == 0) {
/* Fragment output depth */ /* Fragment output depth */
COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_DEPR]); COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_RESULT_DEPR]);
} }
else { else {
/* try user-defined identifiers */ /* try user-defined identifiers */

View File

@@ -1484,22 +1484,22 @@ _swrast_exec_fragment_program( GLcontext *ctx, struct sw_span *span )
/* Store output registers */ /* Store output registers */
{ {
const GLfloat *colOut const GLfloat *colOut
= ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_COLR]; = ctx->FragmentProgram.Machine.Outputs[FRAG_RESULT_COLR];
UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][RCOMP], colOut[0]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][RCOMP], colOut[0]);
UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][GCOMP], colOut[1]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][GCOMP], colOut[1]);
UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][BCOMP], colOut[2]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][BCOMP], colOut[2]);
UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], colOut[3]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], colOut[3]);
} }
/* depth value */ /* depth value */
if (program->OutputsWritten & (1 << FRAG_OUTPUT_DEPR)) { if (program->OutputsWritten & (1 << FRAG_RESULT_DEPR)) {
const GLfloat depth const GLfloat depth
= ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_DEPR][2]; = ctx->FragmentProgram.Machine.Outputs[FRAG_RESULT_DEPR][2];
span->array->z[i] = IROUND(depth * ctx->DrawBuffer->_DepthMaxF); span->array->z[i] = IROUND(depth * ctx->DrawBuffer->_DepthMaxF);
} }
} }
} }
if (program->OutputsWritten & (1 << FRAG_OUTPUT_DEPR)) { if (program->OutputsWritten & (1 << FRAG_RESULT_DEPR)) {
span->interpMask &= ~SPAN_Z; span->interpMask &= ~SPAN_Z;
span->arrayMask |= SPAN_Z; span->arrayMask |= SPAN_Z;
} }