mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Use state RESOLVE_SOURCE for readback from multisampled textures.
This commit is contained in:
parent
3681b83fb4
commit
51c37735a9
Notes:
Henri Verbeet
2024-11-04 17:11:43 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1240
@ -573,6 +573,7 @@ static void get_resource_readback_with_command_list_and_states(ID3D12Resource *r
|
|||||||
D3D12_RESOURCE_STATES initial_state, D3D12_RESOURCE_STATES final_state)
|
D3D12_RESOURCE_STATES initial_state, D3D12_RESOURCE_STATES final_state)
|
||||||
{
|
{
|
||||||
D3D12_HEAP_PROPERTIES heap_properties;
|
D3D12_HEAP_PROPERTIES heap_properties;
|
||||||
|
D3D12_RESOURCE_STATES readback_state;
|
||||||
D3D12_RESOURCE_DESC resource_desc;
|
D3D12_RESOURCE_DESC resource_desc;
|
||||||
ID3D12Resource *src_resource;
|
ID3D12Resource *src_resource;
|
||||||
D3D12_RANGE read_range;
|
D3D12_RANGE read_range;
|
||||||
@ -580,6 +581,7 @@ static void get_resource_readback_with_command_list_and_states(ID3D12Resource *r
|
|||||||
ID3D12Device *device;
|
ID3D12Device *device;
|
||||||
uint64_t buffer_size;
|
uint64_t buffer_size;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
bool is_ms;
|
||||||
|
|
||||||
hr = ID3D12Resource_GetDevice(resource, &IID_ID3D12Device, (void **)&device);
|
hr = ID3D12Resource_GetDevice(resource, &IID_ID3D12Device, (void **)&device);
|
||||||
assert_that(hr == S_OK, "Failed to get device, hr %#x.\n", hr);
|
assert_that(hr == S_OK, "Failed to get device, hr %#x.\n", hr);
|
||||||
@ -598,11 +600,14 @@ static void get_resource_readback_with_command_list_and_states(ID3D12Resource *r
|
|||||||
rb->rb.row_pitch = align(rb->rb.row_pitch, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
|
rb->rb.row_pitch = align(rb->rb.row_pitch, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT);
|
||||||
rb->rb.data = NULL;
|
rb->rb.data = NULL;
|
||||||
|
|
||||||
|
is_ms = resource_desc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER && resource_desc.SampleDesc.Count > 1;
|
||||||
|
readback_state = is_ms ? D3D12_RESOURCE_STATE_RESOLVE_SOURCE : D3D12_RESOURCE_STATE_COPY_SOURCE;
|
||||||
|
|
||||||
if (initial_state != RESOURCE_STATE_DO_NOT_CHANGE)
|
if (initial_state != RESOURCE_STATE_DO_NOT_CHANGE)
|
||||||
transition_sub_resource_state(command_list, resource, sub_resource, initial_state, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
transition_sub_resource_state(command_list, resource, sub_resource, initial_state, readback_state);
|
||||||
|
|
||||||
src_resource = resource;
|
src_resource = resource;
|
||||||
if (resource_desc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER && resource_desc.SampleDesc.Count > 1)
|
if (is_ms)
|
||||||
{
|
{
|
||||||
memset(&heap_properties, 0, sizeof(heap_properties));
|
memset(&heap_properties, 0, sizeof(heap_properties));
|
||||||
heap_properties.Type = D3D12_HEAP_TYPE_DEFAULT;
|
heap_properties.Type = D3D12_HEAP_TYPE_DEFAULT;
|
||||||
@ -652,7 +657,7 @@ static void get_resource_readback_with_command_list_and_states(ID3D12Resource *r
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (final_state != RESOURCE_STATE_DO_NOT_CHANGE)
|
if (final_state != RESOURCE_STATE_DO_NOT_CHANGE)
|
||||||
transition_sub_resource_state(command_list, resource, sub_resource, D3D12_RESOURCE_STATE_COPY_SOURCE, final_state);
|
transition_sub_resource_state(command_list, resource, sub_resource, readback_state, final_state);
|
||||||
|
|
||||||
hr = ID3D12GraphicsCommandList_Close(command_list);
|
hr = ID3D12GraphicsCommandList_Close(command_list);
|
||||||
assert_that(hr == S_OK, "Failed to close command list, hr %#x.\n", hr);
|
assert_that(hr == S_OK, "Failed to close command list, hr %#x.\n", hr);
|
||||||
|
Loading…
Reference in New Issue
Block a user