[Mesa-dev] [PATCH 3/6] main: Added entry point for glTransformFeedbackBufferRange
v2: review from Laura Ekstrand - use the refactored code to lookup the objects - improve some error messages - factor out the gl method name computation - better handle the spec differences between the DSA and non-DSA cases - quote the spec a little more v3: review from Laura Ekstrand - use the new name of _mesa_lookup_bufferobj_err - swap the comments around the offset and size checks v4: review from Laura Ekstrand - add more spec quotes - properly fix the comments around the offset and size checks Signed-off-by: Martin Peres --- src/mapi/glapi/gen/ARB_direct_state_access.xml | 8 +++ src/mesa/main/bufferobj.c | 3 +- src/mesa/main/tests/dispatch_sanity.cpp| 1 + src/mesa/main/transformfeedback.c | 98 +- src/mesa/main/transformfeedback.h | 6 +- 5 files changed, 97 insertions(+), 19 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml index 35d6906..b3c090f 100644 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -20,6 +20,14 @@ + + + + + + + + diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 86532ea..7558e17 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -3548,7 +3548,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index, case GL_TRANSFORM_FEEDBACK_BUFFER: _mesa_bind_buffer_range_transform_feedback(ctx, ctx->TransformFeedback.CurrentObject, - index, bufObj, offset, size); + index, bufObj, offset, size, + false); return; case GL_UNIFORM_BUFFER: bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size); diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 183755f..87f7d6f 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -957,6 +957,7 @@ const struct function gl_core_functions_possible[] = { /* GL_ARB_direct_state_access */ { "glCreateTransformFeedbacks", 45, -1 }, { "glTransformFeedbackBufferBase", 45, -1 }, + { "glTransformFeedbackBufferRange", 45, -1 }, { "glCreateTextures", 45, -1 }, { "glTextureStorage1D", 45, -1 }, { "glTextureStorage2D", 45, -1 }, diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index d932943..2dded21 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -541,7 +541,8 @@ bind_buffer_range(struct gl_context *ctx, /** * Specify a buffer object to receive transform feedback results. Plus, * specify the starting offset to place the results, and max size. - * Called from the glBindBufferRange() function. + * Called from the glBindBufferRange() and glTransformFeedbackBufferRange + * functions. */ void _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, @@ -549,35 +550,74 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, GLuint index, struct gl_buffer_object *bufObj, GLintptr offset, - GLsizeiptr size) + GLsizeiptr size, + bool dsa) { + const char *gl_methd_name; + if (dsa) + gl_methd_name = "glTransformFeedbackBufferRange"; + else + gl_methd_name = "glBindBufferRange"; + + if (obj->Active) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBindBufferRange(transform feedback active)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(transform feedback active)", + gl_methd_name); return; } if (index >= ctx->Const.MaxTransformFeedbackBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d " - "out of bounds)", index); + /* OpenGL 4.5 core profile, 6.1, pdf page 82: An INVALID_VALUE error is + * generated if index is greater than or equal to the number of binding + * points for transform feedback, as described in section 6.7.1. + */ + _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%d out of bounds)", + gl_methd_name, index); return; } if (size & 0x3) { - /* must a multiple of four */ - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", - (int) size); + /* OpenGL 4.5 core profile, 6.7, pdf page 103: multiple of 4 */ + _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d must be a multiple of " + "four)", gl_me
Re: [Mesa-dev] [PATCH 3/6] main: Added entry point for glTransformFeedbackBufferRange
On 02/02/15 23:51, Laura Ekstrand wrote: On Mon, Feb 2, 2015 at 3:30 AM, Martin Peres mailto:martin.pe...@linux.intel.com>> wrote: if (index >= ctx->Const.MaxTransformFeedbackBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d " - "out of bounds)", index); + /* An INVALID_VALUE error is generated if index is greater than or equal + * to the number of binding points for transform feedback, as described + * in section 6.7.1. Include the spec (I presume OpenGL 4.5 core). Done, thanks + */ + _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%d out of bounds)", + gl_methd_name, index); return; } if (size & 0x3) { - /* must a multiple of four */ - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", - (int) size); + /* must a be multiple of four */ + _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d must be a multiple of " + "four)", gl_methd_name, (int) size); return; } if (offset & 0x3) { /* must be multiple of four */ - _mesa_error(ctx, GL_INVALID_VALUE, - "glBindBufferRange(offset=%d)", (int) offset); + _mesa_error(ctx, GL_INVALID_VALUE, "gl%s(offset=%d must be a multiple " + "of four)", gl_methd_name, (int) offset); return; - } + } + + if (offset < 0) { + /* An INVALID_VALUE error is generated by BindBufferRange if buffer is + * non-zero and size is less than or equal to zero. They're still mixed up.^^ It says size instead of offset. I'm so sorry! I fixed it properly now! ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/6] main: Added entry point for glTransformFeedbackBufferRange
On Mon, Feb 2, 2015 at 3:30 AM, Martin Peres wrote: > v2: review from Laura Ekstrand > - use the refactored code to lookup the objects > - improve some error messages > - factor out the gl method name computation > - better handle the spec differences between the DSA and non-DSA cases > - quote the spec a little more > > v3: review from Laura Ekstrand > - use the new name of _mesa_lookup_bufferobj_err > - swap the comments around the offset and size checks > > Signed-off-by: Martin Peres > --- > src/mapi/glapi/gen/ARB_direct_state_access.xml | 8 +++ > src/mesa/main/bufferobj.c | 3 +- > src/mesa/main/tests/dispatch_sanity.cpp| 1 + > src/mesa/main/transformfeedback.c | 94 > +- > src/mesa/main/transformfeedback.h | 6 +- > 5 files changed, 94 insertions(+), 18 deletions(-) > > diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml > b/src/mapi/glapi/gen/ARB_direct_state_access.xml > index 35d6906..b3c090f 100644 > --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml > +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml > @@ -20,6 +20,14 @@ > > > > + > + > + > + > + > + > + > + > > > > diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c > index 86532ea..7558e17 100644 > --- a/src/mesa/main/bufferobj.c > +++ b/src/mesa/main/bufferobj.c > @@ -3548,7 +3548,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index, > case GL_TRANSFORM_FEEDBACK_BUFFER: >_mesa_bind_buffer_range_transform_feedback(ctx, > > ctx->TransformFeedback.CurrentObject, > - index, bufObj, offset, > size); > + index, bufObj, offset, > size, > + false); >return; > case GL_UNIFORM_BUFFER: >bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size); > diff --git a/src/mesa/main/tests/dispatch_sanity.cpp > b/src/mesa/main/tests/dispatch_sanity.cpp > index 166401a..3b34f7b 100644 > --- a/src/mesa/main/tests/dispatch_sanity.cpp > +++ b/src/mesa/main/tests/dispatch_sanity.cpp > @@ -957,6 +957,7 @@ const struct function gl_core_functions_possible[] = { > /* GL_ARB_direct_state_access */ > { "glCreateTransformFeedbacks", 45, -1 }, > { "glTransformFeedbackBufferBase", 45, -1 }, > + { "glTransformFeedbackBufferRange", 45, -1 }, > { "glCreateTextures", 45, -1 }, > { "glTextureStorage1D", 45, -1 }, > { "glTextureStorage2D", 45, -1 }, > diff --git a/src/mesa/main/transformfeedback.c > b/src/mesa/main/transformfeedback.c > index 268360b..45d2043 100644 > --- a/src/mesa/main/transformfeedback.c > +++ b/src/mesa/main/transformfeedback.c > @@ -541,7 +541,8 @@ bind_buffer_range(struct gl_context *ctx, > /** > * Specify a buffer object to receive transform feedback results. Plus, > * specify the starting offset to place the results, and max size. > - * Called from the glBindBufferRange() function. > + * Called from the glBindBufferRange() and glTransformFeedbackBufferRange > + * functions. > */ > void > _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, > @@ -549,35 +550,72 @@ _mesa_bind_buffer_range_transform_feedback(struct > gl_context *ctx, > GLuint index, > struct gl_buffer_object > *bufObj, > GLintptr offset, > - GLsizeiptr size) > + GLsizeiptr size, > + bool dsa) > { > + const char *gl_methd_name; > ^^^ A shorter name, perhaps? > + if (dsa) > + gl_methd_name = "glTransformFeedbackBufferRange"; > + else > + gl_methd_name = "glBindBufferRange"; > + > + > if (obj->Active) { > - _mesa_error(ctx, GL_INVALID_OPERATION, > - "glBindBufferRange(transform feedback active)"); > + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(transform feedback > active)", > + gl_methd_name); >return; > } > > if (index >= ctx->Const.MaxTransformFeedbackBuffers) { > - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d " > - "out of bounds)", index); > + /* An INVALID_VALUE error is generated if index is greater than or > equal > + * to the number of binding points for transform feedback, as > described > + * in section 6.7.1. > Include the spec (I presume OpenGL 4.5 core). > + */ > + _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%d out of bounds)", > + gl_methd_name, index); >return; > } > > if (size & 0x3) { > - /* must a multiple of four */ > - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", >
[Mesa-dev] [PATCH 3/6] main: Added entry point for glTransformFeedbackBufferRange
v2: review from Laura Ekstrand - use the refactored code to lookup the objects - improve some error messages - factor out the gl method name computation - better handle the spec differences between the DSA and non-DSA cases - quote the spec a little more v3: review from Laura Ekstrand - use the new name of _mesa_lookup_bufferobj_err - swap the comments around the offset and size checks Signed-off-by: Martin Peres --- src/mapi/glapi/gen/ARB_direct_state_access.xml | 8 +++ src/mesa/main/bufferobj.c | 3 +- src/mesa/main/tests/dispatch_sanity.cpp| 1 + src/mesa/main/transformfeedback.c | 94 +- src/mesa/main/transformfeedback.h | 6 +- 5 files changed, 94 insertions(+), 18 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml index 35d6906..b3c090f 100644 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -20,6 +20,14 @@ + + + + + + + + diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 86532ea..7558e17 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -3548,7 +3548,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index, case GL_TRANSFORM_FEEDBACK_BUFFER: _mesa_bind_buffer_range_transform_feedback(ctx, ctx->TransformFeedback.CurrentObject, - index, bufObj, offset, size); + index, bufObj, offset, size, + false); return; case GL_UNIFORM_BUFFER: bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size); diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 166401a..3b34f7b 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -957,6 +957,7 @@ const struct function gl_core_functions_possible[] = { /* GL_ARB_direct_state_access */ { "glCreateTransformFeedbacks", 45, -1 }, { "glTransformFeedbackBufferBase", 45, -1 }, + { "glTransformFeedbackBufferRange", 45, -1 }, { "glCreateTextures", 45, -1 }, { "glTextureStorage1D", 45, -1 }, { "glTextureStorage2D", 45, -1 }, diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 268360b..45d2043 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -541,7 +541,8 @@ bind_buffer_range(struct gl_context *ctx, /** * Specify a buffer object to receive transform feedback results. Plus, * specify the starting offset to place the results, and max size. - * Called from the glBindBufferRange() function. + * Called from the glBindBufferRange() and glTransformFeedbackBufferRange + * functions. */ void _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, @@ -549,35 +550,72 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, GLuint index, struct gl_buffer_object *bufObj, GLintptr offset, - GLsizeiptr size) + GLsizeiptr size, + bool dsa) { + const char *gl_methd_name; + if (dsa) + gl_methd_name = "glTransformFeedbackBufferRange"; + else + gl_methd_name = "glBindBufferRange"; + + if (obj->Active) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBindBufferRange(transform feedback active)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(transform feedback active)", + gl_methd_name); return; } if (index >= ctx->Const.MaxTransformFeedbackBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d " - "out of bounds)", index); + /* An INVALID_VALUE error is generated if index is greater than or equal + * to the number of binding points for transform feedback, as described + * in section 6.7.1. + */ + _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%d out of bounds)", + gl_methd_name, index); return; } if (size & 0x3) { - /* must a multiple of four */ - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", - (int) size); + /* must a be multiple of four */ + _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d must be a multiple of " + "four)", gl_methd_name, (int) size); return; } if (offset & 0x3) { /* must be multiple of four */ - _mesa_error(ctx, GL_INVALID_VALUE, - "glBindBufferRange(o
Re: [Mesa-dev] [PATCH 3/6] main: Added entry point for glTransformFeedbackBufferRange
On Thu, Jan 29, 2015 at 4:55 AM, Martin Peres wrote: > v2: review from Laura Ekstrand > - use the refactored code to lookup the objects > - improve some error messages > - factor out the gl method name computation > - better handle the spec differences between the DSA and non-DSA cases > - quote the spec a little more > > Signed-off-by: Martin Peres > --- > src/mapi/glapi/gen/ARB_direct_state_access.xml | 8 +++ > src/mesa/main/bufferobj.c | 3 +- > src/mesa/main/tests/dispatch_sanity.cpp| 1 + > src/mesa/main/transformfeedback.c | 94 > +- > src/mesa/main/transformfeedback.h | 6 +- > 5 files changed, 94 insertions(+), 18 deletions(-) > > diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml > b/src/mapi/glapi/gen/ARB_direct_state_access.xml > index 35d6906..b3c090f 100644 > --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml > +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml > @@ -20,6 +20,14 @@ > > > > + > + > + > + > + > + > + > + > > > > diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c > index 86532ea..7558e17 100644 > --- a/src/mesa/main/bufferobj.c > +++ b/src/mesa/main/bufferobj.c > @@ -3548,7 +3548,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index, > case GL_TRANSFORM_FEEDBACK_BUFFER: >_mesa_bind_buffer_range_transform_feedback(ctx, > > ctx->TransformFeedback.CurrentObject, > - index, bufObj, offset, > size); > + index, bufObj, offset, > size, > + false); >return; > case GL_UNIFORM_BUFFER: >bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size); > diff --git a/src/mesa/main/tests/dispatch_sanity.cpp > b/src/mesa/main/tests/dispatch_sanity.cpp > index 166401a..3b34f7b 100644 > --- a/src/mesa/main/tests/dispatch_sanity.cpp > +++ b/src/mesa/main/tests/dispatch_sanity.cpp > @@ -957,6 +957,7 @@ const struct function gl_core_functions_possible[] = { > /* GL_ARB_direct_state_access */ > { "glCreateTransformFeedbacks", 45, -1 }, > { "glTransformFeedbackBufferBase", 45, -1 }, > + { "glTransformFeedbackBufferRange", 45, -1 }, > { "glCreateTextures", 45, -1 }, > { "glTextureStorage1D", 45, -1 }, > { "glTextureStorage2D", 45, -1 }, > diff --git a/src/mesa/main/transformfeedback.c > b/src/mesa/main/transformfeedback.c > index 6583974..7564b6f 100644 > --- a/src/mesa/main/transformfeedback.c > +++ b/src/mesa/main/transformfeedback.c > @@ -541,7 +541,8 @@ bind_buffer_range(struct gl_context *ctx, > /** > * Specify a buffer object to receive transform feedback results. Plus, > * specify the starting offset to place the results, and max size. > - * Called from the glBindBufferRange() function. > + * Called from the glBindBufferRange() and glTransformFeedbackBufferRange > + * functions. > */ > void > _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, > @@ -549,35 +550,72 @@ _mesa_bind_buffer_range_transform_feedback(struct > gl_context *ctx, > GLuint index, > struct gl_buffer_object > *bufObj, > GLintptr offset, > - GLsizeiptr size) > + GLsizeiptr size, > + bool dsa) > { > + const char *gl_methd_name; > + if (dsa) > + gl_methd_name = "glTransformFeedbackBufferRange"; > + else > + gl_methd_name = "glBindBufferRange"; > + > + > if (obj->Active) { > - _mesa_error(ctx, GL_INVALID_OPERATION, > - "glBindBufferRange(transform feedback active)"); > + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(transform feedback > active)", > + gl_methd_name); >return; > } > > if (index >= ctx->Const.MaxTransformFeedbackBuffers) { > - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d " > - "out of bounds)", index); > + /* An INVALID_VALUE error is generated if index is greater than or > equal > + * to the number of binding points for transform feedback, as > described > + * in section 6.7.1. > + */ > + _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%d out of bounds)", > + gl_methd_name, index); >return; > } > > if (size & 0x3) { > - /* must a multiple of four */ > - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", > - (int) size); > + /* must a be multiple of four */ > + _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d must be a multiple > of " > + "four)", gl_methd_name, (int) size); >return; > } > > if (offset & 0x3) {
[Mesa-dev] [PATCH 3/6] main: Added entry point for glTransformFeedbackBufferRange
v2: review from Laura Ekstrand - use the refactored code to lookup the objects - improve some error messages - factor out the gl method name computation - better handle the spec differences between the DSA and non-DSA cases - quote the spec a little more Signed-off-by: Martin Peres --- src/mapi/glapi/gen/ARB_direct_state_access.xml | 8 +++ src/mesa/main/bufferobj.c | 3 +- src/mesa/main/tests/dispatch_sanity.cpp| 1 + src/mesa/main/transformfeedback.c | 94 +- src/mesa/main/transformfeedback.h | 6 +- 5 files changed, 94 insertions(+), 18 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml index 35d6906..b3c090f 100644 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -20,6 +20,14 @@ + + + + + + + + diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 86532ea..7558e17 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -3548,7 +3548,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index, case GL_TRANSFORM_FEEDBACK_BUFFER: _mesa_bind_buffer_range_transform_feedback(ctx, ctx->TransformFeedback.CurrentObject, - index, bufObj, offset, size); + index, bufObj, offset, size, + false); return; case GL_UNIFORM_BUFFER: bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size); diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 166401a..3b34f7b 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -957,6 +957,7 @@ const struct function gl_core_functions_possible[] = { /* GL_ARB_direct_state_access */ { "glCreateTransformFeedbacks", 45, -1 }, { "glTransformFeedbackBufferBase", 45, -1 }, + { "glTransformFeedbackBufferRange", 45, -1 }, { "glCreateTextures", 45, -1 }, { "glTextureStorage1D", 45, -1 }, { "glTextureStorage2D", 45, -1 }, diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 6583974..7564b6f 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -541,7 +541,8 @@ bind_buffer_range(struct gl_context *ctx, /** * Specify a buffer object to receive transform feedback results. Plus, * specify the starting offset to place the results, and max size. - * Called from the glBindBufferRange() function. + * Called from the glBindBufferRange() and glTransformFeedbackBufferRange + * functions. */ void _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, @@ -549,35 +550,72 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, GLuint index, struct gl_buffer_object *bufObj, GLintptr offset, - GLsizeiptr size) + GLsizeiptr size, + bool dsa) { + const char *gl_methd_name; + if (dsa) + gl_methd_name = "glTransformFeedbackBufferRange"; + else + gl_methd_name = "glBindBufferRange"; + + if (obj->Active) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBindBufferRange(transform feedback active)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(transform feedback active)", + gl_methd_name); return; } if (index >= ctx->Const.MaxTransformFeedbackBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d " - "out of bounds)", index); + /* An INVALID_VALUE error is generated if index is greater than or equal + * to the number of binding points for transform feedback, as described + * in section 6.7.1. + */ + _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%d out of bounds)", + gl_methd_name, index); return; } if (size & 0x3) { - /* must a multiple of four */ - _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", - (int) size); + /* must a be multiple of four */ + _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d must be a multiple of " + "four)", gl_methd_name, (int) size); return; } if (offset & 0x3) { /* must be multiple of four */ - _mesa_error(ctx, GL_INVALID_VALUE, - "glBindBufferRange(offset=%d)", (int) offset); + _mesa_error(ctx, GL_INVALID_VALUE, "gl%s(offset=%d must be a multiple " + "of four)"