#define PATH_MAX _MAX_PATH
#endif
-static void _mesa_shader_write_subroutine_index(struct gl_context *ctx, struct gl_linked_shader *sh);
/**
* Return mask of GLSL_x flags by examining the MESA_GLSL env var.
*/
GLenum resource_type;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return -1;
}
GLenum resource_type;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return -1;
}
GLenum resource_type;
int count, i, j;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
GLenum resource_type;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
GLenum resource_type;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
length, name, api_name);
}
-
GLvoid GLAPIENTRY
_mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
const GLuint *indices)
gl_shader_stage stage;
int i;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
} while(i < count);
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
-
- _mesa_shader_write_subroutine_index(ctx, sh);
}
struct gl_linked_shader *sh;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
struct gl_linked_shader *sh;
gl_shader_stage stage;
- if (!_mesa_has_shader_subroutine(ctx)) {
+ if (!_mesa_has_ARB_shader_subroutine(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
return;
}
stage = _mesa_shader_enum_to_shader_stage(shadertype);
sh = shProg->_LinkedShaders[stage];
+
+ /* ARB_shader_subroutine doesn't ask the program to be linked, or list any
+ * INVALID_OPERATION in the case of not be linked.
+ *
+ * And for some pnames, like GL_ACTIVE_SUBROUTINE_UNIFORMS, you can ask the
+ * same info using other specs (ARB_program_interface_query), without the
+ * need of the program to be linked, being the value for that case 0.
+ *
+ * But at the same time, some other methods require the program to be
+ * linked for pname related to locations, so it would be inconsistent to
+ * not do the same here. So we are:
+ * * Return GL_INVALID_OPERATION if not linked only for locations.
+ * * Setting a default value of 0, to be returned if not linked.
+ */
if (!sh) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
+ values[0] = 0;
+ if (pname == GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", api_name);
+ }
return;
}
binding->IndexPtr[i] = find_compat_subroutine(sh, uni->type);
}
-
- _mesa_shader_write_subroutine_index(ctx, sh);
}
void