summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-09-20 11:03:44 -0700
committerEric Anholt <[email protected]>2013-09-23 12:45:22 -0700
commit10ef949424809d51c627008bb2feab5a067f8e08 (patch)
tree2433777d7bf49ae1642621e915c0e66fdc96a123 /src/mesa/program
parent07572621bc4515c71c56754a2bd9c7c832653d2b (diff)
glsl: Hide many classes local to individual .cpp files in anon namespaces.
This gives the compiler the chance to inline and not export class symbols even in the absence of LTO. Saves about 60kb on disk. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index c46a3d00541..d5a6a872ab5 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -57,11 +57,13 @@ extern "C" {
#include "program/sampler.h"
}
+static int swizzle_for_size(int size);
+
+namespace {
+
class src_reg;
class dst_reg;
-static int swizzle_for_size(int size);
-
/**
* This struct is a corresponding struct to Mesa prog_src_register, with
* wider fields.
@@ -129,6 +131,8 @@ public:
src_reg *reladdr;
};
+} /* anonymous namespace */
+
src_reg::src_reg(dst_reg reg)
{
this->file = reg.file;
@@ -147,6 +151,8 @@ dst_reg::dst_reg(src_reg reg)
this->reladdr = reg.reladdr;
}
+namespace {
+
class ir_to_mesa_instruction : public exec_node {
public:
DECLARE_RZALLOC_CXX_OPERATORS(ir_to_mesa_instruction)
@@ -316,6 +322,8 @@ public:
void *mem_ctx;
};
+} /* anonymous namespace */
+
static src_reg undef_src = src_reg(PROGRAM_UNDEFINED, 0, NULL);
static dst_reg undef_dst = dst_reg(PROGRAM_UNDEFINED, SWIZZLE_NOOP);
@@ -2407,6 +2415,8 @@ print_program(struct prog_instruction *mesa_instructions,
}
}
+namespace {
+
class add_uniform_to_shader : public program_resource_visitor {
public:
add_uniform_to_shader(struct gl_shader_program *shader_program,
@@ -2436,6 +2446,8 @@ private:
gl_shader_type shader_type;
};
+} /* anonymous namespace */
+
void
add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
bool row_major)