summaryrefslogtreecommitdiff
path: root/ir.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-05-26 16:41:47 -0700
committerKenneth Graunke <kenneth@whitecape.org>2010-06-09 11:14:57 -0700
commitc30f6e5dea7e75983784f3539304c8dd36356d1c (patch)
tree07f07b0edadac395c0d0b796cdcfe7e8d07db5a4 /ir.cpp
parent81377c012cf5db3efe2e39885846c60b6e5c6eb8 (diff)
Add mappings between ir_texture_opcode and strings.
Diffstat (limited to 'ir.cpp')
-rw-r--r--ir.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/ir.cpp b/ir.cpp
index 2b05e9776d..9a713494d3 100644
--- a/ir.cpp
+++ b/ir.cpp
@@ -303,6 +303,27 @@ ir_dereference::is_lvalue()
}
+const char *tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf" };
+
+const char *ir_texture::opcode_string()
+{
+ assert((unsigned int) op <=
+ sizeof(tex_opcode_strs) / sizeof(tex_opcode_strs[0]));
+ return tex_opcode_strs[op];
+}
+
+ir_texture_opcode
+ir_texture::get_opcode(const char *str)
+{
+ const int count = sizeof(tex_opcode_strs) / sizeof(tex_opcode_strs[0]);
+ for (int op = 0; op < count; op++) {
+ if (strcmp(str, tex_opcode_strs[op]) == 0)
+ return (ir_texture_opcode) op;
+ }
+ return (ir_texture_opcode) -1;
+}
+
+
ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z,
unsigned w, unsigned count)
: val(val)