struct {
unsigned semantic_name;
unsigned semantic_index;
+ unsigned usage_mask; /* = TGSI_WRITEMASK_* */
} output[UREG_MAX_OUTPUT];
unsigned nr_outputs;
struct ureg_dst
-ureg_DECL_output( struct ureg_program *ureg,
- unsigned name,
- unsigned index )
+ureg_DECL_output_masked( struct ureg_program *ureg,
+ unsigned name,
+ unsigned index,
+ unsigned usage_mask )
{
unsigned i;
+ assert(usage_mask != 0);
+
for (i = 0; i < ureg->nr_outputs; i++) {
if (ureg->output[i].semantic_name == name &&
- ureg->output[i].semantic_index == index)
+ ureg->output[i].semantic_index == index) {
+ ureg->output[i].usage_mask |= usage_mask;
goto out;
+ }
}
if (ureg->nr_outputs < UREG_MAX_OUTPUT) {
ureg->output[i].semantic_name = name;
ureg->output[i].semantic_index = index;
+ ureg->output[i].usage_mask = usage_mask;
ureg->nr_outputs++;
}
else {
}
+struct ureg_dst
+ureg_DECL_output( struct ureg_program *ureg,
+ unsigned name,
+ unsigned index )
+{
+ return ureg_DECL_output_masked(ureg, name, index, TGSI_WRITEMASK_XYZW);
+}
+
+
/* Returns a new constant register. Keep track of which have been
* referred to so that we can emit decls later.
*
unsigned file,
unsigned index,
unsigned semantic_name,
- unsigned semantic_index)
+ unsigned semantic_index,
+ unsigned usage_mask)
{
union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3);
out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
out[0].decl.NrTokens = 3;
out[0].decl.File = file;
- out[0].decl.UsageMask = TGSI_WRITEMASK_XYZW; /* FIXME! */
+ out[0].decl.UsageMask = usage_mask;
out[0].decl.Semantic = 1;
out[1].value = 0;
TGSI_FILE_INPUT,
ureg->gs_input[i].index,
ureg->gs_input[i].semantic_name,
- ureg->gs_input[i].semantic_index);
+ ureg->gs_input[i].semantic_index,
+ TGSI_WRITEMASK_XYZW);
}
}
TGSI_FILE_SYSTEM_VALUE,
ureg->system_value[i].index,
ureg->system_value[i].semantic_name,
- ureg->system_value[i].semantic_index);
+ ureg->system_value[i].semantic_index,
+ TGSI_WRITEMASK_XYZW);
}
for (i = 0; i < ureg->nr_outputs; i++) {
TGSI_FILE_OUTPUT,
i,
ureg->output[i].semantic_name,
- ureg->output[i].semantic_index);
+ ureg->output[i].semantic_index,
+ ureg->output[i].usage_mask);
}
for (i = 0; i < ureg->nr_samplers; i++) {