Commit bddb4f9e authored by Marek Olšák's avatar Marek Olšák Committed by Marge Bot

mesa: compute gl_program_parameter_list::UniformBytes accurately

The previous code didn't do it correctly.
(e.g.  _mesa_recompute_parameter_bounds didn't do anything)
Reviewed-by: Zoltán Böszörményi's avatarZoltán Böszörményi <zboszor@gmail.com>
Part-of: <mesa/mesa!8183>
parent fb73058a
......@@ -336,7 +336,9 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
if (type == PROGRAM_UNIFORM || type == PROGRAM_CONSTANT) {
paramList->UniformBytes =
MAX2(paramList->UniformBytes, paramList->NumParameterValues * 4);
MAX2(paramList->UniformBytes,
(paramList->Parameters[oldNum].ValueOffset +
paramList->Parameters[oldNum].Size) * 4);
} else if (type == PROGRAM_STATE_VAR) {
paramList->FirstStateVarIndex =
MIN2(paramList->FirstStateVarIndex, oldNum);
......@@ -457,6 +459,7 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
void
_mesa_recompute_parameter_bounds(struct gl_program_parameter_list *list)
{
list->UniformBytes = 0;
list->FirstStateVarIndex = INT_MAX;
list->LastStateVarIndex = 0;
......@@ -465,7 +468,9 @@ _mesa_recompute_parameter_bounds(struct gl_program_parameter_list *list)
list->FirstStateVarIndex = MIN2(list->FirstStateVarIndex, i);
list->LastStateVarIndex = MAX2(list->LastStateVarIndex, i);
} else {
list->UniformBytes = MAX2(list->UniformBytes, list->NumParameterValues * 4);
list->UniformBytes = MAX2(list->UniformBytes,
(list->Parameters[i].ValueOffset +
list->Parameters[i].Size) * 4);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment