[Mesa-dev] [PATCH 4/9] i965: Create a new brw_transform_feedback_object subclass.

Eric Anholt eric at anholt.net
Sat Oct 19 04:16:39 CEST 2013


Kenneth Graunke <kenneth at whitecape.org> writes:

> This adds the basic driver hooks to allocate/free the brw variant.
> It doesn't contain any additional information yet, but it will soon.

> diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c
> index 21da444..ffecfc8 100644
> --- a/src/mesa/drivers/dri/i965/gen6_sol.c
> +++ b/src/mesa/drivers/dri/i965/gen6_sol.c
> @@ -26,6 +26,7 @@
>   * Code to initialize the binding table entries used by transform feedback.
>   */
>  
> +#include "main/bufferobj.h"
>  #include "main/macros.h"
>  #include "brw_context.h"
>  #include "intel_batchbuffer.h"
> @@ -132,6 +133,35 @@ const struct brw_tracked_state gen6_gs_binding_table = {
>     .emit = brw_gs_upload_binding_table,
>  };
>  
> +struct gl_transform_feedback_object *
> +brw_new_transform_feedback(struct gl_context *ctx, GLuint name)
> +{
> +   struct brw_context *brw = brw_context(ctx);
> +   struct brw_transform_feedback_object *brw_obj =
> +      CALLOC_STRUCT(brw_transform_feedback_object);
> +   struct gl_transform_feedback_object *obj = &brw_obj->base;
> +
> +   obj->Name = name;
> +   obj->RefCount = 1;
> +   obj->EverBound = GL_FALSE;
> +
> +   return obj;
> +}
> +
> +void
> +brw_delete_transform_feedback(struct gl_context *ctx,
> +                              struct gl_transform_feedback_object *obj)
> +{
> +   struct brw_transform_feedback_object *brw_obj =
> +      (struct brw_transform_feedback_object *) obj;
> +
> +   for (unsigned i = 0; i < Elements(obj->Buffers); i++) {
> +      _mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL);
> +   }
> +
> +   free(brw_obj);
> +}
> +

It seems like we should have shared code for the core parts of
new/delete_transform_feedback.  I note that st_new_transform_feedback is
missing the EverBound flag setup, and if they've diverged already, we
may accidentally diverge some day, too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131018/5896663e/attachment.pgp>


More information about the mesa-dev mailing list