summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-02-14 22:52:37 -0800
committerKristian Høgsberg Kristensen <[email protected]>2016-02-15 17:32:07 -0800
commitea694637ac8a7f6aeb9682a64b197fab6aabf9cd (patch)
tree0a5df25eed104e5d527c4e0c89de43ce8bfab221 /src
parent18dd59538b888127a3894bf764d863e5067f4a4a (diff)
anv/gen7: Set 3DSTATE_SF depth buffer format correctly
We need to pull this from the render pass information at state flush time.
Diffstat (limited to 'src')
-rw-r--r--src/vulkan/gen7_cmd_buffer.c9
-rw-r--r--src/vulkan/gen7_pipeline.c3
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,