Conor McCarthy : vkd3d: Reject 0 sample count textures in d3d12_resource_validate_desc().
Alexandre Julliard
julliard at winehq.org
Fri Oct 15 15:39:49 CDT 2021
Module: vkd3d
Branch: master
Commit: a86a6819121a448d091b5e48192d624886016bf7
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=a86a6819121a448d091b5e48192d624886016bf7
Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date: Fri Oct 15 01:37:40 2021 +0200
vkd3d: Reject 0 sample count textures in d3d12_resource_validate_desc().
Buffers with 0 sample counts were already rejected here.
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d/resource.c | 6 ++++++
tests/d3d12.c | 4 +---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index d6e5d4b..705e720 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -1681,6 +1681,12 @@ HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC *desc, struct d3d
/* Fall through. */
case D3D12_RESOURCE_DIMENSION_TEXTURE2D:
case D3D12_RESOURCE_DIMENSION_TEXTURE3D:
+ if (!desc->SampleDesc.Count)
+ {
+ WARN("Invalid sample count 0.\n");
+ return E_INVALIDARG;
+ }
+
if (!(format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0)))
{
WARN("Invalid format %#x.\n", desc->Format);
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 4a7309d..0833476 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -1703,9 +1703,7 @@ static void test_create_committed_resource(void)
resource_desc.SampleDesc.Count = 0;
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc,
D3D12_RESOURCE_STATE_RENDER_TARGET, &clear_value, &IID_ID3D12Resource, (void **)&resource);
- todo ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
- if (SUCCEEDED(hr))
- ID3D12Resource_Release(resource);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
resource_desc.SampleDesc.Count = 1;
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
More information about the wine-cvs
mailing list