Mesa (master): gallium/swr: Fix min/max range index draw

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 24 11:19:36 UTC 2020


Module: Mesa
Branch: master
Commit: 5e9a2c603f38308f7027d6a5e4575e5fc24c1bd5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e9a2c603f38308f7027d6a5e4575e5fc24c1bd5

Author: Krzysztof Raszkowski <krzysztof.raszkowski at intel.com>
Date:   Fri Feb 21 14:05:33 2020 +0100

gallium/swr: Fix min/max range index draw

Reviewed-by: Jan Zielinski <jan.zielinski at intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3905>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3905>

---

 src/gallium/auxiliary/util/u_vbuf.h   | 9 +++++++++
 src/gallium/drivers/swr/swr_state.cpp | 9 +++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_vbuf.h b/src/gallium/auxiliary/util/u_vbuf.h
index 8167d997ab8..b364e06344a 100644
--- a/src/gallium/auxiliary/util/u_vbuf.h
+++ b/src/gallium/auxiliary/util/u_vbuf.h
@@ -28,6 +28,10 @@
 #ifndef U_VBUF_H
 #define U_VBUF_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* This module takes care of user buffer uploads and vertex format fallbacks.
  * It's designed for the drivers which don't want to use the Draw module.
  * There is a more detailed description at the beginning of the .c file.
@@ -86,4 +90,9 @@ void u_vbuf_restore_vertex_elements(struct u_vbuf *mgr);
 void u_vbuf_save_vertex_buffer0(struct u_vbuf *mgr);
 void u_vbuf_restore_vertex_buffer0(struct u_vbuf *mgr);
 
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
index 625f0050ad5..2967dd233cd 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -51,6 +51,7 @@
 #include "util/u_framebuffer.h"
 #include "util/u_viewport.h"
 #include "util/u_prim.h"
+#include "util/u_vbuf.h"
 
 #include "swr_state.h"
 #include "swr_context.h"
@@ -1399,8 +1400,12 @@ swr_update_derived(struct pipe_context *pipe,
 
    /* Set vertex & index buffers */
    if (ctx->dirty & SWR_NEW_VERTEX) {
-      const struct pipe_draw_info &info = *p_draw_info;
-
+      struct pipe_draw_info info = *p_draw_info;
+      /* SWR always need min/max index info for index draw,
+      *  compute it if upper layer does not do for us */
+      if (info.index_size > 0 && info.max_index == ~0u) {
+         u_vbuf_get_minmax_index(pipe, &info, &(info.min_index), &(info.max_index));
+      }
       /* vertex buffers */
       SWR_VERTEX_BUFFER_STATE swrVertexBuffers[PIPE_MAX_ATTRIBS];
       for (UINT i = 0; i < ctx->num_vertex_buffers; i++) {



More information about the mesa-commit mailing list