From ea694637ac8a7f6aeb9682a64b197fab6aabf9cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg=20Kristensen?= Date: Sun, 14 Feb 2016 22:52:37 -0800 Subject: [PATCH] anv/gen7: Set 3DSTATE_SF depth buffer format correctly We need to pull this from the render pass information at state flush time. --- src/vulkan/gen7_cmd_buffer.c | 9 +++++++++ src/vulkan/gen7_pipeline.c | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/vulkan/gen7_cmd_buffer.c b/src/vulkan/gen7_cmd_buffer.c index b5b9d1c5ce0..18b36487c5f 100644 --- a/src/vulkan/gen7_cmd_buffer.c +++ b/src/vulkan/gen7_cmd_buffer.c @@ -442,15 +442,24 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) gen7_cmd_buffer_emit_scissor(cmd_buffer); if (cmd_buffer->state.dirty & (ANV_CMD_DIRTY_PIPELINE | + ANV_CMD_DIRTY_RENDER_TARGETS | ANV_CMD_DIRTY_DYNAMIC_LINE_WIDTH | ANV_CMD_DIRTY_DYNAMIC_DEPTH_BIAS)) { bool enable_bias = cmd_buffer->state.dynamic.depth_bias.bias != 0.0f || cmd_buffer->state.dynamic.depth_bias.slope != 0.0f; + const struct anv_image_view *iview = + anv_cmd_buffer_get_depth_stencil_view(cmd_buffer); + const struct anv_image *image = iview ? iview->image : NULL; + const uint32_t depth_format = image ? + isl_surf_get_depth_format(&cmd_buffer->device->isl_dev, + &image->depth_surface.isl) : D16_UNORM; + uint32_t sf_dw[GEN7_3DSTATE_SF_length]; struct GEN7_3DSTATE_SF sf = { GEN7_3DSTATE_SF_header, + .DepthBufferSurfaceFormat = depth_format, .LineWidth = cmd_buffer->state.dynamic.line_width, .GlobalDepthOffsetEnableSolid = enable_bias, .GlobalDepthOffsetEnableWireframe = enable_bias, diff --git a/src/vulkan/gen7_pipeline.c b/src/vulkan/gen7_pipeline.c index ec8db1d1956..4ec9cf5f019 100644 --- a/src/vulkan/gen7_pipeline.c +++ b/src/vulkan/gen7_pipeline.c @@ -42,9 +42,6 @@ gen7_emit_rs_state(struct anv_pipeline *pipeline, struct GEN7_3DSTATE_SF sf = { GEN7_3DSTATE_SF_header, - /* FIXME: Get this from pass info */ - .DepthBufferSurfaceFormat = D24_UNORM_X8_UINT, - /* LegacyGlobalDepthBiasEnable */ .StatisticsEnable = true, -- 2.30.2