summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2014-07-21 21:18:14 -0400
committerMarek Olšák <marek.olsak@amd.com>2015-05-16 14:51:23 +0200
commitdfc3bced2ceebd1e3abacd07acd83f932b45c639 (patch)
treea9035bd42ec2b228491cdc161653826bad385356
parentec67d73a73f74011b33f6ab59bed4c88ebaa7497 (diff)
tgsi/ureg: allow ureg_dst to have dimension indices
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.c24
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.h59
2 files changed, 75 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 55d8cf1eeb0..7a8bf5404e3 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -914,8 +914,8 @@ void
ureg_emit_dst( struct ureg_program *ureg,
struct ureg_dst dst )
{
- unsigned size = (1 +
- (dst.Indirect ? 1 : 0));
+ unsigned size = 1 + (dst.Indirect ? 1 : 0) +
+ (dst.Dimension ? (dst.DimIndirect ? 2 : 1) : 0);
union tgsi_any_token *out = get_tokens( ureg, DOMAIN_INSN, size );
unsigned n = 0;
@@ -944,6 +944,26 @@ ureg_emit_dst( struct ureg_program *ureg,
n++;
}
+ if (dst.Dimension) {
+ out[0].dst.Dimension = 1;
+ out[n].dim.Dimension = 0;
+ out[n].dim.Padding = 0;
+ if (dst.DimIndirect) {
+ out[n].dim.Indirect = 1;
+ out[n].dim.Index = dst.DimensionIndex;
+ n++;
+ out[n].value = 0;
+ out[n].ind.File = dst.DimIndFile;
+ out[n].ind.Swizzle = dst.DimIndSwizzle;
+ out[n].ind.Index = dst.DimIndIndex;
+ out[n].ind.ArrayID = dst.ArrayID;
+ } else {
+ out[n].dim.Indirect = 0;
+ out[n].dim.Index = dst.DimensionIndex;
+ }
+ n++;
+ }
+
assert(n == size);
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 8a2ed0a61d7..c3f4012f2b9 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -75,6 +75,8 @@ struct ureg_dst
unsigned File : 4; /* TGSI_FILE_ */
unsigned WriteMask : 4; /* TGSI_WRITEMASK_ */
unsigned Indirect : 1; /* BOOL */
+ unsigned DimIndirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
unsigned Saturate : 1; /* BOOL */
unsigned Predicate : 1;
unsigned PredNegate : 1; /* BOOL */
@@ -86,6 +88,10 @@ struct ureg_dst
int IndirectIndex : 16; /* SINT */
unsigned IndirectFile : 4; /* TGSI_FILE_ */
int IndirectSwizzle : 2; /* TGSI_SWIZZLE_ */
+ unsigned DimIndFile : 4; /* TGSI_FILE_ */
+ unsigned DimIndSwizzle : 2; /* TGSI_SWIZZLE_ */
+ int DimensionIndex : 16; /* SINT */
+ int DimIndIndex : 16; /* SINT */
unsigned ArrayID : 10; /* UINT */
};
@@ -1108,6 +1114,16 @@ ureg_src_indirect( struct ureg_src reg, struct ureg_src addr )
return reg;
}
+static INLINE struct ureg_dst
+ureg_dst_dimension( struct ureg_dst 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( struct ureg_src reg, int index )
{
@@ -1118,6 +1134,19 @@ ureg_src_dimension( struct ureg_src reg, int index )
return reg;
}
+static INLINE struct ureg_dst
+ureg_dst_dimension_indirect( struct ureg_dst 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;
+}
static INLINE struct ureg_src
ureg_src_dimension_indirect( struct ureg_src reg, struct ureg_src addr,
@@ -1161,6 +1190,12 @@ ureg_dst_register( unsigned file,
dst.PredSwizzleZ = TGSI_SWIZZLE_Z;
dst.PredSwizzleW = TGSI_SWIZZLE_W;
dst.Index = index;
+ dst.Dimension = 0;
+ dst.DimensionIndex = 0;
+ dst.DimIndirect = 0;
+ dst.DimIndFile = TGSI_FILE_NULL;
+ dst.DimIndIndex = 0;
+ dst.DimIndSwizzle = 0;
dst.ArrayID = 0;
return dst;
@@ -1189,6 +1224,12 @@ ureg_dst( struct ureg_src src )
dst.PredSwizzleZ = TGSI_SWIZZLE_Z;
dst.PredSwizzleW = TGSI_SWIZZLE_W;
dst.Index = src.Index;
+ dst.Dimension = src.Dimension;
+ dst.DimensionIndex = src.DimensionIndex;
+ dst.DimIndirect = src.DimIndirect;
+ dst.DimIndFile = src.DimIndFile;
+ dst.DimIndIndex = src.DimIndIndex;
+ dst.DimIndSwizzle = src.DimIndSwizzle;
dst.ArrayID = src.ArrayID;
return dst;
@@ -1240,12 +1281,12 @@ ureg_src( struct ureg_dst dst )
src.Absolute = 0;
src.Index = dst.Index;
src.Negate = 0;
- src.Dimension = 0;
- src.DimensionIndex = 0;
- src.DimIndirect = 0;
- src.DimIndFile = TGSI_FILE_NULL;
- src.DimIndIndex = 0;
- src.DimIndSwizzle = 0;
+ src.Dimension = dst.Dimension;
+ src.DimensionIndex = dst.DimensionIndex;
+ src.DimIndirect = dst.DimIndirect;
+ src.DimIndFile = dst.DimIndFile;
+ src.DimIndIndex = dst.DimIndIndex;
+ src.DimIndSwizzle = dst.DimIndSwizzle;
src.ArrayID = dst.ArrayID;
return src;
@@ -1272,6 +1313,12 @@ ureg_dst_undef( void )
dst.PredSwizzleZ = TGSI_SWIZZLE_Z;
dst.PredSwizzleW = TGSI_SWIZZLE_W;
dst.Index = 0;
+ dst.Dimension = 0;
+ dst.DimensionIndex = 0;
+ dst.DimIndirect = 0;
+ dst.DimIndFile = TGSI_FILE_NULL;
+ dst.DimIndIndex = 0;
+ dst.DimIndSwizzle = 0;
dst.ArrayID = 0;
return dst;