libs/vkd3d: Fix copying descriptors with NULL source range sizes.

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:
Józef Kucia 2018-03-28 15:03:19 +02:00 committed by Alexandre Julliard
parent 4dc706733e
commit 953a924ca0
2 changed files with 4 additions and 6 deletions

View File

@ -1673,6 +1673,7 @@ static void STDMETHODCALLTYPE d3d12_device_CopyDescriptors(ID3D12Device *iface,
struct d3d12_device *device = impl_from_ID3D12Device(iface);
unsigned int dst_range_idx, dst_idx, src_range_idx, src_idx;
const struct d3d12_desc *src;
unsigned int src_range_size;
struct d3d12_desc *dst;
TRACE("iface %p, dst_descriptor_range_count %u, dst_descriptor_range_offsets %p, "
@ -1695,7 +1696,8 @@ static void STDMETHODCALLTYPE d3d12_device_CopyDescriptors(ID3D12Device *iface,
for (src_range_idx = 0; src_range_idx < src_descriptor_range_count; ++src_range_idx)
{
src = d3d12_desc_from_cpu_handle(src_descriptor_range_offsets[src_range_idx]);
for (src_idx = 0; src_idx < src_descriptor_range_sizes[src_range_idx]; ++src_idx)
src_range_size = src_descriptor_range_sizes ? src_descriptor_range_sizes[src_range_idx] : 1;
for (src_idx = 0; src_idx < src_range_size; ++src_idx)
{
if (dst_idx >= dst_descriptor_range_sizes[dst_range_idx])
{

View File

@ -11413,16 +11413,12 @@ static void test_copy_descriptors(void)
dst_handles[0] = get_cpu_sampler_handle(&context, sampler_heap, 0);
dst_range_sizes[0] = 4;
src_handles[0] = get_cpu_sampler_handle(&context, cpu_sampler_heap2, 0);
src_range_sizes[0] = 1;
src_handles[1] = get_cpu_sampler_handle(&context, cpu_sampler_heap2, 0);
src_range_sizes[1] = 1;
src_handles[2] = get_cpu_sampler_handle(&context, cpu_sampler_heap2, 0);
src_range_sizes[2] = 1;
src_handles[3] = get_cpu_sampler_handle(&context, cpu_sampler_heap2, 1);
src_range_sizes[3] = 1;
/* s0-s3 */
ID3D12Device_CopyDescriptors(device, 1, dst_handles, dst_range_sizes,
4, src_handles, src_range_sizes, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
4, src_handles, NULL, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
dst_handles[0] = get_cpu_descriptor_handle(&context, heap, 9);
dst_range_sizes[0] = 4;