aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-04-20 19:02:28 +0200
committerSamuel Pitoiset <[email protected]>2017-04-21 10:08:32 +0200
commit862361c4f547efbbc9ff7d01b65ac43c42545db9 (patch)
treeb3ebd2a563eb84c7eab128115f2b6f967e452302 /src/compiler
parent4a0aa0b3b3c07469aeef5d627f63adda6f5bcf5a (diff)
glsl: get rid of values_for_type()
This function is actually a wrapper for component_slots() and it always returns 1 (or N) for samplers. Since component_slots() now return 1 for samplers, it can go. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/link_uniforms.cpp19
-rw-r--r--src/compiler/glsl/linker.h3
-rw-r--r--src/compiler/glsl/shader_cache.cpp4
3 files changed, 4 insertions, 22 deletions
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
index c29fbed7435..925699641e5 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -42,21 +42,6 @@
*/
#define UNMAPPED_UNIFORM_LOC ~0u
-/**
- * Count the backing storage requirements for a type
- */
-unsigned
-values_for_type(const glsl_type *type)
-{
- if (type->is_sampler()) {
- return 1;
- } else if (type->is_array() && type->fields.array->is_sampler()) {
- return type->array_size();
- } else {
- return type->component_slots();
- }
-}
-
void
program_resource_visitor::process(const glsl_type *type, const char *name)
{
@@ -351,7 +336,7 @@ private:
* uniform for multiple shader targets, but in this case we want to
* count it for each shader target.
*/
- const unsigned values = values_for_type(type);
+ const unsigned values = type->component_slots();
if (type->contains_subroutine()) {
this->num_shader_subroutines += values;
} else if (type->contains_sampler()) {
@@ -813,7 +798,7 @@ private:
if (!this->uniforms[id].builtin &&
!this->uniforms[id].is_shader_storage &&
this->buffer_block_index == -1)
- this->values += values_for_type(type);
+ this->values += type->component_slots();
}
/**
diff --git a/src/compiler/glsl/linker.h b/src/compiler/glsl/linker.h
index d06f419cf6e..dd627be5f10 100644
--- a/src/compiler/glsl/linker.h
+++ b/src/compiler/glsl/linker.h
@@ -75,9 +75,6 @@ void
validate_interstage_uniform_blocks(struct gl_shader_program *prog,
gl_linked_shader **stages);
-unsigned
-values_for_type(const glsl_type *type);
-
extern void
link_assign_atomic_counter_resources(struct gl_context *ctx,
struct gl_shader_program *prog);
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 738e5488ac2..19d69c36fc4 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -599,7 +599,7 @@ write_uniforms(struct blob *metadata, struct gl_shader_program *prog)
!prog->data->UniformStorage[i].is_shader_storage &&
prog->data->UniformStorage[i].block_index == -1) {
unsigned vec_size =
- values_for_type(prog->data->UniformStorage[i].type) *
+ prog->data->UniformStorage[i].type->component_slots() *
MAX2(prog->data->UniformStorage[i].array_elements, 1);
blob_write_bytes(metadata, prog->data->UniformStorage[i].storage,
sizeof(union gl_constant_value) * vec_size);
@@ -659,7 +659,7 @@ read_uniforms(struct blob_reader *metadata, struct gl_shader_program *prog)
!prog->data->UniformStorage[i].is_shader_storage &&
prog->data->UniformStorage[i].block_index == -1) {
unsigned vec_size =
- values_for_type(prog->data->UniformStorage[i].type) *
+ prog->data->UniformStorage[i].type->component_slots() *
MAX2(prog->data->UniformStorage[i].array_elements, 1);
blob_copy_bytes(metadata,
(uint8_t *) prog->data->UniformStorage[i].storage,