[Mesa-dev] [PATCH 1/4] svga: fix buffer binding flags initialization

Charmaine Lee charmainel at vmware.com
Mon Jul 3 15:57:42 UTC 2017


>From: Brian Paul <brianp at vmware.com>
>Sent: Sunday, July 2, 2017 8:12 AM
>To: mesa-dev at lists.freedesktop.org
>Cc: Charmaine Lee
>Subject: [PATCH 1/4] svga: fix buffer binding flags initialization

>If a buffer is created/initialized with glNamedBufferData we will
>have no target (GL_ARRAY_BUFFER, GL_UNIFORM_BUFFER, etc) >so the
>svga_buffer::bind_flags will be zero until we try to get the buffer
handle.

>This patch initializes the svga_buffer::bind_flags field when it's
zero.

>This fixes the Piglit arb_uniform_buffer_object-rendering-dsa test.

>Note that there's still issues in this area that'll have to be
>addressed in the future.  For example, creating a buffer object
>as GL_UNIFORM_BUFFER and later using it as a vertex buffer will
>fail.

Since we are creating two separate host surfaces for such buffer object
when it is used as both constant buffer and vertex buffer, we are
probably missing a surface update when the buffer object is updated.
Which piglit fails?

>---
> src/gallium/drivers/svga/svga_resource_buffer_upload.c | 6 ++++++
> 1 file changed, 6 insertions(+)

>diff --git a/src/gallium/drivers/svga/svga_resource_buffer_upload.c >b/src/gallium/drivers/svga/svga_resource_buffer_upload.c
>index 61f6fb0..104cb6d 100644
>--- a/src/gallium/drivers/svga/svga_resource_buffer_upload.c
>+++ b/src/gallium/drivers/svga/svga_resource_buffer_upload.c
>@@ -1003,6 +1003,12 @@ svga_buffer_handle(struct svga_context *svga, struct pipe_resource *buf,
>             return NULL;
>       }
>    } else {
>+      if (!sbuf->bind_flags) {
>+         sbuf->bind_flags = tobind_flags;
>+      }
>+
>+      assert((sbuf->bind_flags & tobind_flags) == tobind_flags);
>+
>       /* This call will set sbuf->handle */
>       if (svga_have_gb_objects(svga)) {
>          ret = svga_buffer_update_hw(svga, sbuf, sbuf->bind_flags);
>--
>1.9.1

Series looks good to me.

Reviewed-by: Charmaine Lee <charmainel at vmware.com>



More information about the mesa-dev mailing list