Conor McCarthy (@cmccarthy) commented about libs/vkd3d/resource.c:
TRACE("Offset %#"PRIx64", size %#"PRIx64", row pitch %#"PRIx64", depth pitch %#"PRIx64".\n", vk_layout.offset, vk_layout.size, vk_layout.rowPitch, vk_layout.depthPitch);
- if (FAILED(hr = d3d12_heap_map(resource->heap, resource->heap_offset, resource, (void **)&dst_data)))
- {
WARN("Failed to map resource %p, hr %#x.\n", resource, hr);
return hr;
- }
- dst_data += vk_layout.offset + vkd3d_format_get_data_offset(format, vk_layout.rowPitch,
- dst_data = d3d12_resource_get_map_ptr(resource);
- dst_offset = vk_layout.offset + vkd3d_format_get_data_offset(format, vk_layout.rowPitch, vk_layout.depthPitch, dst_box->left, dst_box->top, dst_box->front);
- dst_size = vk_layout.depthPitch * (dst_box->back - dst_box->front);
This can be beyond the end, for example for a 2D resource it's the entire resource size. Should it be:
`dst_size = vk_layout.offset + vkd3d_format_get_data_offset(format, vk_layout.rowPitch, vk_layout.depthPitch, dst_box->right, dst_box->bottom, dst_box->back) - dst_offset`? Ditto for `src_size` in `ReadFromSubresource()`.