etnaviv: update Android build files
[mesa.git] / src / gallium / drivers / radeonsi / si_state_draw.c
index 7f7398ff7f589b986685418b0761d3e43bc979a5..2f87896ead6c778718d83dd70ab12c1345bc5e1a 100644 (file)
@@ -2042,12 +2042,11 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i
        if (sctx->ngg &&
            rast_prim == PIPE_PRIM_TRIANGLES &&
            (sctx->screen->always_use_ngg_culling ||
-            /* At least 1500 non-indexed triangles (4500 vertices) are needed
-             * per draw call (no TES/GS) to enable NGG culling. Triangle strips
-             * don't need this, because they have good reuse and therefore
-             * perform the same as indexed triangles.
+            /* At least 1024 non-indexed vertices (8 subgroups) are needed
+             * per draw call (no TES/GS) to enable NGG culling.
              */
-            (!index_size && prim == PIPE_PRIM_TRIANGLES && direct_count > 4500 &&
+            (!index_size && direct_count >= 1024 &&
+             (prim == PIPE_PRIM_TRIANGLES || prim == PIPE_PRIM_TRIANGLE_STRIP) &&
              !sctx->tes_shader.cso && !sctx->gs_shader.cso)) &&
            si_get_vs(sctx)->cso->ngg_culling_allowed) {
                unsigned ngg_culling = 0;
@@ -2068,6 +2067,18 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i
                        if (sctx->viewports.y_inverted ? rs->cull_front : rs->cull_back)
                                ngg_culling |= SI_NGG_CULL_BACK_FACE;
                }
+
+               /* Use NGG fast launch for certain non-indexed primitive types.
+                * A draw must have at least 1 full primitive.
+                */
+               if (ngg_culling && !index_size && direct_count >= 3 &&
+                   !sctx->tes_shader.cso && !sctx->gs_shader.cso) {
+                       if (prim == PIPE_PRIM_TRIANGLES)
+                               ngg_culling |= SI_NGG_CULL_GS_FAST_LAUNCH_TRI_LIST;
+                       else if (prim == PIPE_PRIM_TRIANGLE_STRIP)
+                               ngg_culling |= SI_NGG_CULL_GS_FAST_LAUNCH_TRI_STRIP;
+               }
+
                if (ngg_culling != sctx->ngg_culling) {
                        sctx->ngg_culling = ngg_culling;
                        sctx->do_update_shaders = true;