[Mesa-dev] [PATCH 7/8] anv: Perform rasterizer discard in the SOL stage instead of the clipper.

Kenneth Graunke kenneth at whitecape.org
Tue Jul 19 01:04:26 UTC 2016


See commit b0629e6894513a2c49a018bc3342a4e55435a236, where we discovered
that the SOL stage's "Rendering Disable" feature is a lot faster at
throwing away all geometry than the clipper's "reject all" mode.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/intel/vulkan/gen7_pipeline.c      |  1 +
 src/intel/vulkan/gen8_pipeline.c      |  1 +
 src/intel/vulkan/genX_pipeline_util.h | 12 ++++++++++--
 src/intel/vulkan/genX_state.c         |  1 -
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/gen7_pipeline.c b/src/intel/vulkan/gen7_pipeline.c
index 8ce50be..6acdd85 100644
--- a/src/intel/vulkan/gen7_pipeline.c
+++ b/src/intel/vulkan/gen7_pipeline.c
@@ -119,6 +119,7 @@ genX(graphics_pipeline_create)(
 
    emit_3dstate_clip(pipeline, pCreateInfo->pViewportState,
                      pCreateInfo->pRasterizationState, extra);
+   emit_3dstate_streamout(pipeline, pCreateInfo->pRasterizationState);
 
    if (pCreateInfo->pMultisampleState &&
        pCreateInfo->pMultisampleState->rasterizationSamples > 1)
diff --git a/src/intel/vulkan/gen8_pipeline.c b/src/intel/vulkan/gen8_pipeline.c
index cc10d3a..0010955 100644
--- a/src/intel/vulkan/gen8_pipeline.c
+++ b/src/intel/vulkan/gen8_pipeline.c
@@ -188,6 +188,7 @@ genX(graphics_pipeline_create)(
 
    emit_3dstate_clip(pipeline, pCreateInfo->pViewportState,
                      pCreateInfo->pRasterizationState, extra);
+   emit_3dstate_streamout(pipeline, pCreateInfo->pRasterizationState);
 
    const struct brw_wm_prog_data *wm_prog_data = get_wm_prog_data(pipeline);
    anv_batch_emit(&pipeline->batch, GENX(3DSTATE_WM), wm) {
diff --git a/src/intel/vulkan/genX_pipeline_util.h b/src/intel/vulkan/genX_pipeline_util.h
index 52263df..3a545a0 100644
--- a/src/intel/vulkan/genX_pipeline_util.h
+++ b/src/intel/vulkan/genX_pipeline_util.h
@@ -661,8 +661,7 @@ emit_3dstate_clip(struct anv_pipeline *pipeline,
       clip.APIMode                  = APIMODE_D3D,
       clip.ViewportXYClipTestEnable = true;
 
-      clip.ClipMode = rs_info->rasterizerDiscardEnable ?
-         CLIPMODE_REJECT_ALL : CLIPMODE_NORMAL;
+      clip.ClipMode = CLIPMODE_NORMAL;
 
       clip.TriangleStripListProvokingVertexSelect = 0;
       clip.LineStripListProvokingVertexSelect     = 0;
@@ -682,3 +681,12 @@ emit_3dstate_clip(struct anv_pipeline *pipeline,
 #endif
    }
 }
+
+static void
+emit_3dstate_streamout(struct anv_pipeline *pipeline,
+                       const VkPipelineRasterizationStateCreateInfo *rs_info)
+{
+   anv_batch_emit(&pipeline->batch, GENX(3DSTATE_STREAMOUT), so) {
+      so.RenderingDisable = rs_info->rasterizerDiscardEnable;
+   }
+}
diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index f67b0a7..8253a8b 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -58,7 +58,6 @@ genX(init_device_state)(struct anv_device *device)
    anv_batch_emit(&batch, GENX(3DSTATE_TE), ts);
    anv_batch_emit(&batch, GENX(3DSTATE_DS), ds);
 
-   anv_batch_emit(&batch, GENX(3DSTATE_STREAMOUT), so);
    anv_batch_emit(&batch, GENX(3DSTATE_AA_LINE_PARAMETERS), aa);
 
    anv_batch_emit(&batch, GENX(3DSTATE_DRAWING_RECTANGLE), rect) {
-- 
2.9.0



More information about the mesa-dev mailing list