[Mesa-dev] [PATCH 2/2] mesa: Drop the always-software-primitive-restart paths.
Rob Clark
robdclark at gmail.com
Mon Sep 29 17:59:01 PDT 2014
On Thu, Sep 4, 2014 at 7:43 PM, Eric Anholt <eric at anholt.net> wrote:
> The core sw primitive restart code is still around, because i965 uses it
> in some cases, but there are no drivers that want it on all the time.
Reviewed-by: Rob Clark <robdclark at gmail.com
> ---
> src/mesa/drivers/dri/i965/brw_primitive_restart.c | 8 ----
> src/mesa/main/context.c | 3 --
> src/mesa/main/mtypes.h | 5 ---
> src/mesa/vbo/vbo_exec_array.c | 46 +++--------------------
> src/mesa/vbo/vbo_primitive_restart.c | 4 +-
> 5 files changed, 8 insertions(+), 58 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> index 2d654f6..f7764e1 100644
> --- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> +++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> @@ -138,14 +138,6 @@ brw_handle_primitive_restart(struct gl_context *ctx,
> return GL_FALSE;
> }
>
> - /* If the driver has requested software handling of primitive restarts,
> - * then the VBO module has already taken care of things, and we can
> - * just draw as normal.
> - */
> - if (ctx->Const.PrimitiveRestartInSoftware) {
> - return GL_FALSE;
> - }
> -
> /* If we have set the in_progress flag, then we are in the middle
> * of handling the primitive restart draw.
> */
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index fbdbd68..ba8d00d 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -684,9 +684,6 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api)
> /* GL_ARB_robustness */
> consts->ResetStrategy = GL_NO_RESET_NOTIFICATION_ARB;
>
> - /* PrimitiveRestart */
> - consts->PrimitiveRestartInSoftware = GL_FALSE;
> -
> /* ES 3.0 or ARB_ES3_compatibility */
> consts->MaxElementIndex = 0xffffffffu;
>
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 4fb30ff..3c8f24f 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -3471,11 +3471,6 @@ struct gl_constants
> GLboolean GLSLSkipStrictMaxUniformLimitCheck;
>
> /**
> - * Force software support for primitive restart in the VBO module.
> - */
> - GLboolean PrimitiveRestartInSoftware;
> -
> - /**
> * Always use the GetTransformFeedbackVertexCount() driver hook, rather
> * than passing the transform feedback object to the drawing function.
> */
> diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
> index 22557e1..1ab3e23 100644
> --- a/src/mesa/vbo/vbo_exec_array.c
> +++ b/src/mesa/vbo/vbo_exec_array.c
> @@ -562,38 +562,6 @@ vbo_bind_arrays(struct gl_context *ctx)
> }
> }
>
> -
> -/**
> - * Handle a draw case that potentially has primitive restart enabled.
> - *
> - * If primitive restart is enabled, and PrimitiveRestartInSoftware is
> - * set, then vbo_sw_primitive_restart is used to handle the primitive
> - * restart case in software.
> - */
> -static void
> -vbo_handle_primitive_restart(struct gl_context *ctx,
> - const struct _mesa_prim *prim,
> - GLuint nr_prims,
> - const struct _mesa_index_buffer *ib,
> - GLboolean index_bounds_valid,
> - GLuint min_index,
> - GLuint max_index)
> -{
> - struct vbo_context *vbo = vbo_context(ctx);
> -
> - if (ctx->Const.PrimitiveRestartInSoftware &&
> - ctx->Array._PrimitiveRestart &&
> - (ib != NULL)) {
> - /* Handle primitive restart in software */
> - vbo_sw_primitive_restart(ctx, prim, nr_prims, ib, NULL);
> - } else {
> - /* Call driver directly for draw_prims */
> - vbo->draw_prims(ctx, prim, nr_prims, ib,
> - index_bounds_valid, min_index, max_index, NULL, NULL);
> - }
> -}
> -
> -
> /**
> * Helper function called by the other DrawArrays() functions below.
> * This is where we handle primitive restart for drawing non-indexed
> @@ -1011,8 +979,8 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
> */
>
> check_buffers_are_unmapped(exec->array.inputs);
> - vbo_handle_primitive_restart(ctx, prim, 1, &ib,
> - index_bounds_valid, start, end);
> + vbo->draw_prims(ctx, prim, 1, &ib,
> + index_bounds_valid, start, end, NULL, NULL);
>
> if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
> _mesa_flush(ctx);
> @@ -1386,8 +1354,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
> }
>
> check_buffers_are_unmapped(exec->array.inputs);
> - vbo_handle_primitive_restart(ctx, prim, primcount, &ib,
> - GL_FALSE, ~0, ~0);
> + vbo->draw_prims(ctx, prim, primcount, &ib,
> + false, ~0, ~0, NULL, NULL);
> } else {
> /* render one prim at a time */
> for (i = 0; i < primcount; i++) {
> @@ -1415,8 +1383,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
> prim[0].basevertex = 0;
>
> check_buffers_are_unmapped(exec->array.inputs);
> - vbo_handle_primitive_restart(ctx, prim, 1, &ib,
> - GL_FALSE, ~0, ~0);
> + vbo->draw_prims(ctx, prim, 1, &ib,
> + false, ~0, ~0, NULL, NULL);
> }
> }
>
> @@ -1478,8 +1446,6 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
>
> if (ctx->Driver.GetTransformFeedbackVertexCount &&
> (ctx->Const.AlwaysUseGetTransformFeedbackVertexCount ||
> - (ctx->Const.PrimitiveRestartInSoftware &&
> - ctx->Array._PrimitiveRestart) ||
> !vbo_all_varyings_in_vbos(exec->array.inputs))) {
> GLsizei n = ctx->Driver.GetTransformFeedbackVertexCount(ctx, obj, stream);
> vbo_draw_arrays(ctx, mode, 0, n, numInstances, 0);
> diff --git a/src/mesa/vbo/vbo_primitive_restart.c b/src/mesa/vbo/vbo_primitive_restart.c
> index 25c8966..562dedc 100644
> --- a/src/mesa/vbo/vbo_primitive_restart.c
> +++ b/src/mesa/vbo/vbo_primitive_restart.c
> @@ -41,8 +41,8 @@
>
> /*
> * Notes on primitive restart:
> - * The code below is used when the driver does not support primitive
> - * restart itself. (ctx->Const.PrimitiveRestartInSoftware == GL_TRUE)
> + * The code below is used when the driver does not fully support primitive
> + * restart (for example, if it only does restart index of ~0).
> *
> * We map the index buffer, find the restart indexes, unmap
> * the index buffer then draw the sub-primitives delineated by the restarts.
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list