summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-09-05 03:23:05 +0200
committerMarek Olšák <[email protected]>2011-09-10 08:53:29 +0200
commitd8452a0be810d7176b0cbfe6632fc0f8016b5733 (patch)
tree013c479d43d2ee451289ea2627c5d43cfeb27746 /src/gallium/auxiliary/tgsi
parent379429137238e79296b8222c0e13d7d961910633 (diff)
gallium: add shadow 1D and 2D array samplers to TGSI
And filling in all the switch statements in auxiliary. Mostly untested.
Diffstat (limited to 'src/gallium/auxiliary/tgsi')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_dump.c4
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c37
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sse2.c4
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c6
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_util.c10
5 files changed, 54 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 7e2825e9ce1..64927ed6e02 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -160,7 +160,9 @@ tgsi_texture_names[TGSI_TEXTURE_COUNT] =
"SHADOW2D",
"SHADOWRECT",
"1DARRAY",
- "2DARRAY"
+ "2DARRAY",
+ "SHADOW1DARRAY",
+ "SHADOW2DARRAY",
};
const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index fd118c5bb11..d9de41bf826 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1791,6 +1791,7 @@ exec_tex(struct tgsi_exec_machine *mach,
break;
case TGSI_TEXTURE_1D_ARRAY:
+ case TGSI_TEXTURE_SHADOW1D_ARRAY:
FETCH(&r[0], 0, CHAN_X);
FETCH(&r[1], 0, CHAN_Y);
@@ -1805,6 +1806,7 @@ exec_tex(struct tgsi_exec_machine *mach,
break;
case TGSI_TEXTURE_2D_ARRAY:
+ case TGSI_TEXTURE_SHADOW2D_ARRAY:
FETCH(&r[0], 0, CHAN_X);
FETCH(&r[1], 0, CHAN_Y);
FETCH(&r[2], 0, CHAN_Z);
@@ -1884,8 +1886,10 @@ exec_txd(struct tgsi_exec_machine *mach,
&r[0], &r[1], &r[2], &r[3]); /* R, G, B, A */
break;
+ case TGSI_TEXTURE_1D_ARRAY:
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_RECT:
+ case TGSI_TEXTURE_SHADOW1D_ARRAY:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
@@ -1899,6 +1903,7 @@ exec_txd(struct tgsi_exec_machine *mach,
&r[0], &r[1], &r[2], &r[3]); /* outputs */
break;
+ case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
@@ -1912,6 +1917,19 @@ exec_txd(struct tgsi_exec_machine *mach,
&r[0], &r[1], &r[2], &r[3]);
break;
+ case TGSI_TEXTURE_SHADOW2D_ARRAY:
+
+ FETCH(&r[0], 0, CHAN_X);
+ FETCH(&r[1], 0, CHAN_Y);
+ FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[3], 0, CHAN_W);
+
+ fetch_texel(mach->Samplers[unit],
+ &r[0], &r[1], &r[2], &r[3],
+ tgsi_sampler_lod_bias,
+ &r[0], &r[1], &r[2], &r[3]);
+ break;
+
default:
assert(0);
}
@@ -1957,10 +1975,12 @@ exec_txf(struct tgsi_exec_machine *mach,
switch(inst->Texture.Texture) {
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_2D_ARRAY:
+ case TGSI_TEXTURE_SHADOW2D_ARRAY:
IFETCH(&r[2], 0, CHAN_Z);
/* fallthrough */
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_RECT:
+ case TGSI_TEXTURE_SHADOW1D_ARRAY:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
case TGSI_TEXTURE_1D_ARRAY:
@@ -2067,8 +2087,10 @@ exec_sample(struct tgsi_exec_machine *mach,
&r[0], &r[1], &r[2], &r[3]); /* R, G, B, A */
break;
+ case TGSI_TEXTURE_1D_ARRAY:
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_RECT:
+ case TGSI_TEXTURE_SHADOW1D_ARRAY:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
FETCH(&r[0], 0, CHAN_X);
@@ -2087,6 +2109,7 @@ exec_sample(struct tgsi_exec_machine *mach,
&r[0], &r[1], &r[2], &r[3]); /* outputs */
break;
+ case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
FETCH(&r[0], 0, CHAN_X);
@@ -2105,6 +2128,20 @@ exec_sample(struct tgsi_exec_machine *mach,
&r[0], &r[1], &r[2], &r[3]);
break;
+ case TGSI_TEXTURE_SHADOW2D_ARRAY:
+ FETCH(&r[0], 0, CHAN_X);
+ FETCH(&r[1], 0, CHAN_Y);
+ FETCH(&r[2], 0, CHAN_Z);
+ FETCH(&r[3], 0, CHAN_W);
+
+ assert(modifier != TEX_MODIFIER_PROJECTED);
+
+ fetch_texel(mach->Samplers[sampler_unit],
+ &r[0], &r[1], &r[2], &r[3],
+ control,
+ &r[0], &r[1], &r[2], &r[3]);
+ break;
+
default:
assert(0);
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
index 664946b00f6..5614caf63e7 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
@@ -1526,8 +1526,12 @@ emit_tex( struct x86_function *func,
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
case TGSI_TEXTURE_2D_ARRAY:
+ case TGSI_TEXTURE_SHADOW1D_ARRAY:
count = 3;
break;
+ case TGSI_TEXTURE_SHADOW2D_ARRAY:
+ count = 4;
+ break;
default:
assert(0);
return;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 57622a0dea6..6b97803711f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -826,7 +826,11 @@ static const char *texture_names[TGSI_TEXTURE_COUNT] =
"RECT",
"SHADOW1D",
"SHADOW2D",
- "SHADOWRECT"
+ "SHADOWRECT",
+ "1DARRAY",
+ "2DARRAY",
+ "SHADOW1DARRAY",
+ "SHADOW2DARRAY"
};
static const char *type_names[] =
diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c
index aa9a886d4a9..9f6997dc88a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_util.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_util.c
@@ -270,21 +270,21 @@ tgsi_util_get_inst_usage_mask(const struct tgsi_full_instruction *inst,
case TGSI_TEXTURE_SHADOW1D:
read_mask = TGSI_WRITEMASK_XZ;
break;
+ case TGSI_TEXTURE_1D_ARRAY:
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_RECT:
read_mask = TGSI_WRITEMASK_XY;
break;
+ case TGSI_TEXTURE_SHADOW1D_ARRAY:
case TGSI_TEXTURE_SHADOW2D:
case TGSI_TEXTURE_SHADOWRECT:
+ case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
read_mask = TGSI_WRITEMASK_XYZ;
break;
- case TGSI_TEXTURE_1D_ARRAY:
- read_mask = TGSI_WRITEMASK_XY;
- break;
- case TGSI_TEXTURE_2D_ARRAY:
- read_mask = TGSI_WRITEMASK_XYZ;
+ case TGSI_TEXTURE_SHADOW2D_ARRAY:
+ read_mask = TGSI_WRITEMASK_XYZW;
break;
default:
assert(0);