summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2010-07-09 21:19:28 -0400
committerZack Rusin <zackr@vmware.com>2010-07-09 21:19:28 -0400
commitb4855288e4de9001b4107d3d4c2f7aff4a4680f9 (patch)
treed85eee9091e5125d22960ae97507e12a936d614e /src
parent308f52d57341bc864baf619ac0fbc2b33f5cc5a5 (diff)
mesa: add basic support for 2D register arrays to mesa
just like in Gallium it's a basic functionality needed by a lot of modern graphcis extensions
Diffstat (limited to 'src')
-rw-r--r--src/mesa/program/prog_instruction.h6
-rw-r--r--src/mesa/program/prog_print.c14
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c8
3 files changed, 25 insertions, 3 deletions
diff --git a/src/mesa/program/prog_instruction.h b/src/mesa/program/prog_instruction.h
index bc980c6a7f..cb5beb9b00 100644
--- a/src/mesa/program/prog_instruction.h
+++ b/src/mesa/program/prog_instruction.h
@@ -271,6 +271,12 @@ struct prog_src_register
* instruction which allows per-component negation.
*/
GLuint Negate:4;
+
+ GLuint HasIndex2D:1;
+ GLuint RelAddr2D:1;
+ GLint Index2D:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit.
+ * May be negative for relative
+ * addressing. */
};
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index 80c9203e31..876b2d4618 100644
--- a/src/mesa/program/prog_print.c
+++ b/src/mesa/program/prog_print.c
@@ -265,7 +265,8 @@ arb_output_attrib_string(GLint index, GLenum progType)
*/
static const char *
reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode,
- GLboolean relAddr, const struct gl_program *prog)
+ GLboolean relAddr, const struct gl_program *prog,
+ GLboolean hasIndex2D, GLboolean relAddr2D, GLint index2D)
{
static char str[100];
const char *addr = relAddr ? "ADDR+" : "";
@@ -275,6 +276,11 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode,
switch (mode) {
case PROG_PRINT_DEBUG:
sprintf(str, "%s[%s%d]", file_string(f, mode), addr, index);
+ if (hasIndex2D) {
+ int offset = strlen(str);
+ const char *addr2D = relAddr2D ? "ADDR+" : "";
+ sprintf(str+offset, "[%s%d]", addr2D, index2D);
+ }
break;
case PROG_PRINT_ARB:
@@ -478,7 +484,8 @@ fprint_dst_reg(FILE * f,
{
fprintf(f, "%s%s",
reg_string((gl_register_file) dstReg->File,
- dstReg->Index, mode, dstReg->RelAddr, prog),
+ dstReg->Index, mode, dstReg->RelAddr, prog,
+ GL_FALSE, GL_FALSE, 0),
_mesa_writemask_string(dstReg->WriteMask));
if (dstReg->CondMask != COND_TR) {
@@ -508,7 +515,8 @@ fprint_src_reg(FILE *f,
fprintf(f, "%s%s%s%s",
abs,
reg_string((gl_register_file) srcReg->File,
- srcReg->Index, mode, srcReg->RelAddr, prog),
+ srcReg->Index, mode, srcReg->RelAddr, prog,
+ srcReg->HasIndex2D, srcReg->RelAddr2D, srcReg->Index2D),
_mesa_swizzle_string(srcReg->Swizzle,
srcReg->Negate, GL_FALSE),
abs);
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index fdf023d6ae..050b5d164d 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -330,6 +330,14 @@ translate_src( struct st_translate *t,
}
}
+ if (SrcReg->HasIndex2D) {
+ if (SrcReg->RelAddr2D)
+ src = ureg_src_dimension_indirect( src, ureg_src(t->address[0]),
+ SrcReg->Index2D);
+ else
+ src = ureg_src_dimension( src, SrcReg->Index2D);
+ }
+
return src;
}