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@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15731>
This commit is contained in:
Timothy Arceri
2021-11-02 12:46:06 +11:00
committed by Marge Bot
parent 43a8454ea8
commit cba2fd51a2
2 changed files with 33 additions and 0 deletions

View File

@@ -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;

View File

@@ -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.
*