summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/link_uniforms.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <timothy.arceri@collabora.com>2016-06-02 15:32:14 +1000
committerTimothy Arceri <timothy.arceri@collabora.com>2016-06-08 13:19:32 +1000
commit8c3ecde0e18977f49b804226d7c28483e025cbcd (patch)
treea7f1f08d663d46301d295757223f85087b1b15af /src/compiler/glsl/link_uniforms.cpp
parent6e6fd911da8a1d9cd62fe0a8a4cc0fb7bdccfe02 (diff)
downloadexternal_mesa3d-8c3ecde0e18977f49b804226d7c28483e025cbcd.zip
external_mesa3d-8c3ecde0e18977f49b804226d7c28483e025cbcd.tar.gz
external_mesa3d-8c3ecde0e18977f49b804226d7c28483e025cbcd.tar.bz2
glsl: stop allocating memory for SSBOs and builtins
This just stops counting and assigning a storage location for these uniforms, the count is only used to create the uniform storage. These uniform types don't use this storage. Reviewed-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/compiler/glsl/link_uniforms.cpp')
-rw-r--r--src/compiler/glsl/link_uniforms.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
index 3a2ac4d..98ae3ad 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -402,7 +402,9 @@ private:
* uniforms.
*/
this->num_active_uniforms++;
- this->num_values += values;
+
+ if(!is_gl_identifier(name) && !is_shader_storage)
+ this->num_values += values;
}
struct string_to_uint_map *hidden_map;
@@ -762,13 +764,14 @@ private:
current_var->data.how_declared == ir_var_hidden;
this->uniforms[id].builtin = is_gl_identifier(name);
- /* Do not assign storage if the uniform is builtin */
- if (!this->uniforms[id].builtin)
- this->uniforms[id].storage = this->values;
-
this->uniforms[id].is_shader_storage =
current_var->is_in_shader_storage_block();
+ /* Do not assign storage if the uniform is builtin */
+ if (!this->uniforms[id].builtin &&
+ !this->uniforms[id].is_shader_storage)
+ this->uniforms[id].storage = this->values;
+
if (this->buffer_block_index != -1) {
this->uniforms[id].block_index = this->buffer_block_index;
@@ -819,7 +822,9 @@ private:
this->uniforms[id].row_major = false;
}
- this->values += values_for_type(type);
+ if (!this->uniforms[id].builtin &&
+ !this->uniforms[id].is_shader_storage)
+ this->values += values_for_type(type);
}
/**
@@ -1251,7 +1256,8 @@ link_assign_uniform_locations(struct gl_shader_program *prog,
#ifndef NDEBUG
for (unsigned i = 0; i < num_uniforms; i++) {
- assert(uniforms[i].storage != NULL || uniforms[i].builtin);
+ assert(uniforms[i].storage != NULL || uniforms[i].builtin ||
+ uniforms[i].is_shader_storage);
}
assert(parcel.values == data_end);