Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libs/vkd3d/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -4257,7 +4257,7 @@ static void d3d12_command_list_load_attachment(struct d3d12_command_list *list,
if (rp_layouts[i] != final_layouts[i])
{
VkImageMemoryBarrier2 *barrier = &image_barriers[dep_info.imageMemoryBarrierCount++];
assert(clear_op);
assert(load_op == VK_ATTACHMENT_LOAD_OP_CLEAR);
assert(view->format->vk_aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT));

memset(barrier, 0, sizeof(*barrier));
Expand Down Expand Up @@ -5310,6 +5310,9 @@ static void d3d12_command_list_fuse_attachment_clear(struct d3d12_command_list *
list->dsv_plane_optimal_mask |= plane_write_mask;
list->dsv_layout = dsv_plane_optimal_mask_to_layout(list->dsv_plane_optimal_mask, resource->format->vk_aspect_mask);

attachment->imageLayout = list->dsv_layout;
stencil_attachment->imageLayout = list->dsv_layout;

/* We need to ensure that we transition to the same layout that the render pass transition
* will use as a source layout when transitioning to dsv_layout.
*
Expand Down
59 changes: 20 additions & 39 deletions libs/vkd3d/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@

if (raw_va)
binding->flags |= VKD3D_SHADER_BINDING_FLAG_RAW_VA;
else if (vk_binding->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)

Check warning on line 1153 in libs/vkd3d/state.c

View workflow job for this annotation

GitHub Actions / build-set-linux

‘vk_binding’ may be used uninitialized [-Wmaybe-uninitialized]

Check warning on line 1153 in libs/vkd3d/state.c

View workflow job for this annotation

GitHub Actions / build-set-linux

‘vk_binding’ may be used uninitialized [-Wmaybe-uninitialized]

Check warning on line 1153 in libs/vkd3d/state.c

View workflow job for this annotation

GitHub Actions / build-set-linux

‘vk_binding’ may be used uninitialized [-Wmaybe-uninitialized]

Check warning on line 1153 in libs/vkd3d/state.c

View workflow job for this annotation

GitHub Actions / build-set-linux

‘vk_binding’ may be used uninitialized [-Wmaybe-uninitialized]
binding->flags |= VKD3D_SHADER_BINDING_FLAG_RAW_SSBO;

param = &root_signature->parameters[i];
Expand Down Expand Up @@ -3782,45 +3782,32 @@
STATIC_ASSERT(sizeof(struct vkd3d_shader_transform_feedback_element) == sizeof(D3D12_SO_DECLARATION_ENTRY));

static uint32_t d3d12_graphics_pipeline_state_get_plane_optimal_mask(
struct d3d12_graphics_pipeline_state *graphics, const struct vkd3d_format *dynamic_dsv_format)
struct d3d12_graphics_pipeline_state *graphics)
{
VkFormat dsv_format = VK_FORMAT_UNDEFINED;
uint32_t plane_optimal_mask = 0;
VkImageAspectFlags aspects = 0;

if (dynamic_dsv_format)
{
if (graphics->dsv_format)
{
dsv_format = graphics->dsv_format->vk_format;
aspects = graphics->dsv_format->vk_aspect_mask;
}
else if (d3d12_graphics_pipeline_state_has_unknown_dsv_format_with_test(graphics))
{
dsv_format = dynamic_dsv_format->vk_format;
aspects = dynamic_dsv_format->vk_aspect_mask;
}
}
if (graphics->dsv_format)
aspects = graphics->dsv_format->vk_aspect_mask;
else if (d3d12_graphics_pipeline_state_has_unknown_dsv_format_with_test(graphics))
aspects = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;

if (dsv_format)
{
if ((aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&
((graphics->ds_desc.depthTestEnable || graphics->ds_desc.depthBoundsTestEnable) && graphics->ds_desc.depthWriteEnable))
plane_optimal_mask |= VKD3D_DEPTH_PLANE_OPTIMAL;
if ((aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&
((graphics->ds_desc.depthTestEnable || graphics->ds_desc.depthBoundsTestEnable) && graphics->ds_desc.depthWriteEnable))
plane_optimal_mask |= VKD3D_DEPTH_PLANE_OPTIMAL;

if ((aspects & VK_IMAGE_ASPECT_STENCIL_BIT) &&
(graphics->ds_desc.stencilTestEnable && (graphics->ds_desc.front.writeMask | graphics->ds_desc.back.writeMask)))
plane_optimal_mask |= VKD3D_STENCIL_PLANE_OPTIMAL;
if ((aspects & VK_IMAGE_ASPECT_STENCIL_BIT) &&
(graphics->ds_desc.stencilTestEnable && (graphics->ds_desc.front.writeMask | graphics->ds_desc.back.writeMask)))
plane_optimal_mask |= VKD3D_STENCIL_PLANE_OPTIMAL;

/* If our format does not have both aspects, use same state across the aspects so that we are more likely
* to match one of our common formats, DS_READ_ONLY or DS_OPTIMAL.
* Otherwise, we are very likely to hit the DS write / stencil read layout. */
if (!(aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
plane_optimal_mask |= (plane_optimal_mask & VKD3D_STENCIL_PLANE_OPTIMAL) ? VKD3D_DEPTH_PLANE_OPTIMAL : 0;
/* If our format does not have both aspects, use same state across the aspects so that we are more likely
* to match one of our common formats, DS_READ_ONLY or DS_OPTIMAL.
* Otherwise, we are very likely to hit the DS write / stencil read layout. */
if (!(aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
plane_optimal_mask |= (plane_optimal_mask & VKD3D_STENCIL_PLANE_OPTIMAL) ? VKD3D_DEPTH_PLANE_OPTIMAL : 0;

if (!(aspects & VK_IMAGE_ASPECT_STENCIL_BIT))
plane_optimal_mask |= (plane_optimal_mask & VKD3D_DEPTH_PLANE_OPTIMAL) ? VKD3D_STENCIL_PLANE_OPTIMAL : 0;
}
if (!(aspects & VK_IMAGE_ASPECT_STENCIL_BIT))
plane_optimal_mask |= (plane_optimal_mask & VKD3D_DEPTH_PLANE_OPTIMAL) ? VKD3D_STENCIL_PLANE_OPTIMAL : 0;

return plane_optimal_mask;
}
Expand Down Expand Up @@ -5674,10 +5661,8 @@
state->vk_pso_cache, 0, &graphics->pipeline_dynamic_states)))
return E_OUTOFMEMORY;
}
else
{
graphics->dsv_plane_optimal_mask = d3d12_graphics_pipeline_state_get_plane_optimal_mask(graphics, NULL);
}

graphics->dsv_plane_optimal_mask = d3d12_graphics_pipeline_state_get_plane_optimal_mask(graphics);

return S_OK;
}
Expand Down Expand Up @@ -6401,10 +6386,6 @@
if (d3d12_graphics_pipeline_state_has_unknown_dsv_format_with_test(graphics) && dsv_format)
TRACE("Compiling %p with fallback DSV format %#x.\n", state, dsv_format->vk_format);

/* FIXME: This gets modified on late recompilation, could there be thread safety issues here?
* For GENERAL depth-stencil, this mask should not matter at all, but there might be edge cases for tracked DSV. */
graphics->dsv_plane_optimal_mask = d3d12_graphics_pipeline_state_get_plane_optimal_mask(graphics, dsv_format);

if (key)
{
/* Need a reader lock here since a concurrent vkd3d_late_compile_shader_stages can
Expand Down
Loading