Mesa (master): radv: set the LayerId output usage mask if FS needs it

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 10 13:14:21 UTC 2019


Module: Mesa
Branch: master
Commit: bd86ded02712c90071fbfb71f71b4135be6b668c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd86ded02712c90071fbfb71f71b4135be6b668c

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Jul 10 13:03:49 2019 +0200

radv: set the LayerId output usage mask if FS needs it

When the stage preceding FS doesn't export it the fragment shader
might read it, even if it's 0.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/vulkan/radv_shader_info.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c
index 2756d99e769..946f7aa5f23 100644
--- a/src/amd/vulkan/radv_shader_info.c
+++ b/src/amd/vulkan/radv_shader_info.c
@@ -576,4 +576,21 @@ radv_nir_shader_info_pass(const struct nir_shader *nir,
 	    nir->info.stage == MESA_SHADER_TESS_EVAL ||
 	    nir->info.stage == MESA_SHADER_GEOMETRY)
 		gather_xfb_info(nir, info);
+
+	/* Make sure to export the LayerID if the fragment shader needs it. */
+	if (options->key.vs_common_out.export_layer_id) {
+		switch (nir->info.stage) {
+		case MESA_SHADER_VERTEX:
+			info->vs.output_usage_mask[VARYING_SLOT_LAYER] |= 0x1;
+			break;
+		case MESA_SHADER_TESS_EVAL:
+			info->tes.output_usage_mask[VARYING_SLOT_LAYER] |= 0x1;
+			break;
+		case MESA_SHADER_GEOMETRY:
+			info->gs.output_usage_mask[VARYING_SLOT_LAYER] |= 0x1;
+			break;
+		default:
+			break;
+		}
+	}
 }




More information about the mesa-commit mailing list