[Mesa-dev] [PATCH 3/5] mesa/gles3: Generate error on DrawElements* calls if transform feedback active.
Paul Berry
stereotype441 at gmail.com
Sat Dec 15 14:24:20 PST 2012
On 14 December 2012 17:26, Ian Romanick <idr at freedesktop.org> wrote:
> On 12/14/2012 01:01 PM, Paul Berry wrote:
>
>> In GLES3, only glDrawArrays() and glDrawArraysInstanced() calls are
>> allowed when transform feedback is active.
>> ---
>> src/mesa/main/api_validate.c | 45 ++++++++++++++++++++++++++++++**
>> ++++++++++++++
>> 1 file changed, 45 insertions(+)
>>
>> diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
>> index e47db23..355a93c 100644
>> --- a/src/mesa/main/api_validate.c
>> +++ b/src/mesa/main/api_validate.c
>> @@ -313,9 +313,24 @@ _mesa_validate_DrawElements(**struct gl_context
>> *ctx,
>> GLenum mode, GLsizei count, GLenum type,
>> const GLvoid *indices, GLint basevertex)
>> {
>> + struct gl_transform_feedback_object *xfb_obj
>> + = ctx->TransformFeedback.**CurrentObject;
>> ASSERT_OUTSIDE_BEGIN_END_WITH_**RETVAL(ctx, GL_FALSE);
>> FLUSH_CURRENT(ctx, 0);
>>
>> + /* From the GLES3 specification, section 2.14.2 (Transform Feedback
>> + * Primitive Capture):
>> + *
>> + * The error INVALID_OPERATION is also generated by DrawElements,
>> + * DrawElementsInstanced, and DrawRangeElements while transform
>> feedback
>> + * is active and not paused, regardless of mode.
>> + */
>> + if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
>>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^**^^^^^
>
> It seems like this predicate appears in a bunch of places. May be an
> is_active() macro to wrap it would be nice?
That's a good point. It actually appears in a number of different files in
various guises. I'll add a patch to the end of the series that makes an
inline function for it.
>
>
> + _mesa_error(ctx, GL_INVALID_OPERATION,
>> + "glDrawElements(transform feedback active)");
>> + return GL_FALSE;
>> + }
>> +
>> if (count <= 0) {
>> if (count < 0)
>> _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
>> @@ -431,9 +446,24 @@ _mesa_validate_**DrawRangeElements(struct
>> gl_context *ctx, GLenum mode,
>> GLsizei count, GLenum type,
>> const GLvoid *indices, GLint basevertex)
>> {
>> + struct gl_transform_feedback_object *xfb_obj
>> + = ctx->TransformFeedback.**CurrentObject;
>> ASSERT_OUTSIDE_BEGIN_END_WITH_**RETVAL(ctx, GL_FALSE);
>> FLUSH_CURRENT(ctx, 0);
>>
>> + /* From the GLES3 specification, section 2.14.2 (Transform Feedback
>> + * Primitive Capture):
>> + *
>> + * The error INVALID_OPERATION is also generated by DrawElements,
>> + * DrawElementsInstanced, and DrawRangeElements while transform
>> feedback
>> + * is active and not paused, regardless of mode.
>> + */
>> + if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
>> + _mesa_error(ctx, GL_INVALID_OPERATION,
>> + "glDrawElements(transform feedback active)");
>> + return GL_FALSE;
>> + }
>> +
>> if (count <= 0) {
>> if (count < 0)
>> _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)"
>> );
>> @@ -560,9 +590,24 @@ _mesa_validate_**DrawElementsInstanced(struct
>> gl_context *ctx,
>> const GLvoid *indices, GLsizei
>> numInstances,
>> GLint basevertex)
>> {
>> + struct gl_transform_feedback_object *xfb_obj
>> + = ctx->TransformFeedback.**CurrentObject;
>> ASSERT_OUTSIDE_BEGIN_END_WITH_**RETVAL(ctx, GL_FALSE);
>> FLUSH_CURRENT(ctx, 0);
>>
>> + /* From the GLES3 specification, section 2.14.2 (Transform Feedback
>> + * Primitive Capture):
>> + *
>> + * The error INVALID_OPERATION is also generated by DrawElements,
>> + * DrawElementsInstanced, and DrawRangeElements while transform
>> feedback
>> + * is active and not paused, regardless of mode.
>> + */
>> + if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
>> + _mesa_error(ctx, GL_INVALID_OPERATION,
>> + "glDrawElements(transform feedback active)");
>> + return GL_FALSE;
>> + }
>> +
>> if (count <= 0) {
>> if (count < 0)
>> _mesa_error(ctx, GL_INVALID_VALUE,
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121215/38c56113/attachment-0001.html>
More information about the mesa-dev
mailing list