summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_build.c
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2012-04-30 19:08:55 +0200
committerFrancisco Jerez <currojerez@riseup.net>2012-05-11 12:39:41 +0200
commit82c90b2da8e236bc134cb2bd0ec4e09551b12164 (patch)
tree7e6fd5e47737a52c438700bc6734f4da61d1ef09 /src/gallium/auxiliary/tgsi/tgsi_build.c
parenta4ebb04214bab1cd9bd41967232ec89441e31744 (diff)
downloadexternal_mesa3d-82c90b2da8e236bc134cb2bd0ec4e09551b12164.zip
external_mesa3d-82c90b2da8e236bc134cb2bd0ec4e09551b12164.tar.gz
external_mesa3d-82c90b2da8e236bc134cb2bd0ec4e09551b12164.tar.bz2
gallium/tgsi: Add support for raw resources.
Normal resource access (e.g. the LOAD TGSI opcode) is supposed to perform a series of conversions to turn the texture data as it's found in memory into the target data type. In compute programs it's often the case that we only want to access the raw bits as they're stored in some buffer object, and any kind of channel conversion and scaling is harmful or inefficient, especially in implementations that lack proper hardware support to take care of it -- in those cases the conversion has to be implemented in software and it's likely to result in a performance hit even if the pipe_buffer and declaration data types are set up in a way that would just pass the data through. Add a declaration flag that marks a resource as typeless. No channel conversion will be performed in that case, and the X coordinate of the address vector will be interpreted in byte units instead of elements for obvious reasons. This is similar to D3D11's ByteAddressBuffer, and will be used to implement OpenCL's constant arguments. The remaining four compute memory spaces can also be understood as raw resources.
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_build.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_build.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index 1bcdef2..2945a0d 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -257,12 +257,14 @@ tgsi_default_declaration_resource(void)
struct tgsi_declaration_resource dr;
dr.Resource = TGSI_BUFFER;
+ dr.Raw = 0;
return dr;
}
static struct tgsi_declaration_resource
tgsi_build_declaration_resource(unsigned texture,
+ unsigned raw,
struct tgsi_declaration *declaration,
struct tgsi_header *header)
{
@@ -270,6 +272,7 @@ tgsi_build_declaration_resource(unsigned texture,
dr = tgsi_default_declaration_resource();
dr.Resource = texture;
+ dr.Raw = raw;
declaration_grow(declaration, header);
@@ -439,6 +442,7 @@ tgsi_build_full_declaration(
size++;
*dr = tgsi_build_declaration_resource(full_decl->Resource.Resource,
+ full_decl->Resource.Raw,
declaration,
header);
}