[PATCH vkd3d 3/3] vkd3d: Add support for UAV counters in pixel shaders.
Conor McCarthy
cmccarthy at codeweavers.com
Wed Jul 14 10:47: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 | 22 ++++++++++------------
tests/d3d12.c | 2 --
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 4537e319..8fef5a38 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -2274,8 +2274,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)
{
@@ -2296,19 +2294,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);
+ return hr;
}
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)
{
@@ -2334,6 +2329,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;
+ shader_interface.uav_counter_count = state->uav_counter_count;
target_info = &ps_target_info;
break;
@@ -2817,7 +2814,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->vk_pipeline_layout ? state->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 ab13f397..75c8c222 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -22099,14 +22099,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.31.1
More information about the wine-devel
mailing list