aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/i915simple
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-23 17:00:47 -0600
committerBrian <[email protected]>2007-08-23 17:00:47 -0600
commitd8b16d416de95daa4f0ede9b839bdbf0fa6bf1b1 (patch)
tree9ee52ee42b11661ab89eb66474d49bf600a8e777 /src/mesa/pipe/i915simple
parent83547d1dca7281ffe03424d12316b26bb07b89c9 (diff)
Checkpoint: new vertex/fragment attribute naming
Replace VF_ATTRIB_x with TGSI_ATTRIB_x When converting mesa programs to TGSI programs, also convert the InputsRead and OutputsWritten to a mask of TGSI_ATTRIB_ bits. Still need to do conversion for vertex programs...
Diffstat (limited to 'src/mesa/pipe/i915simple')
-rw-r--r--src/mesa/pipe/i915simple/i915_fpc_emit.c9
-rw-r--r--src/mesa/pipe/i915simple/i915_fpc_translate.c39
-rw-r--r--src/mesa/pipe/i915simple/i915_state_derived.c96
3 files changed, 55 insertions, 89 deletions
diff --git a/src/mesa/pipe/i915simple/i915_fpc_emit.c b/src/mesa/pipe/i915simple/i915_fpc_emit.c
index f062885f8a3..c8d36435d99 100644
--- a/src/mesa/pipe/i915simple/i915_fpc_emit.c
+++ b/src/mesa/pipe/i915simple/i915_fpc_emit.c
@@ -353,23 +353,14 @@ i915_emit_param4fv(struct i915_fp_compile * p, const float * values)
return UREG(REG_TYPE_CONST, fp->param[i].reg);
}
-#if 0
- if (fp->nr_constants == I915_MAX_CONSTANT ||
- fp->nr_params == I915_MAX_CONSTANT) {
-#else
if (p->constants->nr_constants == I915_MAX_CONSTANT ||
fp->nr_params == I915_MAX_CONSTANT) {
-#endif
i915_program_error(p, "i915_emit_param4fv: out of constants\n");
return 0;
}
{
-#if 0
- int reg = fp->nr_constants++;
-#else
int reg = p->constants->nr_constants++;
-#endif
int i = fp->nr_params++;
assert (p->constant_flags[reg] == 0);
diff --git a/src/mesa/pipe/i915simple/i915_fpc_translate.c b/src/mesa/pipe/i915simple/i915_fpc_translate.c
index be3de0f3f45..e7315d2263f 100644
--- a/src/mesa/pipe/i915simple/i915_fpc_translate.c
+++ b/src/mesa/pipe/i915simple/i915_fpc_translate.c
@@ -154,31 +154,31 @@ src_vector(struct i915_fp_compile *p,
index = p->vertex_info->slot_to_attrib[index];
switch (index) {
- case VF_ATTRIB_POS:
+ case TGSI_ATTRIB_POS:
assert(p->wpos_tex != -1);
src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL);
break;
- case VF_ATTRIB_COLOR0:
+ case TGSI_ATTRIB_COLOR0:
src = i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL);
break;
- case VF_ATTRIB_COLOR1:
+ case TGSI_ATTRIB_COLOR1:
src = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ);
src = swizzle(src, X, Y, Z, ONE);
break;
- case VF_ATTRIB_FOG:
+ case TGSI_ATTRIB_FOG:
src = i915_emit_decl(p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W);
src = swizzle(src, W, W, W, W);
break;
- case VF_ATTRIB_TEX0:
- case VF_ATTRIB_TEX1:
- case VF_ATTRIB_TEX2:
- case VF_ATTRIB_TEX3:
- case VF_ATTRIB_TEX4:
- case VF_ATTRIB_TEX5:
- case VF_ATTRIB_TEX6:
- case VF_ATTRIB_TEX7:
+ case TGSI_ATTRIB_TEX0:
+ case TGSI_ATTRIB_TEX1:
+ case TGSI_ATTRIB_TEX2:
+ case TGSI_ATTRIB_TEX3:
+ case TGSI_ATTRIB_TEX4:
+ case TGSI_ATTRIB_TEX5:
+ case TGSI_ATTRIB_TEX6:
+ case TGSI_ATTRIB_TEX7:
src = i915_emit_decl(p, REG_TYPE_T,
- T_TEX0 + (index - VF_ATTRIB_TEX0),
+ T_TEX0 + (index - TGSI_ATTRIB_TEX0),
D0_CHANNEL_ALL);
break;
default:
@@ -237,9 +237,9 @@ get_result_vector(struct i915_fp_compile *p,
switch (dest->DstRegister.File) {
case TGSI_FILE_OUTPUT:
switch (dest->DstRegister.Index) {
- case 1: /*COLOR*/ /*FRAG_RESULT_COLR:*/
+ case TGSI_ATTRIB_COLOR0:
return UREG(REG_TYPE_OC, 0);
- case 0: /*DEPTH*/ /*FRAG_RESULT_DEPR:*/
+ case TGSI_ATTRIB_POS:
return UREG(REG_TYPE_OD, 0);
default:
i915_program_error(p, "Bad inst->DstReg.Index");
@@ -989,14 +989,15 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
static void
i915_find_wpos_space(struct i915_fp_compile *p)
{
- const uint inputs = p->shader->inputs_read | FRAG_BIT_WPOS; /*XXX hack*/
+ const uint inputs
+ = p->shader->inputs_read | (1 << TGSI_ATTRIB_POS); /*XXX hack*/
uint i;
p->wpos_tex = -1;
- if (inputs & FRAG_BIT_WPOS) {
+ if (inputs & (1 << TGSI_ATTRIB_POS)) {
for (i = 0; i < I915_TEX_UNITS; i++) {
- if ((inputs & (FRAG_BIT_TEX0 << i)) == 0) {
+ if ((inputs & (1 << (TGSI_ATTRIB_TEX0 + i))) == 0) {
p->wpos_tex = i;
return;
}
@@ -1017,7 +1018,7 @@ i915_find_wpos_space(struct i915_fp_compile *p)
static void
i915_fixup_depth_write(struct i915_fp_compile *p)
{
- if (p->shader->outputs_written & (1<<FRAG_RESULT_DEPR)) {
+ if (p->shader->outputs_written & (1 << TGSI_ATTRIB_POS)) {
uint depth = UREG(REG_TYPE_OD, 0);
i915_emit_arith(p,
diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c
index e8c7dfba6f3..426d43f2889 100644
--- a/src/mesa/pipe/i915simple/i915_state_derived.c
+++ b/src/mesa/pipe/i915simple/i915_state_derived.c
@@ -35,32 +35,6 @@
#include "i915_fpc.h"
-
-static const unsigned frag_to_vf[FRAG_ATTRIB_MAX] =
-{
- VF_ATTRIB_POS,
- VF_ATTRIB_COLOR0,
- VF_ATTRIB_COLOR1,
- VF_ATTRIB_FOG,
- VF_ATTRIB_TEX0,
- VF_ATTRIB_TEX1,
- VF_ATTRIB_TEX2,
- VF_ATTRIB_TEX3,
- VF_ATTRIB_TEX4,
- VF_ATTRIB_TEX5,
- VF_ATTRIB_TEX6,
- VF_ATTRIB_TEX7,
- VF_ATTRIB_VAR0,
- VF_ATTRIB_VAR1,
- VF_ATTRIB_VAR2,
- VF_ATTRIB_VAR3,
- VF_ATTRIB_VAR4,
- VF_ATTRIB_VAR5,
- VF_ATTRIB_VAR6,
- VF_ATTRIB_VAR7,
-};
-
-
static INLINE void
emit_vertex_attr(struct vertex_info *vinfo, uint vfAttr, uint format)
{
@@ -118,44 +92,45 @@ static void calculate_vertex_layout( struct i915_context *i915 )
{
const unsigned inputsRead = i915->fs.inputs_read;
struct vertex_info *vinfo = &i915->current.vertex_info;
- uint i;
memset(vinfo, 0, sizeof(*vinfo));
/* TODO - Figure out if we need to do perspective divide, etc.
*/
- emit_vertex_attr(vinfo, VF_ATTRIB_POS, FORMAT_3F);
+
+ /* pos */
+ emit_vertex_attr(vinfo, TGSI_ATTRIB_POS, FORMAT_3F);
vinfo->hwfmt[0] |= S4_VFMT_XYZ;
-
- /* Pull in the rest of the attributes. They are all in float4
- * format. Future optimizations could be to keep some attributes
- * as fixed point or ubyte format.
- */
- for (i = 1; i < FRAG_ATTRIB_TEX0; i++) {
- if (inputsRead & (1 << i)) {
- assert(i < Elements(frag_to_vf));
- if (i915->setup.flatshade
- && (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1)) {
- emit_vertex_attr(vinfo, frag_to_vf[i], FORMAT_4UB);
- }
- else {
- emit_vertex_attr(vinfo, frag_to_vf[i], FORMAT_4UB);
- }
- vinfo->hwfmt[0] |= S4_VFMT_COLOR;
- }
+
+ /* color0 */
+ if (inputsRead & (1 << TGSI_ATTRIB_COLOR0)) {
+ emit_vertex_attr(vinfo, TGSI_ATTRIB_COLOR0, FORMAT_4UB);
+ vinfo->hwfmt[0] |= S4_VFMT_COLOR;
}
- for (i = FRAG_ATTRIB_TEX0; i <= FRAG_ATTRIB_TEX7/*MAX*/; i++) {
- uint hwtc;
- if (inputsRead & (1 << i)) {
- hwtc = TEXCOORDFMT_4D;
- assert(i < sizeof(frag_to_vf) / sizeof(frag_to_vf[0]));
- emit_vertex_attr(vinfo, frag_to_vf[i], FORMAT_4F);
- }
- else {
- hwtc = TEXCOORDFMT_NOT_PRESENT;
+ /* color 1 */
+ if (inputsRead & (1 << TGSI_ATTRIB_COLOR1)) {
+ assert(0); /* untested */
+ emit_vertex_attr(vinfo, TGSI_ATTRIB_COLOR1, FORMAT_4UB);
+ vinfo->hwfmt[0] |= S4_VFMT_SPEC_FOG;
+ }
+
+ /* XXX fog? */
+
+ /* texcoords */
+ {
+ uint i;
+ for (i = TGSI_ATTRIB_TEX0; i <= TGSI_ATTRIB_TEX7; i++) {
+ uint hwtc;
+ if (inputsRead & (1 << i)) {
+ emit_vertex_attr(vinfo, i, FORMAT_4F);
+ hwtc = TEXCOORDFMT_4D;
+ }
+ else {
+ hwtc = TEXCOORDFMT_NOT_PRESENT;
+ }
+ vinfo->hwfmt[1] |= hwtc << ((i - TGSI_ATTRIB_TEX0) * 4);
}
- vinfo->hwfmt[1] |= hwtc << ((i - FRAG_ATTRIB_TEX0) * 4);
}
/* Additional attributes required for setup: Just twosided
@@ -163,12 +138,11 @@ static void calculate_vertex_layout( struct i915_context *i915 )
* the vertex header.
*/
if (i915->setup.light_twoside) {
- if (inputsRead & FRAG_BIT_COL0) {
- emit_vertex_attr(vinfo, VF_ATTRIB_BFC0, FORMAT_OMIT);
- }
-
- if (inputsRead & FRAG_BIT_COL1) {
- emit_vertex_attr(vinfo, VF_ATTRIB_BFC1, FORMAT_OMIT);
+ if (inputsRead & (1 << TGSI_ATTRIB_COLOR0)) {
+ emit_vertex_attr(vinfo, TGSI_ATTRIB_BFC0, FORMAT_OMIT);
+ }
+ if (inputsRead & (1 << TGSI_ATTRIB_COLOR1)) {
+ emit_vertex_attr(vinfo, TGSI_ATTRIB_BFC1, FORMAT_OMIT);
}
}