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:
@@ -180,9 +180,9 @@ get_result_vector(struct i915_fragment_program *p,
|
||||
switch (inst->DstReg.File) {
|
||||
case PROGRAM_OUTPUT:
|
||||
switch (inst->DstReg.Index) {
|
||||
case FRAG_RESULT_COLR:
|
||||
case FRAG_RESULT_COLOR:
|
||||
return UREG(REG_TYPE_OC, 0);
|
||||
case FRAG_RESULT_DEPR:
|
||||
case FRAG_RESULT_DEPTH:
|
||||
p->depth_written = 1;
|
||||
return UREG(REG_TYPE_OD, 0);
|
||||
default:
|
||||
|
@@ -198,7 +198,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
|
||||
ctx->Color.AlphaEnabled)
|
||||
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;
|
||||
|
||||
/* _NEW_DEPTH */
|
||||
|
@@ -862,7 +862,7 @@ static void precalc_txp( 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 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;
|
||||
GLuint i;
|
||||
|
||||
@@ -879,7 +879,7 @@ static void emit_fb_write( struct brw_wm_compile *c )
|
||||
outcolor, payload_r0_depth, outdepth);
|
||||
inst->Aux = (i<<1);
|
||||
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),
|
||||
0, outcolor, payload_r0_depth, outdepth);
|
||||
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))
|
||||
outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0);
|
||||
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),
|
||||
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) {
|
||||
GLuint idx = inst->DstReg.Index;
|
||||
if (idx == FRAG_RESULT_COLR)
|
||||
if (idx == FRAG_RESULT_COLOR)
|
||||
c->fp_fragcolor_emitted = 1;
|
||||
}
|
||||
}
|
||||
|
@@ -103,7 +103,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
|
||||
|
||||
/* as far as we can tell */
|
||||
key->computes_depth =
|
||||
(fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) != 0;
|
||||
(fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) != 0;
|
||||
|
||||
/* _NEW_COLOR */
|
||||
key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled;
|
||||
|
@@ -356,8 +356,8 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler)
|
||||
|
||||
static void nqssadce_init(struct nqssadce_state* s)
|
||||
{
|
||||
s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW;
|
||||
s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W;
|
||||
s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW;
|
||||
s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -298,8 +298,8 @@ static void insert_WPOS_trailer(struct r500_fragment_program_compiler *compiler)
|
||||
|
||||
static void nqssadce_init(struct nqssadce_state* s)
|
||||
{
|
||||
s->Outputs[FRAG_RESULT_COLR].Sourced = WRITEMASK_XYZW;
|
||||
s->Outputs[FRAG_RESULT_DEPR].Sourced = WRITEMASK_W;
|
||||
s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW;
|
||||
s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W;
|
||||
}
|
||||
|
||||
static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg)
|
||||
|
@@ -191,7 +191,7 @@ static void process_instruction(struct nqssadce_state* s)
|
||||
|
||||
if (inst->Opcode != OPCODE_KIL) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
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->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);
|
||||
}
|
||||
} else {
|
||||
|
@@ -268,10 +268,9 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
FRAG_RESULT_COLR = 0,
|
||||
FRAG_RESULT_COLH = 1,
|
||||
FRAG_RESULT_DEPR = 2,
|
||||
FRAG_RESULT_DATA0 = 3,
|
||||
FRAG_RESULT_DEPTH = 0,
|
||||
FRAG_RESULT_COLOR = 1,
|
||||
FRAG_RESULT_DATA0 = 2,
|
||||
FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
|
||||
} gl_frag_result;
|
||||
|
||||
|
@@ -1098,7 +1098,7 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
|
||||
rgb_shift)
|
||||
dest = get_temp( p );
|
||||
else
|
||||
dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
|
||||
dest = make_ureg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
|
||||
|
||||
/* 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.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++)
|
||||
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 );
|
||||
out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLR );
|
||||
out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
|
||||
|
||||
if (key->separate_specular) {
|
||||
/* Emit specular add.
|
||||
|
@@ -1688,7 +1688,7 @@ parse_result_binding(GLcontext *ctx, const GLubyte **inst,
|
||||
*/
|
||||
parse_output_color_num(ctx, inst, Program, &out_color);
|
||||
ASSERT(out_color < MAX_DRAW_BUFFERS);
|
||||
*outputReg = FRAG_RESULT_COLR;
|
||||
*outputReg = FRAG_RESULT_COLOR;
|
||||
}
|
||||
else {
|
||||
/* for vtx programs, this is VERTEX_RESULT_POSITION */
|
||||
@@ -1699,7 +1699,7 @@ parse_result_binding(GLcontext *ctx, const GLubyte **inst,
|
||||
case FRAGMENT_RESULT_DEPTH:
|
||||
if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
|
||||
/* for frag programs, this is FRAGMENT_RESULT_DEPTH */
|
||||
*outputReg = FRAG_RESULT_DEPR;
|
||||
*outputReg = FRAG_RESULT_DEPTH;
|
||||
}
|
||||
else {
|
||||
/* for vtx programs, this is VERTEX_RESULT_COLOR */
|
||||
|
@@ -384,18 +384,12 @@ static const char *InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS + 1] = {
|
||||
"TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL
|
||||
};
|
||||
|
||||
|
||||
static const char *OutputRegisters[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS + 1] = {
|
||||
"COLR", "COLH",
|
||||
/* These are only allows for register combiners */
|
||||
/*
|
||||
"TEX0", "TEX1", "TEX2", "TEX3",
|
||||
*/
|
||||
"DEPR", NULL
|
||||
"DEPR", "COLR", "DATA0", NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
/**
|
||||
@@ -828,7 +822,6 @@ static GLboolean
|
||||
Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
|
||||
{
|
||||
GLubyte token[100];
|
||||
GLint j;
|
||||
|
||||
/* Match "o[" */
|
||||
if (!Parse_String(parseState, "o["))
|
||||
@@ -839,19 +832,19 @@ Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum)
|
||||
RETURN_ERROR;
|
||||
|
||||
/* try to match an output register name */
|
||||
for (j = 0; OutputRegisters[j]; j++) {
|
||||
if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) {
|
||||
static GLuint bothColors = (1 << FRAG_RESULT_COLR) | (1 << FRAG_RESULT_COLH);
|
||||
*outputRegNum = j;
|
||||
parseState->outputsWritten |= (1 << j);
|
||||
if ((parseState->outputsWritten & bothColors) == bothColors) {
|
||||
RETURN_ERROR1("Illegal to write to both o[COLR] and o[COLH]");
|
||||
if (_mesa_strcmp((char *) token, "COLR") == 0 ||
|
||||
_mesa_strcmp((char *) token, "COLH") == 0) {
|
||||
/* note that we don't distinguish between COLR and COLH */
|
||||
*outputRegNum = FRAG_RESULT_COLOR;
|
||||
parseState->outputsWritten |= (1 << FRAG_RESULT_COLOR);
|
||||
}
|
||||
break;
|
||||
else if (_mesa_strcmp((char *) token, "DEPR") == 0) {
|
||||
*outputRegNum = FRAG_RESULT_DEPTH;
|
||||
parseState->outputsWritten |= (1 << FRAG_RESULT_DEPTH);
|
||||
}
|
||||
}
|
||||
if (!OutputRegisters[j])
|
||||
else {
|
||||
RETURN_ERROR1("Invalid output register name");
|
||||
}
|
||||
|
||||
/* Match ']' */
|
||||
if (!Parse_String(parseState, "]"))
|
||||
@@ -1826,10 +1819,3 @@ _mesa_nv_fragment_input_register_name(GLuint i)
|
||||
return InputRegisters[i];
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
_mesa_nv_fragment_output_register_name(GLuint i)
|
||||
{
|
||||
ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS);
|
||||
return OutputRegisters[i];
|
||||
}
|
||||
|
@@ -44,9 +44,4 @@ _mesa_print_nv_fragment_program(const struct gl_fragment_program *program);
|
||||
extern const char *
|
||||
_mesa_nv_fragment_input_register_name(GLuint i);
|
||||
|
||||
|
||||
extern const char *
|
||||
_mesa_nv_fragment_output_register_name(GLuint i);
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -222,20 +222,16 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
|
||||
"glGetProgramRegisterfvMESA(registerName)");
|
||||
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 */
|
||||
ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
|
||||
FRAG_RESULT_COLR, v);
|
||||
}
|
||||
else if (_mesa_strcmp(reg, "o[COLH]") == 0) {
|
||||
/* Fragment output color */
|
||||
ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
|
||||
FRAG_RESULT_COLH, v);
|
||||
FRAG_RESULT_COLOR, v);
|
||||
}
|
||||
else if (_mesa_strcmp(reg, "o[DEPR]") == 0) {
|
||||
/* Fragment output depth */
|
||||
ctx->Driver.GetProgramRegister(ctx, PROGRAM_OUTPUT,
|
||||
FRAG_RESULT_DEPR, v);
|
||||
FRAG_RESULT_DEPTH, v);
|
||||
}
|
||||
else {
|
||||
/* try user-defined identifiers */
|
||||
|
@@ -738,7 +738,7 @@ _mesa_combine_programs(GLcontext *ctx,
|
||||
/* Connect color outputs of fprogA to color inputs of fprogB, via a
|
||||
* new temporary register.
|
||||
*/
|
||||
if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) &&
|
||||
if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) &&
|
||||
(progB_inputsRead & FRAG_BIT_COL0)) {
|
||||
GLint tempReg = _mesa_find_free_register(newProg, PROGRAM_TEMPORARY);
|
||||
if (tempReg < 0) {
|
||||
@@ -748,7 +748,7 @@ _mesa_combine_programs(GLcontext *ctx,
|
||||
}
|
||||
/* replace writes to result.color[0] with tempReg */
|
||||
replace_registers(newInst, lenA,
|
||||
PROGRAM_OUTPUT, FRAG_RESULT_COLR,
|
||||
PROGRAM_OUTPUT, FRAG_RESULT_COLOR,
|
||||
PROGRAM_TEMPORARY, tempReg);
|
||||
/* replace reads from the input color with tempReg */
|
||||
replace_registers(newInst + lenA, lenB,
|
||||
@@ -758,7 +758,7 @@ _mesa_combine_programs(GLcontext *ctx,
|
||||
|
||||
/* compute combined program's InputsRead */
|
||||
inputsB = progB_inputsRead;
|
||||
if (progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) {
|
||||
if (progA->OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
|
||||
inputsB &= ~(1 << FRAG_ATTRIB_COL0);
|
||||
}
|
||||
newProg->InputsRead = progA->InputsRead | inputsB;
|
||||
|
@@ -171,7 +171,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
|
||||
if (inst->Opcode == OPCODE_END)
|
||||
break;
|
||||
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 */
|
||||
inst->DstReg.File = PROGRAM_TEMPORARY;
|
||||
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; */
|
||||
inst->Opcode = OPCODE_LRP;
|
||||
inst->DstReg.File = PROGRAM_OUTPUT;
|
||||
inst->DstReg.Index = FRAG_RESULT_COLR;
|
||||
inst->DstReg.Index = FRAG_RESULT_COLOR;
|
||||
inst->DstReg.WriteMask = WRITEMASK_XYZ;
|
||||
inst->SrcReg[0].File = PROGRAM_TEMPORARY;
|
||||
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 */
|
||||
inst->Opcode = OPCODE_MOV;
|
||||
inst->DstReg.File = PROGRAM_OUTPUT;
|
||||
inst->DstReg.Index = FRAG_RESULT_COLR;
|
||||
inst->DstReg.Index = FRAG_RESULT_COLOR;
|
||||
inst->DstReg.WriteMask = WRITEMASK_W;
|
||||
inst->SrcReg[0].File = PROGRAM_TEMPORARY;
|
||||
inst->SrcReg[0].Index = colorTemp;
|
||||
|
@@ -450,8 +450,8 @@ _slang_output_index(const char *name, GLenum target)
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static const struct output_info fragOutputs[] = {
|
||||
{ "gl_FragColor", FRAG_RESULT_COLR },
|
||||
{ "gl_FragDepth", FRAG_RESULT_DEPR },
|
||||
{ "gl_FragColor", FRAG_RESULT_COLOR },
|
||||
{ "gl_FragDepth", FRAG_RESULT_DEPTH },
|
||||
{ "gl_FragData", FRAG_RESULT_DATA0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
@@ -686,7 +686,7 @@ _slang_link(GLcontext *ctx,
|
||||
/* check that gl_FragColor and gl_FragData are not both written to */
|
||||
if (shProg->FragmentProgram) {
|
||||
GLbitfield outputsWritten = shProg->FragmentProgram->Base.OutputsWritten;
|
||||
if ((outputsWritten & ((1 << FRAG_RESULT_COLR))) &&
|
||||
if ((outputsWritten & ((1 << FRAG_RESULT_COLOR))) &&
|
||||
(outputsWritten >= (1 << FRAG_RESULT_DATA0))) {
|
||||
link_error(shProg, "Fragment program cannot write both gl_FragColor"
|
||||
" and gl_FragData[].\n");
|
||||
|
@@ -212,7 +212,7 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
|
||||
inst[ic].TexSrcTarget = TEXTURE_2D_INDEX;
|
||||
ic++;
|
||||
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 */
|
||||
|
||||
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];
|
||||
last->DstReg.File = PROGRAM_OUTPUT;
|
||||
last->DstReg.Index = FRAG_RESULT_COLR;
|
||||
last->DstReg.Index = FRAG_RESULT_COLOR;
|
||||
}
|
||||
|
||||
/* END; */
|
||||
|
@@ -75,7 +75,7 @@ is_passthrough_program(const struct gl_fragment_program *prog)
|
||||
if (inst[0].Opcode == OPCODE_MOV &&
|
||||
inst[1].Opcode == OPCODE_END &&
|
||||
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].SrcReg[0].File == PROGRAM_INPUT &&
|
||||
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
|
||||
* value, then writes to FRAG_RESULT_DEPR.
|
||||
* value, then writes to FRAG_RESULT_DEPTH.
|
||||
* Pass fragment color through as-is.
|
||||
*/
|
||||
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; */
|
||||
p->Instructions[ic].Opcode = OPCODE_TEX;
|
||||
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].SrcReg[0].File = PROGRAM_INPUT;
|
||||
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 */
|
||||
p->Instructions[ic].Opcode = OPCODE_MOV;
|
||||
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].Index = FRAG_ATTRIB_COL0;
|
||||
ic++;
|
||||
@@ -213,7 +213,7 @@ make_fragment_shader_z(struct st_context *st)
|
||||
assert(ic == p->NumInstructions);
|
||||
|
||||
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 */
|
||||
|
||||
st->drawpix.z_shader = (struct st_fragment_program *) p;
|
||||
|
@@ -466,23 +466,23 @@ st_translate_fragment_program(struct st_context *st,
|
||||
GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten;
|
||||
|
||||
/* 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_index[fs_num_outputs] = 0;
|
||||
outputMapping[FRAG_RESULT_DEPR] = fs_num_outputs;
|
||||
outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs;
|
||||
fs_num_outputs++;
|
||||
outputsWritten &= ~(1 << FRAG_RESULT_DEPR);
|
||||
outputsWritten &= ~(1 << FRAG_RESULT_DEPTH);
|
||||
}
|
||||
|
||||
/* handle remaning outputs (color) */
|
||||
for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
|
||||
if (outputsWritten & (1 << attr)) {
|
||||
switch (attr) {
|
||||
case FRAG_RESULT_DEPR:
|
||||
case FRAG_RESULT_DEPTH:
|
||||
/* handled above */
|
||||
assert(0);
|
||||
break;
|
||||
case FRAG_RESULT_COLR:
|
||||
case FRAG_RESULT_COLOR:
|
||||
fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR;
|
||||
fs_output_semantic_index[fs_num_outputs] = numColors;
|
||||
outputMapping[attr] = fs_num_outputs;
|
||||
|
@@ -206,7 +206,7 @@ _swrast_update_deferred_texture(GLcontext *ctx)
|
||||
else {
|
||||
const struct gl_fragment_program *fprog
|
||||
= 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 */
|
||||
swrast->_DeferredTexture = GL_FALSE;
|
||||
}
|
||||
|
@@ -202,9 +202,9 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
|
||||
if (_mesa_execute_program(ctx, &program->Base, machine)) {
|
||||
|
||||
/* Store result color */
|
||||
if (outputsWritten & (1 << FRAG_RESULT_COLR)) {
|
||||
if (outputsWritten & (1 << FRAG_RESULT_COLOR)) {
|
||||
COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i],
|
||||
machine->Outputs[FRAG_RESULT_COLR]);
|
||||
machine->Outputs[FRAG_RESULT_COLOR]);
|
||||
}
|
||||
else {
|
||||
/* Multiple drawbuffers / render targets
|
||||
@@ -221,8 +221,8 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
|
||||
}
|
||||
|
||||
/* Store result depth/z */
|
||||
if (outputsWritten & (1 << FRAG_RESULT_DEPR)) {
|
||||
const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPR][2];
|
||||
if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) {
|
||||
const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPTH][2];
|
||||
if (depth <= 0.0)
|
||||
span->array->z[i] = 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);
|
||||
|
||||
if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR)) {
|
||||
if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)) {
|
||||
span->interpMask &= ~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->arrayMask |= SPAN_Z;
|
||||
}
|
||||
|
Reference in New Issue
Block a user