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;
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);
}
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 */
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 */
};
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 )
{
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,
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;
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;
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;
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;