Patch fixes the slot count used by vector types and adds 1 slot
to be used by image and sampler types.
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82921
unsigned
glsl_type::uniform_locations() const
{
- if (this->is_matrix())
- return 1;
-
unsigned size = 0;
switch (this->base_type) {
+ case GLSL_TYPE_UINT:
+ case GLSL_TYPE_INT:
+ case GLSL_TYPE_FLOAT:
+ case GLSL_TYPE_BOOL:
+ case GLSL_TYPE_SAMPLER:
+ case GLSL_TYPE_IMAGE:
+ return 1;
+
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_INTERFACE:
for (unsigned i = 0; i < this->length; i++)
case GLSL_TYPE_ARRAY:
return this->length * this->fields.array->uniform_locations();
default:
- break;
+ return 0;
}
-
- /* The location count for many types match with component_slots() result,
- * all expections should be handled above.
- */
- return component_slots();
}
bool
/**
* Calculate the number of unique values from glGetUniformLocation for the
* elements of the type.
+ *
+ * This is used to allocate slots in the UniformRemapTable, the amount of
+ * locations may not match with actual used storage space by the driver.
*/
unsigned uniform_locations() const;