summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2014-05-14 13:25:14 -0700
committerIan Romanick <[email protected]>2014-09-30 13:34:41 -0700
commitab51179f1fe8f365cc5357f498e4ce690c28bd3a (patch)
treeca8f1936c61ae7698c721ae3ed64aa51bd75bef6 /src/glsl/ir.cpp
parentbaf5a756640fde8cd4d4e704ed8c9c45da3e5407 (diff)
glsl: Replace ir_variable::warn_extension pointer with an 8-bit index
Also move the new warn_extension_index into ir_variable::data. This enables slightly better packing. Valgrind massif results for a trimmed apitrace of dota2: n time(i) total(B) useful-heap(B) extra-heap(B) stacks(B) Before (32-bit): 82 40,580,040,531 68,488,992 62,973,695 5,515,297 0 After (32-bit): 73 40,580,476,304 68,488,400 62,796,151 5,692,249 0 Before (64-bit): 65 37,124,013,542 95,892,768 88,466,712 7,426,056 0 After (64-bit): 71 37,124,890,613 95,889,584 88,089,008 7,800,576 0 A real savings of 173KiB on 32-bit and 368KiB on 64-bit. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r--src/glsl/ir.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index b83884163d5..07f15ee0701 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1554,7 +1554,7 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
this->data.location = -1;
this->data.location_frac = 0;
this->data.binding = 0;
- this->warn_extension = NULL;
+ this->data.warn_extension_index = 0;
this->constant_value = NULL;
this->constant_initializer = NULL;
this->data.origin_upper_left = false;
@@ -1617,16 +1617,31 @@ ir_variable::determine_interpolation_mode(bool flat_shade)
return INTERP_QUALIFIER_SMOOTH;
}
+const char *const ir_variable::warn_extension_table[] = {
+ "",
+ "GL_ARB_shader_stencil_export",
+ "GL_AMD_shader_stencil_export",
+};
+
void
ir_variable::enable_extension_warning(const char *extension)
{
- this->warn_extension = extension;
+ for (unsigned i = 0; i < Elements(warn_extension_table); i++) {
+ if (strcmp(warn_extension_table[i], extension) == 0) {
+ this->data.warn_extension_index = i;
+ return;
+ }
+ }
+
+ assert(!"Should not get here.");
+ this->data.warn_extension_index = 0;
}
const char *
ir_variable::get_extension_warning() const
{
- return this->warn_extension;
+ return this->data.warn_extension_index == 0
+ ? NULL : warn_extension_table[this->data.warn_extension_index];
}
ir_function_signature::ir_function_signature(const glsl_type *return_type,