Module: Mesa
Branch: main
Commit: d6b9a0a9970288a31d713f364031a45d34467bf7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d6b9a0a9970288a31d713f364031a45d34467bf7

Author: Charmaine Lee <[email protected]>
Date:   Thu Sep  8 15:08:59 2022 -0700

svga: restrict use of rawbuf for constant buffer access to GL43 device

Restrict use of rawbuf for constant buffer access to GL43 capable
device only.

Fixes glretrace regressions running with SW Renderer.

Reviewed-by: Martin Krastev <[email protected]>
Reviewed-by: Zack Rusin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25381>

---

 .../drivers/svga/svga_resource_buffer_upload.c     | 26 ++++++++++++----------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_resource_buffer_upload.c 
b/src/gallium/drivers/svga/svga_resource_buffer_upload.c
index b3a34221941..29cae84463d 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer_upload.c
+++ b/src/gallium/drivers/svga/svga_resource_buffer_upload.c
@@ -209,19 +209,21 @@ svga_buffer_create_host_surface(struct svga_screen *ss,
           */
          sbuf->key.coherent = ss->sws->have_coherent;
 
-         /* Set the persistent bit so if the buffer is to be bound
-          * as constant buffer, we'll access it as raw buffer
-          * instead of copying the content back and forth between the
-          * mapped buffer surface and the constant buffer surface.
-          */
-         sbuf->key.persistent = 1;
+         if (ss->sws->have_gl43) {
+            /* Set the persistent bit so if the buffer is to be bound
+             * as constant buffer, we'll access it as raw buffer
+             * instead of copying the content back and forth between the
+             * mapped buffer surface and the constant buffer surface.
+             */
+            sbuf->key.persistent = 1;
 
-         /* Set the raw views bind flag only if the mapped buffer surface
-          * is not already bound as constant buffer since constant buffer
-          * surface cannot have other bind flags.
-          */
-         if ((bind_flags & PIPE_BIND_CONSTANT_BUFFER) == 0) {
-            sbuf->key.flags |= SVGA3D_SURFACE_BIND_RAW_VIEWS;
+            /* Set the raw views bind flag only if the mapped buffer surface
+             * is not already bound as constant buffer since constant buffer
+             * surface cannot have other bind flags.
+             */
+            if ((bind_flags & PIPE_BIND_CONSTANT_BUFFER) == 0) {
+               sbuf->key.flags |= SVGA3D_SURFACE_BIND_RAW_VIEWS;
+            }
          }
       }
 

Reply via email to