aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2012-04-30 20:20:29 +0200
committerFrancisco Jerez <[email protected]>2012-05-11 12:39:41 +0200
commitb8e808f1ef9462af8545999df514fddbbff34345 (patch)
tree6431be43337a12c166fae50e87e6f8b7e14c9d6c /src/gallium/auxiliary/tgsi
parent82c90b2da8e236bc134cb2bd0ec4e09551b12164 (diff)
gallium/tgsi: Add resource write-back support.
Define a new STORE opcode with a role dual to the LOAD opcode, and add flags to specify that a shader resource is intended for writing.
Diffstat (limited to 'src/gallium/auxiliary/tgsi')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_build.c4
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_dump.c2
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.c1
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c4
4 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index 2945a0d63e7..8378075b3e9 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -258,6 +258,7 @@ tgsi_default_declaration_resource(void)
dr.Resource = TGSI_BUFFER;
dr.Raw = 0;
+ dr.Writable = 0;
return dr;
}
@@ -265,6 +266,7 @@ tgsi_default_declaration_resource(void)
static struct tgsi_declaration_resource
tgsi_build_declaration_resource(unsigned texture,
unsigned raw,
+ unsigned writable,
struct tgsi_declaration *declaration,
struct tgsi_header *header)
{
@@ -273,6 +275,7 @@ tgsi_build_declaration_resource(unsigned texture,
dr = tgsi_default_declaration_resource();
dr.Resource = texture;
dr.Raw = raw;
+ dr.Writable = writable;
declaration_grow(declaration, header);
@@ -443,6 +446,7 @@ tgsi_build_full_declaration(
*dr = tgsi_build_declaration_resource(full_decl->Resource.Resource,
full_decl->Resource.Raw,
+ full_decl->Resource.Writable,
declaration,
header);
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index f48e3907c31..36859466877 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -285,6 +285,8 @@ iter_declaration(
if (decl->Declaration.File == TGSI_FILE_RESOURCE) {
TXT(", ");
ENM(decl->Resource.Resource, tgsi_texture_names);
+ if (decl->Resource.Writable)
+ TXT(", WR");
if (decl->Resource.Raw)
TXT(", RAW");
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index c41288f6588..46a9df113ca 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -200,6 +200,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 1, 0, 0, 0, 0, COMP, "IABS", TGSI_OPCODE_IABS },
{ 1, 1, 0, 0, 0, 0, COMP, "ISSG", TGSI_OPCODE_ISSG },
{ 1, 2, 0, 0, 0, 0, OTHR, "LOAD", TGSI_OPCODE_LOAD },
+ { 1, 2, 0, 0, 0, 0, OTHR, "STORE", TGSI_OPCODE_STORE },
};
const struct tgsi_opcode_info *
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index ad9b304f090..52e30b40169 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -1078,6 +1078,10 @@ static boolean parse_declaration( struct translate_ctx *ctx )
!is_digit_alpha_underscore(cur2)) {
decl.Resource.Raw = 1;
+ } else if (str_match_no_case(&cur2, "WR") &&
+ !is_digit_alpha_underscore(cur2)) {
+ decl.Resource.Writable = 1;
+
} else {
break;
}