mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Immediately transition buffers after creation in the shader runner.
The resource could be destructed before the command list left open is executed; instead, we immediately perform the transition.
This commit is contained in:
parent
46b7fccfd7
commit
c691ad8869
Notes:
Alexandre Julliard
2023-11-01 22:40:06 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/425
@ -773,9 +773,10 @@ static inline void upload_texture_data_(unsigned int line, ID3D12Resource *textu
|
||||
RESOURCE_STATE_DO_NOT_CHANGE, RESOURCE_STATE_DO_NOT_CHANGE);
|
||||
}
|
||||
|
||||
#define upload_buffer_data(a, b, c, d, e, f) upload_buffer_data_(__LINE__, a, b, c, d, e, f)
|
||||
static inline void upload_buffer_data_(unsigned int line, ID3D12Resource *buffer, size_t offset,
|
||||
size_t size, const void *data, ID3D12CommandQueue *queue, ID3D12GraphicsCommandList *command_list)
|
||||
#define upload_buffer_data_with_states(a, b, c, d, e, f, g, h) upload_buffer_data_with_states_(__LINE__, a, b, c, d, e, f, g, h)
|
||||
static inline void upload_buffer_data_with_states_(unsigned int line, ID3D12Resource *buffer, size_t offset,
|
||||
size_t size, const void *data, ID3D12CommandQueue *queue, ID3D12GraphicsCommandList *command_list,
|
||||
D3D12_RESOURCE_STATES initial_state, D3D12_RESOURCE_STATES final_state)
|
||||
{
|
||||
ID3D12Resource *upload_buffer;
|
||||
ID3D12Device *device;
|
||||
@ -786,9 +787,15 @@ static inline void upload_buffer_data_(unsigned int line, ID3D12Resource *buffer
|
||||
|
||||
upload_buffer = create_upload_buffer_(line, device, size, data);
|
||||
|
||||
if (initial_state != RESOURCE_STATE_DO_NOT_CHANGE)
|
||||
transition_resource_state(command_list, buffer, initial_state, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
|
||||
ID3D12GraphicsCommandList_CopyBufferRegion(command_list, buffer, offset,
|
||||
upload_buffer, 0, size);
|
||||
|
||||
if (final_state != RESOURCE_STATE_DO_NOT_CHANGE)
|
||||
transition_resource_state(command_list, buffer, D3D12_RESOURCE_STATE_COPY_DEST, final_state);
|
||||
|
||||
hr = ID3D12GraphicsCommandList_Close(command_list);
|
||||
ok_(line)(SUCCEEDED(hr), "Failed to close command list, hr %#x.\n", hr);
|
||||
exec_command_list(queue, command_list);
|
||||
@ -798,6 +805,14 @@ static inline void upload_buffer_data_(unsigned int line, ID3D12Resource *buffer
|
||||
ID3D12Device_Release(device);
|
||||
}
|
||||
|
||||
#define upload_buffer_data(a, b, c, d, e, f) upload_buffer_data_(__LINE__, a, b, c, d, e, f)
|
||||
static inline void upload_buffer_data_(unsigned int line, ID3D12Resource *buffer, size_t offset,
|
||||
size_t size, const void *data, ID3D12CommandQueue *queue, ID3D12GraphicsCommandList *command_list)
|
||||
{
|
||||
return upload_buffer_data_with_states_(line, buffer, offset, size, data, queue, command_list,
|
||||
RESOURCE_STATE_DO_NOT_CHANGE, RESOURCE_STATE_DO_NOT_CHANGE);
|
||||
}
|
||||
|
||||
static HRESULT create_root_signature(ID3D12Device *device, const D3D12_ROOT_SIGNATURE_DESC *desc,
|
||||
ID3D12RootSignature **root_signature)
|
||||
{
|
||||
|
@ -181,11 +181,10 @@ static struct resource *d3d12_runner_create_resource(struct shader_runner *r, co
|
||||
|
||||
resource->resource = create_default_buffer(device, params->data_size,
|
||||
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
upload_buffer_data(resource->resource, 0, params->data_size, resource_data,
|
||||
test_context->queue, test_context->list);
|
||||
upload_buffer_data_with_states(resource->resource, 0, params->data_size, resource_data,
|
||||
test_context->queue, test_context->list,
|
||||
RESOURCE_STATE_DO_NOT_CHANGE, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
|
||||
reset_command_list(test_context->list, test_context->allocator);
|
||||
transition_resource_state(test_context->list, resource->resource,
|
||||
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
|
||||
|
||||
uav_desc.Format = params->format;
|
||||
uav_desc.ViewDimension = D3D12_UAV_DIMENSION_BUFFER;
|
||||
|
Loading…
Reference in New Issue
Block a user