Mesa (main): turnip: Enable VK_KHR_separate_depth_stencil_layouts
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Nov 12 13:40:09 UTC 2021
Module: Mesa
Branch: main
Commit: ddb3d30d4749e744a667ea7835b0648a5c94ca72
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddb3d30d4749e744a667ea7835b0648a5c94ca72
Author: Hyunjun Ko <zzoon at igalia.com>
Date: Mon Sep 27 07:02:02 2021 +0000
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 <zzoon at igalia.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13057>
---
docs/features.txt | 2 +-
src/freedreno/vulkan/tu_device.c | 3 ++-
src/freedreno/vulkan/tu_pass.c | 53 +++++++++++++++++++++++++++++++--------
src/freedreno/vulkan/tu_private.h | 1 +
4 files changed, 47 insertions(+), 12 deletions(-)
diff --git a/docs/features.txt b/docs/features.txt
index b28c6a8ab7c..0d86c70b2fa 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 c3a92c9183b..3c428a1437c 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 c9a6325ea42..ee200fd69cf 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 613424db7c7..5e690a3cdf7 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"
More information about the mesa-commit
mailing list