vkd3d: Introduce d3d12_box_is_empty().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2019-10-18 17:28:54 +03:30 committed by Alexandre Julliard
parent 6259f10c4d
commit 65417717ac
2 changed files with 7 additions and 2 deletions

View File

@ -1352,7 +1352,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_WriteToSubresource(ID3D12Resourc
return E_INVALIDARG;
}
if (dst_box->right <= dst_box->left || dst_box->bottom <= dst_box->top || dst_box->back <= dst_box->front)
if (d3d12_box_is_empty(dst_box))
{
WARN("Empty box %s.\n", debug_d3d12_box(dst_box));
return S_OK;
@ -1454,7 +1454,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_ReadFromSubresource(ID3D12Resour
return E_INVALIDARG;
}
if (src_box->right <= src_box->left || src_box->bottom <= src_box->top || src_box->back <= src_box->front)
if (d3d12_box_is_empty(src_box))
{
WARN("Empty box %s.\n", debug_d3d12_box(src_box));
return S_OK;

View File

@ -1168,6 +1168,11 @@ static inline const struct vkd3d_format *vkd3d_format_from_d3d12_resource_desc(
desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL);
}
static inline bool d3d12_box_is_empty(const D3D12_BOX *box)
{
return box->right <= box->left || box->bottom <= box->top || box->back <= box->front;
}
static inline unsigned int d3d12_resource_desc_get_width(const D3D12_RESOURCE_DESC *desc,
unsigned int miplevel_idx)
{