Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HansKristian-Work/vkd3d-proton.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2022-09-16 17:27:10 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2022-09-16 17:48:49 +0300
commita9bb59f22197d4dcab8fa41a0e9cfbc52a04e018 (patch)
tree07200f4bf7938b9ed84f89b8f60b775fc8b3c3f8
parentfafe99a278ead592ef49ebee9f67487474d558ce (diff)
vkd3d: Allow more initial resource states for UPLOAD/READBACK.
AgilitySDK 606 now suddenly allows this, but docs still say it's banned, so ... *shrug* F1 22 relies on this to work. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
-rw-r--r--libs/vkd3d/resource.c18
-rw-r--r--tests/d3d12_resource.c16
2 files changed, 27 insertions, 7 deletions
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index 90e7ed6c..af4669ee 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -2226,14 +2226,24 @@ static HRESULT d3d12_resource_validate_heap_properties(const D3D12_RESOURCE_DESC
}
}
- if (heap_properties->Type == D3D12_HEAP_TYPE_UPLOAD && initial_state != D3D12_RESOURCE_STATE_GENERIC_READ)
+ if (heap_properties->Type == D3D12_HEAP_TYPE_UPLOAD &&
+ (initial_state & ~D3D12_RESOURCE_STATE_GENERIC_READ))
{
- WARN("For D3D12_HEAP_TYPE_UPLOAD the state must be D3D12_RESOURCE_STATE_GENERIC_READ.\n");
+ /* AgilitySDK 606 suddenly started allowing COMMON state in UPLOAD heaps.
+ * This is not publicly documented, but it's not a big problem to allow it either.
+ * It also allows any state which is read-only. */
+ WARN("For D3D12_HEAP_TYPE_UPLOAD the state must be part of the D3D12_RESOURCE_STATE_GENERIC_READ bitmask (or COMMON).\n");
return E_INVALIDARG;
}
- if (heap_properties->Type == D3D12_HEAP_TYPE_READBACK && initial_state != D3D12_RESOURCE_STATE_COPY_DEST)
+
+ if (heap_properties->Type == D3D12_HEAP_TYPE_READBACK &&
+ initial_state != D3D12_RESOURCE_STATE_COPY_DEST &&
+ initial_state != D3D12_RESOURCE_STATE_COMMON)
{
- WARN("For D3D12_HEAP_TYPE_READBACK the state must be D3D12_RESOURCE_STATE_COPY_DEST.\n");
+ /* AgilitySDK 606 suddenly started allowing COMMON state in READBACK heaps.
+ * This is not publicly documented, but it's not a big problem to allow it either.
+ * F1 22 hits this case. */
+ WARN("For D3D12_HEAP_TYPE_READBACK the state must be D3D12_RESOURCE_STATE_COPY_DEST (or COMMON).\n");
return E_INVALIDARG;
}
diff --git a/tests/d3d12_resource.c b/tests/d3d12_resource.c
index d55f365d..6070a9a3 100644
--- a/tests/d3d12_resource.c
+++ b/tests/d3d12_resource.c
@@ -268,11 +268,18 @@ void test_create_committed_resource(void)
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
&resource_desc, D3D12_RESOURCE_STATE_COMMON, NULL,
&IID_ID3D12Resource, (void **)&resource);
- ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ /* AgilitySDK 606 allows COMMON for UPLOAD heap now. */
+ if (SUCCEEDED(hr))
+ ID3D12Resource_Release(resource);
+
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
&resource_desc, D3D12_RESOURCE_STATE_COPY_SOURCE, NULL,
&IID_ID3D12Resource, (void **)&resource);
- ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ /* AgilitySDK 606 allows partial GENERIC_READ for UPLOAD heap now. */
+ if (SUCCEEDED(hr))
+ ID3D12Resource_Release(resource);
heap_properties.Type = D3D12_HEAP_TYPE_READBACK;
@@ -291,7 +298,10 @@ void test_create_committed_resource(void)
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
&resource_desc, D3D12_RESOURCE_STATE_COMMON, NULL,
&IID_ID3D12Resource, (void **)&resource);
- ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ /* AgilitySDK 606 allows COMMON for READBACK heap now. */
+ if (SUCCEEDED(hr))
+ ID3D12Resource_Release(resource);
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
&resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL,
&IID_ID3D12Resource, (void **)&resource);