radv: init states from VkPipelineFragmentShadingRateState at only one place
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16672>
This commit is contained in:

committed by
Marge Bot

parent
8fdc4bf3ba
commit
2981ee5c7b
@@ -1903,6 +1903,27 @@ radv_pipeline_init_color_blend_info(struct radv_graphics_pipeline *pipeline,
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct radv_fragment_shading_rate_info
|
||||||
|
radv_pipeline_init_fragment_shading_rate_info(struct radv_graphics_pipeline *pipeline,
|
||||||
|
const VkGraphicsPipelineCreateInfo *pCreateInfo)
|
||||||
|
{
|
||||||
|
const VkPipelineFragmentShadingRateStateCreateInfoKHR *shading_rate =
|
||||||
|
vk_find_struct_const(pCreateInfo->pNext, PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR);
|
||||||
|
struct radv_fragment_shading_rate_info info = {0};
|
||||||
|
|
||||||
|
if (shading_rate && !(pipeline->dynamic_states & RADV_DYNAMIC_FRAGMENT_SHADING_RATE)) {
|
||||||
|
info.size = shading_rate->fragmentSize;
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
info.combiner_ops[i] = shading_rate->combinerOps[i];
|
||||||
|
} else {
|
||||||
|
info.size = (VkExtent2D){ 1, 1 };
|
||||||
|
info.combiner_ops[0] = VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR;
|
||||||
|
info.combiner_ops[1] = VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
static struct radv_graphics_pipeline_info
|
static struct radv_graphics_pipeline_info
|
||||||
radv_pipeline_init_graphics_info(struct radv_graphics_pipeline *pipeline,
|
radv_pipeline_init_graphics_info(struct radv_graphics_pipeline *pipeline,
|
||||||
const VkGraphicsPipelineCreateInfo *pCreateInfo)
|
const VkGraphicsPipelineCreateInfo *pCreateInfo)
|
||||||
@@ -1925,6 +1946,8 @@ radv_pipeline_init_graphics_info(struct radv_graphics_pipeline *pipeline,
|
|||||||
info.ri = radv_pipeline_init_rendering_info(pipeline, pCreateInfo);
|
info.ri = radv_pipeline_init_rendering_info(pipeline, pCreateInfo);
|
||||||
info.cb = radv_pipeline_init_color_blend_info(pipeline, pCreateInfo);
|
info.cb = radv_pipeline_init_color_blend_info(pipeline, pCreateInfo);
|
||||||
|
|
||||||
|
info.fsr = radv_pipeline_init_fragment_shading_rate_info(pipeline, pCreateInfo);
|
||||||
|
|
||||||
/* VK_AMD_mixed_attachment_samples */
|
/* VK_AMD_mixed_attachment_samples */
|
||||||
const VkAttachmentSampleCountInfoAMD *sample_info =
|
const VkAttachmentSampleCountInfoAMD *sample_info =
|
||||||
vk_find_struct_const(pCreateInfo->pNext, ATTACHMENT_SAMPLE_COUNT_INFO_AMD);
|
vk_find_struct_const(pCreateInfo->pNext, ATTACHMENT_SAMPLE_COUNT_INFO_AMD);
|
||||||
@@ -2118,12 +2141,10 @@ radv_pipeline_init_dynamic_state(struct radv_graphics_pipeline *pipeline,
|
|||||||
!(states & RADV_DYNAMIC_VERTEX_INPUT))
|
!(states & RADV_DYNAMIC_VERTEX_INPUT))
|
||||||
pipeline->uses_dynamic_stride = true;
|
pipeline->uses_dynamic_stride = true;
|
||||||
|
|
||||||
const VkPipelineFragmentShadingRateStateCreateInfoKHR *shading_rate = vk_find_struct_const(
|
|
||||||
pCreateInfo->pNext, PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR);
|
|
||||||
if (states & RADV_DYNAMIC_FRAGMENT_SHADING_RATE) {
|
if (states & RADV_DYNAMIC_FRAGMENT_SHADING_RATE) {
|
||||||
dynamic->fragment_shading_rate.size = shading_rate->fragmentSize;
|
dynamic->fragment_shading_rate.size = info->fsr.size;
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
dynamic->fragment_shading_rate.combiner_ops[i] = shading_rate->combinerOps[i];
|
dynamic->fragment_shading_rate.combiner_ops[i] = info->fsr.combiner_ops[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (states & RADV_DYNAMIC_DEPTH_BIAS_ENABLE) {
|
if (states & RADV_DYNAMIC_DEPTH_BIAS_ENABLE) {
|
||||||
|
@@ -1989,6 +1989,11 @@ struct radv_color_blend_info {
|
|||||||
} att[MAX_RTS];
|
} att[MAX_RTS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct radv_fragment_shading_rate_info {
|
||||||
|
VkExtent2D size;
|
||||||
|
VkFragmentShadingRateCombinerOpKHR combiner_ops[2];
|
||||||
|
};
|
||||||
|
|
||||||
struct radv_graphics_pipeline_info {
|
struct radv_graphics_pipeline_info {
|
||||||
struct radv_vertex_input_info vi;
|
struct radv_vertex_input_info vi;
|
||||||
struct radv_input_assembly_info ia;
|
struct radv_input_assembly_info ia;
|
||||||
@@ -2003,6 +2008,8 @@ struct radv_graphics_pipeline_info {
|
|||||||
struct radv_rendering_info ri;
|
struct radv_rendering_info ri;
|
||||||
struct radv_color_blend_info cb;
|
struct radv_color_blend_info cb;
|
||||||
|
|
||||||
|
struct radv_fragment_shading_rate_info fsr;
|
||||||
|
|
||||||
/* VK_AMD_mixed_attachment_samples */
|
/* VK_AMD_mixed_attachment_samples */
|
||||||
uint8_t color_att_samples;
|
uint8_t color_att_samples;
|
||||||
uint8_t ds_att_samples;
|
uint8_t ds_att_samples;
|
||||||
|
Reference in New Issue
Block a user