mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
mesa/shader_query: Fix NAME_LENGTH queries (ARB_gl_spirv)
For shaders constructed from SPIR-V binaries, it is possible that no name reflection information is available. In that case, - glGetProgramInterfaceiv(.., pname=MAX_NAME_LENGTH, ..) - gletProgramResourceiv(.., props=NAME_LENGTH, ..) should return 1. Signed-off-by: Antia Puentes <apuentes@igalia.com> Signed-off-by: Andres Gomez <agomez@igalia.com> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This commit is contained in:
parent
3ebd60b491
commit
96d6156678
1 changed files with 14 additions and 2 deletions
|
|
@ -778,7 +778,15 @@ add_index_to_name(struct gl_program_resource *res)
|
|||
extern unsigned
|
||||
_mesa_program_resource_name_len(struct gl_program_resource *res)
|
||||
{
|
||||
unsigned length = strlen(_mesa_program_resource_name(res));
|
||||
const char* name = _mesa_program_resource_name(res);
|
||||
|
||||
/* For shaders constructed from SPIR-V binaries, variables may not
|
||||
* have names associated with them.
|
||||
*/
|
||||
if (!name)
|
||||
return 0;
|
||||
|
||||
unsigned length = strlen(name);
|
||||
if (_mesa_program_resource_array_size(res) && add_index_to_name(res))
|
||||
length += 3;
|
||||
return length;
|
||||
|
|
@ -819,7 +827,11 @@ _mesa_get_program_resource_name(struct gl_shader_program *shProg,
|
|||
|
||||
_mesa_copy_string(name, bufSize, length, _mesa_program_resource_name(res));
|
||||
|
||||
if (_mesa_program_resource_array_size(res) && add_index_to_name(res)) {
|
||||
/* The resource name can be NULL for shaders constructed from SPIR-V
|
||||
* binaries. In that case, we do not add the '[0]'.
|
||||
*/
|
||||
if (name && name[0] != '\0' &&
|
||||
_mesa_program_resource_array_size(res) && add_index_to_name(res)) {
|
||||
int i;
|
||||
|
||||
/* The comparison is strange because *length does *NOT* include the
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue