From b5661c1d70f9ffaea3c1c14c4bc3f20f7fd4530c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 18 Jul 2016 16:02:02 -0700 Subject: [PATCH] anv: Perform rasterizer discard in the SOL stage instead of the clipper. 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 Reviewed-by: Jason Ekstrand --- 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 8ce50be7717..6acdd8562ab 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 94f50d12c6e..2fa8ac9fcb9 100644 --- a/src/intel/vulkan/gen8_pipeline.c +++ b/src/intel/vulkan/gen8_pipeline.c @@ -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) { diff --git a/src/intel/vulkan/genX_pipeline_util.h b/src/intel/vulkan/genX_pipeline_util.h index 516fc49acd1..c134d5da5a7 100644 --- a/src/intel/vulkan/genX_pipeline_util.h +++ b/src/intel/vulkan/genX_pipeline_util.h @@ -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; + } +} diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c index f67b0a7cb51..8253a8b12d3 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.30.2