summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAapo Tahkola <[email protected]>2005-05-28 01:02:00 +0000
committerAapo Tahkola <[email protected]>2005-05-28 01:02:00 +0000
commit74e412c6956676d69adcd5210ca7046061629eec (patch)
tree204d1b0b07a5e2d07d6bf2c3a2cb9ce9bb4bdfdd /src
parent0080faf83ed9bd7a0516b92249b8c585526ac956 (diff)
Programmable per-vertex point sizes and proper result reg assigns.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h4
-rw-r--r--src/mesa/drivers/dri/r300/r300_maos.c9
-rw-r--r--src/mesa/drivers/dri/r300/r300_shader.c11
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertexprog.c83
5 files changed, 53 insertions, 55 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index befb19ec9f9..723bee7548a 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -573,7 +573,7 @@ extern int hw_tcl_on;
#define CURRENT_VERTEX_SHADER(ctx) (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : ctx->_TnlProgram)
-//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && (OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit)))) : \
+//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && (OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit)))) :
// (r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit))))
#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit))) : \
ctx->Texture.Unit[unit]._ReallyEnabled && r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit)))
@@ -591,7 +591,7 @@ struct r300_vertex_program {
int pos_end;
unsigned long num_temporaries; /* Number of temp vars used by program */
int inputs[VERT_ATTRIB_MAX];
- int tex_regs[8];
+ int outputs[VERT_RESULT_MAX];
};
#if USE_ARB_F_P == 1
diff --git a/src/mesa/drivers/dri/r300/r300_maos.c b/src/mesa/drivers/dri/r300/r300_maos.c
index 301b4b7575e..d9a10b0a068 100644
--- a/src/mesa/drivers/dri/r300/r300_maos.c
+++ b/src/mesa/drivers/dri/r300/r300_maos.c
@@ -396,11 +396,6 @@ void r300EmitArrays(GLcontext * ctx, GLboolean immd)
}
}
-
-int cmd_reserved=0;
-int cmd_written=0;
-drm_radeon_cmd_header_t *cmd = NULL;
-
#define SHOW_INFO(n) do { \
if (RADEON_DEBUG & DEBUG_ALL) { \
fprintf(stderr, "RR[%d] - sz=%d, reg=%d, fmt=%d -- st=%d, of=0x%08x\n", \
@@ -529,7 +524,9 @@ drm_radeon_cmd_header_t *cmd = NULL;
if(OutputsWritten & (1<<VERT_RESULT_BFC1))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT;*/
//if(OutputsWritten & (1<<VERT_RESULT_FOGC))
- //if(OutputsWritten & (1<<VERT_RESULT_PSIZ))
+
+ if(OutputsWritten & (1<<VERT_RESULT_PSIZ))
+ r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
if(OutputsWritten & (1<<(VERT_RESULT_TEX0+i)))
diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c
index c3e4a041d54..0613dd887fb 100644
--- a/src/mesa/drivers/dri/r300/r300_shader.c
+++ b/src/mesa/drivers/dri/r300/r300_shader.c
@@ -66,11 +66,8 @@ static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
static void r300DeleteProgram(GLcontext *ctx, struct program *prog)
{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- struct r300_vertex_program *vp=(void *)prog;
-
- /*if(rmesa->current_vp == vp)
- rmesa->current_vp = NULL;*/
+ //r300ContextPtr rmesa = R300_CONTEXT(ctx);
+ //struct r300_vertex_program *vp=(void *)prog;
_mesa_delete_program(ctx, prog);
}
@@ -99,8 +96,8 @@ void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
static GLboolean r300IsProgramNative(GLcontext *ctx, GLenum target, struct program *prog)
{
- struct r300_vertex_program *vp=(void *)prog;
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
+ //struct r300_vertex_program *vp=(void *)prog;
+ //r300ContextPtr rmesa = R300_CONTEXT(ctx);
return 1;
}
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 6a142318699..4cadfd3f02f 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -1178,6 +1178,7 @@ void r300_setup_rs_unit(GLcontext *ctx)
| (in_texcoords << R300_RS_CNTL_TC_CNT_SHIFT)
| R300_RS_CNTL_0_UNKNOWN_7
| R300_RS_CNTL_0_UNKNOWN_18;
+
if (r300->state.texture.tc_count > 0) {
r300->hw.rr.cmd[R300_RR_CMD_0] = cmducs(R300_RS_ROUTE_0, fp_reg);
diff --git a/src/mesa/drivers/dri/r300/r300_vertexprog.c b/src/mesa/drivers/dri/r300/r300_vertexprog.c
index d5a46641445..8a10931538c 100644
--- a/src/mesa/drivers/dri/r300/r300_vertexprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertexprog.c
@@ -313,42 +313,14 @@ static unsigned long t_dst_class(enum register_file file)
static unsigned long t_dst_index(struct r300_vertex_program *vp, struct vp_dst_register *dst)
{
- int i, high=0;
- if(dst->File == PROGRAM_OUTPUT)
- switch(dst->Index){
- case VERT_RESULT_HPOS:
- return 0;
- case VERT_RESULT_COL0:
- return 1;
- case VERT_RESULT_TEX0:
- case VERT_RESULT_TEX1:
- case VERT_RESULT_TEX2:
- case VERT_RESULT_TEX3:
- case VERT_RESULT_TEX4:
- case VERT_RESULT_TEX5:
- case VERT_RESULT_TEX6:
- case VERT_RESULT_TEX7:
- /* Awful hack to get tex coord results regs correctly packed.
- Wount work if tex coords arent written in logical order! */
- if(vp->tex_regs[dst->Index - VERT_RESULT_TEX0] != 1){
- return vp->tex_regs[dst->Index - VERT_RESULT_TEX0];
- }
-
- for(i=0; i < 8; i++)
- if(vp->tex_regs[i] > high)
- high = vp->tex_regs[i];
-
- high++;
- vp->tex_regs[dst->Index - VERT_RESULT_TEX0] = high;
-
- return high;
- case VERT_RESULT_COL1:
- case VERT_RESULT_BFC0:
- case VERT_RESULT_BFC1:
- case VERT_RESULT_FOGC:
- case VERT_RESULT_PSIZ:
- default: WARN_ONCE("Unknown output\n"); return 10;
+ if(dst->File == PROGRAM_OUTPUT) {
+ if (vp->outputs[dst->Index] != -1)
+ return vp->outputs[dst->Index];
+ else {
+ WARN_ONCE("Unknown output %d\n", dst->Index);
+ return 10;
}
+ }
return dst->Index;
}
@@ -509,8 +481,7 @@ void translate_vertex_shader(struct r300_vertex_program *vp)
{
struct vertex_program *mesa_vp=(void *)vp;
struct vp_instruction *vpi;
- int operand_index, i;
- VERTEX_SHADER_INSTRUCTION t2rs[1024];
+ int i, cur_reg=0;
VERTEX_SHADER_INSTRUCTION *o_inst;
unsigned long operands;
int are_srcs_scalar;
@@ -527,11 +498,43 @@ void translate_vertex_shader(struct r300_vertex_program *vp)
vp->pos_end=0; /* Not supported yet */
vp->program.length=0;
vp->num_temporaries=mesa_vp->Base.NumTemporaries;
- for(i=0; i < 8; i++)
- vp->tex_regs[i]=1;
for(i=0; i < VERT_ATTRIB_MAX; i++)
- vp->inputs[i]=-1;
+ vp->inputs[i] = -1;
+
+ for(i=0; i < VERT_RESULT_MAX; i++)
+ vp->outputs[i] = -1;
+
+ assert(mesa_vp->OutputsWritten & (1 << VERT_RESULT_HPOS));
+ assert(mesa_vp->OutputsWritten & (1 << VERT_RESULT_COL0));
+
+ /* Assign outputs */
+ if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_HPOS))
+ vp->outputs[VERT_RESULT_HPOS] = cur_reg++;
+
+ if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_PSIZ))
+ vp->outputs[VERT_RESULT_PSIZ] = cur_reg++;
+
+ if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_COL0))
+ vp->outputs[VERT_RESULT_COL0] = cur_reg++;
+
+#if 0 /* Not supported yet */
+ if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_BFC0))
+ vp->outputs[VERT_RESULT_BFC0] = cur_reg++;
+
+ if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_COL1))
+ vp->outputs[VERT_RESULT_COL1] = cur_reg++;
+
+ if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_BFC1))
+ vp->outputs[VERT_RESULT_BFC1] = cur_reg++;
+
+ if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_FOGC))
+ vp->outputs[VERT_RESULT_FOGC] = cur_reg++;
+#endif
+
+ for(i=VERT_RESULT_TEX0; i <= VERT_RESULT_TEX7; i++)
+ if(mesa_vp->OutputsWritten & (1 << i))
+ vp->outputs[i] = cur_reg++;
o_inst=vp->program.body.i;
for(vpi=mesa_vp->Instructions; vpi->Opcode != VP_OPCODE_END; vpi++, o_inst++){