Mesa (master): svga: move duplicated code for setting fillmode/flatshade state

Brian Paul brianp at kemper.freedesktop.org
Thu Feb 15 16:11:28 UTC 2018


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Feb 14 09:37:27 2018 -0800

svga: move duplicated code for setting fillmode/flatshade state

Move the calls to svga_hwtnl_set_fillmode() and svga_hwtnl_set_flatshade()
out of the two retry_draw_*() functions to the svga_draw_vbo() function.

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

---

 src/gallium/drivers/svga/svga_pipe_draw.c | 30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c
index af538819ea..c73c406e69 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -64,16 +64,6 @@ retry_draw_range_elements(struct svga_context *svga,
 
    SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_DRAWELEMENTS);
 
-   svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
-
-   /** determine if flatshade is to be used after svga_update_state()
-    *  in case the fragment shader is changed.
-    */
-   svga_hwtnl_set_flatshade(svga->hwtnl,
-                            svga->curr.rast->templ.flatshade ||
-                            is_using_flat_shading(svga),
-                            svga->curr.rast->templ.flatshade_first);
-
    for (unsigned try = 0; try < 2; try++) {
       ret = svga_hwtnl_draw_range_elements(svga->hwtnl,
                                            index_buffer, index_size,
@@ -100,16 +90,6 @@ retry_draw_arrays(struct svga_context *svga,
 
    SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_DRAWARRAYS);
 
-   svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
-
-   /** determine if flatshade is to be used after svga_update_state()
-    *  in case the fragment shader is changed.
-    */
-   svga_hwtnl_set_flatshade(svga->hwtnl,
-                            svga->curr.rast->templ.flatshade ||
-                            is_using_flat_shading(svga),
-                            svga->curr.rast->templ.flatshade_first);
-
    for (unsigned try = 0; try < 2; try++) {
       ret = svga_hwtnl_draw_arrays(svga->hwtnl, prim, start, count,
                                    start_instance, instance_count);
@@ -230,6 +210,16 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
          assert(ret == PIPE_OK);
       }
 
+      svga_hwtnl_set_fillmode(svga->hwtnl, svga->curr.rast->hw_fillmode);
+
+      /** determine if flatshade is to be used after svga_update_state()
+       *  in case the fragment shader is changed.
+       */
+      svga_hwtnl_set_flatshade(svga->hwtnl,
+                               svga->curr.rast->templ.flatshade ||
+                               is_using_flat_shading(svga),
+                               svga->curr.rast->templ.flatshade_first);
+
       if (info->index_size && indexbuf) {
          unsigned offset;
 




More information about the mesa-commit mailing list