mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
mesa: Extract is_active_attrib() in shaderapi
The rules are about to get a bit more complex to account for gl_InstanceID and gl_VertexID, which are system values. Extracting this first avoids introducing duplication. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
aeb03f8aea
commit
ca5c8d6cd4
1 changed files with 19 additions and 8 deletions
|
|
@ -76,6 +76,21 @@ _mesa_BindAttribLocation(GLhandleARB program, GLuint index,
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
is_active_attrib(const ir_variable *var)
|
||||||
|
{
|
||||||
|
if (!var)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch (var->data.mode) {
|
||||||
|
case ir_var_shader_in:
|
||||||
|
return var->data.location != -1;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
|
_mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
|
||||||
GLsizei maxLength, GLsizei * length, GLint * size,
|
GLsizei maxLength, GLsizei * length, GLint * size,
|
||||||
|
|
@ -105,10 +120,8 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
|
||||||
foreach_list(node, ir) {
|
foreach_list(node, ir) {
|
||||||
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
|
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
|
||||||
|
|
||||||
if (var == NULL
|
if (!is_active_attrib(var))
|
||||||
|| var->data.mode != ir_var_shader_in
|
continue;
|
||||||
|| var->data.location == -1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (current_index == desired_index) {
|
if (current_index == desired_index) {
|
||||||
_mesa_copy_string(name, maxLength, length, var->name);
|
_mesa_copy_string(name, maxLength, length, var->name);
|
||||||
|
|
@ -196,10 +209,8 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
|
||||||
foreach_list(node, ir) {
|
foreach_list(node, ir) {
|
||||||
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
|
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
|
||||||
|
|
||||||
if (var == NULL
|
if (!is_active_attrib(var))
|
||||||
|| var->data.mode != ir_var_shader_in
|
continue;
|
||||||
|| var->data.location == -1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue