summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/builtin_variables.cpp
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-01-29 11:18:11 -0500
committerRob Clark <[email protected]>2016-05-11 12:20:12 -0400
commit0e5a369879e33085fbbd2dfce4e77799c4c95d30 (patch)
tree091bdb6e0a3a80e204b6fdf2937e0ef64f934f76 /src/compiler/glsl/builtin_variables.cpp
parentdfbabc6bad775e1575ff4a97a3c871341cd57f77 (diff)
glsl: export accessor for builtin-uniform descriptors
We'll need this for a nir pass to lower builtin-uniform access. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/glsl/builtin_variables.cpp')
-rw-r--r--src/compiler/glsl/builtin_variables.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index f31f9f61ef6..cc32990fc2f 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -527,6 +527,16 @@ builtin_variable_generator::add_variable(const char *name,
return var;
}
+extern "C" const struct gl_builtin_uniform_desc *
+_mesa_glsl_get_builtin_uniform_desc(const char *name)
+{
+ for (unsigned i = 0; _mesa_builtin_uniform_desc[i].name != NULL; i++) {
+ if (strcmp(_mesa_builtin_uniform_desc[i].name, name) == 0) {
+ return &_mesa_builtin_uniform_desc[i];
+ }
+ }
+ return NULL;
+}
ir_variable *
builtin_variable_generator::add_uniform(const glsl_type *type,
@@ -534,16 +544,9 @@ builtin_variable_generator::add_uniform(const glsl_type *type,
{
ir_variable *const uni = add_variable(name, type, ir_var_uniform, -1);
- unsigned i;
- for (i = 0; _mesa_builtin_uniform_desc[i].name != NULL; i++) {
- if (strcmp(_mesa_builtin_uniform_desc[i].name, name) == 0) {
- break;
- }
- }
-
- assert(_mesa_builtin_uniform_desc[i].name != NULL);
const struct gl_builtin_uniform_desc* const statevar =
- &_mesa_builtin_uniform_desc[i];
+ _mesa_glsl_get_builtin_uniform_desc(name);
+ assert(statevar != NULL);
const unsigned array_count = type->is_array() ? type->length : 1;