mesa: rename, reorder FRAG_RESULT_x tokens

s/FRAG_RESULT_DEPR/FRAG_RESULT_DEPTH/
s/FRAG_RESULT_COLR/FRAG_RESULT/COLOR/
Remove FRAG_RESULT_COLH (NV half-precision) output since we never used it.
Next, we might merge the COLOR and DATA outputs (COLOR0, COLOR1, etc).
This commit is contained in:
Brian Paul
2009-02-28 11:49:46 -07:00
parent 7787fa10ba
commit 8d475822e6
23 changed files with 68 additions and 92 deletions

View File

@@ -180,9 +180,9 @@ get_result_vector(struct i915_fragment_program *p,
switch (inst->DstReg.File) { switch (inst->DstReg.File) {
case PROGRAM_OUTPUT: case PROGRAM_OUTPUT:
switch (inst->DstReg.Index) { switch (inst->DstReg.Index) {
case FRAG_RESULT_COLR: case FRAG_RESULT_COLOR:
return UREG(REG_TYPE_OC, 0); return UREG(REG_TYPE_OC, 0);
case FRAG_RESULT_DEPR: case FRAG_RESULT_DEPTH:
p->depth_written = 1; p->depth_written = 1;
return UREG(REG_TYPE_OD, 0); return UREG(REG_TYPE_OD, 0);
default: default:

View File

@@ -198,7 +198,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
ctx->Color.AlphaEnabled) ctx->Color.AlphaEnabled)
lookup |= IZ_PS_KILL_ALPHATEST_BIT; lookup |= IZ_PS_KILL_ALPHATEST_BIT;
if (fp->program.Base.OutputsWritten & (1<<FRAG_RESULT_DEPR)) if (fp->program.Base.OutputsWritten & (1<<FRAG_RESULT_DEPTH))
lookup |= IZ_PS_COMPUTES_DEPTH_BIT; lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
/* _NEW_DEPTH */ /* _NEW_DEPTH */

View File

@@ -862,7 +862,7 @@ static void precalc_txp( struct brw_wm_compile *c,
static void emit_fb_write( struct brw_wm_compile *c ) static void emit_fb_write( struct brw_wm_compile *c )
{ {
struct prog_src_register payload_r0_depth = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH); struct prog_src_register payload_r0_depth = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH);
struct prog_src_register outdepth = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DEPR); struct prog_src_register outdepth = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DEPTH);
struct prog_src_register outcolor; struct prog_src_register outcolor;
GLuint i; GLuint i;
@@ -879,7 +879,7 @@ static void emit_fb_write( struct brw_wm_compile *c )
outcolor, payload_r0_depth, outdepth); outcolor, payload_r0_depth, outdepth);
inst->Aux = (i<<1); inst->Aux = (i<<1);
if (c->fp_fragcolor_emitted) { if (c->fp_fragcolor_emitted) {
outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
0, outcolor, payload_r0_depth, outdepth); 0, outcolor, payload_r0_depth, outdepth);
inst->Aux = (i<<1); inst->Aux = (i<<1);
@@ -892,7 +892,7 @@ static void emit_fb_write( struct brw_wm_compile *c )
if (c->fp->program.Base.OutputsWritten & (1 << FRAG_RESULT_DATA0)) if (c->fp->program.Base.OutputsWritten & (1 << FRAG_RESULT_DATA0))
outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0); outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0);
else else
outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
0, outcolor, payload_r0_depth, outdepth); 0, outcolor, payload_r0_depth, outdepth);
@@ -928,7 +928,7 @@ static void validate_dst_regs( struct brw_wm_compile *c,
{ {
if (inst->DstReg.File == PROGRAM_OUTPUT) { if (inst->DstReg.File == PROGRAM_OUTPUT) {
GLuint idx = inst->DstReg.Index; GLuint idx = inst->DstReg.Index;
if (idx == FRAG_RESULT_COLR) if (idx == FRAG_RESULT_COLOR)
c->fp_fragcolor_emitted = 1; c->fp_fragcolor_emitted = 1;
} }
} }

View File

@@ -103,7 +103,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
/* as far as we can tell */ /* as far as we can tell */
key->computes_depth = key->computes_depth =
(fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) != 0; (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) != 0;
/* _NEW_COLOR */ /* _NEW_COLOR */
key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled; key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled;

View File

@@ -356,8 +356,8 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler)
static void nqssadce_init(struct nqssadce_state* s) static void nqssadce_init(struct nqssadce_state* s)
{ {
s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW; s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW;
s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W; s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W;
} }

