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

Author: Faith Ekstrand <[email protected]>
Date:   Tue Nov 14 16:40:52 2023 -0600

nak: Add a writes_layer bit to nak_shader_info::vtg

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197>

---

 src/nouveau/compiler/nak.h  | 1 +
 src/nouveau/compiler/nak.rs | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/nouveau/compiler/nak.h b/src/nouveau/compiler/nak.h
index 98e338e40a2..14a8ca76f43 100644
--- a/src/nouveau/compiler/nak.h
+++ b/src/nouveau/compiler/nak.h
@@ -110,6 +110,7 @@ struct nak_shader_info {
    };
 
    struct {
+      bool writes_layer;
       uint8_t clip_enable;
       uint8_t cull_enable;
 
diff --git a/src/nouveau/compiler/nak.rs b/src/nouveau/compiler/nak.rs
index bb24027698f..57ea3f5fa68 100644
--- a/src/nouveau/compiler/nak.rs
+++ b/src/nouveau/compiler/nak.rs
@@ -355,11 +355,14 @@ pub extern "C" fn nak_compile_shader(
             ShaderStageInfo::Geometry(_)
             | ShaderStageInfo::Tessellation
             | ShaderStageInfo::Vertex => {
+                let writes_layer =
+                    nir.info.outputs_written & (1 << VARYING_SLOT_LAYER) != 0;
                 let num_clip = nir.info.clip_distance_array_size();
                 let num_cull = nir.info.cull_distance_array_size();
                 let clip_enable = (1_u32 << num_clip) - 1;
                 let cull_enable = ((1_u32 << num_cull) - 1) << num_clip;
                 nak_shader_info__bindgen_ty_2 {
+                    writes_layer: writes_layer,
                     clip_enable: clip_enable.try_into().unwrap(),
                     cull_enable: cull_enable.try_into().unwrap(),
                     xfb: unsafe { nak_xfb_from_nir(nir.xfb_info) },

Reply via email to