diff options
author | Nicolai Hähnle <[email protected]> | 2017-04-13 21:06:11 +0200 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-04-24 13:11:13 +0100 |
commit | 6abdbd8b1014f3e11885fa46716f1d2b3df9e5c2 (patch) | |
tree | fb72eb5ddbaf0bfa280647f783f98b54bcd3e102 /src | |
parent | 24c05c57e45be807ee7af9764b593509b60455d5 (diff) |
mesa: extract need_xfb_remaining_prims_check
The same logic needs to be applied to glMultiDrawArrays.
Cc: [email protected]
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
(cherry picked from commit 756e9ebbdd84018382908d3556973a62dbda09ca)
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/api_validate.c | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 8f834324ad4..2e1829bb13a 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -816,25 +816,10 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, "glDrawRangeElements"); } + static bool -validate_draw_arrays(struct gl_context *ctx, const char *func, - GLenum mode, GLsizei count, GLsizei numInstances) +need_xfb_remaining_prims_check(const struct gl_context *ctx) { - struct gl_transform_feedback_object *xfb_obj - = ctx->TransformFeedback.CurrentObject; - FLUSH_CURRENT(ctx, 0); - - if (count < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "%s(count)", func); - return false; - } - - if (!_mesa_valid_prim_mode(ctx, mode, func)) - return false; - - if (!check_valid_to_render(ctx, func)) - return false; - /* From the GLES3 specification, section 2.14.2 (Transform Feedback * Primitive Capture): * @@ -862,9 +847,32 @@ validate_draw_arrays(struct gl_context *ctx, const char *func, * is removed and replaced with the GL behavior (primitives are not * written and the corresponding counter is not updated)..." */ - if (_mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx) && - !_mesa_has_OES_geometry_shader(ctx) && - !_mesa_has_OES_tessellation_shader(ctx)) { + return _mesa_is_gles3(ctx) && _mesa_is_xfb_active_and_unpaused(ctx) && + !_mesa_has_OES_geometry_shader(ctx) && + !_mesa_has_OES_tessellation_shader(ctx); +} + + +static bool +validate_draw_arrays(struct gl_context *ctx, const char *func, + GLenum mode, GLsizei count, GLsizei numInstances) +{ + FLUSH_CURRENT(ctx, 0); + + if (count < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s(count)", func); + return false; + } + + if (!_mesa_valid_prim_mode(ctx, mode, func)) + return false; + + if (!check_valid_to_render(ctx, func)) + return false; + + if (need_xfb_remaining_prims_check(ctx)) { + struct gl_transform_feedback_object *xfb_obj + = ctx->TransformFeedback.CurrentObject; size_t prim_count = vbo_count_tessellated_primitives(mode, count, numInstances); if (xfb_obj->GlesRemainingPrims < prim_count) { _mesa_error(ctx, GL_INVALID_OPERATION, |