[Mesa-dev] [PATCH 07/70] i965: get LinkedTransformFeedback from gl_transform_feedback_object

Eric Anholt eric at anholt.net
Tue Dec 27 17:55:23 UTC 2016


Timothy Arceri <timothy.arceri at collabora.com> writes:

> We have already set the gl_shader_program pointer to the correct
> shader program in _mesa_BeginTransformFeedback() so use it.
>
> This is more consistent with how we do it for gen7.
> ---
>  src/mesa/drivers/dri/i965/gen6_sol.c | 27 +++++++++------------------
>  1 file changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c
> index 7da927d..93d48c8 100644
> --- a/src/mesa/drivers/dri/i965/gen6_sol.c
> +++ b/src/mesa/drivers/dri/i965/gen6_sol.c
> @@ -38,28 +38,19 @@ static void
>  gen6_update_sol_surfaces(struct brw_context *brw)
>  {
>     struct gl_context *ctx = &brw->ctx;
> -   /* BRW_NEW_TRANSFORM_FEEDBACK */
> -   struct gl_transform_feedback_object *xfb_obj =
> -      ctx->TransformFeedback.CurrentObject;
> -   const struct gl_shader_program *shaderprog;
> -   const struct gl_transform_feedback_info *linked_xfb_info;
> -   int i;
> +   bool xfb_active = _mesa_is_xfb_active_and_unpaused(ctx);
> +   struct gl_transform_feedback_object *xfb_obj;
> +   const struct gl_transform_feedback_info *linked_xfb_info = NULL;
>  
> -   if (brw->geometry_program) {
> -      /* BRW_NEW_GEOMETRY_PROGRAM */
> -      shaderprog =
> -         ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
> -   } else {
> -      /* BRW_NEW_VERTEX_PROGRAM */
> -      shaderprog =
> -         ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
> +   if (xfb_active) {
> +      /* BRW_NEW_TRANSFORM_FEEDBACK */
> +      xfb_obj = ctx->TransformFeedback.CurrentObject;
> +      linked_xfb_info = &xfb_obj->shader_program->LinkedTransformFeedback;
>     }
> -   linked_xfb_info = &shaderprog->LinkedTransformFeedback;
>  
> -   for (i = 0; i < BRW_MAX_SOL_BINDINGS; ++i) {
> +   for (int i = 0; i < BRW_MAX_SOL_BINDINGS; ++i) {
>        const int surf_index = SURF_INDEX_GEN6_SOL_BINDING(i);
> -      if (_mesa_is_xfb_active_and_unpaused(ctx) &&
> -          i < linked_xfb_info->NumOutputs) {
> +      if (xfb_active && i < linked_xfb_info->NumOutputs) {
>           unsigned buffer = linked_xfb_info->Outputs[i].OutputBuffer;
>           unsigned buffer_offset =
>              xfb_obj->Offset[buffer] / 4 +

Given the removal of the BRW_NEW_GEOMETRY_PROGRAM and
BRW_NEW_VERTEX_PROGRAM comments, I think this patch should also remove
those flags from gen6_sol_surface.  It's really nice to keep the flag
comments and actual flags matched up, to reduce git archaeology later.
I'm assuming here that we can't change brw->geometry_program/
LinkedTransformFeedback while active_and_unpaused and !BRW_NEW_FT, which
iirc is true.

Even better than just keeping the comments matched up, it means that we
stop calling this atom on every VP change while TF is inactive!

This patch does a bit more cleanup than the commit message says, but
it's all good, so with the flags fixed:

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161227/ade5eb36/attachment-0001.sig>


More information about the mesa-dev mailing list