vkd3d: Use rt_count as basis for binding RTVs.
Found some validation errors where rt_count != rtv_active_mask, and blending used rt_count instead of rtv_active_mask. If shader renders to a NULL attachment, we must make sure that it's part of the PSO interface. Also, use rt_count rather than active mask when beginning render pass. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
34f5fc6a31
commit
6e915dd2c0
|
@ -4538,7 +4538,7 @@ static bool d3d12_command_list_update_rendering_info(struct d3d12_command_list *
|
||||||
graphics = &list->state->graphics;
|
graphics = &list->state->graphics;
|
||||||
|
|
||||||
rendering_info->rtv_mask = graphics->rtv_active_mask;
|
rendering_info->rtv_mask = graphics->rtv_active_mask;
|
||||||
rendering_info->info.colorAttachmentCount = vkd3d_get_color_attachment_count(graphics->rtv_active_mask);
|
rendering_info->info.colorAttachmentCount = graphics->rt_count;
|
||||||
|
|
||||||
/* The pipeline has fallback PSO in case we're attempting to render to unbound RTV. */
|
/* The pipeline has fallback PSO in case we're attempting to render to unbound RTV. */
|
||||||
for (i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
|
for (i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
|
||||||
|
@ -4713,8 +4713,10 @@ static bool d3d12_command_list_update_graphics_pipeline(struct d3d12_command_lis
|
||||||
dsv_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
dsv_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we need to bind or unbind certain render targets or if the DSV layout changed, interrupt rendering */
|
/* If we need to bind or unbind certain render targets or if the DSV layout changed, interrupt rendering.
|
||||||
|
* It's also possible that rtv_active_mask is constant, but rt_count increases (if last RT format is NULL). */
|
||||||
if ((list->state->graphics.rtv_active_mask != list->rendering_info.rtv_mask) ||
|
if ((list->state->graphics.rtv_active_mask != list->rendering_info.rtv_mask) ||
|
||||||
|
(list->state->graphics.rt_count != list->rendering_info.info.colorAttachmentCount) ||
|
||||||
(dsv_layout != list->rendering_info.dsv.imageLayout))
|
(dsv_layout != list->rendering_info.dsv.imageLayout))
|
||||||
{
|
{
|
||||||
d3d12_command_list_invalidate_rendering_info(list);
|
d3d12_command_list_invalidate_rendering_info(list);
|
||||||
|
|
|
@ -3935,7 +3935,7 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
|
||||||
rendering_info.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR;
|
rendering_info.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR;
|
||||||
rendering_info.pNext = NULL;
|
rendering_info.pNext = NULL;
|
||||||
rendering_info.viewMask = 0;
|
rendering_info.viewMask = 0;
|
||||||
rendering_info.colorAttachmentCount = vkd3d_get_color_attachment_count(graphics->rtv_active_mask);
|
rendering_info.colorAttachmentCount = graphics->rt_count;
|
||||||
rendering_info.pColorAttachmentFormats = rtv_formats;
|
rendering_info.pColorAttachmentFormats = rtv_formats;
|
||||||
rendering_info.depthAttachmentFormat = dsv_format ? dsv_format->vk_format : VK_FORMAT_UNDEFINED;
|
rendering_info.depthAttachmentFormat = dsv_format ? dsv_format->vk_format : VK_FORMAT_UNDEFINED;
|
||||||
rendering_info.stencilAttachmentFormat = dsv_format ? dsv_format->vk_format : VK_FORMAT_UNDEFINED;
|
rendering_info.stencilAttachmentFormat = dsv_format ? dsv_format->vk_format : VK_FORMAT_UNDEFINED;
|
||||||
|
|
|
@ -3401,16 +3401,6 @@ static inline const struct vkd3d_format *vkd3d_format_from_d3d12_resource_desc(
|
||||||
desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL);
|
desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int vkd3d_get_color_attachment_count(unsigned int attachment_mask)
|
|
||||||
{
|
|
||||||
unsigned int count = 0;
|
|
||||||
|
|
||||||
while (attachment_mask >> count)
|
|
||||||
count++;
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline VkImageSubresourceRange vk_subresource_range_from_layers(const VkImageSubresourceLayers *layers)
|
static inline VkImageSubresourceRange vk_subresource_range_from_layers(const VkImageSubresourceLayers *layers)
|
||||||
{
|
{
|
||||||
VkImageSubresourceRange range;
|
VkImageSubresourceRange range;
|
||||||
|
|
Loading…
Reference in New Issue