dzn: Fix SRV barrier state on compute command lists

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22225>
(cherry picked from commit f2a5a03d3b)
This commit is contained in:
Jesse Natalie 2023-03-23 08:34:39 -07:00 committed by Dylan Baker
parent f3a2ad5895
commit 67e71ee93f
4 changed files with 13 additions and 9 deletions

View File

@ -6624,7 +6624,7 @@
"description": "dzn: Fix SRV barrier state on compute command lists",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@ -211,12 +211,12 @@ dzn_cmd_buffer_queue_image_range_layout_transition(struct dzn_cmd_buffer *cmdbuf
dzn_foreach_aspect(aspect, range->aspectMask) {
D3D12_RESOURCE_STATES after =
dzn_image_layout_to_state(image, new_layout, aspect);
dzn_image_layout_to_state(image, new_layout, aspect, cmdbuf->type);
D3D12_RESOURCE_STATES before =
(old_layout == VK_IMAGE_LAYOUT_UNDEFINED ||
old_layout == VK_IMAGE_LAYOUT_PREINITIALIZED) ?
D3D12_RESOURCE_STATE_COMMON :
dzn_image_layout_to_state(image, old_layout, aspect);
dzn_image_layout_to_state(image, old_layout, aspect, cmdbuf->type);
uint32_t layer_count = dzn_get_layer_count(image, range);
uint32_t level_count = dzn_get_level_count(image, range);
@ -4219,8 +4219,8 @@ dzn_cmd_buffer_resolve_rendering_attachment(struct dzn_cmd_buffer *cmdbuf,
.layerCount = MIN2(src->vk.layer_count, dst->vk.layer_count),
};
D3D12_RESOURCE_STATES src_state = dzn_image_layout_to_state(src_img, src_layout, aspect);
D3D12_RESOURCE_STATES dst_state = dzn_image_layout_to_state(dst_img, dst_layout, aspect);
D3D12_RESOURCE_STATES src_state = dzn_image_layout_to_state(src_img, src_layout, aspect, cmdbuf->type);
D3D12_RESOURCE_STATES dst_state = dzn_image_layout_to_state(dst_img, dst_layout, aspect, cmdbuf->type);
D3D12_BARRIER_LAYOUT src_restore_layout = D3D12_BARRIER_LAYOUT_COMMON,
src_needed_layout = D3D12_BARRIER_LAYOUT_DIRECT_QUEUE_GENERIC_READ;
D3D12_BARRIER_LAYOUT dst_restore_layout = D3D12_BARRIER_LAYOUT_COMMON,

View File

@ -580,11 +580,14 @@ dzn_image_get_rtv_desc(const struct dzn_image *image,
D3D12_RESOURCE_STATES
dzn_image_layout_to_state(const struct dzn_image *image,
VkImageLayout layout,
VkImageAspectFlagBits aspect)
VkImageAspectFlagBits aspect,
D3D12_COMMAND_LIST_TYPE type)
{
D3D12_RESOURCE_STATES shaders_access =
(image->desc.Flags & D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE) ?
0 : D3D12_RESOURCE_STATE_ALL_SHADER_RESOURCE;
0 : (type == D3D12_COMMAND_LIST_TYPE_DIRECT ?
D3D12_RESOURCE_STATE_ALL_SHADER_RESOURCE :
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
switch (layout) {
case VK_IMAGE_LAYOUT_PREINITIALIZED:
@ -623,7 +626,7 @@ dzn_image_layout_to_state(const struct dzn_image *image,
D3D12_RESOURCE_STATE_DEPTH_WRITE;
case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
return D3D12_RESOURCE_STATE_ALL_SHADER_RESOURCE;
return shaders_access;
case VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT:
return D3D12_RESOURCE_STATE_COMMON;

View File

@ -943,7 +943,8 @@ dzn_image_get_rtv_desc(const struct dzn_image *image,
D3D12_RESOURCE_STATES
dzn_image_layout_to_state(const struct dzn_image *image,
VkImageLayout layout,
VkImageAspectFlagBits aspect);
VkImageAspectFlagBits aspect,
D3D12_COMMAND_LIST_TYPE type);
D3D12_BARRIER_LAYOUT
dzn_vk_layout_to_d3d_layout(VkImageLayout layout,