Mesa (master): nir: pack nir_variable::data::stream

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 4 23:17:58 UTC 2019


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Oct 25 14:55:06 2019 -0400

nir: pack nir_variable::data::stream

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

---

 src/compiler/glsl/glsl_to_nir.cpp            | 2 ++
 src/compiler/nir/nir.h                       | 7 ++++---
 src/gallium/drivers/radeonsi/si_shader_nir.c | 4 ++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index c9bba912622..9b9da7f8187 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -445,6 +445,8 @@ nir_visitor::visit(ir_variable *ir)
    var->data.invariant = ir->data.invariant;
    var->data.location = ir->data.location;
    var->data.stream = ir->data.stream;
+   if (ir->data.stream & (1u << 31))
+      var->data.stream |= NIR_STREAM_PACKED;
    var->data.compact = false;
 
    switch(ir->data.mode) {
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 00e5028d27b..e1f0fdd707c 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -60,6 +60,7 @@ extern "C" {
 #define NIR_TRUE (~0u)
 #define NIR_MAX_VEC_COMPONENTS 4
 #define NIR_MAX_MATRIX_COLUMNS 4
+#define NIR_STREAM_PACKED (1 << 8)
 typedef uint8_t nir_component_mask_t;
 
 /** Defines a cast function
@@ -450,10 +451,10 @@ typedef struct nir_variable {
       /**
        * Vertex stream output identifier.
        *
-       * For packed outputs, bit 31 is set and bits [2*i+1,2*i] indicate the
-       * stream of the i-th component.
+       * For packed outputs, NIR_STREAM_PACKED is set and bits [2*i+1,2*i]
+       * indicate the stream of the i-th component.
        */
-      unsigned stream;
+      unsigned stream:9;
 
       /**
        * output index for dual source blending.
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 4df625ed274..463ec0b5421 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -466,8 +466,8 @@ static void scan_output_slot(const nir_variable *var,
 	ubyte usagemask = ((1 << num_components) - 1) << component;
 
 	unsigned gs_out_streams;
-	if (var->data.stream & (1u << 31)) {
-		gs_out_streams = var->data.stream & ~(1u << 31);
+	if (var->data.stream & NIR_STREAM_PACKED) {
+		gs_out_streams = var->data.stream & ~NIR_STREAM_PACKED;
 	} else {
 		assert(var->data.stream < 4);
 		gs_out_streams = 0;




More information about the mesa-commit mailing list