[Mesa-dev] [PATCH 5/6] i965: Rename "prim" parameter to "prims" where it's an array.
Paul Berry
stereotype441 at gmail.com
Fri Aug 30 12:29:50 PDT 2013
On 28 August 2013 16:49, Kenneth Graunke <kenneth at whitecape.org> wrote:
> Some drawing functions take a single _mesa_prim object, while others
> take an array of primitives. Both kinds of functions used a parameter
> called "prim" (the singular form), which was confusing.
>
> Using the plural form, "prims," clearly communicates that the parameter
> is an array of primitives.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>
I really like this. Thanks.
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
> ---
> src/mesa/drivers/dri/i965/brw_draw.c | 26
> +++++++++++------------
> src/mesa/drivers/dri/i965/brw_draw.h | 2 +-
> src/mesa/drivers/dri/i965/brw_primitive_restart.c | 8 +++----
> 3 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_draw.c
> b/src/mesa/drivers/dri/i965/brw_draw.c
> index 2583a6f..d14f7f0 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> @@ -314,7 +314,7 @@ static void
> brw_postdraw_set_buffers_need_resolve(struct brw_context *brw)
> */
> static bool brw_try_draw_prims( struct gl_context *ctx,
> const struct gl_client_array
> *arrays[],
> - const struct _mesa_prim *prim,
> + const struct _mesa_prim *prims,
> GLuint nr_prims,
> const struct _mesa_index_buffer *ib,
> GLuint min_index,
> @@ -386,18 +386,18 @@ static bool brw_try_draw_prims( struct gl_context
> *ctx,
> intel_batchbuffer_require_space(brw, estimated_max_prim_size,
> false);
> intel_batchbuffer_save_state(brw);
>
> - if (brw->num_instances != prim[i].num_instances) {
> - brw->num_instances = prim[i].num_instances;
> + if (brw->num_instances != prims[i].num_instances) {
> + brw->num_instances = prims[i].num_instances;
> brw->state.dirty.brw |= BRW_NEW_VERTICES;
> }
> - if (brw->basevertex != prim[i].basevertex) {
> - brw->basevertex = prim[i].basevertex;
> + if (brw->basevertex != prims[i].basevertex) {
> + brw->basevertex = prims[i].basevertex;
> brw->state.dirty.brw |= BRW_NEW_VERTICES;
> }
> if (brw->gen < 6)
> - brw_set_prim(brw, &prim[i]);
> + brw_set_prim(brw, &prims[i]);
> else
> - gen6_set_prim(brw, &prim[i]);
> + gen6_set_prim(brw, &prims[i]);
>
> retry:
> /* Note that before the loop, brw->state.dirty.brw was set to != 0,
> and
> @@ -410,7 +410,7 @@ retry:
> brw_upload_state(brw);
> }
>
> - brw_emit_prim(brw, &prim[i], brw->primitive);
> + brw_emit_prim(brw, &prims[i], brw->primitive);
>
> brw->no_batch_wrap = false;
>
> @@ -446,7 +446,7 @@ retry:
> }
>
> void brw_draw_prims( struct gl_context *ctx,
> - const struct _mesa_prim *prim,
> + const struct _mesa_prim *prims,
> GLuint nr_prims,
> const struct _mesa_index_buffer *ib,
> GLboolean index_bounds_valid,
> @@ -461,7 +461,7 @@ void brw_draw_prims( struct gl_context *ctx,
> return;
>
> /* Handle primitive restart if needed */
> - if (brw_handle_primitive_restart(ctx, prim, nr_prims, ib)) {
> + if (brw_handle_primitive_restart(ctx, prims, nr_prims, ib)) {
> /* The draw was handled, so we can exit now */
> return;
> }
> @@ -471,7 +471,7 @@ void brw_draw_prims( struct gl_context *ctx,
> * to upload.
> */
> if (!vbo_all_varyings_in_vbos(arrays) && !index_bounds_valid)
> - vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index,
> nr_prims);
> + vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index,
> nr_prims);
>
> /* Do GL_SELECT and GL_FEEDBACK rendering using swrast, even though it
> * won't support all the extensions we support.
> @@ -481,7 +481,7 @@ void brw_draw_prims( struct gl_context *ctx,
> _mesa_lookup_enum_by_nr(ctx->RenderMode));
> _swsetup_Wakeup(ctx);
> _tnl_wakeup(ctx);
> - _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index,
> max_index);
> + _tnl_draw_prims(ctx, arrays, prims, nr_prims, ib, min_index,
> max_index);
> return;
> }
>
> @@ -489,7 +489,7 @@ void brw_draw_prims( struct gl_context *ctx,
> * manage it. swrast doesn't support our featureset, so we can't fall
> back
> * to it.
> */
> - brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index,
> max_index);
> + brw_try_draw_prims(ctx, arrays, prims, nr_prims, ib, min_index,
> max_index);
> }
>
> void brw_draw_init( struct brw_context *brw )
> diff --git a/src/mesa/drivers/dri/i965/brw_draw.h
> b/src/mesa/drivers/dri/i965/brw_draw.h
> index c915bc3..aac375f 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw.h
> +++ b/src/mesa/drivers/dri/i965/brw_draw.h
> @@ -49,7 +49,7 @@ void brw_draw_destroy( struct brw_context *brw );
> /* brw_primitive_restart.c */
> GLboolean
> brw_handle_primitive_restart(struct gl_context *ctx,
> - const struct _mesa_prim *prim,
> + const struct _mesa_prim *prims,
> GLuint nr_prims,
> const struct _mesa_index_buffer *ib);
>
> diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> index ca2e6b7..27fae8a 100644
> --- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> +++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> @@ -120,7 +120,7 @@ can_cut_index_handle_prims(struct gl_context *ctx,
> */
> GLboolean
> brw_handle_primitive_restart(struct gl_context *ctx,
> - const struct _mesa_prim *prim,
> + const struct _mesa_prim *prims,
> GLuint nr_prims,
> const struct _mesa_index_buffer *ib)
> {
> @@ -158,17 +158,17 @@ brw_handle_primitive_restart(struct gl_context *ctx,
> */
> brw->prim_restart.in_progress = true;
>
> - if (can_cut_index_handle_prims(ctx, &prim[0], ib)) {
> + if (can_cut_index_handle_prims(ctx, &prims[0], ib)) {
> /* Cut index should work for primitive restart, so use it
> */
> brw->prim_restart.enable_cut_index = true;
> - brw_draw_prims(ctx, prim, nr_prims, ib, GL_FALSE, -1, -1, NULL);
> + brw_draw_prims(ctx, prims, nr_prims, ib, GL_FALSE, -1, -1, NULL);
> brw->prim_restart.enable_cut_index = false;
> } else {
> /* Not all the primitive draw modes are supported by the cut index,
> * so take the software path
> */
> - vbo_sw_primitive_restart(ctx, prim, nr_prims, ib);
> + vbo_sw_primitive_restart(ctx, prims, nr_prims, ib);
> }
>
> brw->prim_restart.in_progress = false;
> --
> 1.8.3.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130830/025b859c/attachment.html>
More information about the mesa-dev
mailing list