mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-01 13:20:25 +01:00
mesa: fix bug in get_uniform_rows_cols(): sometimes returned too many rows
This commit is contained in:
parent
753635f733
commit
ea9568dfbe
1 changed files with 13 additions and 6 deletions
|
|
@ -1108,7 +1108,8 @@ get_matrix_dims(GLenum type, GLint *rows, GLint *cols)
|
|||
|
||||
/**
|
||||
* Determine the number of rows and columns occupied by a uniform
|
||||
* according to its datatype.
|
||||
* according to its datatype. For non-matrix types (such as GL_FLOAT_VEC4),
|
||||
* the number of rows = 1 and cols = number of elements in the vector.
|
||||
*/
|
||||
static void
|
||||
get_uniform_rows_cols(const struct gl_program_parameter *p,
|
||||
|
|
@ -1117,11 +1118,17 @@ get_uniform_rows_cols(const struct gl_program_parameter *p,
|
|||
get_matrix_dims(p->DataType, rows, cols);
|
||||
if (*rows == 0 && *cols == 0) {
|
||||
/* not a matrix type, probably a float or vector */
|
||||
*rows = p->Size / 4 + 1;
|
||||
if (p->Size % 4 == 0)
|
||||
*cols = 4;
|
||||
else
|
||||
*cols = p->Size % 4;
|
||||
if (p->Size <= 4) {
|
||||
*rows = 1;
|
||||
*cols = p->Size;
|
||||
}
|
||||
else {
|
||||
*rows = p->Size / 4 + 1;
|
||||
if (p->Size % 4 == 0)
|
||||
*cols = 4;
|
||||
else
|
||||
*cols = p->Size % 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue