summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2010-06-11 10:35:24 -0400
committerZack Rusin <[email protected]>2010-06-11 10:35:24 -0400
commit23969670387bc0bb7d0761936905e5eb4df963dc (patch)
treec18dafe1c955c6d8680a5877c8db690d751b4f4f /src/gallium
parent27bc2de5461c1d66c8e005b35de77e7b9e214754 (diff)
tgsi: support 2d indirect addressing
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_dump.c21
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c7
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sanity.c1
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.c31
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.h44
5 files changed, 86 insertions, 18 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 35480076edf..de6d4419464 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -211,9 +211,24 @@ _dump_register_src(
{
ENM(src->Register.File, file_names);
if (src->Register.Dimension) {
- CHR('[');
- SID(src->Dimension.Index);
- CHR(']');
+ if (src->Dimension.Indirect) {
+ CHR( '[' );
+ ENM( src->DimIndirect.File, file_names );
+ CHR( '[' );
+ SID( src->DimIndirect.Index );
+ TXT( "]." );
+ ENM( src->DimIndirect.SwizzleX, swizzle_names );
+ if (src->Dimension.Index != 0) {
+ if (src->Dimension.Index > 0)
+ CHR( '+' );
+ SID( src->Dimension.Index );
+ }
+ CHR( ']' );
+ } else {
+ CHR('[');
+ SID(src->Dimension.Index);
+ CHR(']');
+ }
}
if (src->Register.Indirect) {
CHR( '[' );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index c15d970b573..f66f72d257a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1046,7 +1046,12 @@ fetch_src_file_channel(const struct tgsi_exec_machine *mach,
case TGSI_FILE_INPUT:
case TGSI_FILE_SYSTEM_VALUE:
for (i = 0; i < QUAD_SIZE; i++) {
- /* XXX: 2D indexing */
+ /*
+ if (TGSI_PROCESSOR_GEOMETRY == mach->Processor) {
+ debug_printf("Fetching Input[%d] (2d=%d, 1d=%d)\n",
+ index2D->i[i] * TGSI_EXEC_MAX_INPUT_ATTRIBS + index->i[i],
+ index2D->i[i], index->i[i]);
+ }*/
chan->u[i] = mach->Inputs[index2D->i[i] * TGSI_EXEC_MAX_INPUT_ATTRIBS + index->i[i]].xyzw[swizzle].u[i];
}
break;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
index ce0a92f7fb3..c2fd6b6e434 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
@@ -102,7 +102,6 @@ scan_register_src(scan_register *reg,
if (src->Register.Dimension) {
/*FIXME: right now we don't support indirect
* multidimensional addressing */
- debug_assert(!src->Dimension.Indirect);
fill_scan_register2d(reg,
src->Register.File,
src->Register.Index,
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 7d357e154b3..3cf6893a9b9 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -732,11 +732,12 @@ ureg_DECL_immediate_int( struct ureg_program *ureg,
}
-void
+void
ureg_emit_src( struct ureg_program *ureg,
struct ureg_src src )
{
- unsigned size = 1 + (src.Indirect ? 1 : 0) + (src.Dimension ? 1 : 0);
+ unsigned size = 1 + (src.Indirect ? 1 : 0) +
+ (src.Dimension ? (src.DimIndirect ? 2 : 1) : 0);
union tgsi_any_token *out = get_tokens( ureg, DOMAIN_INSN, size );
unsigned n = 0;
@@ -769,11 +770,27 @@ ureg_emit_src( struct ureg_program *ureg,
}
if (src.Dimension) {
- out[0].src.Dimension = 1;
- out[n].dim.Indirect = 0;
- out[n].dim.Dimension = 0;
- out[n].dim.Padding = 0;
- out[n].dim.Index = src.DimensionIndex;
+ if (src.DimIndirect) {
+ out[0].src.Dimension = 1;
+ out[n].dim.Indirect = 1;
+ out[n].dim.Dimension = 0;
+ out[n].dim.Padding = 0;
+ out[n].dim.Index = src.DimensionIndex;
+ n++;
+ out[n].value = 0;
+ out[n].src.File = src.DimIndFile;
+ out[n].src.SwizzleX = src.DimIndSwizzle;
+ out[n].src.SwizzleY = src.DimIndSwizzle;
+ out[n].src.SwizzleZ = src.DimIndSwizzle;
+ out[n].src.SwizzleW = src.DimIndSwizzle;
+ out[n].src.Index = src.DimIndIndex;
+ } else {
+ out[0].src.Dimension = 1;
+ out[n].dim.Indirect = 0;
+ out[n].dim.Dimension = 0;
+ out[n].dim.Padding = 0;
+ out[n].dim.Index = src.DimensionIndex;
+ }
n++;
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 055545f3d2a..07fb01ab7b3 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -49,14 +49,18 @@ struct ureg_src
unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_ */
unsigned SwizzleW : 2; /* TGSI_SWIZZLE_ */
unsigned Indirect : 1; /* BOOL */
+ unsigned DimIndirect : 1; /* BOOL */
unsigned Dimension : 1; /* BOOL */
unsigned Absolute : 1; /* BOOL */
unsigned Negate : 1; /* BOOL */
int Index : 16; /* SINT */
- unsigned IndirectFile : 4; /* TGSI_FILE_ */
- int IndirectIndex : 16; /* SINT */
- unsigned IndirectSwizzle : 2; /* TGSI_SWIZZLE_ */
- int DimensionIndex : 16; /* SINT */
+ unsigned IndirectFile : 4; /* TGSI_FILE_ */
+ int IndirectIndex : 16; /* SINT */
+ unsigned IndirectSwizzle : 2; /* TGSI_SWIZZLE_ */
+ int DimensionIndex : 16; /* SINT */
+ unsigned DimIndFile : 4; /* TGSI_FILE_ */
+ int DimIndIndex : 16; /* SINT */
+ unsigned DimIndSwizzle : 2; /* TGSI_SWIZZLE_ */
};
/* Very similar to a tgsi_dst_register, removing unsupported fields
@@ -821,12 +825,28 @@ ureg_src_indirect( struct ureg_src reg, struct ureg_src addr )
return reg;
}
-static INLINE struct ureg_src
+static INLINE struct ureg_src
ureg_src_dimension( struct ureg_src reg, int index )
{
assert(reg.File != TGSI_FILE_NULL);
reg.Dimension = 1;
+ reg.DimIndirect = 0;
+ reg.DimensionIndex = index;
+ return reg;
+}
+
+
+static INLINE struct ureg_src
+ureg_src_dimension_indirect( struct ureg_src reg, struct ureg_src addr,
+ int index )
+{
+ assert(reg.File != TGSI_FILE_NULL);
+ reg.Dimension = 1;
+ reg.DimIndirect = 1;
reg.DimensionIndex = index;
+ reg.DimIndFile = addr.File;
+ reg.DimIndIndex = addr.Index;
+ reg.DimIndSwizzle = addr.SwizzleX;
return reg;
}
@@ -874,6 +894,10 @@ ureg_src_register(unsigned file,
src.Negate = 0;
src.Dimension = 0;
src.DimensionIndex = 0;
+ src.DimIndirect = 0;
+ src.DimIndFile = TGSI_FILE_NULL;
+ src.DimIndIndex = 0;
+ src.DimIndSwizzle = 0;
return src;
}
@@ -897,6 +921,10 @@ ureg_src( struct ureg_dst dst )
src.Negate = 0;
src.Dimension = 0;
src.DimensionIndex = 0;
+ src.DimIndirect = 0;
+ src.DimIndFile = TGSI_FILE_NULL;
+ src.DimIndIndex = 0;
+ src.DimIndSwizzle = 0;
return src;
}
@@ -944,7 +972,11 @@ ureg_src_undef( void )
src.Negate = 0;
src.Dimension = 0;
src.DimensionIndex = 0;
-
+ src.DimIndirect = 0;
+ src.DimIndFile = TGSI_FILE_NULL;
+ src.DimIndIndex = 0;
+ src.DimIndSwizzle = 0;
+
return src;
}