vkd3d: Use dynamic rendering for pipeline creation.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
This commit is contained in:
parent
3783eaf4f7
commit
9673ac173d
|
@ -4275,11 +4275,13 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
|
||||||
VkPipelineVertexInputDivisorStateCreateInfoEXT input_divisor_info;
|
VkPipelineVertexInputDivisorStateCreateInfoEXT input_divisor_info;
|
||||||
VkPipelineCreationFeedbackEXT feedbacks[VKD3D_MAX_SHADER_STAGES];
|
VkPipelineCreationFeedbackEXT feedbacks[VKD3D_MAX_SHADER_STAGES];
|
||||||
VkPipelineShaderStageCreateInfo stages[VKD3D_MAX_SHADER_STAGES];
|
VkPipelineShaderStageCreateInfo stages[VKD3D_MAX_SHADER_STAGES];
|
||||||
|
VkFormat rtv_formats[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT];
|
||||||
VkPipelineTessellationStateCreateInfo tessellation_info;
|
VkPipelineTessellationStateCreateInfo tessellation_info;
|
||||||
VkPipelineDepthStencilStateCreateInfo fallback_ds_desc;
|
VkPipelineDepthStencilStateCreateInfo fallback_ds_desc;
|
||||||
VkPipelineCreationFeedbackCreateInfoEXT feedback_info;
|
VkPipelineCreationFeedbackCreateInfoEXT feedback_info;
|
||||||
VkPipelineDynamicStateCreateInfo dynamic_create_info;
|
VkPipelineDynamicStateCreateInfo dynamic_create_info;
|
||||||
VkPipelineVertexInputStateCreateInfo input_desc;
|
VkPipelineVertexInputStateCreateInfo input_desc;
|
||||||
|
VkPipelineRenderingCreateInfoKHR rendering_info;
|
||||||
VkPipelineInputAssemblyStateCreateInfo ia_desc;
|
VkPipelineInputAssemblyStateCreateInfo ia_desc;
|
||||||
struct d3d12_device *device = state->device;
|
struct d3d12_device *device = state->device;
|
||||||
VkGraphicsPipelineCreateInfo pipeline_desc;
|
VkGraphicsPipelineCreateInfo pipeline_desc;
|
||||||
|
@ -4345,8 +4347,25 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
|
||||||
vp_desc.scissorCount = key && !key->dynamic_viewport ? max(key->viewport_count, 1) : 0;
|
vp_desc.scissorCount = key && !key->dynamic_viewport ? max(key->viewport_count, 1) : 0;
|
||||||
vp_desc.pScissors = NULL;
|
vp_desc.pScissors = NULL;
|
||||||
|
|
||||||
|
rendering_info.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR;
|
||||||
|
rendering_info.pNext = NULL;
|
||||||
|
rendering_info.viewMask = 0;
|
||||||
|
rendering_info.colorAttachmentCount = vkd3d_get_color_attachment_count(graphics->rtv_active_mask);
|
||||||
|
rendering_info.pColorAttachmentFormats = rtv_formats;
|
||||||
|
rendering_info.depthAttachmentFormat = dsv_format ? dsv_format->vk_format : VK_FORMAT_UNDEFINED;
|
||||||
|
rendering_info.stencilAttachmentFormat = dsv_format ? dsv_format->vk_format : VK_FORMAT_UNDEFINED;
|
||||||
|
|
||||||
|
rtv_active_mask = key ? key->rtv_active_mask : graphics->rtv_active_mask;
|
||||||
|
for (i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
|
||||||
|
{
|
||||||
|
if (rtv_active_mask & (1u << i))
|
||||||
|
rtv_formats[i] = graphics->rtv_formats[i];
|
||||||
|
else
|
||||||
|
rtv_formats[i] = VK_FORMAT_UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
pipeline_desc.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
pipeline_desc.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
||||||
pipeline_desc.pNext = NULL;
|
pipeline_desc.pNext = &rendering_info;
|
||||||
pipeline_desc.flags = 0;
|
pipeline_desc.flags = 0;
|
||||||
pipeline_desc.stageCount = graphics->stage_count;
|
pipeline_desc.stageCount = graphics->stage_count;
|
||||||
pipeline_desc.pStages = graphics->stages;
|
pipeline_desc.pStages = graphics->stages;
|
||||||
|
@ -4360,10 +4379,14 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
|
||||||
pipeline_desc.pColorBlendState = &graphics->blend_desc;
|
pipeline_desc.pColorBlendState = &graphics->blend_desc;
|
||||||
pipeline_desc.pDynamicState = &dynamic_create_info;
|
pipeline_desc.pDynamicState = &dynamic_create_info;
|
||||||
pipeline_desc.layout = graphics->pipeline_layout;
|
pipeline_desc.layout = graphics->pipeline_layout;
|
||||||
|
pipeline_desc.renderPass = VK_NULL_HANDLE;
|
||||||
pipeline_desc.subpass = 0;
|
pipeline_desc.subpass = 0;
|
||||||
pipeline_desc.basePipelineHandle = VK_NULL_HANDLE;
|
pipeline_desc.basePipelineHandle = VK_NULL_HANDLE;
|
||||||
pipeline_desc.basePipelineIndex = -1;
|
pipeline_desc.basePipelineIndex = -1;
|
||||||
|
|
||||||
|
if (d3d12_device_supports_variable_shading_rate_tier_2(device))
|
||||||
|
pipeline_desc.flags |= VK_PIPELINE_CREATE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR;
|
||||||
|
|
||||||
/* A workaround for SottR, which creates pipelines with DSV_UNKNOWN, but still insists on using a depth buffer.
|
/* A workaround for SottR, which creates pipelines with DSV_UNKNOWN, but still insists on using a depth buffer.
|
||||||
* If we notice that the base pipeline's DSV format does not match the dynamic DSV format, we fall-back to create a new render pass. */
|
* If we notice that the base pipeline's DSV format does not match the dynamic DSV format, we fall-back to create a new render pass. */
|
||||||
if (graphics->dsv_format != dsv_format && (graphics->null_attachment_mask & dsv_attachment_mask(graphics)))
|
if (graphics->dsv_format != dsv_format && (graphics->null_attachment_mask & dsv_attachment_mask(graphics)))
|
||||||
|
@ -4382,7 +4405,6 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
|
||||||
pipeline_desc.pDepthStencilState = &fallback_ds_desc;
|
pipeline_desc.pDepthStencilState = &fallback_ds_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtv_active_mask = key ? key->rtv_active_mask : graphics->rtv_active_mask;
|
|
||||||
if (graphics->rtv_active_mask != rtv_active_mask)
|
if (graphics->rtv_active_mask != rtv_active_mask)
|
||||||
{
|
{
|
||||||
TRACE("Compiling %p with fallback RTV write mask (PSO = 0x%x, RT = 0x%x).\n", state,
|
TRACE("Compiling %p with fallback RTV write mask (PSO = 0x%x, RT = 0x%x).\n", state,
|
||||||
|
@ -4394,9 +4416,6 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
|
||||||
render_pass_compat, &graphics->dsv_plane_optimal_mask, variant_flags)))
|
render_pass_compat, &graphics->dsv_plane_optimal_mask, variant_flags)))
|
||||||
return VK_NULL_HANDLE;
|
return VK_NULL_HANDLE;
|
||||||
|
|
||||||
/* Any of these is fine from a compatibility PoV. */
|
|
||||||
pipeline_desc.renderPass = render_pass_compat->dsv_layouts[0];
|
|
||||||
|
|
||||||
if (key)
|
if (key)
|
||||||
{
|
{
|
||||||
/* In a fallback pipeline, we might have to re-create shader modules.
|
/* In a fallback pipeline, we might have to re-create shader modules.
|
||||||
|
|
|
@ -3104,6 +3104,7 @@ static inline bool d3d12_device_use_ssbo_root_descriptors(struct d3d12_device *d
|
||||||
}
|
}
|
||||||
|
|
||||||
bool d3d12_device_supports_variable_shading_rate_tier_1(struct d3d12_device *device);
|
bool d3d12_device_supports_variable_shading_rate_tier_1(struct d3d12_device *device);
|
||||||
|
bool d3d12_device_supports_variable_shading_rate_tier_2(struct d3d12_device *device);
|
||||||
bool d3d12_device_supports_ray_tracing_tier_1_0(const struct d3d12_device *device);
|
bool d3d12_device_supports_ray_tracing_tier_1_0(const struct d3d12_device *device);
|
||||||
|
|
||||||
/* ID3DBlob */
|
/* ID3DBlob */
|
||||||
|
@ -3271,6 +3272,16 @@ 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