View File

@@ -298,8 +298,8 @@ static void insert_WPOS_trailer(struct r500_fragment_program_compiler *compiler)
static void nqssadce_init(struct nqssadce_state* s) static void nqssadce_init(struct nqssadce_state* s)
{ {
s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW; s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW;
s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W; s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W;
} }
static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg) static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg)

View File

@@ -191,7 +191,7 @@ static void process_instruction(struct nqssadce_state* s)
if (inst->Opcode != OPCODE_KIL) { if (inst->Opcode != OPCODE_KIL) {
if (s->Descr->RewriteDepthOut) { if (s->Descr->RewriteDepthOut) {
if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPR) if (inst->DstReg.File == PROGRAM_OUTPUT && inst->DstReg.Index == FRAG_RESULT_DEPTH)
rewrite_depth_out(inst); rewrite_depth_out(inst);
} }

View File

@@ -778,10 +778,10 @@ static void fill_dest_into_pair(struct pair_state *s, struct radeon_pair_instruc
struct prog_instruction *inst = s->Program->Instructions + ip; struct prog_instruction *inst = s->Program->Instructions + ip;
if (inst->DstReg.File == PROGRAM_OUTPUT) { if (inst->DstReg.File == PROGRAM_OUTPUT) {
if (inst->DstReg.Index == FRAG_RESULT_COLR) { if (inst->DstReg.Index == FRAG_RESULT_COLOR) {
pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & WRITEMASK_XYZ; pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & WRITEMASK_XYZ;
pair->Alpha.OutputWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); pair->Alpha.OutputWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
} else if (inst->DstReg.Index == FRAG_RESULT_DEPR) { } else if (inst->DstReg.Index == FRAG_RESULT_DEPTH) {
pair->Alpha.DepthWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); pair->Alpha.DepthWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
} }
} else { } else {

View File

@@ -268,10 +268,9 @@ typedef enum
*/ */
typedef enum typedef enum
{ {
FRAG_RESULT_COLR = 0, FRAG_RESULT_DEPTH = 0,
FRAG_RESULT_COLH = 1, FRAG_RESULT_COLOR = 1,
FRAG_RESULT_DEPR = 2, FRAG_RESULT_DATA0 = 2,
FRAG_RESULT_DATA0 = 3,
FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS) FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
} gl_frag_result; } gl_frag_result;

View File

@@ -1098,7 +1098,7 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
rgb_shift) rgb_shift)
dest = get_temp( p ); dest = get_temp( p );
else else
dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLR); dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
/* Emit the RGB and A combine ops /* Emit the RGB and A combine ops
*/ */
@@ -1278,7 +1278,7 @@ create_new_program(GLcontext *ctx, struct state_key *key,
p.program->Base.Parameters = _mesa_new_parameter_list(); p.program->Base.Parameters = _mesa_new_parameter_list();
p.program->Base.InputsRead = 0; p.program->Base.InputsRead = 0;
p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLR; p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++)
p.src_texture[unit] = undef; p.src_texture[unit] = undef;
@@ -1313,7 +1313,7 @@ create_new_program(GLcontext *ctx, struct state_key *key,
} }
cf = get_source( &p, SRC_PREVIOUS, 0 ); cf = get_source( &p, SRC_PREVIOUS, 0 );
out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLR ); out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
if (key->separate_specular) { if (key->separate_specular) {
/* Emit specular add. /* Emit specular add.

View File

@@ -1688,7 +1688,7 @@ parse_result_binding(GLcontext *ctx, const 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_RESULT_COLR; *outputReg = FRAG_RESULT_COLOR;
} }
else { else {
/* for vtx programs, this is VERTEX_RESULT_POSITION */ /* for vtx programs, this is VERTEX_RESULT_POSITION */
@@ -1699,7 +1699,7 @@ parse_result_binding(GLcontext *ctx, const 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_RESULT_DEPR; *outputReg = FRAG_RESULT_DEPTH;
} }
else { else {
/* for vtx programs, this is VERTEX_RESULT_COLOR */ /* for vtx programs, this is VERTEX_RESULT_COLOR */

View File

@@ -384,18 +384,12 @@ static const char *InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS + 1] = {
"TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL
}; };
static const char *OutputRegisters[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS + 1] = { static const char *OutputRegisters[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS + 1] = {
"COLR", "COLH", "DEPR", "COLR", "DATA0", NULL
/* These are only allows for register combiners */
/*
"TEX0", "TEX1", "TEX2", "TEX3",
*/
"DEPR", NULL
}; };
/**********************************************************************/ /**********************************************************************/
/** /**
@@ -828,7 +822,6 @@ static GLboolean
Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum) Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
{ {
GLubyte token[100]; GLubyte token[100];
GLint j;
/* Match "o[" */ /* Match "o[" */
if (!Parse_String(parseState, "o[")) if (!Parse_String(parseState, "o["))
@@ -839,19 +832,19 @@ Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
RETURN_ERROR; RETURN_ERROR;
/* try to match an output register name */ /* try to match an output register name */
for (j = 0; OutputRegisters[j]; j++) { if (_mesa_strcmp((char *) token, "COLR") == 0 ||
if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) { _mesa_strcmp((char *) token, "COLH") == 0) {
static GLuint bothColors = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_COLH); /* note that we don't distinguish between COLR and COLH */
*outputRegNum = j; *outputRegNum = FRAG_RESULT_COLOR;
parseState->outputsWritten |= (1 << j); parseState->outputsWritten |= (1 << FRAG_RESULT_COLOR);
if ((parseState->outputsWritten & bothColors) == bothColors) {
RETURN_ERROR1("Illegal to write to both o[COLR] and o[COLH]");
} }
break; else if (_mesa_strcmp((char *) token, "DEPR") == 0) {
*outputRegNum = FRAG_RESULT_DEPTH;
parseState->outputsWritten |= (1 << FRAG_RESULT_DEPTH);
} }
} else {
if (!OutputRegisters[j])
RETURN_ERROR1("Invalid output register name"); RETURN_ERROR1("Invalid output register name");
}
/* Match ']' */ /* Match ']' */
if (!Parse_String(parseState, "]")) if (!Parse_String(parseState, "]"))
@@ -1826,10 +1819,3 @@ _mesa_nv_fragment_input_register_name(GLuint i)
return InputRegisters[i]; return InputRegisters[i];
} }
const char *
_mesa_nv_fragment_output_register_name(GLuint i)
{
ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS);
return OutputRegisters[i];
}

