mesa/shader_query: Fix LOCATION_INDEX query (ARB_gl_spirv)
When querying GL_LOCATION_INDEX using glGetProgramResourceiv we already know the index of the resource, we do not need to find it using the name, which is convenient for shaders coming from SPIR-V binaries where names are optional. Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This commit is contained in:
committed by
Alejandro Piñeiro
parent
8818553f18
commit
161de77e0f
@@ -938,17 +938,9 @@ _mesa_program_resource_location(struct gl_shader_program *shProg,
|
||||
return program_resource_location(res, array_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function implements following index queries:
|
||||
* glGetFragDataIndex
|
||||
*/
|
||||
GLint
|
||||
_mesa_program_resource_location_index(struct gl_shader_program *shProg,
|
||||
GLenum programInterface, const char *name)
|
||||
static GLint
|
||||
_get_resource_location_index(struct gl_program_resource *res)
|
||||
{
|
||||
struct gl_program_resource *res =
|
||||
_mesa_program_resource_find_name(shProg, programInterface, name, NULL);
|
||||
|
||||
/* Non-existent variable or resource is not referenced by fragment stage. */
|
||||
if (!res || !(res->StageReferences & (1 << MESA_SHADER_FRAGMENT)))
|
||||
return -1;
|
||||
@@ -963,6 +955,20 @@ _mesa_program_resource_location_index(struct gl_shader_program *shProg,
|
||||
return RESOURCE_VAR(res)->index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function implements following index queries:
|
||||
* glGetFragDataIndex
|
||||
*/
|
||||
GLint
|
||||
_mesa_program_resource_location_index(struct gl_shader_program *shProg,
|
||||
GLenum programInterface, const char *name)
|
||||
{
|
||||
struct gl_program_resource *res =
|
||||
_mesa_program_resource_find_name(shProg, programInterface, name, NULL);
|
||||
|
||||
return _get_resource_location_index(res);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
stage_from_enum(GLenum ref)
|
||||
{
|
||||
@@ -1320,8 +1326,7 @@ _mesa_program_resource_prop(struct gl_shader_program *shProg,
|
||||
if (tmp == -1)
|
||||
*val = -1;
|
||||
else
|
||||
*val = _mesa_program_resource_location_index(shProg, res->Type,
|
||||
RESOURCE_VAR(res)->name);
|
||||
*val = _get_resource_location_index(res);
|
||||
return 1;
|
||||
}
|
||||
case GL_NUM_COMPATIBLE_SUBROUTINES:
|
||||
|
||||
Reference in New Issue
Block a user