diff options
author | Brian Paul <[email protected]> | 2011-04-26 14:54:41 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-04-26 14:54:41 -0600 |
commit | 6b329b9274b18c50f4177eef7ee087d50ebc1525 (patch) | |
tree | bdce359cdb3ccddf55b98778849d2be0a950464b /src/mesa/main/uniforms.c | |
parent | 37642518b8864ce751754957b08cdb437998f4e7 (diff) |
Squashed commit of the following:
commit 864fe253b04105b7469e5f7b064dc37637b944f8
Author: Brian Paul <[email protected]>
Date: Thu Apr 21 20:13:07 2011 -0600
mesa: s/exec/disp/ in _mesa_init_histogram_dispatch()
This function isn't normally compiled (FEATURE_histogram).
commit f4bf45e2b94b582cacd19cdca873c5be627e4250
Author: nobled <[email protected]>
Date: Thu Apr 21 07:53:58 2011 -0600
mesa: hook up GL_ARB_robustness dispatch functions
...and advertise the extension.
Signed-off-by: Brian Paul <[email protected]>
commit 2b89e38e5f572dc40cebc06381ae7c5d04386998
Author: nobled <[email protected]>
Date: Thu Apr 21 07:53:58 2011 -0600
mesa: regenerated API files for GL_ARB_robustness
Signed-off-by: Brian Paul <[email protected]>
commit 5d5ebfb7135cec9d833adef86cbf4d0f3d9beca8
Author: nobled <[email protected]>
Date: Thu Apr 21 07:53:57 2011 -0600
glapi: add ARB_robustness xml
Signed-off-by: Brian Paul <[email protected]>
commit 0159d1d6d99f4bbc18381dc2081c20d3aff17ac9
Author: nobled <[email protected]>
Date: Thu Apr 21 07:53:57 2011 -0600
mesa: implement GL_ARB_robustness functions
Signed-off-by: Brian Paul <[email protected]>
commit 938fd71f4c4742f274922d53492a7290ab8d9c9b
Author: nobled <[email protected]>
Date: Thu Apr 21 07:53:57 2011 -0600
mesa: add context fields for GL_ARB_robustness
Signed-off-by: Brian Paul <[email protected]>
commit 72075137bc79e65be03dac7e97b6dba93c3a86a4
Author: nobled <[email protected]>
Date: Thu Apr 21 07:53:57 2011 -0600
mesa: standardize more bounds-checking error messages
Signed-off-by: Brian Paul <[email protected]>
commit 32a3fc23746db49da903fbc08afa0135af3007d2
Author: nobled <[email protected]>
Date: Thu Apr 21 07:53:57 2011 -0600
mesa: standardize some bounds-checking error messages
Signed-off-by: Brian Paul <[email protected]>
commit cecbf1f4d164207de373dec0cadee2e84e1f9656
Author: nobled <[email protected]>
Date: Thu Apr 21 07:53:57 2011 -0600
mesa: add more bounds-checking support for client memory buffers
Signed-off-by: Brian Paul <[email protected]>
commit edc895b52383d5bd274422db56adead1d81daf5f
Author: nobled <[email protected]>
Date: Thu Apr 21 07:53:57 2011 -0600
mesa: add bounds-checking support for client memory buffers
Signed-off-by: Brian Paul <[email protected]>
commit 3a96ef28a538f158a219b406cd090dee70470c85
Author: nobled <[email protected]>
Date: Thu Apr 21 07:53:57 2011 -0600
mesa: use is_bufferobj() helper function
Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/uniforms.c')
-rw-r--r-- | src/mesa/main/uniforms.c | 106 |
1 files changed, 92 insertions, 14 deletions
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index f984ce3bc56..12fe7b5e226 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -412,11 +412,10 @@ split_location_offset(GLint *location, GLint *offset) */ static void _mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location, - GLfloat *params) + GLsizei bufSize, GLfloat *params) { struct gl_program *prog; - GLint paramPos; - GLint offset; + GLint paramPos, offset; split_location_offset(&location, &offset); @@ -426,9 +425,18 @@ _mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location, const struct gl_program_parameter *p = &prog->Parameters->Parameters[paramPos]; GLint rows, cols, i, j, k; + GLsizei numBytes; get_uniform_rows_cols(p, &rows, &cols); + numBytes = rows * cols * sizeof *params; + if (bufSize < numBytes) { + _mesa_error( ctx, GL_INVALID_OPERATION, + "glGetnUniformfvARB(out of bounds: bufSize is %d," + " but %d bytes are required)", bufSize, numBytes ); + return; + } + k = 0; for (i = 0; i < rows; i++) { const int base = paramPos + offset + i; @@ -447,11 +455,10 @@ _mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location, */ static void _mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location, - GLint *params) + GLsizei bufSize, GLint *params) { struct gl_program *prog; - GLint paramPos; - GLint offset; + GLint paramPos, offset; split_location_offset(&location, &offset); @@ -461,9 +468,18 @@ _mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location, const struct gl_program_parameter *p = &prog->Parameters->Parameters[paramPos]; GLint rows, cols, i, j, k; + GLsizei numBytes; get_uniform_rows_cols(p, &rows, &cols); + numBytes = rows * cols * sizeof *params; + if (bufSize < numBytes) { + _mesa_error( ctx, GL_INVALID_OPERATION, + "glGetnUniformivARB(out of bounds: bufSize is %d," + " but %d bytes are required)", bufSize, numBytes ); + return; + } + k = 0; for (i = 0; i < rows; i++) { const int base = paramPos + offset + i; @@ -483,11 +499,10 @@ _mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location, */ static void _mesa_get_uniformuiv(struct gl_context *ctx, GLuint program, GLint location, - GLuint *params) + GLsizei bufSize, GLuint *params) { struct gl_program *prog; - GLint paramPos; - GLint offset; + GLint paramPos, offset; split_location_offset(&location, &offset); @@ -497,9 +512,18 @@ _mesa_get_uniformuiv(struct gl_context *ctx, GLuint program, GLint location, const struct gl_program_parameter *p = &prog->Parameters->Parameters[paramPos]; GLint rows, cols, i, j, k; + GLsizei numBytes; get_uniform_rows_cols(p, &rows, &cols); + numBytes = rows * cols * sizeof *params; + if (bufSize < numBytes) { + _mesa_error( ctx, GL_INVALID_OPERATION, + "glGetnUniformuivARB(out of bounds: bufSize is %d," + " but %d bytes are required)", bufSize, numBytes ); + return; + } + k = 0; for (i = 0; i < rows; i++) { const int base = paramPos + offset + i; @@ -513,6 +537,19 @@ _mesa_get_uniformuiv(struct gl_context *ctx, GLuint program, GLint location, /** + * Called via glGetUniformdv(). + * New in GL_ARB_gpu_shader_fp64, OpenGL 4.0 + */ +static void +_mesa_get_uniformdv(struct gl_context *ctx, GLuint program, GLint location, + GLsizei bufSize, GLdouble *params) +{ + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformdvARB" + "(GL_ARB_gpu_shader_fp64 not implemented)"); +} + + +/** * Called via glGetUniformLocation(). * * The return value will encode two values, the uniform location and an @@ -1350,29 +1387,65 @@ _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, void GLAPIENTRY -_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat *params) +_mesa_GetnUniformfvARB(GLhandleARB program, GLint location, + GLsizei bufSize, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - _mesa_get_uniformfv(ctx, program, location, params); + _mesa_get_uniformfv(ctx, program, location, bufSize, params); +} + +void GLAPIENTRY +_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat *params) +{ + _mesa_GetnUniformfvARB(program, location, INT_MAX, params); } void GLAPIENTRY -_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint *params) +_mesa_GetnUniformivARB(GLhandleARB program, GLint location, + GLsizei bufSize, GLint *params) { GET_CURRENT_CONTEXT(ctx); - _mesa_get_uniformiv(ctx, program, location, params); + _mesa_get_uniformiv(ctx, program, location, bufSize, params); +} + +void GLAPIENTRY +_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint *params) +{ + _mesa_GetnUniformivARB(program, location, INT_MAX, params); } /* GL3 */ void GLAPIENTRY +_mesa_GetnUniformuivARB(GLhandleARB program, GLint location, + GLsizei bufSize, GLuint *params) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_get_uniformuiv(ctx, program, location, bufSize, params); +} + +void GLAPIENTRY _mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params) { + _mesa_GetnUniformuivARB(program, location, INT_MAX, params); +} + + +/* GL4 */ +void GLAPIENTRY +_mesa_GetnUniformdvARB(GLhandleARB program, GLint location, + GLsizei bufSize, GLdouble *params) +{ GET_CURRENT_CONTEXT(ctx); - _mesa_get_uniformuiv(ctx, program, location, params); + _mesa_get_uniformdv(ctx, program, location, bufSize, params); } +void GLAPIENTRY +_mesa_GetUniformdv(GLhandleARB program, GLint location, GLdouble *params) +{ + _mesa_GetnUniformdvARB(program, location, INT_MAX, params); +} GLint GLAPIENTRY @@ -1454,6 +1527,11 @@ _mesa_init_shader_uniform_dispatch(struct _glapi_table *exec) SET_Uniform4uivEXT(exec, _mesa_Uniform4uiv); SET_GetUniformuivEXT(exec, _mesa_GetUniformuiv); + /* GL_ARB_robustness */ + SET_GetnUniformfvARB(exec, _mesa_GetnUniformfvARB); + SET_GetnUniformivARB(exec, _mesa_GetnUniformivARB); + SET_GetnUniformuivARB(exec, _mesa_GetnUniformuivARB); + SET_GetnUniformdvARB(exec, _mesa_GetnUniformdvARB); /* GL 4.0 */ #endif /* FEATURE_GL */ } |