turnip: Selectively configure GRAS_LAYER_CNTL

One of the features of geometry shaders is the ability to render to
different layers by assigning to the gl_Layer (Layer in SPIR-V)
builtin.

While have already plumbed the layer regid to the geometry shader,
we also need to GRAS_LAYER_CNTL to actually use layered rendering.
In addition, gmem does not support layered rendering, so we need to
force sysmem.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4436>
This commit is contained in:
Brian Ho 2020-04-03 07:57:25 -07:00 committed by Marge Bot
parent 475fe500bf
commit 3550e20229
2 changed files with 9 additions and 2 deletions

View file

@ -127,6 +127,10 @@ force_sysmem(const struct tu_cmd_buffer *cmd,
bool has_linear_mipmapped_store = false;
const struct tu_render_pass *pass = cmd->state.pass;
/* Layered rendering requires sysmem. */
if (fb->layers > 1)
return true;
/* Iterate over all the places we call tu6_emit_store_attachment() */
for (unsigned i = 0; i < pass->subpass_count; i++) {
const struct tu_subpass *subpass = &pass->subpasses[i];
@ -553,6 +557,11 @@ tu6_emit_mrt(struct tu_cmd_buffer *cmd,
.rt5 = mrt_comp[5],
.rt6 = mrt_comp[6],
.rt7 = mrt_comp[7]));
// XXX: We probably can't hardcode LAYER_CNTL_TYPE.
tu_cs_emit_regs(cs,
A6XX_GRAS_LAYER_CNTL(.layered = fb->layers > 1,
.type = LAYER_2D_ARRAY));
}
static void

View file

@ -1531,8 +1531,6 @@ tu6_emit_gras_unknowns(struct tu_cs *cs)
{
tu_cs_emit_pkt4(cs, REG_A6XX_GRAS_UNKNOWN_8001, 1);
tu_cs_emit(cs, 0x0);
tu_cs_emit_pkt4(cs, REG_A6XX_GRAS_LAYER_CNTL, 1);
tu_cs_emit(cs, 0x0);
}
static void