radv: move shader_z_format calculation to pipeline.
authorDave Airlie <airlied@redhat.com>
Tue, 28 Mar 2017 01:34:46 +0000 (11:34 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 28 Mar 2017 07:40:17 +0000 (17:40 +1000)
No need to recalculate this every time.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_private.h

index 8e35dc5299bd23eab7c0993cb48a4a7b7a211ebe..c3b141ea3a645078a57648b0dfff4b0f753dde50 100644 (file)
@@ -709,10 +709,7 @@ radv_emit_fragment_shader(struct radv_cmd_buffer *cmd_buffer,
        radeon_set_context_reg(cmd_buffer->cs, R_0286E0_SPI_BARYC_CNTL, spi_baryc_cntl);
 
        radeon_set_context_reg(cmd_buffer->cs, R_028710_SPI_SHADER_Z_FORMAT,
-                              ps->info.fs.writes_sample_mask ? V_028710_SPI_SHADER_32_ABGR :
-                              ps->info.fs.writes_stencil ? V_028710_SPI_SHADER_32_GR :
-                              ps->info.fs.writes_z ? V_028710_SPI_SHADER_32_R :
-                              V_028710_SPI_SHADER_ZERO);
+                              pipeline->graphics.shader_z_format);
 
        radeon_set_context_reg(cmd_buffer->cs, R_028714_SPI_SHADER_COL_FORMAT, blend->spi_shader_col_format);
 
index 42e8abd84ef3642f0b1785f48d65f4d9c91ba5d9..550b773e9a537c65b45eee7926b3b3c847c00948 100644 (file)
@@ -1666,6 +1666,12 @@ radv_pipeline_init(struct radv_pipeline *pipeline,
                S_02880C_EXEC_ON_HIER_FAIL(ps->info.fs.writes_memory) |
                S_02880C_EXEC_ON_NOOP(ps->info.fs.writes_memory);
 
+       pipeline->graphics.shader_z_format =
+               ps->info.fs.writes_sample_mask ? V_028710_SPI_SHADER_32_ABGR :
+               ps->info.fs.writes_stencil ? V_028710_SPI_SHADER_32_GR :
+               ps->info.fs.writes_z ? V_028710_SPI_SHADER_32_R :
+               V_028710_SPI_SHADER_ZERO;
+
        const VkPipelineVertexInputStateCreateInfo *vi_info =
                pCreateInfo->pVertexInputState;
        for (uint32_t i = 0; i < vi_info->vertexAttributeDescriptionCount; i++) {
index 8e45e95b770e771718d66b282d0f0f45daab3888..dff0aef83287e86529e4f75790d73ed970f215f4 100644 (file)
@@ -956,6 +956,7 @@ struct radv_pipeline {
                        struct radv_raster_state raster;
                        struct radv_multisample_state ms;
                        uint32_t db_shader_control;
+                       uint32_t shader_z_format;
                        unsigned prim;
                        unsigned gs_out;
                        uint32_t vgt_gs_mode;