[PATCH vkd3d v3 2/2] vkd3d: Add support for UAV counters in pixel shaders.
Conor McCarthy
cmccarthy at codeweavers.com
Fri Jul 23 09:02:43 CDT 2021
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49107
Allows GRID (2019) to run in D3D12 mode.
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
---
libs/vkd3d/state.c | 24 ++++++++++++------------
tests/d3d12.c | 2 --
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 29121e5f..a381679e 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -2268,8 +2268,6 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
shader_interface.push_constant_buffer_count = root_signature->root_constant_count;
shader_interface.combined_samplers = NULL;
shader_interface.combined_sampler_count = 0;
- shader_interface.uav_counters = NULL;
- shader_interface.uav_counter_count = 0;
for (i = 0; i < ARRAY_SIZE(shader_stages); ++i)
{
@@ -2290,19 +2288,16 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
hr = hresult_from_vkd3d_result(ret);
goto fail;
}
- for (j = 0; j < shader_info.descriptor_count; ++j)
+ if (FAILED(hr = d3d12_pipeline_state_init_uav_counters(state,
+ device, root_signature, &shader_info, shader_stages[i].stage)))
{
- const struct vkd3d_shader_descriptor_info *d = &shader_info.descriptors[j];
-
- if (d->type == VKD3D_SHADER_DESCRIPTOR_TYPE_UAV
- && (d->flags & VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_COUNTER))
- {
- FIXME("UAV counters not implemented for graphics pipelines.\n");
- break;
- }
+ WARN("Failed to create descriptor set layout for UAV counters, hr %#x.\n", hr);
+ goto fail;
}
vkd3d_shader_free_scan_descriptor_info(&shader_info);
+ shader_interface.uav_counters = NULL;
+ shader_interface.uav_counter_count = 0;
target_info = NULL;
switch (shader_stages[i].stage)
{
@@ -2328,6 +2323,8 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
break;
case VK_SHADER_STAGE_FRAGMENT_BIT:
+ shader_interface.uav_counters = state->uav_counters.bindings;
+ shader_interface.uav_counter_count = state->uav_counters.binding_count;
target_info = &ps_target_info;
break;
@@ -2523,6 +2520,8 @@ fail:
}
vkd3d_shader_free_shader_signature(&input_signature);
+ d3d12_pipeline_uav_counter_state_cleanup(&state->uav_counters, device);
+
return hr;
}
@@ -2811,7 +2810,8 @@ VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_sta
pipeline_desc.pDepthStencilState = &graphics->ds_desc;
pipeline_desc.pColorBlendState = &blend_desc;
pipeline_desc.pDynamicState = &dynamic_desc;
- pipeline_desc.layout = graphics->root_signature->vk_pipeline_layout;
+ pipeline_desc.layout = state->uav_counters.vk_pipeline_layout ? state->uav_counters.vk_pipeline_layout
+ : graphics->root_signature->vk_pipeline_layout;
pipeline_desc.subpass = 0;
pipeline_desc.basePipelineHandle = VK_NULL_HANDLE;
pipeline_desc.basePipelineIndex = -1;
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 3a1a72a8..d5ed40a9 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -22481,14 +22481,12 @@ static void test_graphics_uav_counters(void)
ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0);
counter = read_uav_counter(&context, counter_buffer, uav_desc.Buffer.CounterOffsetInBytes);
- todo
ok(counter == 64, "Got %u, expected 64.\n", counter);
transition_sub_resource_state(command_list, buffer, 0,
D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE);
get_buffer_readback_with_command_list(buffer, DXGI_FORMAT_R32_UINT, &rb, queue, command_list);
set_box(&box, 0, 0, 0, uav_desc.Buffer.NumElements, 1, 1);
- todo
check_readback_data_uint(&rb, &box, 1, 0);
release_resource_readback(&rb);
--
2.32.0
More information about the wine-devel
mailing list