diff --git a/.pick_status.json b/.pick_status.json index 69ea4b93e3d..23d87f55cb1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1184,7 +1184,7 @@ "description": "mesa: add _mesa_lookup_state_param_idx() helper", "nominated": false, "nomination_type": 0, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index acfd9211a11..94e601e5b50 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -422,15 +422,10 @@ _mesa_add_typed_unnamed_constant(struct gl_program_parameter_list *paramList, } GLint -_mesa_add_sized_state_reference(struct gl_program_parameter_list *paramList, - const gl_state_index16 stateTokens[STATE_LENGTH], - const unsigned size, bool pad_and_align) +_mesa_lookup_state_param_idx(struct gl_program_parameter_list *paramList, + const gl_state_index16 stateTokens[STATE_LENGTH]) { - char *name; - GLint index; - - /* Check if the state reference is already in the list */ - for (index = 0; index < (GLint) paramList->NumParameters; index++) { + for (GLint index = 0; index < (GLint) paramList->NumParameters; index++) { if (!memcmp(paramList->Parameters[index].StateIndexes, stateTokens, sizeof(paramList->Parameters[index].StateIndexes))) { @@ -438,6 +433,21 @@ _mesa_add_sized_state_reference(struct gl_program_parameter_list *paramList, } } + return -1; +} + +GLint +_mesa_add_sized_state_reference(struct gl_program_parameter_list *paramList, + const gl_state_index16 stateTokens[STATE_LENGTH], + const unsigned size, bool pad_and_align) +{ + char *name; + + /* Check if the state reference is already in the list */ + GLint index = _mesa_lookup_state_param_idx(paramList, stateTokens); + if (index >= 0) + return index; + name = _mesa_program_state_string(stateTokens); index = _mesa_add_parameter(paramList, PROGRAM_STATE_VAR, name, size, GL_NONE, NULL, stateTokens, diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h index 26e2c3da72c..c4cff25e277 100644 --- a/src/mesa/program/prog_parameter.h +++ b/src/mesa/program/prog_parameter.h @@ -188,6 +188,10 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, swizzleOut); } +extern GLint +_mesa_lookup_state_param_idx(struct gl_program_parameter_list *paramList, + const gl_state_index16 stateTokens[STATE_LENGTH]); + extern GLint _mesa_add_sized_state_reference(struct gl_program_parameter_list *paramList, const gl_state_index16 stateTokens[STATE_LENGTH],