iris: Fix tessellation evaluation shaders that use scratch

The code path for emitting tessellation commands when the TES needed
scratch space was failing to emit 3DSTATE_TE, and instead only emitting
3DSTATE_DS.  This meant that you could get HS and DS enabled with
tessellation itself turned off, which is utter nonsense and would
cause a GPU hang.

Alchemist and later takes a different path and don't take this bug,
but all earlier hardware would hit it.  Discovered while working on
compiler changes that caused a single piglit test to spill minorly,
and thus break entirely.

Fixes: 4256f7ed58 ("iris: Fill out scratch base address dynamically")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28032>
(cherry picked from commit 9e5fd49cbe)
This commit is contained in:
Kenneth Graunke 2024-03-06 21:40:59 -08:00 committed by Eric Engestrom
parent 14a15f8265
commit c968caaa69
2 changed files with 8 additions and 2 deletions

View file

@ -24,7 +24,7 @@
"description": "iris: Fix tessellation evaluation shaders that use scratch",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "4256f7ed5847505c30e903b6674dac88c5d03315",
"notes": null

View file

@ -7278,7 +7278,13 @@ iris_upload_dirty_render_state(struct iris_context *ice,
switch (stage) {
case MESA_SHADER_VERTEX: MERGE_SCRATCH_ADDR(3DSTATE_VS); break;
case MESA_SHADER_TESS_CTRL: MERGE_SCRATCH_ADDR(3DSTATE_HS); break;
case MESA_SHADER_TESS_EVAL: MERGE_SCRATCH_ADDR(3DSTATE_DS); break;
case MESA_SHADER_TESS_EVAL: {
uint32_t *shader_ds = (uint32_t *) shader->derived_data;
uint32_t *shader_te = shader_ds + GENX(3DSTATE_DS_length);
iris_batch_emit(batch, shader_te, 4 * GENX(3DSTATE_TE_length));
MERGE_SCRATCH_ADDR(3DSTATE_DS);
break;
}
case MESA_SHADER_GEOMETRY: MERGE_SCRATCH_ADDR(3DSTATE_GS); break;
}
} else {