svga: clamp max_const_buffers to SVGA_MAX_CONST_BUFS

Submitted by Charmaine Lee on May 23, 2019, 5:15 p.m.

Details

Message ID BYAPR05MB42328D9F076EAA74091DC2E6B5010@BYAPR05MB4232.namprd05.prod.outlook.com
State New
Headers show
Series "svga: clamp max_const_buffers to SVGA_MAX_CONST_BUFS" ( rev: 2 ) in Mesa

Not browsing as part of any series.

Commit Message

Charmaine Lee May 23, 2019, 5:15 p.m.
Reviewed-by: Charmaine Lee <charmainel@vmware.com>

Patch hide | download patch | download mbox

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;
    }