Skip to content

Commit

Permalink
vkd3d: Implement CopyResource for sampler feedback.
Browse files Browse the repository at this point in the history
Signed-off-by: Hans-Kristian Arntzen <[email protected]>
  • Loading branch information
HansKristian-Work committed Nov 7, 2023
1 parent 59491f7 commit 26b8210
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libs/vkd3d/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -7941,6 +7941,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyResource(d3d12_command_list
VkCopyBufferInfo2 copy_info;
VkImageCopy2 vk_image_copy;
unsigned int layer_count;
unsigned int level_count;
unsigned int i;

TRACE("iface %p, dst_resource %p, src_resource %p.\n", iface, dst, src);
Expand Down Expand Up @@ -7986,13 +7987,14 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyResource(d3d12_command_list
else
{
layer_count = d3d12_resource_desc_get_layer_count(&dst_resource->desc);
level_count = d3d12_resource_desc_get_active_level_count(&dst_resource->desc);

assert(d3d12_resource_is_texture(dst_resource));
assert(d3d12_resource_is_texture(src_resource));
assert(dst_resource->desc.MipLevels == src_resource->desc.MipLevels);
assert(level_count == d3d12_resource_desc_get_active_level_count(&src_resource->desc));
assert(layer_count == d3d12_resource_desc_get_layer_count(&src_resource->desc));

for (i = 0; i < dst_resource->desc.MipLevels; ++i)
for (i = 0; i < level_count; ++i)
{
if (!vk_image_copy_from_d3d12(&vk_image_copy, i, i,
&src_resource->desc, &dst_resource->desc, src_resource->format, dst_resource->format, NULL, 0, 0, 0))
Expand All @@ -8001,6 +8003,10 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyResource(d3d12_command_list
continue;
}

/* Copying sampler feedback is only allowed in CopyResource. */
if (d3d12_resource_desc_is_sampler_feedback(&src_resource->desc))
vk_image_copy.extent = d3d12_resource_desc_get_padded_feedback_extent(&src_resource->desc);

vk_image_copy.dstSubresource.layerCount = layer_count;
vk_image_copy.srcSubresource.layerCount = layer_count;
vk_image_copy.dstSubresource.aspectMask = dst_resource->format->vk_aspect_mask;
Expand Down

0 comments on commit 26b8210

Please sign in to comment.