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/eval.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/eval.c')
-rw-r--r-- | src/mesa/main/eval.c | 95 |
1 files changed, 92 insertions, 3 deletions
diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 9ab55072f00..e651715f788 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -545,7 +545,7 @@ _mesa_Map2d( GLenum target, static void GLAPIENTRY -_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) +_mesa_GetnMapdvARB( GLenum target, GLenum query, GLsizei bufSize, GLdouble *v ) { GET_CURRENT_CONTEXT(ctx); struct gl_1d_map *map1d; @@ -553,6 +553,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) GLint i, n; GLfloat *data; GLuint comps; + GLsizei numBytes; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -577,6 +578,9 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) n = map2d->Uorder * map2d->Vorder * comps; } if (data) { + numBytes = n * sizeof *v; + if (bufSize < numBytes) + goto overflow; for (i=0;i<n;i++) { v[i] = data[i]; } @@ -584,19 +588,31 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) break; case GL_ORDER: if (map1d) { + numBytes = 1 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = (GLdouble) map1d->Order; } else { + numBytes = 2 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = (GLdouble) map2d->Uorder; v[1] = (GLdouble) map2d->Vorder; } break; case GL_DOMAIN: if (map1d) { + numBytes = 2 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = (GLdouble) map1d->u1; v[1] = (GLdouble) map1d->u2; } else { + numBytes = 4 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = (GLdouble) map2d->u1; v[1] = (GLdouble) map2d->u2; v[2] = (GLdouble) map2d->v1; @@ -606,11 +622,22 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" ); } + return; + +overflow: + _mesa_error( ctx, GL_INVALID_OPERATION, + "glGetnMapdvARB(out of bounds: bufSize is %d," + " but %d bytes are required)", bufSize, numBytes ); } +static void GLAPIENTRY +_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) +{ + _mesa_GetnMapdvARB(target, query, INT_MAX, v); +} static void GLAPIENTRY -_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) +_mesa_GetnMapfvARB( GLenum target, GLenum query, GLsizei bufSize, GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); struct gl_1d_map *map1d; @@ -618,6 +645,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) GLint i, n; GLfloat *data; GLuint comps; + GLsizei numBytes; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -642,6 +670,9 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) n = map2d->Uorder * map2d->Vorder * comps; } if (data) { + numBytes = n * sizeof *v; + if (bufSize < numBytes) + goto overflow; for (i=0;i<n;i++) { v[i] = data[i]; } @@ -649,19 +680,31 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) break; case GL_ORDER: if (map1d) { + numBytes = 1 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = (GLfloat) map1d->Order; } else { + numBytes = 2 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = (GLfloat) map2d->Uorder; v[1] = (GLfloat) map2d->Vorder; } break; case GL_DOMAIN: if (map1d) { + numBytes = 2 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = map1d->u1; v[1] = map1d->u2; } else { + numBytes = 4 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = map2d->u1; v[1] = map2d->u2; v[2] = map2d->v1; @@ -671,11 +714,24 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" ); } + return; + +overflow: + _mesa_error( ctx, GL_INVALID_OPERATION, + "glGetnMapfvARB(out of bounds: bufSize is %d," + " but %d bytes are required)", bufSize, numBytes ); } static void GLAPIENTRY -_mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) +_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) +{ + _mesa_GetnMapfvARB(target, query, INT_MAX, v); +} + + +static void GLAPIENTRY +_mesa_GetnMapivARB( GLenum target, GLenum query, GLsizei bufSize, GLint *v ) { GET_CURRENT_CONTEXT(ctx); struct gl_1d_map *map1d; @@ -683,6 +739,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) GLuint i, n; GLfloat *data; GLuint comps; + GLsizei numBytes; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -707,6 +764,9 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) n = map2d->Uorder * map2d->Vorder * comps; } if (data) { + numBytes = n * sizeof *v; + if (bufSize < numBytes) + goto overflow; for (i=0;i<n;i++) { v[i] = IROUND(data[i]); } @@ -714,19 +774,31 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) break; case GL_ORDER: if (map1d) { + numBytes = 1 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = map1d->Order; } else { + numBytes = 2 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = map2d->Uorder; v[1] = map2d->Vorder; } break; case GL_DOMAIN: if (map1d) { + numBytes = 2 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = IROUND(map1d->u1); v[1] = IROUND(map1d->u2); } else { + numBytes = 4 * sizeof *v; + if (bufSize < numBytes) + goto overflow; v[0] = IROUND(map2d->u1); v[1] = IROUND(map2d->u2); v[2] = IROUND(map2d->v1); @@ -736,9 +808,21 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" ); } + return; + +overflow: + _mesa_error( ctx, GL_INVALID_OPERATION, + "glGetnMapivARB(out of bounds: bufSize is %d," + " but %d bytes are required)", bufSize, numBytes ); } +static void GLAPIENTRY +_mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) +{ + _mesa_GetnMapivARB(target, query, INT_MAX, v); +} + static void GLAPIENTRY _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) @@ -832,6 +916,11 @@ _mesa_init_eval_dispatch(struct _glapi_table *disp) SET_MapGrid1f(disp, _mesa_MapGrid1f); SET_MapGrid2d(disp, _mesa_MapGrid2d); SET_MapGrid2f(disp, _mesa_MapGrid2f); + + /* GL_ARB_robustness */ + SET_GetnMapdvARB(disp, _mesa_GetnMapdvARB); + SET_GetnMapfvARB(disp, _mesa_GetnMapfvARB); + SET_GetnMapivARB(disp, _mesa_GetnMapivARB); } |