mesa: move disallowed TFB in DrawElements on GLES from draws to state changes

glDrawElements is disallowed by GLES when transform feedback is active
and GS is not supported.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
This commit is contained in:
Marek Olšák
2021-01-25 13:27:01 -05:00
committed by Marge Bot
parent 1488d0a9b1
commit 3f64f3338a
+32 -33
View File
@@ -473,7 +473,39 @@ _mesa_update_valid_to_render_state(struct gl_context *ctx)
}
#endif
/* Non-indexed draws are valid after this point. */
ctx->ValidPrimMask = mask;
/* Section 2.14.2 (Transform Feedback Primitive Capture) of the OpenGL ES
* 3.1 spec says:
*
* The error INVALID_OPERATION is also generated by DrawElements,
* DrawElementsInstanced, and DrawRangeElements while transform feedback
* is active and not paused, regardless of mode.
*
* The OES_geometry_shader_spec says:
*
* Issues:
*
* ...
*
* (13) Does this extension change how transform feedback operates
* compared to unextended OpenGL ES 3.0 or 3.1?
*
* RESOLVED: Yes... Since we no longer require being able to predict how
* much geometry will be generated, we also lift the restriction that
* only DrawArray* commands are supported and also support the
* DrawElements* commands for transform feedback.
*
* This should also be reflected in the body of the spec, but that appears
* to have been overlooked. The body of the spec only explicitly allows
* the indirect versions.
*/
if (_mesa_is_gles3(ctx) &&
!_mesa_has_OES_geometry_shader(ctx) &&
_mesa_is_xfb_active_and_unpaused(ctx))
return;
ctx->ValidPrimMaskIndexed = mask;
}
@@ -546,39 +578,6 @@ validate_DrawElements_common(struct gl_context *ctx,
const GLvoid *indices,
const char *caller)
{
/* Section 2.14.2 (Transform Feedback Primitive Capture) of the OpenGL ES
* 3.1 spec says:
*
* The error INVALID_OPERATION is also generated by DrawElements,
* DrawElementsInstanced, and DrawRangeElements while transform feedback
* is active and not paused, regardless of mode.
*
* The OES_geometry_shader_spec says:
*
* Issues:
*
* ...
*
* (13) Does this extension change how transform feedback operates
* compared to unextended OpenGL ES 3.0 or 3.1?
*
* RESOLVED: Yes... Since we no longer require being able to predict how
* much geometry will be generated, we also lift the restriction that
* only DrawArray* commands are supported and also support the
* DrawElements* commands for transform feedback.
*
* This should also be reflected in the body of the spec, but that appears
* to have been overlooked. The body of the spec only explicitly allows
* the indirect versions.
*/
if (_mesa_is_gles3(ctx) &&
!_mesa_has_OES_geometry_shader(ctx) &&
_mesa_is_xfb_active_and_unpaused(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(transform feedback active)", caller);
return false;
}
if (count < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(count)", caller);
return false;