diff options
author | Jason Ekstrand <[email protected]> | 2016-10-19 16:37:03 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-11-16 10:11:07 -0800 |
commit | 6614234fc938e793eb258fb981008661aa943a10 (patch) | |
tree | 5371e26524fc1047cf98b7d81d3244a997f81c05 /src | |
parent | d2b4a9da038a200db3c5c61a11d5ea451cc6cc98 (diff) |
anv/cmd_buffer: Stop relying on the framebuffer for 3DSTATE_SF on gen7
Signed-off-by: Jason Ekstrand <[email protected]>
Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/vulkan/gen7_cmd_buffer.c | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/src/intel/vulkan/gen7_cmd_buffer.c b/src/intel/vulkan/gen7_cmd_buffer.c index c1b7724599f..38e400b2d17 100644 --- a/src/intel/vulkan/gen7_cmd_buffer.c +++ b/src/intel/vulkan/gen7_cmd_buffer.c @@ -28,6 +28,7 @@ #include <fcntl.h> #include "anv_private.h" +#include "vk_format_info.h" #include "genxml/gen_macros.h" #include "genxml/genX_pack.h" @@ -121,6 +122,36 @@ void genX(CmdBindIndexBuffer)( cmd_buffer->state.gen7.index_offset = offset; } +static uint32_t +get_depth_format(struct anv_cmd_buffer *cmd_buffer) +{ + const struct anv_render_pass *pass = cmd_buffer->state.pass; + const struct anv_subpass *subpass = cmd_buffer->state.subpass; + + if (subpass->depth_stencil_attachment >= pass->attachment_count) + return D16_UNORM; + + struct anv_render_pass_attachment *att = + &pass->attachments[subpass->depth_stencil_attachment]; + + switch (att->format) { + case VK_FORMAT_D16_UNORM: + case VK_FORMAT_D16_UNORM_S8_UINT: + return D16_UNORM; + + case VK_FORMAT_X8_D24_UNORM_PACK32: + case VK_FORMAT_D24_UNORM_S8_UINT: + return D24_UNORM_X8_UINT; + + case VK_FORMAT_D32_SFLOAT: + case VK_FORMAT_D32_SFLOAT_S8_UINT: + return D32_FLOAT; + + default: + return D16_UNORM; + } +} + void genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) { @@ -130,20 +161,10 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) ANV_CMD_DIRTY_RENDER_TARGETS | ANV_CMD_DIRTY_DYNAMIC_LINE_WIDTH | ANV_CMD_DIRTY_DYNAMIC_DEPTH_BIAS)) { - - 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 bool has_depth = - image && (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT); - const uint32_t depth_format = has_depth ? - isl_surf_get_depth_format(&cmd_buffer->device->isl_dev, - &image->depth_surface.isl) : D16_UNORM; - uint32_t sf_dw[GENX(3DSTATE_SF_length)]; struct GENX(3DSTATE_SF) sf = { GENX(3DSTATE_SF_header), - .DepthBufferSurfaceFormat = depth_format, + .DepthBufferSurfaceFormat = get_depth_format(cmd_buffer), .LineWidth = cmd_buffer->state.dynamic.line_width, .GlobalDepthOffsetConstant = cmd_buffer->state.dynamic.depth_bias.bias, .GlobalDepthOffsetScale = cmd_buffer->state.dynamic.depth_bias.slope, |