*
* We also use a texture coordinate to pass wpos when possible.
*/
-#if 1
- /* use vertex format info to remap input regs */
- assert(index < p->vertex_info->num_attribs);
- printf("%s map index %d to %d\n",
- __FUNCTION__,
- index,
- p->vertex_info->slot_to_attrib[index]);
+ /* use vertex format info to map a slot number to a VF attrib */
+ assert(index < p->vertex_info->num_attribs);
index = p->vertex_info->slot_to_attrib[index];
switch (index) {
T_TEX0 + (index - VF_ATTRIB_TEX0),
D0_CHANNEL_ALL);
break;
-
default:
i915_program_error(p, "Bad source->Index");
return 0;
}
-
-#else
- switch (index) {
- case FRAG_ATTRIB_WPOS:
- assert(p->wpos_tex != -1);
- src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL);
- break;
- case FRAG_ATTRIB_COL0:
- src = i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL);
- break;
- case FRAG_ATTRIB_COL1:
- src = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ);
- src = swizzle(src, X, Y, Z, ONE);
- break;
- case FRAG_ATTRIB_FOGC:
- src = i915_emit_decl(p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W);
- src = swizzle(src, W, W, W, W);
- break;
- case FRAG_ATTRIB_TEX0:
- case FRAG_ATTRIB_TEX1:
- case FRAG_ATTRIB_TEX2:
- case FRAG_ATTRIB_TEX3:
- case FRAG_ATTRIB_TEX4:
- case FRAG_ATTRIB_TEX5:
- case FRAG_ATTRIB_TEX6:
- case FRAG_ATTRIB_TEX7:
- src = i915_emit_decl(p, REG_TYPE_T,
- T_TEX0 + (index - FRAG_ATTRIB_TEX0),
- D0_CHANNEL_ALL);
- break;
-
- default:
- i915_program_error(p, "Bad source->Index");
- return 0;
- }
-#endif
-
break;
case TGSI_FILE_CONSTANT:
}
-#if 0
-/* Hardcoded vertex format: xyz/rgba
- */
-static INLINE void
-emit_hw_vertex( struct i915_context *i915,
- struct vertex_header *vertex )
-{
- OUT_BATCH( fui(vertex->data[0][0]) );
- OUT_BATCH( fui(vertex->data[0][1]) );
- OUT_BATCH( fui(vertex->data[0][2]) );
-
- /* colors are ARGB (MSB to LSB) */
- OUT_BATCH( pack_ub4(float_to_ubyte( vertex->data[1][2] ),
- float_to_ubyte( vertex->data[1][1] ),
- float_to_ubyte( vertex->data[1][0] ),
- float_to_ubyte( vertex->data[1][3] )) );
-}
-#endif
-
-
/**
* Extract the needed fields from vertex_header and emit i915 dwords.
* Recall that the vertices are constructed by the 'draw' module and
* clip pos) that we ignore here.
*/
static INLINE void
-emit_hw_vertex2( struct i915_context *i915,
- const struct vertex_header *vertex)
+emit_hw_vertex( struct i915_context *i915,
+ const struct vertex_header *vertex)
{
const struct vertex_info *vinfo = &i915->current.vertex_info;
uint i;
unsigned nr )
{
struct i915_context *i915 = setup_stage(stage)->i915;
-#if 0
- unsigned vertex_size = 4 * sizeof(int);
-#else
unsigned vertex_size = i915->current.vertex_info.size * 4; /* in bytes */
-#endif
unsigned *ptr;
unsigned i;
((4 + vertex_size * nr)/4 - 2));
for (i = 0; i < nr; i++) {
- emit_hw_vertex2(i915, prim->v[i]);
+ emit_hw_vertex(i915, prim->v[i]);
ptr += vertex_size / sizeof(int);
}
}
#include "i915_context.h"
#include "i915_state.h"
#include "i915_reg.h"
-
-/* XXX should include i915_fpc.h but that causes some trouble atm */
-extern void i915_translate_fragment_program( struct i915_context *i915 );
+#include "i915_fpc.h"
static void calculate_vertex_layout( struct i915_context *i915 )
{
const unsigned inputsRead = i915->fs.inputs_read;
-// const unsigned inputsRead = (FRAG_BIT_WPOS | FRAG_BIT_COL0);
- unsigned i;
struct vertex_info *vinfo = &i915->current.vertex_info;
+ uint i;
memset(vinfo, 0, sizeof(*vinfo));
*/
if (i915->setup.light_twoside) {
if (inputsRead & FRAG_BIT_COL0) {
- /* XXX: mark as discarded after setup */
emit_vertex_attr(vinfo, VF_ATTRIB_BFC0, FORMAT_OMIT);
}
if (inputsRead & FRAG_BIT_COL1) {
- /* XXX: discard after setup */
emit_vertex_attr(vinfo, VF_ATTRIB_BFC1, FORMAT_OMIT);
}
}
draw_set_vertex_attributes( i915->draw,
vinfo->slot_to_attrib,
vinfo->num_attribs);
-#if 0
- printf("VERTEX_FORMAT LIS2: 0x%x LIS4: 0x%x\n",
- vinfo->hwfmt[1], vinfo->hwfmt[0]);
-#endif
}
static void upload_S2S4(struct i915_context *i915)
{
unsigned LIS2, LIS4;
-
+
/* I915_NEW_VERTEX_FORMAT */
-#if 0
- LIS2 = 0xffffffff;
- LIS4 = (S4_VFMT_XYZ | S4_VFMT_COLOR);
-#else
- /*
- assert(LIS2 == i915->current.vertex_info.hwfmt[1]);
- assert(LIS4 == i915->current.vertex_info.hwfmt[0]);
- */
- LIS2 = i915->current.vertex_info.hwfmt[1];
- LIS4 = i915->current.vertex_info.hwfmt[0];
-#endif
- printf("DEFAULT FORMT LIS2: 0x%x LIS4: 0x%x\n", ~0, (S4_VFMT_XYZ | S4_VFMT_COLOR));
- printf("UPLOAD FORMAT LIS2: 0x%x LIS4: 0x%x\n", LIS2, LIS4);
- printf("VF FORMAT LIS2: 0x%x LIS4: 0x%x\n",
- i915->current.vertex_info.hwfmt[1],
- i915->current.vertex_info.hwfmt[0]);
+ {
+ LIS2 = i915->current.vertex_info.hwfmt[1];
+ LIS4 = i915->current.vertex_info.hwfmt[0];
+ /*
+ printf("LIS2: 0x%x LIS4: 0x%x\n", LIS2, LIS4);
+ */
+ assert(LIS4); /* should never be zero? */
+ }
/* I915_NEW_SETUP */
switch (i915->setup.cull_mode) {