summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_pipeline.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-03-28 05:45:00 +1000
committerDave Airlie <[email protected]>2017-03-28 08:39:14 +1000
commitb640dfcd0506253231b93c03de7ee393fb0dfc46 (patch)
tree4f208de3d78f2c28cf976d98b0b80ef9ec35ca50 /src/amd/vulkan/radv_pipeline.c
parentf1f1cb41d0a80230085e63e8de65aa58ff3872da (diff)
radv: don't emit no color formats. (v3)
If we had no rasterization, we'd emit SPI color format as all 0's the hw dislikes this, add the workaround from radeonsi. Found while debugging tessellation v2: handle at pipeline stage, we have to handle it after we process the fragment shader. (Bas) v3: simplify even further, remove old fallback. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_pipeline.c')
-rw-r--r--src/amd/vulkan/radv_pipeline.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 094d636fc5c..45277b94fa1 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -888,8 +888,6 @@ radv_pipeline_compute_spi_color_formats(struct radv_pipeline *pipeline,
if (blend_mrt0_is_dual_src)
col_format |= (col_format & 0xf) << 4;
- if (!col_format)
- col_format |= V_028714_SPI_SHADER_32_R;
blend->spi_shader_col_format = col_format;
}
@@ -1602,6 +1600,25 @@ radv_pipeline_init(struct radv_pipeline *pipeline,
pipeline->graphics.prim_restart_enable = !!pCreateInfo->pInputAssemblyState->primitiveRestartEnable;
/* prim vertex count will need TESS changes */
pipeline->graphics.prim_vertex_count = prim_size_table[pipeline->graphics.prim];
+
+ /* Ensure that some export memory is always allocated, for two reasons:
+ *
+ * 1) Correctness: The hardware ignores the EXEC mask if no export
+ * memory is allocated, so KILL and alpha test do not work correctly
+ * without this.
+ * 2) Performance: Every shader needs at least a NULL export, even when
+ * it writes no color/depth output. The NULL export instruction
+ * stalls without this setting.
+ *
+ * Don't add this to CB_SHADER_MASK.
+ */
+ if (!pipeline->graphics.blend.spi_shader_col_format) {
+ struct radv_shader_variant *ps = pipeline->shaders[MESA_SHADER_FRAGMENT];
+ if (!ps->info.fs.writes_z &&
+ !ps->info.fs.writes_stencil &&
+ !ps->info.fs.writes_sample_mask)
+ pipeline->graphics.blend.spi_shader_col_format = V_028714_SPI_SHADER_32_R;
+ }
const VkPipelineVertexInputStateCreateInfo *vi_info =
pCreateInfo->pVertexInputState;