summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-06-23 20:20:31 +0200
committerNicolai Hähnle <[email protected]>2017-07-05 12:25:49 +0200
commitf4f7096c1d68746a1833ba1b19d8a290a83cbdde (patch)
treee54e685018cc081613d4b46ae2a36dffe4b5645d /src/mesa
parent727e8ba1331f64f831626da7ca8961b560e58c5c (diff)
glsl: simplify add_uniform_to_shader::visit_field
Each field gets a distinct name, so we should never hit the case where the name already exists in the parameter list. Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 93c6946fd63..ac12b59d075 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2450,13 +2450,12 @@ add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
if (type->contains_opaque() && !var->data.bindless)
return;
- int index = _mesa_lookup_parameter_index(params, name);
- if (index < 0) {
- unsigned size = type_size(type) * 4;
+ assert(_mesa_lookup_parameter_index(params, name) < 0);
- index = _mesa_add_parameter(params, PROGRAM_UNIFORM, name, size,
- type->gl_type, NULL, NULL);
- }
+ unsigned size = type_size(type) * 4;
+
+ int index = _mesa_add_parameter(params, PROGRAM_UNIFORM, name, size,
+ type->gl_type, NULL, NULL);
/* The first part of the uniform that's processed determines the base
* location of the whole uniform (for structures).