From: Brian Ho Date: Fri, 3 Apr 2020 14:57:25 +0000 (-0700) Subject: turnip: Selectively configure GRAS_LAYER_CNTL X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3550e20229bfc1872ae041e66958187ee4a97ac6;p=mesa.git 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: --- diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c index 3fe3b17e83b..4155c0a8a88 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.c +++ b/src/freedreno/vulkan/tu_cmd_buffer.c @@ -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 diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c index 48f08cb5f3a..ac02e66590b 100644 --- a/src/freedreno/vulkan/tu_pipeline.c +++ b/src/freedreno/vulkan/tu_pipeline.c @@ -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