anv: allocate fake render pass on pipeline creation
v3: (Lionel) - Handle VkPipelineRenderingCreateInfoKHR not being present - Rename dynamic_pass and set it for regular render passes too v4: C99 is good (Lionel) Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13980>
This commit is contained in:
@@ -2332,10 +2332,11 @@ anv_pipeline_validate_create_info(const VkGraphicsPipelineCreateInfo *info)
|
||||
assert(info->sType == VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO);
|
||||
|
||||
renderpass = anv_render_pass_from_handle(info->renderPass);
|
||||
assert(renderpass);
|
||||
|
||||
assert(info->subpass < renderpass->subpass_count);
|
||||
subpass = &renderpass->subpasses[info->subpass];
|
||||
if (renderpass) {
|
||||
assert(info->subpass < renderpass->subpass_count);
|
||||
subpass = &renderpass->subpasses[info->subpass];
|
||||
}
|
||||
|
||||
assert(info->stageCount >= 1);
|
||||
assert(info->pRasterizationState);
|
||||
@@ -2435,8 +2436,36 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
|
||||
pipeline->batch_data, sizeof(pipeline->batch_data));
|
||||
|
||||
ANV_FROM_HANDLE(anv_render_pass, render_pass, pCreateInfo->renderPass);
|
||||
assert(pCreateInfo->subpass < render_pass->subpass_count);
|
||||
pipeline->subpass = &render_pass->subpasses[pCreateInfo->subpass];
|
||||
|
||||
if (render_pass) {
|
||||
assert(pCreateInfo->subpass < render_pass->subpass_count);
|
||||
pipeline->subpass = &render_pass->subpasses[pCreateInfo->subpass];
|
||||
pipeline->pass = render_pass;
|
||||
} else {
|
||||
const VkPipelineRenderingCreateInfoKHR *rendering_create_info =
|
||||
vk_find_struct_const(pCreateInfo->pNext, PIPELINE_RENDERING_CREATE_INFO_KHR);
|
||||
|
||||
/* These should be zeroed already. */
|
||||
pipeline->pass = &pipeline->dynamic_render_pass.pass;
|
||||
pipeline->subpass = &pipeline->dynamic_render_pass.subpass;
|
||||
|
||||
if (rendering_create_info) {
|
||||
struct anv_dynamic_pass_create_info info = {
|
||||
.viewMask = rendering_create_info->viewMask,
|
||||
.colorAttachmentCount =
|
||||
rendering_create_info->colorAttachmentCount,
|
||||
.pColorAttachmentFormats =
|
||||
rendering_create_info->pColorAttachmentFormats,
|
||||
.depthAttachmentFormat =
|
||||
rendering_create_info->depthAttachmentFormat,
|
||||
.stencilAttachmentFormat =
|
||||
rendering_create_info->stencilAttachmentFormat,
|
||||
};
|
||||
|
||||
anv_dynamic_pass_init(&pipeline->dynamic_render_pass, &info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
assert(pCreateInfo->pRasterizationState);
|
||||
|
||||
|
@@ -3474,6 +3474,7 @@ struct anv_graphics_pipeline {
|
||||
uint32_t rasterization_samples;
|
||||
|
||||
struct anv_subpass * subpass;
|
||||
struct anv_render_pass * pass;
|
||||
|
||||
struct anv_shader_bin * shaders[ANV_GRAPHICS_SHADER_STAGE_COUNT];
|
||||
|
||||
@@ -3528,6 +3529,8 @@ struct anv_graphics_pipeline {
|
||||
struct {
|
||||
uint32_t wm_depth_stencil[4];
|
||||
} gfx9;
|
||||
|
||||
struct anv_dynamic_render_pass dynamic_render_pass;
|
||||
};
|
||||
|
||||
struct anv_compute_pipeline {
|
||||
|
@@ -2495,8 +2495,6 @@ genX(graphics_pipeline_create)(
|
||||
VkPipeline* pPipeline)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_render_pass, pass, pCreateInfo->renderPass);
|
||||
struct anv_subpass *subpass = &pass->subpasses[pCreateInfo->subpass];
|
||||
struct anv_graphics_pipeline *pipeline;
|
||||
VkResult result;
|
||||
|
||||
@@ -2520,6 +2518,9 @@ genX(graphics_pipeline_create)(
|
||||
return result;
|
||||
}
|
||||
|
||||
struct anv_render_pass *pass = pipeline->pass;
|
||||
struct anv_subpass *subpass = pipeline->subpass;
|
||||
|
||||
/* Information on which states are considered dynamic. */
|
||||
const VkPipelineDynamicStateCreateInfo *dyn_info =
|
||||
pCreateInfo->pDynamicState;
|
||||
|
Reference in New Issue
Block a user