View File

@@ -44,9 +44,4 @@ _mesa_print_nv_fragment_program(const struct gl_fragment_program *program);
extern const char * extern const char *
_mesa_nv_fragment_input_register_name(GLuint i); _mesa_nv_fragment_input_register_name(GLuint i);
extern const char *
_mesa_nv_fragment_output_register_name(GLuint i);
#endif #endif

View File

@@ -222,20 +222,16 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
"glGetProgramRegisterfvMESA(registerName)"); "glGetProgramRegisterfvMESA(registerName)");
return; return;
} }
else if (_mesa_strcmp(reg, "o[COLR]") == 0) { else if (_mesa_strcmp(reg, "o[COLR]") == 0 ||
_mesa_strcmp(reg, "o[COLH]") == 0) {
/* Fragment output color */ /* Fragment output color */
ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
FRAG_RESULT_COLR, v); FRAG_RESULT_COLOR, v);
}
else if (_mesa_strcmp(reg, "o[COLH]") == 0) {
/* Fragment output color */
ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
FRAG_RESULT_COLH, v);
} }
else if (_mesa_strcmp(reg, "o[DEPR]") == 0) { else if (_mesa_strcmp(reg, "o[DEPR]") == 0) {
/* Fragment output depth */ /* Fragment output depth */
ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT, ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
FRAG_RESULT_DEPR, v); FRAG_RESULT_DEPTH, v);
} }
else { else {
/* try user-defined identifiers */ /* try user-defined identifiers */

View File

@@ -738,7 +738,7 @@ _mesa_combine_programs(GLcontext *ctx,
/* Connect color outputs of fprogA to color inputs of fprogB, via a /* Connect color outputs of fprogA to color inputs of fprogB, via a
* new temporary register. * new temporary register.
*/ */
if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) && if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) &&
(progB_inputsRead & FRAG_BIT_COL0)) { (progB_inputsRead & FRAG_BIT_COL0)) {
GLint tempReg = _mesa_find_free_register(newProg, PROGRAM_TEMPORARY); GLint tempReg = _mesa_find_free_register(newProg, PROGRAM_TEMPORARY);
if (tempReg < 0) { if (tempReg < 0) {
@@ -748,7 +748,7 @@ _mesa_combine_programs(GLcontext *ctx,
} }
/* replace writes to result.color[0] with tempReg */ /* replace writes to result.color[0] with tempReg */
replace_registers(newInst, lenA, replace_registers(newInst, lenA,
PROGRAM_OUTPUT, FRAG_RESULT_COLR, PROGRAM_OUTPUT, FRAG_RESULT_COLOR,
PROGRAM_TEMPORARY, tempReg); PROGRAM_TEMPORARY, tempReg);
/* replace reads from the input color with tempReg */ /* replace reads from the input color with tempReg */
replace_registers(newInst + lenA, lenB, replace_registers(newInst + lenA, lenB,
@@ -758,7 +758,7 @@ _mesa_combine_programs(GLcontext *ctx,
/* compute combined program's InputsRead */ /* compute combined program's InputsRead */
inputsB = progB_inputsRead; inputsB = progB_inputsRead;
if (progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) { if (progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
inputsB &= ~(1 << FRAG_ATTRIB_COL0); inputsB &= ~(1 << FRAG_ATTRIB_COL0);
} }
newProg->InputsRead = progA->InputsRead | inputsB; newProg->InputsRead = progA->InputsRead | inputsB;

View File

@@ -171,7 +171,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
if (inst->Opcode == OPCODE_END) if (inst->Opcode == OPCODE_END)
break; break;
if (inst->DstReg.File == PROGRAM_OUTPUT && if (inst->DstReg.File == PROGRAM_OUTPUT &&
inst->DstReg.Index == FRAG_RESULT_COLR) { inst->DstReg.Index == FRAG_RESULT_COLOR) {
/* change the instruction to write to colorTemp w/ clamping */ /* change the instruction to write to colorTemp w/ clamping */
inst->DstReg.File = PROGRAM_TEMPORARY; inst->DstReg.File = PROGRAM_TEMPORARY;
inst->DstReg.Index = colorTemp; inst->DstReg.Index = colorTemp;
@@ -249,7 +249,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
/* LRP result.color.xyz, fogFactorTemp.xxxx, colorTemp, fogColorRef; */ /* LRP result.color.xyz, fogFactorTemp.xxxx, colorTemp, fogColorRef; */
inst->Opcode = OPCODE_LRP; inst->Opcode = OPCODE_LRP;
inst->DstReg.File = PROGRAM_OUTPUT; inst->DstReg.File = PROGRAM_OUTPUT;
inst->DstReg.Index = FRAG_RESULT_COLR; inst->DstReg.Index = FRAG_RESULT_COLOR;
inst->DstReg.WriteMask = WRITEMASK_XYZ; inst->DstReg.WriteMask = WRITEMASK_XYZ;
inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].File = PROGRAM_TEMPORARY;
inst->SrcReg[0].Index = fogFactorTemp; inst->SrcReg[0].Index = fogFactorTemp;
@@ -264,7 +264,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
/* MOV result.color.w, colorTemp.x; # copy alpha */ /* MOV result.color.w, colorTemp.x; # copy alpha */
inst->Opcode = OPCODE_MOV; inst->Opcode = OPCODE_MOV;
inst->DstReg.File = PROGRAM_OUTPUT; inst->DstReg.File = PROGRAM_OUTPUT;
inst->DstReg.Index = FRAG_RESULT_COLR; inst->DstReg.Index = FRAG_RESULT_COLOR;
inst->DstReg.WriteMask = WRITEMASK_W; inst->DstReg.WriteMask = WRITEMASK_W;
inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].File = PROGRAM_TEMPORARY;
inst->SrcReg[0].Index = colorTemp; inst->SrcReg[0].Index = colorTemp;

View File

@@ -450,8 +450,8 @@ _slang_output_index(const char *name, GLenum target)
{ NULL, 0 } { NULL, 0 }
}; };
static const struct output_info fragOutputs[] = { static const struct output_info fragOutputs[] = {
{ "gl_FragColor", FRAG_RESULT_COLR }, { "gl_FragColor", FRAG_RESULT_COLOR },
{ "gl_FragDepth", FRAG_RESULT_DEPR }, { "gl_FragDepth", FRAG_RESULT_DEPTH },
{ "gl_FragData", FRAG_RESULT_DATA0 }, { "gl_FragData", FRAG_RESULT_DATA0 },
{ NULL, 0 } { NULL, 0 }
}; };

View File

@@ -686,7 +686,7 @@ _slang_link(GLcontext *ctx,
/* check that gl_FragColor and gl_FragData are not both written to */ /* check that gl_FragColor and gl_FragData are not both written to */
if (shProg->FragmentProgram) { if (shProg->FragmentProgram) {
GLbitfield outputsWritten = shProg->FragmentProgram->Base.OutputsWritten; GLbitfield outputsWritten = shProg->FragmentProgram->Base.OutputsWritten;
if ((outputsWritten & ((1 << FRAG_RESULT_COLR))) && if ((outputsWritten & ((1 << FRAG_RESULT_COLOR))) &&
(outputsWritten >= (1 << FRAG_RESULT_DATA0))) { (outputsWritten >= (1 << FRAG_RESULT_DATA0))) {
link_error(shProg, "Fragment program cannot write both gl_FragColor" link_error(shProg, "Fragment program cannot write both gl_FragColor"
" and gl_FragData[].\n"); " and gl_FragData[].\n");

View File

@@ -212,7 +212,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
inst[ic].TexSrcTarget = TEXTURE_2D_INDEX; inst[ic].TexSrcTarget = TEXTURE_2D_INDEX;
ic++; ic++;
fp->Base.InputsRead = (1 << FRAG_ATTRIB_TEX0); fp->Base.InputsRead = (1 << FRAG_ATTRIB_TEX0);
fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLR); fp->Base.OutputsWritten = (1 << FRAG_RESULT_COLOR);
fp->Base.SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */ fp->Base.SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */
if (key->scaleAndBias) { if (key->scaleAndBias) {
@@ -400,7 +400,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
{ {
struct prog_instruction *last = &inst[ic - 1]; struct prog_instruction *last = &inst[ic - 1];
last->DstReg.File = PROGRAM_OUTPUT; last->DstReg.File = PROGRAM_OUTPUT;
last->DstReg.Index = FRAG_RESULT_COLR; last->DstReg.Index = FRAG_RESULT_COLOR;
} }
/* END; */ /* END; */

View File

@@ -75,7 +75,7 @@ is_passthrough_program(const struct gl_fragment_program *prog)
if (inst[0].Opcode == OPCODE_MOV && if (inst[0].Opcode == OPCODE_MOV &&
inst[1].Opcode == OPCODE_END && inst[1].Opcode == OPCODE_END &&
inst[0].DstReg.File == PROGRAM_OUTPUT && inst[0].DstReg.File == PROGRAM_OUTPUT &&
inst[0].DstReg.Index == FRAG_RESULT_COLR && inst[0].DstReg.Index == FRAG_RESULT_COLOR &&
inst[0].DstReg.WriteMask == WRITEMASK_XYZW && inst[0].DstReg.WriteMask == WRITEMASK_XYZW &&
inst[0].SrcReg[0].File == PROGRAM_INPUT && inst[0].SrcReg[0].File == PROGRAM_INPUT &&
inst[0].SrcReg[0].Index == FRAG_ATTRIB_COL0 && inst[0].SrcReg[0].Index == FRAG_ATTRIB_COL0 &&
@@ -158,7 +158,7 @@ combined_drawpix_fragment_program(GLcontext *ctx)
/** /**
* Create fragment shader that does a TEX() instruction to get a Z * Create fragment shader that does a TEX() instruction to get a Z
* value, then writes to FRAG_RESULT_DEPR. * value, then writes to FRAG_RESULT_DEPTH.
* Pass fragment color through as-is. * Pass fragment color through as-is.
*/ */
static struct st_fragment_program * static struct st_fragment_program *
@@ -191,7 +191,7 @@ make_fragment_shader_z(struct st_context *st)
/* TEX result.depth, fragment.texcoord[0], texture[0], 2D; */ /* TEX result.depth, fragment.texcoord[0], texture[0], 2D; */
p->Instructions[ic].Opcode = OPCODE_TEX; p->Instructions[ic].Opcode = OPCODE_TEX;
p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPR; p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH;
p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z; p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z;
p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
@@ -202,7 +202,7 @@ make_fragment_shader_z(struct st_context *st)
/* MOV result.color, fragment.color */ /* MOV result.color, fragment.color */
p->Instructions[ic].Opcode = OPCODE_MOV; p->Instructions[ic].Opcode = OPCODE_MOV;
p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLR; p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR;
p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0; p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0;
ic++; ic++;
@@ -213,7 +213,7 @@ make_fragment_shader_z(struct st_context *st)
assert(ic == p->NumInstructions); assert(ic == p->NumInstructions);
p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0; p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0;
p->OutputsWritten = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_DEPR); p->OutputsWritten = (1 << FRAG_RESULT_COLOR) | (1 << FRAG_RESULT_DEPTH);
p->SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */ p->SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */
st->drawpix.z_shader = (struct st_fragment_program *) p; st->drawpix.z_shader = (struct st_fragment_program *) p;

View File

@@ -466,23 +466,23 @@ st_translate_fragment_program(struct st_context *st,
GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten; GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten;
/* if z is written, emit that first */ /* if z is written, emit that first */
if (outputsWritten & (1 << FRAG_RESULT_DEPR)) { if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) {
fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION; fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION;
fs_output_semantic_index[fs_num_outputs] = 0; fs_output_semantic_index[fs_num_outputs] = 0;
outputMapping[FRAG_RESULT_DEPR] = fs_num_outputs; outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs;
fs_num_outputs++; fs_num_outputs++;
outputsWritten &= ~(1 << FRAG_RESULT_DEPR); outputsWritten &= ~(1 << FRAG_RESULT_DEPTH);
} }
/* handle remaning outputs (color) */ /* handle remaning outputs (color) */
for (attr = 0; attr < FRAG_RESULT_MAX; attr++) { for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
if (outputsWritten & (1 << attr)) { if (outputsWritten & (1 << attr)) {
switch (attr) { switch (attr) {
case FRAG_RESULT_DEPR: case FRAG_RESULT_DEPTH:
/* handled above */ /* handled above */
assert(0); assert(0);
break; break;
case FRAG_RESULT_COLR: case FRAG_RESULT_COLOR:
fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR; fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR;
fs_output_semantic_index[fs_num_outputs] = numColors; fs_output_semantic_index[fs_num_outputs] = numColors;
outputMapping[attr] = fs_num_outputs; outputMapping[attr] = fs_num_outputs;

View File

@@ -206,7 +206,7 @@ _swrast_update_deferred_texture(GLcontext *ctx)
else { else {
const struct gl_fragment_program *fprog const struct gl_fragment_program *fprog
= ctx->FragmentProgram._Current; = ctx->FragmentProgram._Current;
if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR))) { if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH))) {
/* Z comes from fragment program/shader */ /* Z comes from fragment program/shader */
swrast->_DeferredTexture = GL_FALSE; swrast->_DeferredTexture = GL_FALSE;
} }

View File

@@ -202,9 +202,9 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
if (_mesa_execute_program(ctx, &program->Base, machine)) { if (_mesa_execute_program(ctx, &program->Base, machine)) {
/* Store result color */ /* Store result color */
if (outputsWritten & (1 << FRAG_RESULT_COLR)) { if (outputsWritten & (1 << FRAG_RESULT_COLOR)) {
COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i],
machine->Outputs[FRAG_RESULT_COLR]); machine->Outputs[FRAG_RESULT_COLOR]);
} }
else { else {
/* Multiple drawbuffers / render targets /* Multiple drawbuffers / render targets
@@ -221,8 +221,8 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
} }
/* Store result depth/z */ /* Store result depth/z */
if (outputsWritten & (1 << FRAG_RESULT_DEPR)) { if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) {
const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPR][2]; const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPTH][2];
if (depth <= 0.0) if (depth <= 0.0)
span->array->z[i] = 0; span->array->z[i] = 0;
else if (depth >= 1.0) else if (depth >= 1.0)
@@ -259,12 +259,12 @@ _swrast_exec_fragment_program( GLcontext *ctx, SWspan *span )
run_program(ctx, span, 0, span->end); run_program(ctx, span, 0, span->end);
if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR)) { if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
span->interpMask &= ~SPAN_RGBA; span->interpMask &= ~SPAN_RGBA;
span->arrayMask |= SPAN_RGBA; span->arrayMask |= SPAN_RGBA;
} }
if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) { if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) {
span->interpMask &= ~SPAN_Z; span->interpMask &= ~SPAN_Z;
span->arrayMask |= SPAN_Z; span->arrayMask |= SPAN_Z;
} }