*/
static void upload_sf_prog( struct brw_context *brw )
{
+ const struct brw_fragment_program *fs = brw->attribs.FragmentProgram;
struct brw_sf_prog_key key;
+ struct tgsi_parse_context parse;
+ int i, done = 0;
+
memset(&key, 0, sizeof(key));
}
+
+ /* Scan fp inputs to figure out what interpolation modes are
+ * required for each incoming vp output. There is an assumption
+ * that the state tracker makes sure there is a 1:1 linkage between
+ * these sets of attributes (XXX: position??)
+ */
+ tgsi_parse_init( &parse, fs->program.tokens );
+ while( !done &&
+ !tgsi_parse_end_of_tokens( &parse ) )
+ {
+ tgsi_parse_token( &parse );
+
+ switch( parse.FullToken.Token.Type ) {
+ case TGSI_TOKEN_TYPE_DECLARATION:
+ if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_INPUT)
+ {
+ int first = parse.FullToken.FullDeclaration.u.DeclarationRange.First;
+ int last = parse.FullToken.FullDeclaration.u.DeclarationRange.Last;
+ int interp_mode = parse.FullToken.FullDeclaration.Interpolation.Interpolate;
+ //int semantic = parse.FullToken.FullDeclaration.Semantic.SemanticName;
+ //int semantic_index = parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
+
+ _mesa_printf("fs input %d..%d interp mode %d\n", first, last, interp_mode);
+
+ switch (interp_mode) {
+ case TGSI_INTERPOLATE_CONSTANT:
+ for (i = first; i <= last; i++)
+ key.const_mask |= (1 << i);
+ break;
+ case TGSI_INTERPOLATE_LINEAR:
+ for (i = first; i <= last; i++)
+ key.linear_mask |= (1 << i);
+ break;
+ case TGSI_INTERPOLATE_PERSPECTIVE:
+ for (i = first; i <= last; i++)
+ key.persp_mask |= (1 << i);
+ break;
+ default:
+ break;
+ }
+
+ /* Also need stuff for flat shading, twosided color.
+ */
+
+ }
+ break;
+ default:
+ done = 1;
+ break;
+ }
+ }
+
+ _mesa_printf("key.persp_mask: %x\n", key.persp_mask);
+ _mesa_printf("key.linear_mask: %x\n", key.linear_mask);
+ _mesa_printf("key.const_mask: %x\n", key.const_mask);
+
+
// key.do_point_sprite = brw->attribs.Point->PointSprite;
// key.SpriteOrigin = brw->attribs.Point->SpriteOrigin;
};
+
+#if 0
/* Build a struct like the one we'd like the state tracker to pass to
* us.
*/
- /* First scan fp inputs
- */
- tgsi_parse_init( &parse, fs->program.tokens );
- while( !done &&
- !tgsi_parse_end_of_tokens( &parse ) )
- {
- tgsi_parse_token( &parse );
-
- switch( parse.FullToken.Token.Type ) {
- case TGSI_TOKEN_TYPE_DECLARATION:
- if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_INPUT)
- {
- int first = parse.FullToken.FullDeclaration.u.DeclarationRange.First;
- int last = parse.FullToken.FullDeclaration.u.DeclarationRange.Last;
-
- for (i = first; i < last; i++) {
- state.fp_input[i].vp_output = ~0;
- state.fp_input[i].bf_vp_output = ~0;
- state.fp_input[i].interp_mode =
- parse.FullToken.FullDeclaration.Interpolation.Interpolate;
-
- fp_semantic[i].semantic =
- parse.FullToken.FullDeclaration.Semantic.SemanticName;
- fp_semantic[i].semantic_index =
- parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
-
- }
-
- assert(last > state.fp_input_count);
- state.fp_input_count = last;
- }
- break;
- default:
- done = 1;
- break;
- }
- }
assert(state.fp_input_count == fs->program.num_inputs);
.update = update_sf_linkage
};
+
+#endif
ushort *pc_linear)
{
boolean is_last_attr = (reg == c->nr_setup_regs - 1);
+ unsigned persp_mask = c->key.persp_mask;
+ unsigned linear_mask = c->key.linear_mask;
+ _mesa_printf("persp_mask: %x\n", persp_mask);
+ _mesa_printf("linear_mask: %x\n", linear_mask);
*pc_persp = 0;
*pc_linear = 0;
*pc = 0xf;
-// if (persp_mask & (1 << c->idx_to_attr[reg*2]))
-// *pc_persp = 0xf;
+ if (persp_mask & (1 << (reg*2)))
+ *pc_persp = 0xf;
-// if (linear_mask & (1 << c->idx_to_attr[reg*2]))
+ if (linear_mask & (1 << (reg*2)))
*pc_linear = 0xf;
/* Maybe only processs one attribute on the final round:
*/
- if (1 || reg*2+1 < c->nr_setup_attrs) {
+ if (reg*2+1 < c->nr_setup_attrs) {
*pc |= 0xf0;
-// if (persp_mask & (1 << c->idx_to_attr[reg*2+1]))
-// *pc_persp |= 0xf0;
+ if (persp_mask & (1 << (reg*2+1)))
+ *pc_persp |= 0xf0;
-// if (linear_mask & (1 << c->idx_to_attr[reg*2+1]))
+ if (linear_mask & (1 << (reg*2+1)))
*pc_linear |= 0xf0;
}
+ _mesa_printf("pc: %x\n", *pc);
+ _mesa_printf("pc_persp: %x\n", *pc_persp);
+ _mesa_printf("pc_linear: %x\n", *pc_linear);
+
+
return is_last_attr;
}
struct brw_compile *p = &c->func;
unsigned i;
+ _mesa_printf("%s START ==============\n", __FUNCTION__);
+
c->nr_verts = 3;
alloc_regs(c);
invert_det(c);
struct brw_reg a0 = offset(c->vert[0], i);
struct brw_reg a1 = offset(c->vert[1], i);
struct brw_reg a2 = offset(c->vert[2], i);
- ushort pc, pc_persp, pc_linear;
+ ushort pc = 0, pc_persp = 0, pc_linear = 0;
boolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear);
if (pc_persp)
BRW_URB_SWIZZLE_TRANSPOSE); /* XXX: Swizzle control "SF to windower" */
}
}
+
+ _mesa_printf("%s DONE ==============\n", __FUNCTION__);
+
}