summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.h12
-rw-r--r--src/mesa/drivers/dri/r200/r200_maos.h2
-rw-r--r--src/mesa/drivers/dri/r200/r200_maos_arrays.c402
-rw-r--r--src/mesa/drivers/dri/r200/r200_tcl.c42
-rw-r--r--src/mesa/drivers/dri/r200/r200_vertprog.c17
5 files changed, 141 insertions, 334 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h
index 26a43d20dda..e840a502c0b 100644
--- a/src/mesa/drivers/dri/r200/r200_context.h
+++ b/src/mesa/drivers/dri/r200/r200_context.h
@@ -107,8 +107,7 @@ struct r200_vertex_program {
VERTEX_SHADER_INSTRUCTION instr[R200_VSF_MAX_INST + 6];
int pos_end;
int inputs[VERT_ATTRIB_MAX];
- int rev_inputs[16];
- int gen_inputs_mapped;
+ GLubyte inputmap_rev[16];
int native;
int fogpidx;
int fogmode;
@@ -733,14 +732,7 @@ struct r200_tcl_info {
GLuint *Elts;
struct r200_dma_region indexed_verts;
- struct r200_dma_region weight;
- struct r200_dma_region obj;
- struct r200_dma_region rgba;
- struct r200_dma_region spec;
- struct r200_dma_region fog;
- struct r200_dma_region tex[R200_MAX_TEXTURE_UNITS];
- struct r200_dma_region norm;
- struct r200_dma_region generic[16];
+ struct r200_dma_region vertex_data[15];
};
diff --git a/src/mesa/drivers/dri/r200/r200_maos.h b/src/mesa/drivers/dri/r200/r200_maos.h
index b9e4d3c2392..4998f67445c 100644
--- a/src/mesa/drivers/dri/r200/r200_maos.h
+++ b/src/mesa/drivers/dri/r200/r200_maos.h
@@ -38,7 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_context.h"
-extern void r200EmitArrays( GLcontext *ctx, GLuint inputs );
+extern void r200EmitArrays( GLcontext *ctx, GLubyte *vimap_rev );
extern void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs );
#endif
diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
index db5ac6fc8a5..6a6c30a2b0d 100644
--- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c
+++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
@@ -376,7 +376,7 @@ static void emit_vector( GLcontext *ctx,
/* Emit any changed arrays to new GART memory, re-emit a packet to
* update the arrays.
*/
-void r200EmitArrays( GLcontext *ctx, GLuint inputs )
+void r200EmitArrays( GLcontext *ctx, GLubyte *vimap_rev )
{
r200ContextPtr rmesa = R200_CONTEXT( ctx );
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
@@ -384,284 +384,109 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
GLuint nr = 0;
GLuint vfmt0 = 0, vfmt1 = 0;
GLuint count = VB->Count;
- GLuint i;
- GLuint generic_in_mapped = 0;
- struct r200_vertex_program *vp = NULL;
-
- /* this looks way more complicated than necessary... */
- if (ctx->VertexProgram._Enabled) {
- vp = rmesa->curr_vp_hw;
- generic_in_mapped = vp->gen_inputs_mapped;
- }
-
- if (inputs & VERT_BIT_POS) {
- if (!rmesa->tcl.obj.buf)
- emit_vector( ctx,
- &rmesa->tcl.obj,
- (char *)VB->ObjPtr->data,
- VB->ObjPtr->size,
- VB->ObjPtr->stride,
- count);
-
- switch( VB->ObjPtr->size ) {
- case 4: vfmt0 |= R200_VTX_W0;
- case 3: vfmt0 |= R200_VTX_Z0;
- case 2:
- default:
- break;
- }
- component[nr++] = &rmesa->tcl.obj;
- }
- else if (generic_in_mapped & (1 << 0)) {
- int geninput = vp->rev_inputs[0] - VERT_ATTRIB_GENERIC0;
- if (!rmesa->tcl.generic[geninput].buf) {
- emit_vector( ctx,
- &(rmesa->tcl.generic[geninput]),
- (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
- 4,
- VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
- count );
- }
- component[nr++] = &rmesa->tcl.generic[geninput];
- vfmt0 |= R200_VTX_W0 | R200_VTX_Z0;
- }
-
- if (inputs & VERT_BIT_WEIGHT) {
- if (!rmesa->tcl.weight.buf)
- emit_vector( ctx,
- &rmesa->tcl.weight,
- (char *)VB->AttribPtr[VERT_ATTRIB_WEIGHT]->data,
- VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size,
- VB->AttribPtr[VERT_ATTRIB_WEIGHT]->stride,
- count);
-
- assert(VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size <= 4);
- vfmt0 |= VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size << R200_VTX_WEIGHT_COUNT_SHIFT;
- component[nr++] = &rmesa->tcl.weight;
- }
-
- if (inputs & VERT_BIT_NORMAL) {
- if (!rmesa->tcl.norm.buf)
- emit_vector( ctx,
- &(rmesa->tcl.norm),
- (char *)VB->NormalPtr->data,
- 3,
- VB->NormalPtr->stride,
- count);
-
- vfmt0 |= R200_VTX_N0;
- component[nr++] = &rmesa->tcl.norm;
- }
-
- if (inputs & VERT_BIT_FOG) {
- if (!rmesa->tcl.fog.buf) {
- if (ctx->VertexProgram._Enabled)
- emit_vector( ctx,
- &(rmesa->tcl.fog),
- (char *)VB->FogCoordPtr->data,
+ GLuint i, emitsize;
+
+ for ( i = 0; i < 15; i++ ) {
+ GLubyte attrib = vimap_rev[i];
+ if (attrib != 255) {
+ switch (i) {
+ case 0:
+ emitsize = (VB->AttribPtr[attrib]->size);
+ switch (emitsize) {
+ case 4:
+ vfmt0 |= R200_VTX_W0;
+ /* fallthrough */
+ case 3:
+ vfmt0 |= R200_VTX_Z0;
+ break;
+ case 2:
+ break;
+ default: assert(0);
+ }
+ break;
+ case 1:
+ assert(attrib == VERT_ATTRIB_WEIGHT);
+ emitsize = (VB->AttribPtr[attrib]->size);
+ vfmt0 |= emitsize << R200_VTX_WEIGHT_COUNT_SHIFT;
+ break;
+ case 2:
+ assert(attrib == VERT_ATTRIB_NORMAL);
+ emitsize = 3;
+ vfmt0 |= R200_VTX_N0;
+ break;
+ case 3:
+ /* special handling to fix up fog. Will get us into trouble with vbos...*/
+ assert(attrib == VERT_ATTRIB_FOG);
+ if (!rmesa->tcl.vertex_data[i].buf) {
+ if (ctx->VertexProgram._Enabled)
+ emit_vector( ctx,
+ &(rmesa->tcl.vertex_data[attrib]),
+ (char *)VB->AttribPtr[attrib]->data,
1,
- VB->FogCoordPtr->stride,
+ VB->AttribPtr[attrib]->stride,
count);
- else
- emit_vecfog( ctx,
- &(rmesa->tcl.fog),
- (char *)VB->FogCoordPtr->data,
- VB->FogCoordPtr->stride,
+ else
+ emit_vecfog( ctx,
+ &(rmesa->tcl.vertex_data[attrib]),
+ (char *)VB->AttribPtr[attrib]->data,
+ VB->AttribPtr[attrib]->stride,
count);
- }
-
- vfmt0 |= R200_VTX_DISCRETE_FOG;
- component[nr++] = &rmesa->tcl.fog;
- }
-
- if (inputs & VERT_BIT_COLOR0) {
- int emitsize;
-
- if (VB->ColorPtr[0]->size == 4 &&
- (VB->ColorPtr[0]->stride != 0 ||
- VB->ColorPtr[0]->data[0][3] != 1.0)) {
- vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
- emitsize = 4;
- }
- else {
- vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_0_SHIFT;
- emitsize = 3;
- }
-
- if (!rmesa->tcl.rgba.buf)
- emit_vector( ctx,
- &(rmesa->tcl.rgba),
- (char *)VB->ColorPtr[0]->data,
- emitsize,
- VB->ColorPtr[0]->stride,
- count);
-
- component[nr++] = &rmesa->tcl.rgba;
- }
-/* vfmt0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT;
- emit_ubyte_rgba( ctx, &rmesa->tcl.rgba,
- (char *)VB->ColorPtr[0]->data, 4,
- VB->ColorPtr[0]->stride, count);*/
- else if (generic_in_mapped & (1 << 2)) {
- int geninput = vp->rev_inputs[2] - VERT_ATTRIB_GENERIC0;
- if (!rmesa->tcl.generic[geninput].buf) {
- emit_vector( ctx,
- &(rmesa->tcl.generic[geninput]),
- (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
- 4,
- VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
- count );
- }
- component[nr++] = &rmesa->tcl.generic[geninput];
- vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
- }
-
-
- if (inputs & VERT_BIT_COLOR1) {
- if (!rmesa->tcl.spec.buf) {
- emit_vector( ctx,
- &rmesa->tcl.spec,
- (char *)VB->SecondaryColorPtr[0]->data,
- 3,
- VB->SecondaryColorPtr[0]->stride,
- count);
- }
-
- /* How does this work?
- */
- vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_1_SHIFT;
- component[nr++] = &rmesa->tcl.spec;
- }
- else if (generic_in_mapped & (1 << 3)) {
- int geninput = vp->rev_inputs[3] - VERT_ATTRIB_GENERIC0;
- if (!rmesa->tcl.generic[geninput].buf) {
- emit_vector( ctx,
- &(rmesa->tcl.generic[geninput]),
- (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
- 4,
- VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
- count );
- }
- component[nr++] = &rmesa->tcl.generic[geninput];
- vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT;
- }
-
- if (generic_in_mapped & (1 << 4)) {
- int geninput = vp->rev_inputs[4] - VERT_ATTRIB_GENERIC0;
- if (!rmesa->tcl.generic[geninput].buf) {
- emit_vector( ctx,
- &(rmesa->tcl.generic[geninput]),
- (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
- 4,
- VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
- count );
- }
- component[nr++] = &rmesa->tcl.generic[geninput];
- vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_2_SHIFT;
- }
-
- if (generic_in_mapped & (1 << 5)) {
- int geninput = vp->rev_inputs[5] - VERT_ATTRIB_GENERIC0;
- if (!rmesa->tcl.generic[geninput].buf) {
- emit_vector( ctx,
- &(rmesa->tcl.generic[geninput]),
- (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
- 4,
- VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
- count );
- }
- component[nr++] = &rmesa->tcl.generic[geninput];
- vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_3_SHIFT;
- }
-
- for ( i = 0 ; i < 6 ; i++ ) {
- if (inputs & (VERT_BIT_TEX0 << i)) {
- if (!rmesa->tcl.tex[i].buf)
- emit_vector( ctx,
- &(rmesa->tcl.tex[i]),
- (char *)VB->TexCoordPtr[i]->data,
- VB->TexCoordPtr[i]->size,
- VB->TexCoordPtr[i]->stride,
- count );
-
- vfmt1 |= VB->TexCoordPtr[i]->size << (i * 3);
- component[nr++] = &rmesa->tcl.tex[i];
- }
- else if (generic_in_mapped & (1 << (i + 6))) {
- int geninput = vp->rev_inputs[i + 6] - VERT_ATTRIB_GENERIC0;
- if (!rmesa->tcl.generic[geninput].buf) {
- emit_vector( ctx,
- &(rmesa->tcl.generic[geninput]),
- (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
- 4,
- VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
- count );
- }
- component[nr++] = &rmesa->tcl.generic[geninput];
- vfmt1 |= 4 << (R200_VTX_TEX0_COMP_CNT_SHIFT + (i * 3));
- }
- }
-
- if (generic_in_mapped & (1 << 13)) {
- int geninput = vp->rev_inputs[13] - VERT_ATTRIB_GENERIC0;
- if (!rmesa->tcl.generic[geninput].buf) {
- emit_vector( ctx,
- &(rmesa->tcl.generic[geninput]),
- (char *)VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->data,
- 4,
- VB->AttribPtr[geninput + VERT_ATTRIB_GENERIC0]->stride,
- count );
- }
- component[nr++] = &rmesa->tcl.generic[geninput];
- vfmt0 |= R200_VTX_XY1 | R200_VTX_Z1 | R200_VTX_W1;
- }
-
-/* doesn't work. Wrong order with mixed generic & conventional! */
-/*
- if (ctx->VertexProgram._Enabled) {
- int *vp_inputs = rmesa->curr_vp_hw->inputs;
- for ( i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++ ) {
- if (inputs & (1 << i)) {
- int geninput = i - VERT_ATTRIB_GENERIC0;
- if (!rmesa->tcl.generic[geninput].buf) {
- emit_vector( ctx,
- &(rmesa->tcl.generic[geninput]),
- (char *)VB->AttribPtr[i]->data,
- 4,
- VB->AttribPtr[i]->stride,
- count );
}
- component[nr++] = &rmesa->tcl.generic[geninput];
- switch (vp_inputs[i]) {
- case 0:
- vfmt0 |= R200_VTX_W0 | R200_VTX_Z0;
- break;
+ vfmt0 |= R200_VTX_DISCRETE_FOG;
+ goto after_emit;
+ break;
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ if (VB->AttribPtr[attrib]->size == 4 &&
+ (VB->AttribPtr[attrib]->stride != 0 ||
+ VB->AttribPtr[attrib]->data[0][3] != 1.0)) emitsize = 4;
+ else emitsize = 3;
+ if (emitsize == 4)
+ vfmt0 |= R200_VTX_FP_RGBA << (R200_VTX_COLOR_0_SHIFT + (i - 4) * 2);
+ else {
+ vfmt0 |= R200_VTX_FP_RGB << (R200_VTX_COLOR_0_SHIFT + (i - 4) * 2);
+ }
+ break;
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ emitsize = VB->AttribPtr[attrib]->size;
+ vfmt1 |= emitsize << (R200_VTX_TEX0_COMP_CNT_SHIFT + (i - 8) * 3);
+ break;
+ case 14:
+ emitsize = VB->AttribPtr[attrib]->size >= 2 ? VB->AttribPtr[attrib]->size : 2;
+ switch (emitsize) {
case 2:
+ vfmt0 |= R200_VTX_XY1;
+ /* fallthrough */
case 3:
+ vfmt0 |= R200_VTX_Z1;
+ /* fallthrough */
case 4:
- case 5:
- vfmt0 |= R200_VTX_FP_RGBA << (R200_VTX_COLOR_0_SHIFT + (vp_inputs[i] - 2) * 2);
- break;
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- vfmt1 |= 4 << (R200_VTX_TEX0_COMP_CNT_SHIFT + (vp_inputs[i] - 6) * 3);
- break;
- case 13:
- vfmt0 |= R200_VTX_XY1 | R200_VTX_Z1 | R200_VTX_W1;
- break;
- case 1:
- case 12:
- default:
- assert(0);
+ vfmt0 |= R200_VTX_W1;
+ break;
}
+ default:
+ assert(0);
+ }
+ if (!rmesa->tcl.vertex_data[i].buf) {
+ emit_vector( ctx,
+ &(rmesa->tcl.vertex_data[i]),
+ (char *)VB->AttribPtr[attrib]->data,
+ emitsize,
+ VB->AttribPtr[attrib]->stride,
+ count );
}
+after_emit:
+ assert(nr < 12);
+ component[nr++] = &rmesa->tcl.vertex_data[i];
}
}
-*/
if (vfmt0 != rmesa->hw.vtx.cmd[VTX_VTXFMT_0] ||
vfmt1 != rmesa->hw.vtx.cmd[VTX_VTXFMT_1]) {
@@ -676,42 +501,13 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
{
- GLuint unit;
r200ContextPtr rmesa = R200_CONTEXT( ctx );
-/* if (R200_DEBUG & DEBUG_VERTS) */
-/* _tnl_print_vert_flags( __FUNCTION__, newinputs ); */
-
- if (newinputs & VERT_BIT_POS)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_WEIGHT)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.weight, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_NORMAL)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.norm, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_FOG)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.fog, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_COLOR0)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.rgba, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_COLOR1)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
-
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
- if (newinputs & VERT_BIT_TEX(unit))
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[unit], __FUNCTION__ );
- }
-
- if (ctx->VertexProgram._Enabled) {
- int i;
- for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
- if (newinputs & (1 << i))
- r200ReleaseDmaRegion( rmesa,
- &rmesa->tcl.generic[i - VERT_ATTRIB_GENERIC0], __FUNCTION__ );
- }
+ /* only do it for changed inputs ? */
+ int i;
+ for (i = 0; i < 15; i++) {
+ if (newinputs & (1 << i))
+ r200ReleaseDmaRegion( rmesa,
+ &rmesa->tcl.vertex_data[i], __FUNCTION__ );
}
-
}
diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c
index 62c335a707f..e0c32b26d92 100644
--- a/src/mesa/drivers/dri/r200/r200_tcl.c
+++ b/src/mesa/drivers/dri/r200/r200_tcl.c
@@ -384,8 +384,14 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
r200ContextPtr rmesa = R200_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint inputs = 0;
GLuint i;
+ GLubyte *vimap_rev;
+/* use hw fixed order for simplicity, pos 0, weight 1, normal 2, fog 3,
+ color0 - color3 4-7, texcoord0 - texcoord5 8-13, pos 1 14. Must not use
+ more than 12 of those at the same time. */
+ GLubyte map_rev_fixed[15] = {255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255};
+
/* TODO: separate this from the swtnl pipeline
*/
@@ -404,30 +410,40 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
r200ValidateState( ctx );
if (!ctx->VertexProgram._Enabled) {
- inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
/* NOTE: inputs != tnl->render_inputs - these are the untransformed
* inputs.
*/
+ map_rev_fixed[0] = VERT_ATTRIB_POS;
+ /* technically there is no reason we always need VA_COLOR0. In theory
+ could disable it depending on lighting, color materials, texturing... */
+ map_rev_fixed[4] = VERT_ATTRIB_COLOR0;
+
if (ctx->Light.Enabled) {
- inputs |= VERT_BIT_NORMAL;
+ map_rev_fixed[2] = VERT_ATTRIB_NORMAL;
}
+ /* this also enables VA_COLOR1 when using separate specular
+ lighting model, which is unnecessary.
+ FIXME: OTOH, we're missing the case where a ATI_fragment_shader accesses
+ the secondary color (if lighting is disabled). The chip seems
+ misconfigured for that though elsewhere (tcl output, might lock up) */
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- inputs |= VERT_BIT_COLOR1;
+ map_rev_fixed[5] = VERT_ATTRIB_COLOR1;
}
if ( (ctx->Fog.FogCoordinateSource == GL_FOG_COORD) && ctx->Fog.Enabled ) {
- inputs |= VERT_BIT_FOG;
+ map_rev_fixed[3] = VERT_ATTRIB_FOG;
}
for (i = 0 ; i < ctx->Const.MaxTextureUnits; i++) {
if (ctx->Texture.Unit[i]._ReallyEnabled) {
if (rmesa->TexGenNeedNormals[i]) {
- inputs |= VERT_BIT_NORMAL;
+ map_rev_fixed[2] = VERT_ATTRIB_NORMAL;
}
- inputs |= VERT_BIT_TEX(i);
+ map_rev_fixed[8 + i] = VERT_ATTRIB_TEX0 + i;
}
}
+ vimap_rev = &map_rev_fixed[0];
}
else {
/* vtx_tcl_output_vtxfmt_0/1 need to match configuration of "fragment
@@ -437,14 +453,8 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
We only need to change compsel. */
GLuint out_compsel = 0;
GLuint vp_out = rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten;
-#if 0
- /* can't handle other inputs, generic attribs etc. currently - should never arrive here */
- assert ((rmesa->curr_vp_hw->mesa_program.Base.InputsRead &
- ~(VERT_BIT_POS | VERT_BIT_NORMAL | VERT_BIT_COLOR0 | VERT_BIT_COLOR1 |
- VERT_BIT_FOG | VERT_BIT_TEX0 | VERT_BIT_TEX1 | VERT_BIT_TEX2 |
- VERT_BIT_TEX3 | VERT_BIT_TEX4 | VERT_BIT_TEX5)) == 0);
-#endif
- inputs |= rmesa->curr_vp_hw->mesa_program.Base.InputsRead;
+
+ vimap_rev = &rmesa->curr_vp_hw->inputmap_rev[0];
assert(vp_out & (1 << VERT_RESULT_HPOS));
out_compsel = R200_OUTPUT_XYZW;
if (vp_out & (1 << VERT_RESULT_COL0)) {
@@ -473,7 +483,7 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx,
/* Do the actual work:
*/
r200ReleaseArrays( ctx, ~0 /* stage->changed_inputs */ );
- r200EmitArrays( ctx, inputs );
+ r200EmitArrays( ctx, vimap_rev );
rmesa->tcl.Elts = VB->Elts;
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c
index 713e2f9ecab..4960d481d5d 100644
--- a/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -405,7 +405,6 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte
int dofogfix = 0;
int fog_temp_i = 0;
int free_inputs;
- int free_inputs_conv;
int array_count = 0;
vp->native = GL_FALSE;
@@ -477,6 +476,8 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte
for(i = 0; i < VERT_ATTRIB_MAX; i++)
vp->inputs[i] = -1;
+ for(i = 0; i < 15; i++)
+ vp->inputmap_rev[i] = 255;
free_inputs = 0x2ffd;
/* fglrx uses fixed inputs as follows for conventional attribs.
@@ -499,38 +500,45 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte
/* may look different when using idx buf / input_route instead of se_vtx_fmt? */
if (mesa_vp->Base.InputsRead & VERT_BIT_POS) {
vp->inputs[VERT_ATTRIB_POS] = 0;
+ vp->inputmap_rev[0] = VERT_ATTRIB_POS;
free_inputs &= ~(1 << 0);
array_count++;
}
if (mesa_vp->Base.InputsRead & VERT_BIT_WEIGHT) {
vp->inputs[VERT_ATTRIB_WEIGHT] = 12;
+ vp->inputmap_rev[1] = VERT_ATTRIB_WEIGHT;
array_count++;
}
if (mesa_vp->Base.InputsRead & VERT_BIT_NORMAL) {
vp->inputs[VERT_ATTRIB_NORMAL] = 1;
+ vp->inputmap_rev[2] = VERT_ATTRIB_NORMAL;
array_count++;
}
if (mesa_vp->Base.InputsRead & VERT_BIT_COLOR0) {
vp->inputs[VERT_ATTRIB_COLOR0] = 2;
+ vp->inputmap_rev[4] = VERT_ATTRIB_COLOR0;
free_inputs &= ~(1 << 2);
array_count++;
}
if (mesa_vp->Base.InputsRead & VERT_BIT_COLOR1) {
vp->inputs[VERT_ATTRIB_COLOR1] = 3;
+ vp->inputmap_rev[5] = VERT_ATTRIB_COLOR1;
free_inputs &= ~(1 << 3);
array_count++;
}
if (mesa_vp->Base.InputsRead & VERT_BIT_FOG) {
vp->inputs[VERT_ATTRIB_FOG] = 15; array_count++;
+ vp->inputmap_rev[3] = VERT_ATTRIB_FOG;
+ array_count++;
}
for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX5; i++) {
if (mesa_vp->Base.InputsRead & (1 << i)) {
vp->inputs[i] = i - VERT_ATTRIB_TEX0 + 6;
+ vp->inputmap_rev[8 + i - VERT_ATTRIB_TEX0] = i;
free_inputs &= ~(1 << (i - VERT_ATTRIB_TEX0 + 6));
array_count++;
}
}
- free_inputs_conv = free_inputs;
/* using VERT_ATTRIB_TEX6/7 would be illegal */
/* completely ignore aliasing? */
for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
@@ -549,13 +557,14 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte
if (free_inputs & (1 << j)) {
free_inputs &= ~(1 << j);
vp->inputs[i] = j;
- vp->rev_inputs[j] = i;
+ if (j == 0) vp->inputmap_rev[j] = i; /* mapped to pos */
+ else if (j < 12) vp->inputmap_rev[j + 2] = i; /* mapped to col/tex */
+ else vp->inputmap_rev[j + 1] = i; /* mapped to pos1 */
break;
}
}
}
}
- vp->gen_inputs_mapped = free_inputs ^ free_inputs_conv;
if (!(mesa_vp->Base.OutputsWritten & (1 << VERT_RESULT_HPOS))) {
if (R200_DEBUG & DEBUG_FALLBACKS) {