summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2015-03-18 15:26:10 +0200
committerFrancisco Jerez <currojerez@riseup.net>2015-03-23 14:09:32 +0200
commit5bcca9f8dc34a13e34270d284bcf8a49b52bb58e (patch)
tree01e034056c465e6ddf04e9c5c0987d7a5560a758 /src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
parent132cdcc468d0e40f422dd96303a61ee231be1a92 (diff)
downloadexternal_mesa3d-5bcca9f8dc34a13e34270d284bcf8a49b52bb58e.zip
external_mesa3d-5bcca9f8dc34a13e34270d284bcf8a49b52bb58e.tar.gz
external_mesa3d-5bcca9f8dc34a13e34270d284bcf8a49b52bb58e.tar.bz2
i965/vec4: Remove broken vector size deduction in setup_builtin_uniform_values().
This seemed to be trying to deduce the number of uniform vector components from the parameter swizzle, but the algorithm would always give 4 as result. Instead grab the correct number of components from the GLSL type. Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index af909a1..e8dab02 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -756,20 +756,15 @@ vec4_visitor::setup_builtin_uniform_values(ir_variable *ir)
&this->prog->Parameters->ParameterValues[index][0];
assert(this->uniforms < uniform_array_size);
- this->uniform_vector_size[this->uniforms] = 0;
- /* Add each of the unique swizzled channels of the element.
- * This will end up matching the size of the glsl_type of this field.
- */
- int last_swiz = -1;
- for (unsigned int j = 0; j < 4; j++) {
- int swiz = GET_SWZ(slots[i].swizzle, j);
- last_swiz = swiz;
-
- stage_prog_data->param[this->uniforms * 4 + j] = &values[swiz];
- assert(this->uniforms < uniform_array_size);
- if (swiz <= last_swiz)
- this->uniform_vector_size[this->uniforms]++;
- }
+
+ for (unsigned j = 0; j < 4; j++)
+ stage_prog_data->param[this->uniforms * 4 + j] =
+ &values[GET_SWZ(slots[i].swizzle, j)];
+
+ this->uniform_vector_size[this->uniforms] =
+ (ir->type->is_scalar() || ir->type->is_vector() ||
+ ir->type->is_matrix() ? ir->type->vector_elements : 4);
+
this->uniforms++;
}
}