cur = ctx->cur;
eat_opt_white( &cur );
+ if (*cur == ',') {
+ cur2 = cur;
+ cur2++;
+ eat_opt_white( &cur2 );
+ if (str_match_nocase_whole( &cur2, "ARRAY(" )) {
+ int arrayid;
+ eat_opt_white( &cur2 );
+ if (!parse_int( &cur2, &arrayid )) {
+ report_error( ctx, "Expected `,'" );
+ return FALSE;
+ }
+ eat_opt_white( &cur2 );
+ if (*cur2 != ')') {
+ report_error( ctx, "Expected `,'" );
+ return FALSE;
+ }
+ decl.Declaration.Array = 1;
+ decl.Array.ArrayID = arrayid;
+ cur = cur2;
+ }
+ }
+
if (*cur == ',' && !is_vs_input) {
uint i, j;
struct tgsi_declaration_interp decl_interp;
struct tgsi_declaration_semantic decl_semantic;
struct tgsi_declaration_sampler_view decl_sampler_view;
+ struct tgsi_declaration_array array;
struct tgsi_immediate imm;
union tgsi_immediate_data imm_data;
struct tgsi_instruction insn;
#define UREG_MAX_IMMEDIATE 256
#define UREG_MAX_ADDR 2
#define UREG_MAX_PRED 1
+#define UREG_MAX_ARRAY_TEMPS 256
struct const_decl {
struct {
struct util_bitmask *decl_temps;
unsigned nr_temps;
+ unsigned array_temps[UREG_MAX_ARRAY_TEMPS];
+ unsigned nr_array_temps;
+
struct const_decl const_decls;
struct const_decl const_decls2D[PIPE_MAX_CONSTANT_BUFFERS];
if (local)
util_bitmask_set(ureg->local_temps, i);
+ /* Always start a new declaration at the start */
util_bitmask_set(ureg->decl_temps, i);
ureg->nr_temps += size;
+
+ /* and also at the end of the array */
util_bitmask_set(ureg->decl_temps, ureg->nr_temps);
+ if (ureg->nr_array_temps < UREG_MAX_ARRAY_TEMPS)
+ ureg->array_temps[ureg->nr_array_temps++] = i;
+
return dst;
}
static void
emit_decl_temps( struct ureg_program *ureg,
unsigned first, unsigned last,
- boolean local )
+ boolean local,
+ unsigned arrayid )
{
- union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 2 );
+ union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL,
+ arrayid ? 3 : 2 );
out[0].value = 0;
out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
out[1].value = 0;
out[1].decl_range.First = first;
out[1].decl_range.Last = last;
+
+ if (arrayid) {
+ out[0].decl.Array = 1;
+ out[2].value = 0;
+ out[2].array.ArrayID = arrayid;
+ }
}
static void emit_decl_range( struct ureg_program *ureg,
}
if (ureg->nr_temps) {
+ unsigned array = 0;
for (i = 0; i < ureg->nr_temps;) {
boolean local = util_bitmask_get(ureg->local_temps, i);
unsigned first = i;
if (i == UTIL_BITMASK_INVALID_INDEX)
i = ureg->nr_temps;
- emit_decl_temps( ureg, first, i - 1, local );
+ if (array < ureg->nr_array_temps && ureg->array_temps[array] == first)
+ emit_decl_temps( ureg, first, i - 1, local, ++array );
+ else
+ emit_decl_temps( ureg, first, i - 1, local, 0 );
}
}
unsigned Interpolate : 1; /**< any interpolation info? */
unsigned Invariant : 1; /**< invariant optimization? */
unsigned Local : 1; /**< optimize as subroutine local variable? */
- unsigned Padding : 7;
+ unsigned Array : 1; /**< extra array info? */
+ unsigned Padding : 6;
};
struct tgsi_declaration_range
unsigned ReturnTypeW : 6; /**< one of enum pipe_type */
};
+struct tgsi_declaration_array {
+ unsigned ArrayID : 10;
+ unsigned Padding : 22;
+};
+
/*
* Special resources that don't need to be declared. They map to the
* GLOBAL/LOCAL/PRIVATE/INPUT compute memory spaces.