[Mesa-dev] [PATCH] svga: clamp max_const_buffers to SVGA_MAX_CONST_BUFS

Charmaine Lee charmainel at vmware.com
Thu May 23 17:15:43 UTC 2019


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

________________________________________
From: Brian Paul <brianp at vmware.com>
Sent: Monday, May 20, 2019 6:36:33 AM
To: mesa-dev at lists.freedesktop.org
Cc: Neha Bhende; Charmaine Lee
Subject: [PATCH] svga: clamp max_const_buffers to SVGA_MAX_CONST_BUFS

In case the device reports 15 (or more) buffers.
---
 src/gallium/drivers/svga/svga_screen.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 02c1a99..b70fd85 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -1079,7 +1079,8 @@ svga_screen_create(struct svga_winsys_screen *sws)
       /* Maximum number of constant buffers */
       svgascreen->max_const_buffers =
          get_uint_cap(sws, SVGA3D_DEVCAP_DX_MAX_CONSTANT_BUFFERS, 1);
-      assert(svgascreen->max_const_buffers <= SVGA_MAX_CONST_BUFS);
+      svgascreen->max_const_buffers = MIN2(svgascreen->max_const_buffers,
+                                           SVGA_MAX_CONST_BUFS);

       screen->is_format_supported = svga_is_dx_format_supported;
    }
--
2.7.4



More information about the mesa-dev mailing list