From 3550e20229bfc1872ae041e66958187ee4a97ac6 Mon Sep 17 00:00:00 2001 From: Brian Ho Date: Fri, 3 Apr 2020 07:57:25 -0700 Subject: [PATCH] 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: --- src/freedreno/vulkan/tu_cmd_buffer.c | 9 +++++++++ src/freedreno/vulkan/tu_pipeline.c | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-) 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 -- 2.30.2