mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 22:30:12 +01:00
vk/graphics_state: Remove vk_subpass_info
It only has a subset of the renderpass state, whereas with turnip we need to use pretty much all of it at one point or another. Just allow the driver to pass in the entire vk_render_pass_state if it's using its own renderpass implementation. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22301>
This commit is contained in:
parent
282e73118d
commit
1d5eeefd9b
4 changed files with 20 additions and 41 deletions
|
|
@ -30,20 +30,16 @@ the render pass and dynamic rendering. For drivers which use
|
||||||
structure will be populated as if for dynamic rendering, regardless of
|
structure will be populated as if for dynamic rendering, regardless of
|
||||||
which path is used. Drivers which use their own render pass structure
|
which path is used. Drivers which use their own render pass structure
|
||||||
should parse the render pass, if available, and pass a
|
should parse the render pass, if available, and pass a
|
||||||
:cpp:struct:`vk_subpass_info` into
|
:cpp:struct:`vk_render_pass_state` to the `driver_rp` argument of
|
||||||
:cpp:func:`vk_graphics_pipeline_state_fill()` with the relevant information
|
:cpp:func:`vk_graphics_pipeline_state_fill()` with the relevant information
|
||||||
from the specified subpass. If a render pass is available,
|
from the specified subpass. If a render pass is available,
|
||||||
:cpp:struct:`vk_render_pass_state` will be populated with the
|
:cpp:struct:`vk_render_pass_state` will be populated with the
|
||||||
:cpp:type:`VkRenderPass` handle and subpass index as well as the
|
the information from the :cpp:struct:`driver_rp`. If dynamic
|
||||||
information from the :cpp:struct:`vk_render_pass_state`. If dynamic
|
rendering is used or the driver provides a `NULL`
|
||||||
rendering is used or the driver does not provide a
|
:cpp:struct:`driver_rp`, the :cpp:struct:`vk_render_pass_state`
|
||||||
:cpp:struct:`vk_subpass_info` structure, :cpp:struct:`vk_render_pass_state`
|
|
||||||
structure will be populated for dynamic rendering, including color, depth,
|
structure will be populated for dynamic rendering, including color, depth,
|
||||||
and stencil attachment formats.
|
and stencil attachment formats.
|
||||||
|
|
||||||
.. doxygenstruct:: vk_subpass_info
|
|
||||||
:members:
|
|
||||||
|
|
||||||
The usual flow for creating a full graphics pipeline (not library) looks
|
The usual flow for creating a full graphics pipeline (not library) looks
|
||||||
like this:
|
like this:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2242,8 +2242,8 @@ err_free_build_context:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct vk_subpass_info
|
static struct vk_render_pass_state
|
||||||
pvr_create_subpass_info(const VkGraphicsPipelineCreateInfo *const info)
|
pvr_create_renderpass_state(const VkGraphicsPipelineCreateInfo *const info)
|
||||||
{
|
{
|
||||||
PVR_FROM_HANDLE(pvr_render_pass, pass, info->renderPass);
|
PVR_FROM_HANDLE(pvr_render_pass, pass, info->renderPass);
|
||||||
const struct pvr_render_subpass *const subpass =
|
const struct pvr_render_subpass *const subpass =
|
||||||
|
|
@ -2263,8 +2263,10 @@ pvr_create_subpass_info(const VkGraphicsPipelineCreateInfo *const info)
|
||||||
pass->attachments[subpass->depth_stencil_attachment].aspects;
|
pass->attachments[subpass->depth_stencil_attachment].aspects;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (struct vk_subpass_info){
|
return (struct vk_render_pass_state){
|
||||||
.attachment_aspects = attachment_aspects,
|
.attachment_aspects = attachment_aspects,
|
||||||
|
.render_pass = info->renderPass,
|
||||||
|
.subpass = info->subpass,
|
||||||
|
|
||||||
/* TODO: This is only needed for VK_KHR_create_renderpass2 (or core 1.2),
|
/* TODO: This is only needed for VK_KHR_create_renderpass2 (or core 1.2),
|
||||||
* which is not currently supported.
|
* which is not currently supported.
|
||||||
|
|
@ -2282,7 +2284,7 @@ pvr_graphics_pipeline_init(struct pvr_device *device,
|
||||||
{
|
{
|
||||||
struct vk_dynamic_graphics_state *const dynamic_state =
|
struct vk_dynamic_graphics_state *const dynamic_state =
|
||||||
&gfx_pipeline->dynamic_state;
|
&gfx_pipeline->dynamic_state;
|
||||||
const struct vk_subpass_info sp_info = pvr_create_subpass_info(pCreateInfo);
|
const struct vk_render_pass_state rp_state = pvr_create_renderpass_state(pCreateInfo);
|
||||||
|
|
||||||
struct vk_graphics_pipeline_all_state all_state;
|
struct vk_graphics_pipeline_all_state all_state;
|
||||||
struct vk_graphics_pipeline_state state = { 0 };
|
struct vk_graphics_pipeline_state state = { 0 };
|
||||||
|
|
@ -2294,7 +2296,7 @@ pvr_graphics_pipeline_init(struct pvr_device *device,
|
||||||
result = vk_graphics_pipeline_state_fill(&device->vk,
|
result = vk_graphics_pipeline_state_fill(&device->vk,
|
||||||
&state,
|
&state,
|
||||||
pCreateInfo,
|
pCreateInfo,
|
||||||
&sp_info,
|
&rp_state,
|
||||||
&all_state,
|
&all_state,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -1012,8 +1012,8 @@ vk_render_pass_state_is_complete(const struct vk_render_pass_state *rp)
|
||||||
static void
|
static void
|
||||||
vk_render_pass_state_init(struct vk_render_pass_state *rp,
|
vk_render_pass_state_init(struct vk_render_pass_state *rp,
|
||||||
const struct vk_render_pass_state *old_rp,
|
const struct vk_render_pass_state *old_rp,
|
||||||
|
const struct vk_render_pass_state *driver_rp,
|
||||||
const VkGraphicsPipelineCreateInfo *info,
|
const VkGraphicsPipelineCreateInfo *info,
|
||||||
const struct vk_subpass_info *sp_info,
|
|
||||||
VkGraphicsPipelineLibraryFlagsEXT lib)
|
VkGraphicsPipelineLibraryFlagsEXT lib)
|
||||||
{
|
{
|
||||||
VkPipelineCreateFlags valid_pipeline_flags = 0;
|
VkPipelineCreateFlags valid_pipeline_flags = 0;
|
||||||
|
|
@ -1048,9 +1048,10 @@ vk_render_pass_state_init(struct vk_render_pass_state *rp,
|
||||||
.stencil_attachment_format = VK_FORMAT_UNDEFINED,
|
.stencil_attachment_format = VK_FORMAT_UNDEFINED,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (info->renderPass != VK_NULL_HANDLE && sp_info != NULL) {
|
if (info->renderPass != VK_NULL_HANDLE && driver_rp != NULL) {
|
||||||
rp->attachment_aspects = sp_info->attachment_aspects;
|
assert(driver_rp->render_pass == info->renderPass);
|
||||||
rp->view_mask = sp_info->view_mask;
|
assert(driver_rp->subpass == info->subpass);
|
||||||
|
*rp = *driver_rp;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1187,7 +1188,7 @@ VkResult
|
||||||
vk_graphics_pipeline_state_fill(const struct vk_device *device,
|
vk_graphics_pipeline_state_fill(const struct vk_device *device,
|
||||||
struct vk_graphics_pipeline_state *state,
|
struct vk_graphics_pipeline_state *state,
|
||||||
const VkGraphicsPipelineCreateInfo *info,
|
const VkGraphicsPipelineCreateInfo *info,
|
||||||
const struct vk_subpass_info *sp_info,
|
const struct vk_render_pass_state *driver_rp,
|
||||||
struct vk_graphics_pipeline_all_state *all,
|
struct vk_graphics_pipeline_all_state *all,
|
||||||
const VkAllocationCallbacks *alloc,
|
const VkAllocationCallbacks *alloc,
|
||||||
VkSystemAllocationScope scope,
|
VkSystemAllocationScope scope,
|
||||||
|
|
@ -1307,7 +1308,7 @@ vk_graphics_pipeline_state_fill(const struct vk_device *device,
|
||||||
if (lib & (VK_GRAPHICS_PIPELINE_LIBRARY_PRE_RASTERIZATION_SHADERS_BIT_EXT |
|
if (lib & (VK_GRAPHICS_PIPELINE_LIBRARY_PRE_RASTERIZATION_SHADERS_BIT_EXT |
|
||||||
VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT |
|
VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT |
|
||||||
VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT)) {
|
VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT)) {
|
||||||
vk_render_pass_state_init(&rp, state->rp, info, sp_info, lib);
|
vk_render_pass_state_init(&rp, state->rp, driver_rp, info, lib);
|
||||||
|
|
||||||
needs |= MESA_VK_GRAPHICS_STATE_RENDER_PASS_BIT;
|
needs |= MESA_VK_GRAPHICS_STATE_RENDER_PASS_BIT;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -867,26 +867,6 @@ struct vk_graphics_pipeline_state {
|
||||||
const struct vk_render_pass_state *rp;
|
const struct vk_render_pass_state *rp;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Struct for extra information that we need from the subpass.
|
|
||||||
*
|
|
||||||
* This struct need only be provided if the driver has its own render pass
|
|
||||||
* implementation. If the driver uses the common render pass implementation,
|
|
||||||
* we can get this information ourselves.
|
|
||||||
*/
|
|
||||||
struct vk_subpass_info {
|
|
||||||
/** VkSubpassDescription2::viewMask */
|
|
||||||
uint32_t view_mask;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Aspects of all attachments used as color or depth/stencil attachments
|
|
||||||
* in the subpass. Input and resolve attachments should not be considered
|
|
||||||
* when computing the attachments aspect mask. This is used to determine
|
|
||||||
* whether or not depth/stencil and color blend state are required for a
|
|
||||||
* pipeline.
|
|
||||||
*/
|
|
||||||
VkImageAspectFlags attachment_aspects;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Populate a vk_graphics_pipeline_state from VkGraphicsPipelineCreateInfo
|
/** Populate a vk_graphics_pipeline_state from VkGraphicsPipelineCreateInfo
|
||||||
*
|
*
|
||||||
* This function crawls the provided VkGraphicsPipelineCreateInfo and uses it
|
* This function crawls the provided VkGraphicsPipelineCreateInfo and uses it
|
||||||
|
|
@ -913,7 +893,7 @@ struct vk_subpass_info {
|
||||||
* @param[in] device The Vulkan device
|
* @param[in] device The Vulkan device
|
||||||
* @param[out] state The graphics pipeline state to populate
|
* @param[out] state The graphics pipeline state to populate
|
||||||
* @param[in] info The pCreateInfo from vkCreateGraphicsPipelines
|
* @param[in] info The pCreateInfo from vkCreateGraphicsPipelines
|
||||||
* @param[in] sp_info Subpass info if the driver implements render
|
* @param[in] driver_rp Renderpass state if the driver implements render
|
||||||
* passes itself. This should be NULL for drivers
|
* passes itself. This should be NULL for drivers
|
||||||
* that use the common render pass infrastructure
|
* that use the common render pass infrastructure
|
||||||
* built on top of dynamic rendering.
|
* built on top of dynamic rendering.
|
||||||
|
|
@ -933,7 +913,7 @@ VkResult
|
||||||
vk_graphics_pipeline_state_fill(const struct vk_device *device,
|
vk_graphics_pipeline_state_fill(const struct vk_device *device,
|
||||||
struct vk_graphics_pipeline_state *state,
|
struct vk_graphics_pipeline_state *state,
|
||||||
const VkGraphicsPipelineCreateInfo *info,
|
const VkGraphicsPipelineCreateInfo *info,
|
||||||
const struct vk_subpass_info *sp_info,
|
const struct vk_render_pass_state *rp_info,
|
||||||
struct vk_graphics_pipeline_all_state *all,
|
struct vk_graphics_pipeline_all_state *all,
|
||||||
const VkAllocationCallbacks *alloc,
|
const VkAllocationCallbacks *alloc,
|
||||||
VkSystemAllocationScope scope,
|
VkSystemAllocationScope scope,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue