turnip: implement variableMultisampleRate
If subpass doesn't have depth/color attachments - samples count is devised from VkPipelineMultisampleStateCreateInfo::rasterizationSamples. Without variableMultisampleRate enabled all pipelines in such subpass should have the same samples count; variableMultisampleRate allows to have pipelines with different number of samples in one subpass, given that it doesn't have depth/color attachments. Blob doesn't have it enabled but there is no known reason for this. Passes: dEQP-VK.pipeline.multisample.variable_rate.* Fixes test: dEQP-VK.pipeline.framebuffer_attachment.no_attachments_ms Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com> Reviewed-by: Hyunjun Ko <zzoon@igalia.com> Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9556>
This commit is contained in:
parent
f31a84233b
commit
519eb735a3
|
@ -2964,7 +2964,8 @@ tu_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
|
|||
|
||||
tu6_emit_zs(cmd, cmd->state.subpass, &cmd->draw_cs);
|
||||
tu6_emit_mrt(cmd, cmd->state.subpass, &cmd->draw_cs);
|
||||
tu6_emit_msaa(&cmd->draw_cs, cmd->state.subpass->samples);
|
||||
if (cmd->state.subpass->samples)
|
||||
tu6_emit_msaa(&cmd->draw_cs, cmd->state.subpass->samples);
|
||||
tu6_emit_render_cntl(cmd, cmd->state.subpass, &cmd->draw_cs, false);
|
||||
|
||||
tu_set_input_attachments(cmd, cmd->state.subpass);
|
||||
|
@ -3029,7 +3030,8 @@ tu_CmdNextSubpass2(VkCommandBuffer commandBuffer,
|
|||
/* emit mrt/zs/msaa/ubwc state for the subpass that is starting */
|
||||
tu6_emit_zs(cmd, cmd->state.subpass, cs);
|
||||
tu6_emit_mrt(cmd, cmd->state.subpass, cs);
|
||||
tu6_emit_msaa(cs, cmd->state.subpass->samples);
|
||||
if (cmd->state.subpass->samples)
|
||||
tu6_emit_msaa(cs, cmd->state.subpass->samples);
|
||||
tu6_emit_render_cntl(cmd, cmd->state.subpass, cs, false);
|
||||
|
||||
tu_set_input_attachments(cmd, cmd->state.subpass);
|
||||
|
|
|
@ -386,7 +386,7 @@ tu_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
|
|||
.shaderInt64 = false,
|
||||
.shaderInt16 = false,
|
||||
.sparseBinding = false,
|
||||
.variableMultisampleRate = false,
|
||||
.variableMultisampleRate = true,
|
||||
.inheritedQueries = true,
|
||||
};
|
||||
|
||||
|
|
|
@ -630,8 +630,6 @@ tu_CreateRenderPass2(VkDevice _device,
|
|||
pass->attachments[a].gmem_offset = 0;
|
||||
update_samples(subpass, pCreateInfo->pAttachments[a].samples);
|
||||
}
|
||||
|
||||
subpass->samples = subpass->samples ?: 1;
|
||||
}
|
||||
|
||||
/* disable unused attachments */
|
||||
|
|
|
@ -259,6 +259,7 @@ struct tu_pipeline_builder
|
|||
|
||||
bool rasterizer_discard;
|
||||
/* these states are affectd by rasterizer_discard */
|
||||
bool emit_msaa_state;
|
||||
VkSampleCountFlagBits samples;
|
||||
bool use_color_attachments;
|
||||
bool use_dual_src_blend;
|
||||
|
@ -2559,7 +2560,8 @@ tu_pipeline_builder_parse_rasterization(struct tu_pipeline_builder *builder,
|
|||
depth_clip_disable = !depth_clip_state->depthClipEnable;
|
||||
|
||||
struct tu_cs cs;
|
||||
pipeline->rast_state = tu_cs_draw_state(&pipeline->cs, &cs, 13);
|
||||
uint32_t cs_size = 13 + (builder->emit_msaa_state ? 11 : 0);
|
||||
pipeline->rast_state = tu_cs_draw_state(&pipeline->cs, &cs, cs_size);
|
||||
|
||||
tu_cs_emit_regs(&cs,
|
||||
A6XX_GRAS_CL_CNTL(
|
||||
|
@ -2591,6 +2593,12 @@ tu_pipeline_builder_parse_rasterization(struct tu_pipeline_builder *builder,
|
|||
tu_cs_emit_regs(&cs,
|
||||
A6XX_VPC_UNKNOWN_9107(.raster_discard = rast_info->rasterizerDiscardEnable));
|
||||
|
||||
/* If samples count couldn't be devised from the subpass, we should emit it here.
|
||||
* It happens when subpass doesn't use any color/depth attachment.
|
||||
*/
|
||||
if (builder->emit_msaa_state)
|
||||
tu6_emit_msaa(&cs, builder->samples);
|
||||
|
||||
pipeline->gras_su_cntl =
|
||||
tu6_gras_su_cntl(rast_info, builder->samples, builder->multiview_mask != 0);
|
||||
|
||||
|
@ -2969,6 +2977,9 @@ tu_pipeline_builder_init_graphics(
|
|||
builder->rasterizer_discard =
|
||||
create_info->pRasterizationState->rasterizerDiscardEnable;
|
||||
|
||||
/* variableMultisampleRate support */
|
||||
builder->emit_msaa_state = (subpass->samples == 0) && !builder->rasterizer_discard;
|
||||
|
||||
if (builder->rasterizer_discard) {
|
||||
builder->samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue