Open
Description
get_exts
treats an implementation having 0 extensions as an error case even though the spec makes no guarantees about the number of extensions provided by an implementation:
// generated glad.c - get_exts
...
int index;
num_exts_i = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);
if (num_exts_i > 0) {
exts_i = (char **)malloc((size_t)num_exts_i * (sizeof *exts_i));
}
if (exts_i == NULL) {
return 0;
}
for(index = 0; index < num_exts_i; index++) {
const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index);
size_t len = strlen(gl_str_tmp);
char *local_str = (char*)malloc((len+1) * sizeof(char));
if(local_str != NULL) {
memcpy(local_str, gl_str_tmp, (len+1) * sizeof(char));
}
exts_i[index] = local_str;
}
return 1;
Admittedly this is not that big of a deal because practically every "real" GL implementation has at least one extension, but I ran into it while testing a program using glad against the translation layer I'm working on (which currently advertises having no extensions).