summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_exec.c
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2012-05-01 02:38:51 +0200
committerFrancisco Jerez <[email protected]>2012-05-11 12:39:39 +0200
commita5f44cc8c2ce0916809ce5da5a2490ad000ef099 (patch)
tree33ffba4161f7f3201a505ab5a23d6f70ea6cfc7f /src/gallium/auxiliary/tgsi/tgsi_exec.c
parentd9d82dcd006c124e6569789c90390c43c1360c06 (diff)
gallium/tgsi: Split sampler views from shader resources.
This commit splits the current concept of resource into "sampler views" and "shader resources": "Sampler views" are textures or buffers that are bound to a given shader stage and can be read from in conjunction with a sampler object. They are analogous to OpenGL texture objects or Direct3D SRVs. "Shader resources" are textures or buffers that can be read and written from a shader. There's no support for floating point coordinates, address wrap modes or filtering, and, unlike sampler views, shader resources are global for the whole graphics pipeline. They are analogous to OpenGL image objects (as in ARB_shader_image_load_store) or Direct3D UAVs. Most hardware is likely to implement shader resources and sampler views as separate objects, so, having the distinction at the API level simplifies things slightly for the driver. This patch introduces the SVIEW register file with a declaration token and syntax analogous to the already existing RES register file. After this change, the SAMPLE_* opcodes no longer accept a resource as input, but rather a SVIEW object. To preserve the functionality of reading from a sampler view with integer coordinates, the SAMPLE_I(_MS) opcodes are introduced which are similar to LOAD(_MS) but take a SVIEW register instead of a RES register as argument.
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_exec.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index c4ad34b1e61..20bbe407caf 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -2121,7 +2121,7 @@ exec_sample(struct tgsi_exec_machine *mach,
control = tgsi_sampler_lod_bias;
}
- switch (mach->Resources[resource_unit].Resource) {
+ switch (mach->SamplerViews[resource_unit].Resource) {
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
FETCH(&r[0], 0, TGSI_CHAN_X);
@@ -2215,7 +2215,7 @@ exec_sample_d(struct tgsi_exec_machine *mach,
* XXX: This is fake SAMPLE_D -- the derivatives are not taken into account, yet.
*/
- switch (mach->Resources[resource_unit].Resource) {
+ switch (mach->SamplerViews[resource_unit].Resource) {
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
@@ -2338,8 +2338,8 @@ static void
exec_declaration(struct tgsi_exec_machine *mach,
const struct tgsi_full_declaration *decl)
{
- if (decl->Declaration.File == TGSI_FILE_RESOURCE) {
- mach->Resources[decl->Range.First] = decl->Resource;
+ if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) {
+ mach->SamplerViews[decl->Range.First] = decl->SamplerView;
return;
}
@@ -4154,11 +4154,11 @@ exec_instruction(
exec_endswitch(mach);
break;
- case TGSI_OPCODE_LOAD:
+ case TGSI_OPCODE_SAMPLE_I:
assert(0);
break;
- case TGSI_OPCODE_LOAD_MS:
+ case TGSI_OPCODE_SAMPLE_I_MS:
assert(0);
break;
@@ -4190,7 +4190,7 @@ exec_instruction(
assert(0);
break;
- case TGSI_OPCODE_RESINFO:
+ case TGSI_OPCODE_SVIEWINFO:
assert(0);
break;