anv/gen7: Set 3DSTATE_SF depth buffer format correctly
authorKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Mon, 15 Feb 2016 06:52:37 +0000 (22:52 -0800)
committerKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Tue, 16 Feb 2016 01:32:07 +0000 (17:32 -0800)
We need to pull this from the render pass information at state flush
time.

src/vulkan/gen7_cmd_buffer.c
src/vulkan/gen7_pipeline.c

index b5b9d1c5ce06f5e412e6aebac498d507b6d23611..18b36487c5ffdd2cd74e8077f72028ac375de62d 100644 (file)
@@ -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,
index ec8db1d195663f735b49c2432a03400a15c8bad5..4ec9cf5f019060040768db7b6ecd886264eeacdd 100644 (file)
@@ -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,