vkd3d: Introduce a vkd3d_bound_range() helper.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura
2021-07-26 15:51:28 -05:00
committed by Alexandre Julliard
parent 9f0b475583
commit bcf272aa0b
4 changed files with 15 additions and 4 deletions

View File

@@ -4422,7 +4422,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_IASetVertexBuffers(ID3D12Graphi
null_resources = &list->device->null_resources;
gpu_va_allocator = &list->device->gpu_va_allocator;
if (start_slot >= ARRAY_SIZE(list->strides) || view_count > ARRAY_SIZE(list->strides) - start_slot)
if (!vkd3d_bound_range(start_slot, view_count, ARRAY_SIZE(list->strides)))
{
WARN("Invalid start slot %u / view count %u.\n", start_slot, view_count);
return;
@@ -4477,7 +4477,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_SOSetTargets(ID3D12GraphicsComm
return;
}
if (start_slot >= ARRAY_SIZE(buffers) || view_count > ARRAY_SIZE(buffers) - start_slot)
if (!vkd3d_bound_range(start_slot, view_count, ARRAY_SIZE(buffers)))
{
WARN("Invalid start slot %u / view count %u.\n", start_slot, view_count);
return;

View File

@@ -3515,8 +3515,7 @@ static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints(ID3D12Device *i
array_size = d3d12_resource_desc_get_layer_count(desc);
if (first_sub_resource >= desc->MipLevels * array_size
|| sub_resource_count > desc->MipLevels * array_size - first_sub_resource)
if (!vkd3d_bound_range(first_sub_resource, sub_resource_count, desc->MipLevels * array_size))
{
WARN("Invalid sub-resource range %u-%u for resource.\n", first_sub_resource, sub_resource_count);
return;