diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 3c06cd0b..e826478f 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -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]) { diff --git a/tests/d3d12.c b/tests/d3d12.c index c140a266..587f8b72 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -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;