diff options
author | Dave Airlie <[email protected]> | 2017-03-28 11:34:19 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-03-28 17:40:14 +1000 |
commit | 8996fdbf61e5341c321c802278ee388ac5001f50 (patch) | |
tree | a7eacc1fb244766b9ede938c6d04e95db9b6a6f2 /src/amd/vulkan/radv_pipeline.c | |
parent | cd33a5c1cb68d8c7e67f4724cc19bb92a405c796 (diff) |
radv: move db_shader_control calculation to pipeline.
There is no need to recalculate this every time.
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.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 752986a9c59..42e8abd84ef 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -1641,14 +1641,31 @@ radv_pipeline_init(struct radv_pipeline *pipeline, * * Don't add this to CB_SHADER_MASK. */ + struct radv_shader_variant *ps = pipeline->shaders[MESA_SHADER_FRAGMENT]; 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; } + unsigned z_order; + pipeline->graphics.db_shader_control = 0; + if (ps->info.fs.early_fragment_test || !ps->info.fs.writes_memory) + z_order = V_02880C_EARLY_Z_THEN_LATE_Z; + else + z_order = V_02880C_LATE_Z; + + pipeline->graphics.db_shader_control = + S_02880C_Z_EXPORT_ENABLE(ps->info.fs.writes_z) | + S_02880C_STENCIL_TEST_VAL_EXPORT_ENABLE(ps->info.fs.writes_stencil) | + S_02880C_KILL_ENABLE(!!ps->info.fs.can_discard) | + S_02880C_MASK_EXPORT_ENABLE(ps->info.fs.writes_sample_mask) | + S_02880C_Z_ORDER(z_order) | + S_02880C_DEPTH_BEFORE_SHADER(ps->info.fs.early_fragment_test) | + S_02880C_EXEC_ON_HIER_FAIL(ps->info.fs.writes_memory) | + S_02880C_EXEC_ON_NOOP(ps->info.fs.writes_memory); + const VkPipelineVertexInputStateCreateInfo *vi_info = pCreateInfo->pVertexInputState; for (uint32_t i = 0; i < vi_info->vertexAttributeDescriptionCount; i++) { |