[Mesa-stable] [Mesa-dev] [PATCH 1/2] mesa: Pass the type to _mesa_uniform_matrix as a glsl_base_type
Timothy Arceri
t_arceri at yahoo.com.au
Mon Aug 31 21:33:19 PDT 2015
On Mon, 2015-08-31 at 20:56 -0700, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This matches _mesa_uniform, and it enables the bug fix in the next
> patch.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Both are: Reviewed-by: Timothy Arceri <t_arceri at yahoo.com.au>
> Cc: Dave Airlie <airlied at redhat.com>
> Cc: "10.6 11.0 <mesa-stable at lists.freedesktop.org>"
> ---
> src/mesa/main/uniform_query.cpp | 10 +++---
> src/mesa/main/uniforms.c | 72 ++++++++++++++++++++------------------
> ---
> src/mesa/main/uniforms.h | 2 +-
> 3 files changed, 42 insertions(+), 42 deletions(-)
>
> diff --git a/src/mesa/main/uniform_query.cpp
> b/src/mesa/main/uniform_query.cpp
> index 1026618..7e3a4a5 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -873,7 +873,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct
> gl_shader_program *shProg,
> GLuint cols, GLuint rows,
> GLint location, GLsizei count,
> GLboolean transpose,
> - const GLvoid *values, GLenum type)
> + const GLvoid *values, enum glsl_base_type basicType)
> {
> unsigned offset;
> unsigned vectors;
> @@ -892,8 +892,8 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct
> gl_shader_program *shProg,
> return;
> }
>
> - assert(type == GL_FLOAT || type == GL_DOUBLE);
> - size_mul = type == GL_DOUBLE ? 2 : 1;
> + assert(basicType == GLSL_TYPE_FLOAT || type == GLSL_TYPE_DOUBLE);
> + size_mul = basicType == GLSL_TYPE_DOUBLE ? 2 : 1;
>
> assert(!uni->type->is_sampler());
> vectors = uni->type->matrix_columns;
> @@ -948,7 +948,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct
> gl_shader_program *shProg,
> if (!transpose) {
> memcpy(&uni->storage[elements * offset], values,
> sizeof(uni->storage[0]) * elements * count * size_mul);
> - } else if (type == GL_FLOAT) {
> + } else if (basicType == GLSL_TYPE_FLOAT) {
> /* Copy and transpose the matrix.
> */
> const float *src = (const float *)values;
> @@ -965,7 +965,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct
> gl_shader_program *shProg,
> src += elements;
> }
> } else {
> - assert(type == GL_DOUBLE);
> + assert(basicType == GLSL_TYPE_DOUBLE);
> const double *src = (const double *)values;
> double *dst = (double *)&uni->storage[elements * offset].f;
>
> diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
> index 10819e2..973b877 100644
> --- a/src/mesa/main/uniforms.c
> +++ b/src/mesa/main/uniforms.c
> @@ -553,7 +553,7 @@ _mesa_UniformMatrix2fv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 2, 2, location, count, transpose, value, GL_FLOAT);
> + 2, 2, location, count, transpose, value,
> GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -562,7 +562,7 @@ _mesa_UniformMatrix3fv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 3, 3, location, count, transpose, value, GL_FLOAT);
> + 3, 3, location, count, transpose, value,
> GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -571,7 +571,7 @@ _mesa_UniformMatrix4fv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 4, 4, location, count, transpose, value, GL_FLOAT);
> + 4, 4, location, count, transpose, value,
> GLSL_TYPE_FLOAT);
> }
>
> /** Same as above with direct state access **/
> @@ -683,7 +683,7 @@ _mesa_ProgramUniformMatrix2fv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix2fv");
> - _mesa_uniform_matrix(ctx, shProg, 2, 2, location, count, transpose,
> value, GL_FLOAT);
> + _mesa_uniform_matrix(ctx, shProg, 2, 2, location, count, transpose,
> value, GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -694,7 +694,7 @@ _mesa_ProgramUniformMatrix3fv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix3fv");
> - _mesa_uniform_matrix(ctx, shProg, 3, 3, location, count, transpose,
> value, GL_FLOAT);
> + _mesa_uniform_matrix(ctx, shProg, 3, 3, location, count, transpose,
> value, GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -705,7 +705,7 @@ _mesa_ProgramUniformMatrix4fv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix4fv");
> - _mesa_uniform_matrix(ctx, shProg, 4, 4, location, count, transpose,
> value, GL_FLOAT);
> + _mesa_uniform_matrix(ctx, shProg, 4, 4, location, count, transpose,
> value, GLSL_TYPE_FLOAT);
> }
>
>
> @@ -718,7 +718,7 @@ _mesa_UniformMatrix2x3fv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 2, 3, location, count, transpose, value, GL_FLOAT);
> + 2, 3, location, count, transpose, value,
> GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -727,7 +727,7 @@ _mesa_UniformMatrix3x2fv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 3, 2, location, count, transpose, value, GL_FLOAT);
> + 3, 2, location, count, transpose, value,
> GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -736,7 +736,7 @@ _mesa_UniformMatrix2x4fv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 2, 4, location, count, transpose, value, GL_FLOAT);
> + 2, 4, location, count, transpose, value,
> GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -745,7 +745,7 @@ _mesa_UniformMatrix4x2fv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 4, 2, location, count, transpose, value, GL_FLOAT);
> + 4, 2, location, count, transpose, value,
> GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -754,7 +754,7 @@ _mesa_UniformMatrix3x4fv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 3, 4, location, count, transpose, value, GL_FLOAT);
> + 3, 4, location, count, transpose, value,
> GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -763,7 +763,7 @@ _mesa_UniformMatrix4x3fv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 4, 3, location, count, transpose, value, GL_FLOAT);
> + 4, 3, location, count, transpose, value,
> GLSL_TYPE_FLOAT);
> }
>
> /** Same as above with direct state access **/
> @@ -776,7 +776,7 @@ _mesa_ProgramUniformMatrix2x3fv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix2x3fv");
> - _mesa_uniform_matrix(ctx, shProg, 2, 3, location, count, transpose,
> value, GL_FLOAT);
> + _mesa_uniform_matrix(ctx, shProg, 2, 3, location, count, transpose,
> value, GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -787,7 +787,7 @@ _mesa_ProgramUniformMatrix3x2fv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix3x2fv");
> - _mesa_uniform_matrix(ctx, shProg, 3, 2, location, count, transpose,
> value, GL_FLOAT);
> + _mesa_uniform_matrix(ctx, shProg, 3, 2, location, count, transpose,
> value, GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -798,7 +798,7 @@ _mesa_ProgramUniformMatrix2x4fv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix2x4fv");
> - _mesa_uniform_matrix(ctx, shProg, 2, 4, location, count, transpose,
> value, GL_FLOAT);
> + _mesa_uniform_matrix(ctx, shProg, 2, 4, location, count, transpose,
> value, GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -809,7 +809,7 @@ _mesa_ProgramUniformMatrix4x2fv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix4x2fv");
> - _mesa_uniform_matrix(ctx, shProg, 4, 2, location, count, transpose,
> value, GL_FLOAT);
> + _mesa_uniform_matrix(ctx, shProg, 4, 2, location, count, transpose,
> value, GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -820,7 +820,7 @@ _mesa_ProgramUniformMatrix3x4fv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix3x4fv");
> - _mesa_uniform_matrix(ctx, shProg, 3, 4, location, count, transpose,
> value, GL_FLOAT);
> + _mesa_uniform_matrix(ctx, shProg, 3, 4, location, count, transpose,
> value, GLSL_TYPE_FLOAT);
> }
>
> void GLAPIENTRY
> @@ -831,7 +831,7 @@ _mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix4x3fv");
> - _mesa_uniform_matrix(ctx, shProg, 4, 3, location, count, transpose,
> value, GL_FLOAT);
> + _mesa_uniform_matrix(ctx, shProg, 4, 3, location, count, transpose,
> value, GLSL_TYPE_FLOAT);
> }
>
>
> @@ -1303,7 +1303,7 @@ _mesa_UniformMatrix2dv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 2, 2, location, count, transpose, value,
> GL_DOUBLE);
> + 2, 2, location, count, transpose, value,
> GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1312,7 +1312,7 @@ _mesa_UniformMatrix3dv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 3, 3, location, count, transpose, value,
> GL_DOUBLE);
> + 3, 3, location, count, transpose, value,
> GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1321,7 +1321,7 @@ _mesa_UniformMatrix4dv(GLint location, GLsizei count,
> GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 4, 4, location, count, transpose, value,
> GL_DOUBLE);
> + 4, 4, location, count, transpose, value,
> GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1330,7 +1330,7 @@ _mesa_UniformMatrix2x3dv(GLint location, GLsizei
> count, GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 2, 3, location, count, transpose, value,
> GL_DOUBLE);
> + 2, 3, location, count, transpose, value,
> GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1339,7 +1339,7 @@ _mesa_UniformMatrix3x2dv(GLint location, GLsizei
> count, GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 3, 2, location, count, transpose, value,
> GL_DOUBLE);
> + 3, 2, location, count, transpose, value,
> GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1348,7 +1348,7 @@ _mesa_UniformMatrix2x4dv(GLint location, GLsizei
> count, GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 2, 4, location, count, transpose, value,
> GL_DOUBLE);
> + 2, 4, location, count, transpose, value,
> GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1357,7 +1357,7 @@ _mesa_UniformMatrix4x2dv(GLint location, GLsizei
> count, GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 4, 2, location, count, transpose, value,
> GL_DOUBLE);
> + 4, 2, location, count, transpose, value,
> GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1366,7 +1366,7 @@ _mesa_UniformMatrix3x4dv(GLint location, GLsizei
> count, GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 3, 4, location, count, transpose, value,
> GL_DOUBLE);
> + 3, 4, location, count, transpose, value,
> GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1375,7 +1375,7 @@ _mesa_UniformMatrix4x3dv(GLint location, GLsizei
> count, GLboolean transpose,
> {
> GET_CURRENT_CONTEXT(ctx);
> _mesa_uniform_matrix(ctx, ctx->_Shader->ActiveProgram,
> - 4, 3, location, count, transpose, value,
> GL_DOUBLE);
> + 4, 3, location, count, transpose, value,
> GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1481,7 +1481,7 @@ _mesa_ProgramUniformMatrix2dv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix2dv");
> - _mesa_uniform_matrix(ctx, shProg, 2, 2, location, count, transpose,
> value, GL_DOUBLE);
> + _mesa_uniform_matrix(ctx, shProg, 2, 2, location, count, transpose,
> value, GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1492,7 +1492,7 @@ _mesa_ProgramUniformMatrix3dv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix3dv");
> - _mesa_uniform_matrix(ctx, shProg, 3, 3, location, count, transpose,
> value, GL_DOUBLE);
> + _mesa_uniform_matrix(ctx, shProg, 3, 3, location, count, transpose,
> value, GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1503,7 +1503,7 @@ _mesa_ProgramUniformMatrix4dv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix4dv");
> - _mesa_uniform_matrix(ctx, shProg, 4, 4, location, count, transpose,
> value, GL_DOUBLE);
> + _mesa_uniform_matrix(ctx, shProg, 4, 4, location, count, transpose,
> value, GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1514,7 +1514,7 @@ _mesa_ProgramUniformMatrix2x3dv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix2x3dv");
> - _mesa_uniform_matrix(ctx, shProg, 2, 3, location, count, transpose,
> value, GL_DOUBLE);
> + _mesa_uniform_matrix(ctx, shProg, 2, 3, location, count, transpose,
> value, GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1525,7 +1525,7 @@ _mesa_ProgramUniformMatrix3x2dv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix3x2dv");
> - _mesa_uniform_matrix(ctx, shProg, 3, 2, location, count, transpose,
> value, GL_DOUBLE);
> + _mesa_uniform_matrix(ctx, shProg, 3, 2, location, count, transpose,
> value, GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1536,7 +1536,7 @@ _mesa_ProgramUniformMatrix2x4dv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix2x4dv");
> - _mesa_uniform_matrix(ctx, shProg, 2, 4, location, count, transpose,
> value, GL_DOUBLE);
> + _mesa_uniform_matrix(ctx, shProg, 2, 4, location, count, transpose,
> value, GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1547,7 +1547,7 @@ _mesa_ProgramUniformMatrix4x2dv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix4x2dv");
> - _mesa_uniform_matrix(ctx, shProg, 4, 2, location, count, transpose,
> value, GL_DOUBLE);
> + _mesa_uniform_matrix(ctx, shProg, 4, 2, location, count, transpose,
> value, GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1558,7 +1558,7 @@ _mesa_ProgramUniformMatrix3x4dv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix3x4dv");
> - _mesa_uniform_matrix(ctx, shProg, 3, 4, location, count, transpose,
> value, GL_DOUBLE);
> + _mesa_uniform_matrix(ctx, shProg, 3, 4, location, count, transpose,
> value, GLSL_TYPE_DOUBLE);
> }
>
> void GLAPIENTRY
> @@ -1569,5 +1569,5 @@ _mesa_ProgramUniformMatrix4x3dv(GLuint program, GLint
> location, GLsizei count,
> struct gl_shader_program *shProg =
> _mesa_lookup_shader_program_err(ctx, program,
> "glProgramUniformMatrix4x3dv");
> - _mesa_uniform_matrix(ctx, shProg, 4, 3, location, count, transpose,
> value, GL_DOUBLE);
> + _mesa_uniform_matrix(ctx, shProg, 4, 3, location, count, transpose,
> value, GLSL_TYPE_DOUBLE);
> }
> diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
> index e62eaa5..c3c9c1e 100644
> --- a/src/mesa/main/uniforms.h
> +++ b/src/mesa/main/uniforms.h
> @@ -355,7 +355,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct
> gl_shader_program *shProg,
> GLuint cols, GLuint rows,
> GLint location, GLsizei count,
> GLboolean transpose,
> - const GLvoid *values, GLenum type);
> + const GLvoid *values, enum glsl_base_type basicType);
>
> void
> _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
More information about the mesa-stable
mailing list