summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/compiler/glsl/ir.h2
-rw-r--r--src/compiler/glsl/serialize.cpp2
-rw-r--r--src/compiler/glsl/standalone_scaffolding.cpp4
-rw-r--r--src/compiler/glsl/standalone_scaffolding.h4
-rw-r--r--src/compiler/nir/nir.h10
-rw-r--r--src/compiler/nir/nir_lower_drawpixels.c3
-rw-r--r--src/compiler/shader_enums.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_link.cpp3
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_vertprog.c2
-rw-r--r--src/mesa/main/ffvertex_prog.c2
-rw-r--r--src/mesa/main/tests/program_state_string.cpp2
-rw-r--r--src/mesa/main/uniforms.h2
-rw-r--r--src/mesa/program/ir_to_mesa.cpp2
-rw-r--r--src/mesa/program/prog_parameter.c10
-rw-r--r--src/mesa/program/prog_parameter.h6
-rw-r--r--src/mesa/program/prog_statevars.c6
-rw-r--r--src/mesa/program/prog_statevars.h5
-rw-r--r--src/mesa/program/program_parse.y18
-rw-r--r--src/mesa/program/programopt.c8
-rw-r--r--src/mesa/state_tracker/st_atifs_to_tgsi.c4
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp6
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp7
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c2
-rw-r--r--src/mesa/state_tracker/st_nir_lower_builtin.c4
-rw-r--r--src/mesa/state_tracker/st_program.c6
27 files changed, 63 insertions, 63 deletions
diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index d5a255eb8b4..b849c938722 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 {
- int tokens[5];
+ gl_state_index16 tokens[5];
int swizzle;
};
diff --git a/src/compiler/glsl/serialize.cpp b/src/compiler/glsl/serialize.cpp
index 63ce41d87bd..9d2033bddfa 100644
--- a/src/compiler/glsl/serialize.cpp
+++ b/src/compiler/glsl/serialize.cpp
@@ -975,7 +975,7 @@ static void
read_shader_parameters(struct blob_reader *metadata,
struct gl_program_parameter_list *params)
{
- gl_state_index state_indexes[STATE_LENGTH];
+ gl_state_index16 state_indexes[STATE_LENGTH];
uint32_t i = 0;
uint32_t num_parameters = blob_read_uint32(metadata);
diff --git a/src/compiler/glsl/standalone_scaffolding.cpp b/src/compiler/glsl/standalone_scaffolding.cpp
index 34065a9fe10..caaddc028f7 100644
--- a/src/compiler/glsl/standalone_scaffolding.cpp
+++ b/src/compiler/glsl/standalone_scaffolding.cpp
@@ -100,13 +100,13 @@ _mesa_new_shader(GLuint name, gl_shader_stage stage)
}
GLbitfield
-_mesa_program_state_flags(UNUSED const gl_state_index state[STATE_LENGTH])
+_mesa_program_state_flags(UNUSED const gl_state_index16 state[STATE_LENGTH])
{
return 0;
}
char *
-_mesa_program_state_string(UNUSED const gl_state_index state[STATE_LENGTH])
+_mesa_program_state_string(UNUSED const gl_state_index16 state[STATE_LENGTH])
{
return NULL;
}
diff --git a/src/compiler/glsl/standalone_scaffolding.h b/src/compiler/glsl/standalone_scaffolding.h
index 7532d0836f7..c8d90597ca0 100644
--- a/src/compiler/glsl/standalone_scaffolding.h
+++ b/src/compiler/glsl/standalone_scaffolding.h
@@ -69,11 +69,11 @@ _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
const char *msg);
extern "C" GLbitfield
-_mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]);
+_mesa_program_state_flags(const gl_state_index16 state[STATE_LENGTH]);
extern "C" char *
-_mesa_program_state_string(const gl_state_index state[STATE_LENGTH]);
+_mesa_program_state_string(const gl_state_index16 state[STATE_LENGTH]);
static inline gl_shader_stage
_mesa_shader_enum_to_shader_stage(GLenum v)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 5ea8c9926b9..216cc8837fd 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 {
- int tokens[5];
+ gl_state_index16 tokens[5];
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 {
- int state_tokens[5];
+ gl_state_index16 state_tokens[5];
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 {
- int texcoord_state_tokens[5];
- int scale_state_tokens[5];
- int bias_state_tokens[5];
+ gl_state_index16 texcoord_state_tokens[5];
+ gl_state_index16 scale_state_tokens[5];
+ gl_state_index16 bias_state_tokens[5];
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 acec9443431..4d43f423a49 100644
--- a/src/compiler/nir/nir_lower_drawpixels.c
+++ b/src/compiler/nir/nir_lower_drawpixels.c
@@ -67,7 +67,8 @@ get_texcoord(lower_drawpixels_state *state)
}
static nir_variable *
-create_uniform(nir_shader *shader, const char *name, const int state_tokens[5])
+create_uniform(nir_shader *shader, const char *name,
+ const gl_state_index16 state_tokens[5])
{
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 fb78ad384cb..d1e875bd189 100644
--- a/src/compiler/shader_enums.h
+++ b/src/compiler/shader_enums.h
@@ -48,6 +48,8 @@ typedef enum
MESA_SHADER_COMPUTE = 5,
} gl_shader_stage;
+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/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index fc35c006dcd..f0598f591ab 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -319,8 +319,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
assert(var->state_slots != NULL);
for (unsigned int i = 0; i < var->num_state_slots; i++) {
- _mesa_add_state_reference(prog->Parameters,
- (gl_state_index *)slots[i].tokens);
+ _mesa_add_state_reference(prog->Parameters, slots[i].tokens);
}
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp
index 05f61674c3c..9c4fb22a905 100644
--- a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp
+++ b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp
@@ -40,7 +40,7 @@ brw_nir_setup_glsl_builtin_uniform(nir_variable *var,
* get the same index back here.
*/
int index = _mesa_add_state_reference(prog->Parameters,
- (gl_state_index *)slots[i].tokens);
+ slots[i].tokens);
/* Add each of the unique swizzles of the element as a parameter.
* This'll end up matching the expected layout of the
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 7fae22c6207..9aaffc37bd1 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -127,7 +127,7 @@ brw_create_nir(struct brw_context *brw,
NIR_PASS(progress, nir, nir_lower_wpos_ytransform, &wpos_options);
if (progress) {
_mesa_add_state_reference(prog->Parameters,
- (gl_state_index *) wpos_options.state_tokens);
+ wpos_options.state_tokens);
}
}
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c
index c3606b50ff0..8599e478815 100644
--- a/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -456,7 +456,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
if ((mesa_vp->info.outputs_written & (1 << VARYING_SLOT_FOGC)) &&
!vp->fogpidx) {
struct gl_program_parameter_list *paramList;
- gl_state_index tokens[STATE_LENGTH] = { STATE_FOG_PARAMS, 0, 0, 0, 0 };
+ gl_state_index16 tokens[STATE_LENGTH] = { STATE_FOG_PARAMS, 0, 0, 0, 0 };
paramList = mesa_vp->Parameters;
vp->fogpidx = _mesa_add_state_reference(paramList, tokens);
}
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 976b6f46b9f..c7b639456cd 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -413,7 +413,7 @@ static struct ureg register_param5(struct tnl_program *p,
GLint s3,
GLint s4)
{
- gl_state_index tokens[STATE_LENGTH];
+ gl_state_index16 tokens[STATE_LENGTH];
GLint idx;
tokens[0] = s0;
tokens[1] = s1;
diff --git a/src/mesa/main/tests/program_state_string.cpp b/src/mesa/main/tests/program_state_string.cpp
index 64c43960f14..38805f92c77 100644
--- a/src/mesa/main/tests/program_state_string.cpp
+++ b/src/mesa/main/tests/program_state_string.cpp
@@ -30,7 +30,7 @@
TEST(program_state_string, depth_range)
{
- const gl_state_index state[STATE_LENGTH] = {
+ const gl_state_index16 state[STATE_LENGTH] = {
STATE_DEPTH_RANGE
};
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
index 9236db97805..819cf90ba41 100644
--- a/src/mesa/main/uniforms.h
+++ b/src/mesa/main/uniforms.h
@@ -505,7 +505,7 @@ _mesa_flush_vertices_for_uniforms(struct gl_context *ctx,
struct gl_builtin_uniform_element {
const char *field;
- int tokens[STATE_LENGTH];
+ gl_state_index16 tokens[STATE_LENGTH];
int swizzle;
};
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 660e2c1bd04..74089605029 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -663,7 +663,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
for (unsigned int i = 0; i < ir->get_num_state_slots(); i++) {
int index = _mesa_add_state_reference(this->prog->Parameters,
- (gl_state_index *)slots[i].tokens);
+ slots[i].tokens);
if (storage->file == PROGRAM_STATE_VAR) {
if (storage->index == -1) {
diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c
index 81609f5c5e1..6b6599d7453 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -232,7 +232,7 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
gl_register_file type, const char *name,
GLuint size, GLenum datatype,
const gl_constant_value *values,
- const gl_state_index state[STATE_LENGTH])
+ const gl_state_index16 state[STATE_LENGTH])
{
assert(0 < size && size <=4);
const GLuint oldNum = paramList->NumParameters;
@@ -352,7 +352,7 @@ _mesa_add_typed_unnamed_constant(struct gl_program_parameter_list *paramList,
*/
GLint
_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
- const gl_state_index stateTokens[STATE_LENGTH])
+ const gl_state_index16 stateTokens[STATE_LENGTH])
{
const GLuint size = 4; /* XXX fix */
char *name;
@@ -361,15 +361,15 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
/* Check if the state reference is already in the list */
for (index = 0; index < (GLint) paramList->NumParameters; index++) {
if (!memcmp(paramList->Parameters[index].StateIndexes,
- stateTokens, STATE_LENGTH * sizeof(gl_state_index))) {
+ stateTokens,
+ sizeof(paramList->Parameters[index].StateIndexes))) {
return index;
}
}
name = _mesa_program_state_string(stateTokens);
index = _mesa_add_parameter(paramList, PROGRAM_STATE_VAR, name,
- size, GL_NONE,
- NULL, (gl_state_index *) stateTokens);
+ size, GL_NONE, NULL, stateTokens);
paramList->StateFlags |= _mesa_program_state_flags(stateTokens);
/* free name string here since we duplicated it in add_parameter() */
diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h
index f50e99c8abe..ce5d2cbaabc 100644
--- a/src/mesa/program/prog_parameter.h
+++ b/src/mesa/program/prog_parameter.h
@@ -72,7 +72,7 @@ struct gl_program_parameter
/**
* A sequence of STATE_* tokens and integers to identify GL state.
*/
- gl_state_index StateIndexes[STATE_LENGTH];
+ gl_state_index16 StateIndexes[STATE_LENGTH];
};
@@ -108,7 +108,7 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
gl_register_file type, const char *name,
GLuint size, GLenum datatype,
const gl_constant_value *values,
- const gl_state_index state[STATE_LENGTH]);
+ const gl_state_index16 state[STATE_LENGTH]);
extern GLint
_mesa_add_typed_unnamed_constant(struct gl_program_parameter_list *paramList,
@@ -126,7 +126,7 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList,
extern GLint
_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
- const gl_state_index stateTokens[STATE_LENGTH]);
+ const gl_state_index16 stateTokens[]);
static inline GLint
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index 78f70053017..e7fa72ce10e 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -54,7 +54,7 @@
* The program parser will produce the state[] values.
*/
static void
-_mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
+_mesa_fetch_state(struct gl_context *ctx, const gl_state_index16 state[],
gl_constant_value *val)
{
GLfloat *value = &val->f;
@@ -628,7 +628,7 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
* some GL state has changed.
*/
GLbitfield
-_mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
+_mesa_program_state_flags(const gl_state_index16 state[STATE_LENGTH])
{
switch (state[0]) {
case STATE_MATERIAL:
@@ -948,7 +948,7 @@ append_index(char *dst, GLint index)
* Use free() to deallocate the string.
*/
char *
-_mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
+_mesa_program_state_string(const gl_state_index16 state[STATE_LENGTH])
{
char str[1000] = "";
char tmp[30];
diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h
index 3fdb413c421..6d3cc94a029 100644
--- a/src/mesa/program/prog_statevars.h
+++ b/src/mesa/program/prog_statevars.h
@@ -138,18 +138,17 @@ typedef enum gl_state_index_ {
} gl_state_index;
-
extern void
_mesa_load_state_parameters(struct gl_context *ctx,
struct gl_program_parameter_list *paramList);
extern GLbitfield
-_mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]);
+_mesa_program_state_flags(const gl_state_index16 state[STATE_LENGTH]);
extern char *
-_mesa_program_state_string(const gl_state_index state[STATE_LENGTH]);
+_mesa_program_state_string(const gl_state_index16 state[STATE_LENGTH]);
diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
index 1bc5f515494..8adbbf0ac5b 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -45,13 +45,13 @@ static struct asm_symbol *declare_variable(struct asm_parser_state *state,
char *name, enum asm_type t, struct YYLTYPE *locp);
static int add_state_reference(struct gl_program_parameter_list *param_list,
- const gl_state_index tokens[STATE_LENGTH]);
+ const gl_state_index16 tokens[STATE_LENGTH]);
static int initialize_symbol_from_state(struct gl_program *prog,
- struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
+ struct asm_symbol *param_var, const gl_state_index16 tokens[STATE_LENGTH]);
static int initialize_symbol_from_param(struct gl_program *prog,
- struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
+ struct asm_symbol *param_var, const gl_state_index16 tokens[STATE_LENGTH]);
static int initialize_symbol_from_const(struct gl_program *prog,
struct asm_symbol *param_var, const struct asm_vector *vec,
@@ -136,7 +136,7 @@ static struct asm_instruction *asm_instruction_copy_ctor(
unsigned attrib;
int integer;
float real;
- gl_state_index state[STATE_LENGTH];
+ gl_state_index16 state[STATE_LENGTH];
int negate;
struct asm_vector vector;
enum prog_opcode opcode;
@@ -2299,7 +2299,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
int add_state_reference(struct gl_program_parameter_list *param_list,
- const gl_state_index tokens[STATE_LENGTH])
+ const gl_state_index16 tokens[STATE_LENGTH])
{
const GLuint size = 4; /* XXX fix */
char *name;
@@ -2320,10 +2320,10 @@ int add_state_reference(struct gl_program_parameter_list *param_list,
int
initialize_symbol_from_state(struct gl_program *prog,
struct asm_symbol *param_var,
- const gl_state_index tokens[STATE_LENGTH])
+ const gl_state_index16 tokens[STATE_LENGTH])
{
int idx = -1;
- gl_state_index state_tokens[STATE_LENGTH];
+ gl_state_index16 state_tokens[STATE_LENGTH];
memcpy(state_tokens, tokens, sizeof(state_tokens));
@@ -2372,10 +2372,10 @@ initialize_symbol_from_state(struct gl_program *prog,
int
initialize_symbol_from_param(struct gl_program *prog,
struct asm_symbol *param_var,
- const gl_state_index tokens[STATE_LENGTH])
+ const gl_state_index16 tokens[STATE_LENGTH])
{
int idx = -1;
- gl_state_index state_tokens[STATE_LENGTH];
+ gl_state_index16 state_tokens[STATE_LENGTH];
memcpy(state_tokens, tokens, sizeof(state_tokens));
diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c
index f560bce62e4..a9c0beb31bc 100644
--- a/src/mesa/program/programopt.c
+++ b/src/mesa/program/programopt.c
@@ -57,7 +57,7 @@ insert_mvp_dp4_code(struct gl_context *ctx, struct gl_program *vprog)
* Setup state references for the modelview/projection matrix.
* XXX we should check if these state vars are already declared.
*/
- static const gl_state_index mvpState[4][STATE_LENGTH] = {
+ static const gl_state_index16 mvpState[4][STATE_LENGTH] = {
{ STATE_MVP_MATRIX, 0, 0, 0, 0 }, /* state.matrix.mvp.row[0] */
{ STATE_MVP_MATRIX, 0, 1, 1, 0 }, /* state.matrix.mvp.row[1] */
{ STATE_MVP_MATRIX, 0, 2, 2, 0 }, /* state.matrix.mvp.row[2] */
@@ -125,7 +125,7 @@ insert_mvp_mad_code(struct gl_context *ctx, struct gl_program *vprog)
* Setup state references for the modelview/projection matrix.
* XXX we should check if these state vars are already declared.
*/
- static const gl_state_index mvpState[4][STATE_LENGTH] = {
+ static const gl_state_index16 mvpState[4][STATE_LENGTH] = {
{ STATE_MVP_MATRIX, 0, 0, 0, STATE_MATRIX_TRANSPOSE },
{ STATE_MVP_MATRIX, 0, 1, 1, STATE_MATRIX_TRANSPOSE },
{ STATE_MVP_MATRIX, 0, 2, 2, STATE_MATRIX_TRANSPOSE },
@@ -247,9 +247,9 @@ void
_mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
GLenum fog_mode, GLboolean saturate)
{
- static const gl_state_index fogPStateOpt[STATE_LENGTH]
+ static const gl_state_index16 fogPStateOpt[STATE_LENGTH]
= { STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0 };
- static const gl_state_index fogColorState[STATE_LENGTH]
+ static const gl_state_index16 fogColorState[STATE_LENGTH]
= { STATE_FOG_COLOR, 0, 0, 0, 0};
struct prog_instruction *newInst, *inst;
const GLuint origLen = fprog->arb.NumInstructions;
diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.c b/src/mesa/state_tracker/st_atifs_to_tgsi.c
index 8affbdc8d1d..76236cf9656 100644
--- a/src/mesa/state_tracker/st_atifs_to_tgsi.c
+++ b/src/mesa/state_tracker/st_atifs_to_tgsi.c
@@ -544,9 +544,9 @@ st_init_atifs_prog(struct gl_context *ctx, struct gl_program *prog)
unsigned pass, i, r, optype, arg;
- static const gl_state_index fog_params_state[STATE_LENGTH] =
+ static const gl_state_index16 fog_params_state[STATE_LENGTH] =
{STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0};
- static const gl_state_index fog_color[STATE_LENGTH] =
+ static const gl_state_index16 fog_color[STATE_LENGTH] =
{STATE_FOG_COLOR, 0, 0, 0, 0};
prog->info.inputs_read = 0;
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 3f48a278359..765c827d93f 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -247,7 +247,7 @@ st_nir_assign_uniform_locations(struct gl_program *prog,
else
loc = imageidx++;
} else if (strncmp(uniform->name, "gl_", 3) == 0) {
- const gl_state_index *const stateTokens = (gl_state_index *)uniform->state_slots[0].tokens;
+ const gl_state_index16 *const stateTokens = uniform->state_slots[0].tokens;
/* This state reference has already been setup by ir_to_mesa, but we'll
* get the same index back here.
*/
@@ -365,7 +365,7 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
for (unsigned int i = 0; i < var->num_state_slots; i++) {
_mesa_add_state_reference(prog->Parameters,
- (gl_state_index *)slots[i].tokens);
+ slots[i].tokens);
}
}
}
@@ -598,7 +598,7 @@ st_link_nir(struct gl_context *ctx,
/* fragment shaders may need : */
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
- static const gl_state_index wposTransformState[STATE_LENGTH] = {
+ static const gl_state_index16 wposTransformState[STATE_LENGTH] = {
STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM
};
nir_lower_wpos_ytransform_options wpos_options = { { 0 } };
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index ffe0ca0ad70..7fef93949e8 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1135,7 +1135,6 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
for (unsigned int i = 0; i < ir->get_num_state_slots(); i++) {
int index = _mesa_add_state_reference(this->prog->Parameters,
- (gl_state_index *)
slots[i].tokens);
if (storage->file == PROGRAM_STATE_VAR) {
@@ -1497,7 +1496,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
* is a FBO or the window system buffer, respectively.
* It is then multiplied with the source operand of DDY.
*/
- static const gl_state_index transform_y_state[STATE_LENGTH]
+ static const gl_state_index16 transform_y_state[STATE_LENGTH]
= { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM };
unsigned transform_y_index =
@@ -2115,7 +2114,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
break;
case ir_binop_interpolate_at_offset: {
/* The y coordinate needs to be flipped for the default fb */
- static const gl_state_index transform_y_state[STATE_LENGTH]
+ static const gl_state_index16 transform_y_state[STATE_LENGTH]
= { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM };
unsigned transform_y_index =
@@ -6866,7 +6865,7 @@ get_mesa_program_tgsi(struct gl_context *ctx,
if (shader->Stage == MESA_SHADER_FRAGMENT &&
(prog->info.inputs_read & VARYING_BIT_POS ||
prog->info.system_values_read & (1 << SYSTEM_VALUE_FRAG_COORD))) {
- static const gl_state_index wposTransformState[STATE_LENGTH] = {
+ static const gl_state_index16 wposTransformState[STATE_LENGTH] = {
STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM
};
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 75825c3cf62..c76180a5799 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -622,7 +622,7 @@ emit_wpos_adjustment(struct gl_context *ctx,
* Need to replace instances of INPUT[WPOS] with temp T
* where T = INPUT[WPOS] by y is inverted.
*/
- static const gl_state_index wposTransformState[STATE_LENGTH]
+ static const gl_state_index16 wposTransformState[STATE_LENGTH]
= { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM, 0, 0, 0 };
/* XXX: note we are modifying the incoming shader here! Need to
diff --git a/src/mesa/state_tracker/st_nir_lower_builtin.c b/src/mesa/state_tracker/st_nir_lower_builtin.c
index 19a8ac03139..fca0bef6653 100644
--- a/src/mesa/state_tracker/st_nir_lower_builtin.c
+++ b/src/mesa/state_tracker/st_nir_lower_builtin.c
@@ -100,7 +100,7 @@ get_variable(lower_builtin_state *state, nir_deref_var *deref,
const struct gl_builtin_uniform_element *element)
{
nir_shader *shader = state->shader;
- int tokens[STATE_LENGTH];
+ gl_state_index16 tokens[STATE_LENGTH];
memcpy(tokens, element->tokens, sizeof(tokens));
@@ -126,7 +126,7 @@ get_variable(lower_builtin_state *state, nir_deref_var *deref,
}
}
- char *name = _mesa_program_state_string((gl_state_index *)tokens);
+ char *name = _mesa_program_state_string(tokens);
nir_foreach_variable(var, &shader->uniforms) {
if (strcmp(var->name, name) == 0) {
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index d9b7155a912..03f5ce4753b 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1013,11 +1013,11 @@ st_create_fp_variant(struct st_context *st,
struct st_fp_variant *variant = CALLOC_STRUCT(st_fp_variant);
struct pipe_shader_state tgsi = {0};
struct gl_program_parameter_list *params = stfp->Base.Parameters;
- static const gl_state_index texcoord_state[STATE_LENGTH] =
+ static const gl_state_index16 texcoord_state[STATE_LENGTH] =
{ STATE_INTERNAL, STATE_CURRENT_ATTRIB, VERT_ATTRIB_TEX0 };
- static const gl_state_index scale_state[STATE_LENGTH] =
+ static const gl_state_index16 scale_state[STATE_LENGTH] =
{ STATE_INTERNAL, STATE_PT_SCALE };
- static const gl_state_index bias_state[STATE_LENGTH] =
+ static const gl_state_index16 bias_state[STATE_LENGTH] =
{ STATE_INTERNAL, STATE_PT_BIAS };
if (!variant)