[Mesa-dev] [PATCH 4/5] mesa/bufferobj: consolidate some buffer binding code.

Nicolai Hähnle nhaehnle at gmail.com
Sun Oct 22 20:59:48 UTC 2017


Looks like this patch regressed 
GL45-CTS.multi_bind.dispatch_bind_buffers_base.

On 15.09.2017 05:57, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> These paths are again 90% the same, consolidate them into
> one.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>   src/mesa/main/bufferobj.c | 76 ++++++++++++++++++++++-------------------------
>   1 file changed, 35 insertions(+), 41 deletions(-)
> 
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index 052a671..fba1f44 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -1308,6 +1308,29 @@ set_buffer_multi_binding(struct gl_context *ctx,
>      }
>   }
>   
> +static void
> +bind_buffer(struct gl_context *ctx,
> +            struct gl_buffer_binding *binding,
> +            struct gl_buffer_object *bufObj,
> +            GLintptr offset,
> +            GLsizeiptr size,
> +            GLboolean autoSize,
> +            uint64_t driver_state,
> +            gl_buffer_usage usage)
> +{
> +   if (binding->BufferObject == bufObj &&
> +       binding->Offset == offset &&
> +       binding->Size == size &&
> +       binding->AutomaticSize == autoSize) {
> +      return;
> +   }
> +
> +   FLUSH_VERTICES(ctx, 0);
> +   ctx->NewDriverState |= driver_state;
> +
> +   set_buffer_binding(ctx, binding, bufObj, offset, size, autoSize, usage);
> +}
> +
>   /**
>    * Binds a buffer object to a uniform buffer binding point.
>    *
> @@ -1323,20 +1346,10 @@ bind_uniform_buffer(struct gl_context *ctx,
>                       GLsizeiptr size,
>                       GLboolean autoSize)
>   {
> -   struct gl_buffer_binding *binding =
> -      &ctx->UniformBufferBindings[index];
> -
> -   if (binding->BufferObject == bufObj &&
> -       binding->Offset == offset &&
> -       binding->Size == size &&
> -       binding->AutomaticSize == autoSize) {
> -      return;
> -   }
> -
> -   FLUSH_VERTICES(ctx, 0);
> -   ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer;
> -
> -   set_buffer_binding(ctx, binding, bufObj, offset, size, autoSize, USAGE_UNIFORM_BUFFER);
> +   bind_buffer(ctx, &ctx->UniformBufferBindings[index],
> +               bufObj, offset, size, autoSize,
> +               ctx->DriverFlags.NewUniformBuffer,
> +               USAGE_UNIFORM_BUFFER);
>   }
>   
>   /**
> @@ -1354,20 +1367,10 @@ bind_shader_storage_buffer(struct gl_context *ctx,
>                              GLsizeiptr size,
>                              GLboolean autoSize)
>   {
> -   struct gl_buffer_binding *binding =
> -      &ctx->ShaderStorageBufferBindings[index];
> -
> -   if (binding->BufferObject == bufObj &&
> -       binding->Offset == offset &&
> -       binding->Size == size &&
> -       binding->AutomaticSize == autoSize) {
> -      return;
> -   }
> -
> -   FLUSH_VERTICES(ctx, 0);
> -   ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer;
> -
> -   set_buffer_binding(ctx, binding, bufObj, offset, size, autoSize, USAGE_SHADER_STORAGE_BUFFER);
> +   bind_buffer(ctx, &ctx->ShaderStorageBufferBindings[index],
> +               bufObj, offset, size, autoSize,
> +               ctx->DriverFlags.NewShaderStorageBuffer,
> +               USAGE_SHADER_STORAGE_BUFFER);
>   }
>   
>   /**
> @@ -1382,19 +1385,10 @@ bind_atomic_buffer(struct gl_context *ctx, unsigned index,
>                      struct gl_buffer_object *bufObj, GLintptr offset,
>                      GLsizeiptr size, GLboolean autoSize)
>   {
> -   struct gl_buffer_binding *binding =
> -      &ctx->AtomicBufferBindings[index];
> -   if (binding->BufferObject == bufObj &&
> -       binding->Offset == offset &&
> -       binding->Size == size &&
> -       binding->AutomaticSize == autoSize) {
> -      return;
> -   }
> -
> -   FLUSH_VERTICES(ctx, 0);
> -   ctx->NewDriverState |= ctx->DriverFlags.NewAtomicBuffer;
> -
> -   set_buffer_binding(ctx, binding, bufObj, offset, size, autoSize, USAGE_ATOMIC_COUNTER_BUFFER);
> +   bind_buffer(ctx, &ctx->AtomicBufferBindings[index],
> +               bufObj, offset, size, autoSize,
> +               ctx->DriverFlags.NewAtomicBuffer,
> +               USAGE_ATOMIC_COUNTER_BUFFER);
>   }
>   
>   /**
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list