mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 21:30:09 +01:00
mesa: refactor GetFragDataIndex
Use _mesa_program_resource_location_index to fetch index. Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
This commit is contained in:
parent
62057c77f1
commit
4e7f134f89
1 changed files with 2 additions and 23 deletions
|
|
@ -428,29 +428,8 @@ _mesa_GetFragDataIndex(GLuint program, const GLchar *name)
|
|||
if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL)
|
||||
return -1;
|
||||
|
||||
exec_list *ir = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->ir;
|
||||
foreach_in_list(ir_instruction, node, ir) {
|
||||
const ir_variable *const var = node->as_variable();
|
||||
|
||||
/* The extra check against FRAG_RESULT_DATA0 is because
|
||||
* glGetFragDataLocation cannot be used on "conventional" attributes.
|
||||
*
|
||||
* From page 95 of the OpenGL 3.0 spec:
|
||||
*
|
||||
* "If name is not an active attribute, if name is a conventional
|
||||
* attribute, or if an error occurs, -1 will be returned."
|
||||
*/
|
||||
if (var == NULL
|
||||
|| var->data.mode != ir_var_shader_out
|
||||
|| var->data.location == -1
|
||||
|| var->data.location < FRAG_RESULT_DATA0)
|
||||
continue;
|
||||
|
||||
if (get_matching_index(var, (const char *) name) >= 0)
|
||||
return var->data.index;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return _mesa_program_resource_location_index(shProg, GL_PROGRAM_OUTPUT,
|
||||
name);
|
||||
}
|
||||
|
||||
GLint GLAPIENTRY
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue