From: Hyunjun Ko Date: Mon, 27 Sep 2021 07:02:02 +0000 (+0000) Subject: turnip: Enable VK_KHR_separate_depth_stencil_layouts X-Git-Tag: upstream/22.3.5~15762 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ddb3d30d4749e744a667ea7835b0648a5c94ca72;p=platform%2Fupstream%2Fmesa.git turnip: Enable VK_KHR_separate_depth_stencil_layouts We now start handling depth/stencil layouts separately when adding implicit subpass dependancies. Signed-off-by: Hyunjun Ko Reviewed-by: Connor Abbott Part-of: --- diff --git a/docs/features.txt b/docs/features.txt index b28c6a8..0d86c70 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -454,7 +454,7 @@ Vulkan 1.2 -- all DONE: anv, vn VK_KHR_image_format_list DONE (anv, lvp, radv, tu, v3dv, vn) VK_KHR_imageless_framebuffer DONE (anv, lvp, radv, tu, vn) VK_KHR_sampler_mirror_clamp_to_edge DONE (anv, lvp, radv, tu, v3dv, vn) - VK_KHR_separate_depth_stencil_layouts DONE (anv, lvp, radv, vn) + VK_KHR_separate_depth_stencil_layouts DONE (anv, lvp, radv, vn, tu) VK_KHR_shader_atomic_int64 DONE (anv/gen9+, lvp, radv, vn) VK_KHR_shader_float16_int8 DONE (anv/gen8+, lvp, radv, tu, vn) VK_KHR_shader_float_controls DONE (anv/gen8+, lvp, radv, tu, vn) diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c index c3a92c9..3c428a1 100644 --- a/src/freedreno/vulkan/tu_device.c +++ b/src/freedreno/vulkan/tu_device.c @@ -155,6 +155,7 @@ get_device_extensions(const struct tu_physical_device *device, .KHR_variable_pointers = true, .KHR_vulkan_memory_model = true, .KHR_driver_properties = true, + .KHR_separate_depth_stencil_layouts = true, #ifndef TU_USE_KGSL .KHR_timeline_semaphore = true, #endif @@ -556,7 +557,7 @@ tu_get_physical_device_features_1_2(struct tu_physical_device *pdevice, features->imagelessFramebuffer = true; features->uniformBufferStandardLayout = true; features->shaderSubgroupExtendedTypes = true; - features->separateDepthStencilLayouts = false; + features->separateDepthStencilLayouts = true; features->hostQueryReset = true; features->timelineSemaphore = true; features->bufferDeviceAddress = false; diff --git a/src/freedreno/vulkan/tu_pass.c b/src/freedreno/vulkan/tu_pass.c index c9a6325..ee200fd 100644 --- a/src/freedreno/vulkan/tu_pass.c +++ b/src/freedreno/vulkan/tu_pass.c @@ -208,9 +208,17 @@ tu_render_pass_add_implicit_deps(struct tu_render_pass *pass, for (unsigned j = 0; j < subpass->inputAttachmentCount; j++) { uint32_t a = subpass->pInputAttachments[j].attachment; + if (a == VK_ATTACHMENT_UNUSED) continue; - if (att[a].initialLayout != subpass->pInputAttachments[j].layout && + + uint32_t stencil_layout = vk_format_has_stencil(att[a].format) ? + vk_att_ref_stencil_layout(&subpass->pInputAttachments[j], att) : + VK_IMAGE_LAYOUT_UNDEFINED; + uint32_t stencil_initial_layout = vk_att_desc_stencil_layout(&att[a], false); + + if ((att[a].initialLayout != subpass->pInputAttachments[j].layout || + stencil_initial_layout != stencil_layout) && !att_used[a] && !has_external_src[i]) src_implicit_dep = true; att_used[a] = true; @@ -229,9 +237,14 @@ tu_render_pass_add_implicit_deps(struct tu_render_pass *pass, if (subpass->pDepthStencilAttachment && subpass->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) { uint32_t a = subpass->pDepthStencilAttachment->attachment; - if (att[a].initialLayout != subpass->pDepthStencilAttachment->layout && - !att_used[a] && !has_external_src[i]) + uint32_t stencil_layout = vk_att_ref_stencil_layout(subpass->pDepthStencilAttachment, att); + uint32_t stencil_initial_layout = vk_att_desc_stencil_layout(&att[a], false); + + if ((att[a].initialLayout != subpass->pDepthStencilAttachment->layout || + stencil_initial_layout != stencil_layout) && + !att_used[a] && !has_external_src[i]) { src_implicit_dep = true; + } att_used[a] = true; } @@ -253,8 +266,12 @@ tu_render_pass_add_implicit_deps(struct tu_render_pass *pass, if (ds_resolve && ds_resolve->pDepthStencilResolveAttachment && ds_resolve->pDepthStencilResolveAttachment->attachment != VK_ATTACHMENT_UNUSED) { uint32_t a = ds_resolve->pDepthStencilResolveAttachment->attachment; - if (att[a].initialLayout != subpass->pDepthStencilAttachment->layout && - !att_used[a] && !has_external_src[i]) + uint32_t stencil_layout = vk_att_ref_stencil_layout(ds_resolve->pDepthStencilResolveAttachment, att); + uint32_t stencil_initial_layout = vk_att_desc_stencil_layout(&att[a], false); + + if ((att[a].initialLayout != subpass->pDepthStencilAttachment->layout || + stencil_initial_layout != stencil_layout) && + !att_used[a] && !has_external_src[i]) src_implicit_dep = true; att_used[a] = true; } @@ -286,7 +303,14 @@ tu_render_pass_add_implicit_deps(struct tu_render_pass *pass, uint32_t a = subpass->pInputAttachments[j].attachment; if (a == VK_ATTACHMENT_UNUSED) continue; - if (att[a].finalLayout != subpass->pInputAttachments[j].layout && + + uint32_t stencil_layout = vk_format_has_stencil(att[a].format) ? + vk_att_ref_stencil_layout(&subpass->pInputAttachments[j], att) : + VK_IMAGE_LAYOUT_UNDEFINED; + uint32_t stencil_final_layout = vk_att_desc_stencil_layout(&att[a], true); + + if ((att[a].finalLayout != subpass->pInputAttachments[j].layout || + stencil_final_layout != stencil_layout) && !att_used[a] && !has_external_dst[i]) dst_implicit_dep = true; att_used[a] = true; @@ -305,9 +329,14 @@ tu_render_pass_add_implicit_deps(struct tu_render_pass *pass, if (subpass->pDepthStencilAttachment && subpass->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) { uint32_t a = subpass->pDepthStencilAttachment->attachment; - if (att[a].finalLayout != subpass->pDepthStencilAttachment->layout && - !att_used[a] && !has_external_dst[i]) + uint32_t stencil_layout = vk_att_ref_stencil_layout(subpass->pDepthStencilAttachment, att); + uint32_t stencil_final_layout = vk_att_desc_stencil_layout(&att[a], true); + + if ((att[a].finalLayout != subpass->pDepthStencilAttachment->layout || + stencil_final_layout != stencil_layout) && + !att_used[a] && !has_external_dst[i]) { dst_implicit_dep = true; + } att_used[a] = true; } @@ -329,8 +358,12 @@ tu_render_pass_add_implicit_deps(struct tu_render_pass *pass, if (ds_resolve && ds_resolve->pDepthStencilResolveAttachment && ds_resolve->pDepthStencilResolveAttachment->attachment != VK_ATTACHMENT_UNUSED) { uint32_t a = ds_resolve->pDepthStencilResolveAttachment->attachment; - if (att[a].finalLayout != subpass->pDepthStencilAttachment->layout && - !att_used[a] && !has_external_dst[i]) + uint32_t stencil_layout = vk_att_ref_stencil_layout(ds_resolve->pDepthStencilResolveAttachment, att); + uint32_t stencil_final_layout = vk_att_desc_stencil_layout(&att[a], true); + + if ((att[a].finalLayout != subpass->pDepthStencilAttachment->layout || + stencil_final_layout != stencil_layout) && + !att_used[a] && !has_external_src[i]) dst_implicit_dep = true; att_used[a] = true; } diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index 613424d..5e690a3 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -94,6 +94,7 @@ typedef uint32_t xcb_window_t; #include "tu_entrypoints.h" #include "vk_format.h" +#include "vk_image.h" #include "vk_command_buffer.h" #include "vk_queue.h"