vkd3d: Return E_INVALIDARG for texture creation if SampleDesc.Count == 0.

Windows returns E_INVALIDARG at least on AMD and Intel.
Psychonaughts 2 seems to use this as a de facto "do not create"
value, and reasonable vram usage depends on the call failing.

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
This commit is contained in:
Conor McCarthy 2021-09-18 14:18:49 +10:00 committed by Joshie
parent d366ba47ac
commit 446c7423ce
1 changed files with 6 additions and 0 deletions

View File

@ -1974,6 +1974,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 == 0)
{
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);