Mesa (master): mesa: move STATE_LENGTH to shader_enums.h and use it everywhere

Marek Olšák mareko at kemper.freedesktop.org
Tue Feb 13 00:17:37 UTC 2018


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Thu Nov 16 16:19:22 2017 +0100

mesa: move STATE_LENGTH to shader_enums.h and use it everywhere

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/compiler/glsl/ir.h                  |  2 +-
 src/compiler/nir/nir.h                  | 10 +++++-----
 src/compiler/nir/nir_lower_drawpixels.c |  2 +-
 src/compiler/shader_enums.h             |  6 ++++++
 src/mesa/program/prog_statevars.h       |  6 ------
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index b849c93872..6d3ef89eb8 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -397,7 +397,7 @@ depth_layout_string(ir_depth_layout layout);
  * \sa ir_variable::state_slots
  */
 struct ir_state_slot {
-   gl_state_index16 tokens[5];
+   gl_state_index16 tokens[STATE_LENGTH];
    int swizzle;
 };
 
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 216cc8837f..2acd9511f5 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -89,7 +89,7 @@ struct nir_instr;
  * \sa nir_variable::state_slots
  */
 typedef struct {
-   gl_state_index16 tokens[5];
+   gl_state_index16 tokens[STATE_LENGTH];
    int swizzle;
 } nir_state_slot;
 
@@ -2653,7 +2653,7 @@ void nir_lower_passthrough_edgeflags(nir_shader *shader);
 void nir_lower_tes_patch_vertices(nir_shader *tes, unsigned patch_vertices);
 
 typedef struct nir_lower_wpos_ytransform_options {
-   gl_state_index16 state_tokens[5];
+   gl_state_index16 state_tokens[STATE_LENGTH];
    bool fs_coord_origin_upper_left :1;
    bool fs_coord_origin_lower_left :1;
    bool fs_coord_pixel_center_integer :1;
@@ -2665,9 +2665,9 @@ bool nir_lower_wpos_ytransform(nir_shader *shader,
 bool nir_lower_wpos_center(nir_shader *shader, const bool for_sample_shading);
 
 typedef struct nir_lower_drawpixels_options {
-   gl_state_index16 texcoord_state_tokens[5];
-   gl_state_index16 scale_state_tokens[5];
-   gl_state_index16 bias_state_tokens[5];
+   gl_state_index16 texcoord_state_tokens[STATE_LENGTH];
+   gl_state_index16 scale_state_tokens[STATE_LENGTH];
+   gl_state_index16 bias_state_tokens[STATE_LENGTH];
    unsigned drawpix_sampler;
    unsigned pixelmap_sampler;
    bool pixel_maps :1;
diff --git a/src/compiler/nir/nir_lower_drawpixels.c b/src/compiler/nir/nir_lower_drawpixels.c
index 4d43f423a4..5cc358d869 100644
--- a/src/compiler/nir/nir_lower_drawpixels.c
+++ b/src/compiler/nir/nir_lower_drawpixels.c
@@ -68,7 +68,7 @@ get_texcoord(lower_drawpixels_state *state)
 
 static nir_variable *
 create_uniform(nir_shader *shader, const char *name,
-               const gl_state_index16 state_tokens[5])
+               const gl_state_index16 state_tokens[STATE_LENGTH])
 {
    nir_variable *var = nir_variable_create(shader,
                                            nir_var_uniform,
diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h
index d1e875bd18..ac83c65b30 100644
--- a/src/compiler/shader_enums.h
+++ b/src/compiler/shader_enums.h
@@ -48,6 +48,12 @@ typedef enum
    MESA_SHADER_COMPUTE = 5,
 } gl_shader_stage;
 
+/**
+ * Number of STATE_* values we need to address any GL state.
+ * Used to dimension arrays.
+ */
+#define STATE_LENGTH 5
+
 typedef short gl_state_index16; /* see enum gl_state_index */
 
 const char *gl_shader_stage_name(gl_shader_stage stage);
diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h
index 6d3cc94a02..6cb3531233 100644
--- a/src/mesa/program/prog_statevars.h
+++ b/src/mesa/program/prog_statevars.h
@@ -37,12 +37,6 @@ extern "C" {
 struct gl_context;
 struct gl_program_parameter_list;
 
-/**
- * Number of STATE_* values we need to address any GL state.
- * Used to dimension arrays.
- */
-#define STATE_LENGTH 5
-
 
 /**
  * Used for describing GL state referenced from inside ARB vertex and




More information about the mesa-commit mailing list