From 4e8b532db31425f469c76f7de2aa4b6d6151b03b Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 21 Apr 2023 09:39:18 +0200 Subject: [PATCH] nir: remove nir_state_slot::swizzle This is only ever written to, never read from. Let's just get rid of it! This also saves us a few needless includes. Reviewed-by: Emma Anholt Part-of: --- src/compiler/glsl/glsl_to_nir.cpp | 1 - src/compiler/nir/nir.h | 1 - src/compiler/nir/nir_lower_patch_vertices.c | 2 -- src/compiler/nir/nir_lower_pntc_ytransform.c | 2 -- src/compiler/nir/nir_lower_point_size_mov.c | 1 - src/compiler/nir/nir_lower_wpos_ytransform.c | 2 -- 6 files changed, 9 deletions(-) diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 1cc34771b34..00b6afa1a20 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -707,7 +707,6 @@ nir_visitor::visit(ir_variable *ir) for (unsigned i = 0; i < var->num_state_slots; i++) { for (unsigned j = 0; j < 4; j++) var->state_slots[i].tokens[j] = state_slots[i].tokens[j]; - var->state_slots[i].swizzle = state_slots[i].swizzle; } } else { var->state_slots = NULL; diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 753b8821c27..02f94e08665 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -171,7 +171,6 @@ struct nir_xfb_info; */ typedef struct { gl_state_index16 tokens[STATE_LENGTH]; - uint16_t swizzle; } nir_state_slot; typedef enum { diff --git a/src/compiler/nir/nir_lower_patch_vertices.c b/src/compiler/nir/nir_lower_patch_vertices.c index 3f6ccfbfbf4..476f1b00847 100644 --- a/src/compiler/nir/nir_lower_patch_vertices.c +++ b/src/compiler/nir/nir_lower_patch_vertices.c @@ -22,7 +22,6 @@ */ #include "nir_builder.h" -#include "program/prog_instruction.h" static nir_variable * make_uniform(nir_shader *nir, const gl_state_index16 *tokens) @@ -36,7 +35,6 @@ make_uniform(nir_shader *nir, const gl_state_index16 *tokens) var->num_state_slots = 1; var->state_slots = ralloc_array(var, nir_state_slot, var->num_state_slots); memcpy(var->state_slots[0].tokens, tokens, sizeof(*tokens) * STATE_LENGTH); - var->state_slots[0].swizzle = SWIZZLE_XXXX; return var; } diff --git a/src/compiler/nir/nir_lower_pntc_ytransform.c b/src/compiler/nir/nir_lower_pntc_ytransform.c index e7b12b4ec65..18f0f326763 100644 --- a/src/compiler/nir/nir_lower_pntc_ytransform.c +++ b/src/compiler/nir/nir_lower_pntc_ytransform.c @@ -23,7 +23,6 @@ #include "nir.h" #include "nir_builder.h" -#include "program/prog_instruction.h" /* Lower gl_PointCoord to account for user requested point-coord origin * and for whether draw buffer is flipped. @@ -50,7 +49,6 @@ get_pntc_transform(lower_pntc_ytransform_state *state) var->num_state_slots = 1; var->state_slots = ralloc_array(var, nir_state_slot, 1); - var->state_slots[0].swizzle = SWIZZLE_XYZW; memcpy(var->state_slots[0].tokens, state->pntc_state_tokens, sizeof(var->state_slots[0].tokens)); var->data.how_declared = nir_var_hidden; diff --git a/src/compiler/nir/nir_lower_point_size_mov.c b/src/compiler/nir/nir_lower_point_size_mov.c index beedf33856c..6c1c16c749a 100644 --- a/src/compiler/nir/nir_lower_point_size_mov.c +++ b/src/compiler/nir/nir_lower_point_size_mov.c @@ -46,7 +46,6 @@ lower_impl(nir_function_impl *impl, glsl_vec4_type(), "gl_PointSizeClampedMESA"); in->num_state_slots = 1; in->state_slots = ralloc_array(in, nir_state_slot, 1); - in->state_slots[0].swizzle = BITFIELD_MASK(4); memcpy(in->state_slots[0].tokens, pointsize_state_tokens, sizeof(in->state_slots[0].tokens)); diff --git a/src/compiler/nir/nir_lower_wpos_ytransform.c b/src/compiler/nir/nir_lower_wpos_ytransform.c index 63c9a0b1516..3e70b1d1454 100644 --- a/src/compiler/nir/nir_lower_wpos_ytransform.c +++ b/src/compiler/nir/nir_lower_wpos_ytransform.c @@ -23,7 +23,6 @@ #include "nir.h" #include "nir_builder.h" -#include "program/prog_instruction.h" /* Lower gl_FragCoord (and fddy) to account for driver's requested coordinate- * origin and pixel-center vs. shader. If transformation is required, a @@ -56,7 +55,6 @@ get_transform(lower_wpos_ytransform_state *state) var->num_state_slots = 1; var->state_slots = ralloc_array(var, nir_state_slot, 1); - var->state_slots[0].swizzle = SWIZZLE_XYZW; memcpy(var->state_slots[0].tokens, state->options->state_tokens, sizeof(var->state_slots[0].tokens)); var->data.how_declared = nir_var_hidden;