hk: be robust against invalid MSAA inputs

fixes vkd3d-proton test_multisample_rendering

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32320>
This commit is contained in:
Alyssa Rosenzweig 2024-11-23 18:10:53 -05:00 committed by Marge Bot
parent 1f7598c202
commit 6b8d4cca7e

View file

@ -2968,12 +2968,16 @@ hk_flush_dynamic_state(struct hk_cmd_buffer *cmd, struct hk_cs *cs,
/* With attachmentless rendering, we don't know the sample count until draw
* time, so we do a late tilebuffer fix up. But with rasterizer discard,
* rasterization_samples might be 0.
*
* Note that we ignore dyn->ms.rasterization_samples when we do have a sample
* count from an attachment. In Vulkan, these have to match anyway, but DX12
* drivers are robust against this scenarios and vkd3d-proton will go out of
* spec here. No reason we can't be robust here too.
*/
if (dyn->ms.rasterization_samples &&
gfx->render.tilebuffer.nr_samples != dyn->ms.rasterization_samples) {
if (dyn->ms.rasterization_samples && !gfx->render.tilebuffer.nr_samples) {
agx_tilebuffer_set_samples(&gfx->render.tilebuffer,
dyn->ms.rasterization_samples);
unsigned nr_samples = MAX2(dyn->ms.rasterization_samples, 1);
agx_tilebuffer_set_samples(&gfx->render.tilebuffer, nr_samples);
cs->tib = gfx->render.tilebuffer;
}