Mesa (main): nir: add variable data fields required for NIR glsl varying linking
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 16 04:43:32 UTC 2022
Module: Mesa
Branch: main
Commit: cba2fd51a26adfeab3dee64ab774b36a3f47fc76
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cba2fd51a26adfeab3dee64ab774b36a3f47fc76
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Tue Nov 2 12:46:06 2021 +1100
nir: add variable data fields required for NIR glsl varying linking
These will be used in the following patches that add a NIR based
varying linker.
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15731>
---
src/compiler/glsl/glsl_to_nir.cpp | 3 +++
src/compiler/nir/nir.h | 30 ++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 4113615c2b7..5a920c54a76 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -496,6 +496,7 @@ nir_visitor::visit(ir_variable *ir)
var->type = ir->type;
var->name = ralloc_strdup(var, ir->name);
+ var->data.assigned = ir->data.assigned;
var->data.always_active_io = ir->data.always_active_io;
var->data.read_only = ir->data.read_only;
var->data.centroid = ir->data.centroid;
@@ -504,6 +505,7 @@ nir_visitor::visit(ir_variable *ir)
var->data.how_declared = get_nir_how_declared(ir->data.how_declared);
var->data.invariant = ir->data.invariant;
var->data.location = ir->data.location;
+ var->data.must_be_shader_input = ir->data.must_be_shader_input;
var->data.stream = ir->data.stream;
if (ir->data.stream & (1u << 31))
var->data.stream |= NIR_STREAM_PACKED;
@@ -668,6 +670,7 @@ nir_visitor::visit(ir_variable *ir)
var->data.descriptor_set = 0;
var->data.binding = ir->data.binding;
var->data.explicit_binding = ir->data.explicit_binding;
+ var->data.explicit_offset = ir->data.explicit_xfb_offset;
var->data.bindless = ir->data.bindless;
var->data.offset = ir->data.offset;
var->data.access = (gl_access_qualifier)mem_access;
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 88a2c0626c2..985f07c7d3c 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -456,6 +456,16 @@ typedef struct nir_variable {
*/
unsigned precision:2;
+ /**
+ * Has this variable been statically assigned?
+ *
+ * This answers whether the variable was assigned in any path of
+ * the shader during ast_to_hir. This doesn't answer whether it is
+ * still written after dead code removal, nor is it maintained in
+ * non-ast_to_hir.cpp (GLSL parsing) paths.
+ */
+ unsigned assigned:1;
+
/**
* Can this variable be coalesced with another?
*
@@ -527,6 +537,20 @@ typedef struct nir_variable {
*/
unsigned explicit_location:1;
+ /**
+ * Is this varying used by transform feedback?
+ *
+ * This is used by the linker to decide if it's safe to pack the varying.
+ */
+ unsigned is_xfb:1;
+
+ /**
+ * Is this varying used only by transform feedback?
+ *
+ * This is used by the linker to decide if its safe to pack the varying.
+ */
+ unsigned is_xfb_only:1;
+
/**
* Was a transfer feedback buffer set in the shader?
*/
@@ -553,6 +577,12 @@ typedef struct nir_variable {
*/
unsigned from_named_ifc_block:1;
+ /**
+ * Non-zero if the variable must be a shader input. This is useful for
+ * constraints on function parameters.
+ */
+ unsigned must_be_shader_input:1;
+
/**
* How the variable was declared. See nir_var_declaration_type.
*
More information about the mesa-commit
mailing list