mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Validate box in d3d12_command_list_CopyTextureRegion().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c960e10ea5
commit
e9574e1f39
@ -2715,6 +2715,13 @@ static void d3d12_command_list_copy_incompatible_texture_region(struct d3d12_com
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &buffer_image_copy));
|
||||
}
|
||||
|
||||
static bool validate_d3d12_box(const D3D12_BOX *box)
|
||||
{
|
||||
return box->right > box->left
|
||||
&& box->bottom > box->top
|
||||
&& box->back > box->front;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE d3d12_command_list_CopyTextureRegion(ID3D12GraphicsCommandList1 *iface,
|
||||
const D3D12_TEXTURE_COPY_LOCATION *dst, UINT dst_x, UINT dst_y, UINT dst_z,
|
||||
const D3D12_TEXTURE_COPY_LOCATION *src, const D3D12_BOX *src_box)
|
||||
@ -2729,6 +2736,12 @@ static void STDMETHODCALLTYPE d3d12_command_list_CopyTextureRegion(ID3D12Graphic
|
||||
TRACE("iface %p, dst %p, dst_x %u, dst_y %u, dst_z %u, src %p, src_box %p.\n",
|
||||
iface, dst, dst_x, dst_y, dst_z, src, src_box);
|
||||
|
||||
if (src_box && !validate_d3d12_box(src_box))
|
||||
{
|
||||
WARN("Empty box %s.\n", debug_d3d12_box(src_box));
|
||||
return;
|
||||
}
|
||||
|
||||
vk_procs = &list->device->vk_procs;
|
||||
|
||||
dst_resource = unsafe_impl_from_ID3D12Resource(dst->pResource);
|
||||
|
@ -321,6 +321,16 @@ HRESULT return_interface(void *iface, REFIID iface_iid,
|
||||
return hr;
|
||||
}
|
||||
|
||||
const char *debug_d3d12_box(const D3D12_BOX *box)
|
||||
{
|
||||
if (!box)
|
||||
return "(null)";
|
||||
|
||||
return vkd3d_dbg_sprintf("(%u, %u, %u)-(%u, %u, %u)",
|
||||
box->left, box->top, box->front,
|
||||
box->right, box->bottom, box->back);
|
||||
}
|
||||
|
||||
const char *debug_vk_extent_3d(VkExtent3D extent)
|
||||
{
|
||||
return vkd3d_dbg_sprintf("(%u, %u, %u)",
|
||||
|
@ -1015,6 +1015,7 @@ static inline bool is_cpu_accessible_heap(const D3D12_HEAP_PROPERTIES *propertie
|
||||
HRESULT return_interface(void *iface, REFIID iface_iid,
|
||||
REFIID requested_iid, void **object) DECLSPEC_HIDDEN;
|
||||
|
||||
const char *debug_d3d12_box(const D3D12_BOX *box) DECLSPEC_HIDDEN;
|
||||
const char *debug_vk_extent_3d(VkExtent3D extent) DECLSPEC_HIDDEN;
|
||||
const char *debug_vk_memory_heap_flags(VkMemoryHeapFlags flags) DECLSPEC_HIDDEN;
|
||||
const char *debug_vk_memory_property_flags(VkMemoryPropertyFlags flags) DECLSPEC_HIDDEN;
|
||||
|
@ -20933,6 +20933,11 @@ static void test_copy_texture_buffer(void)
|
||||
ID3D12GraphicsCommandList_CopyTextureRegion(command_list,
|
||||
&dst_location, 32, 0, 0, &src_location, &box);
|
||||
|
||||
/* empty box */
|
||||
set_box(&box, 128, 0, 0, 32, 32, 1);
|
||||
ID3D12GraphicsCommandList_CopyTextureRegion(command_list,
|
||||
&dst_location, 0, 0, 0, &src_location, &box);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dst_buffers); ++i)
|
||||
{
|
||||
transition_resource_state(command_list, dst_buffers[i],
|
||||
|
Loading…
Reference in New Issue
Block a user