anv: Perform rasterizer discard in the SOL stage instead of the clipper.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 18 Jul 2016 23:02:02 +0000 (16:02 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 30 Jul 2016 19:06:37 +0000 (12:06 -0700)
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@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/gen7_pipeline.c
src/intel/vulkan/gen8_pipeline.c
src/intel/vulkan/genX_pipeline_util.h
src/intel/vulkan/genX_state.c

index 8ce50be7717f0eaaba0660e3bacd2d288224e30c..6acdd8562ab2ca853b8a7bdd889e338cbba96d81 100644 (file)
@@ -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)
index 94f50d12c6e2af90e26fa13788a729da54b19960..2fa8ac9fcb966faed12a18df5da4f13ff28d3f3f 100644 (file)
@@ -185,6 +185,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) {
index 516fc49acd126c13651414d2562629c2fc66f972..c134d5da5a7005026ebacf77196f73811b582bba 100644 (file)
@@ -666,8 +666,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;
@@ -687,3 +686,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;
+   }
+}
index f67b0a7cb51070adf2b7f08d5d810be2748c5098..8253a8b12d3c6ddb36a953ee23791510a21a4b4f 100644 (file)
@@ -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) {