mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 17:58:26 +02:00
mesa: add _mesa_lookup_state_param_idx() helper
This will be used in the following patch.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
(cherry picked from commit c3aae0714c)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40092>
This commit is contained in:
parent
0710d042db
commit
d7fa6a4deb
3 changed files with 23 additions and 9 deletions
|
|
@ -4494,7 +4494,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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue