Skip to content

Commit c3f47fe

Browse files
mardyWinterMute
authored andcommitted
functions: add lookup for ARB functions
Instead of adding duplicate entries for functions that were originally added as ARB extensions, just try to remove the ARB suffix, if we find it (e.g., when asked to lookup "glGenBuffersARB" we will look for "glGenBuffers").
1 parent 3a9ff40 commit c3f47fe

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/functions.c

+11
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,17 @@ static int compare_proc(const void *a_ptr, const void *b_ptr)
411411

412412
void *ogx_get_proc_address(const char *proc)
413413
{
414+
char buffer[64];
415+
size_t len;
416+
417+
/* If the string ends with the "ARB" suffix, remove it */
418+
len = strlen(proc);
419+
if (len > 3 && strcmp(proc + len - 3, "ARB") == 0) {
420+
strncpy(buffer, proc, len - 3);
421+
buffer[len - 3] = '\0';
422+
proc = buffer;
423+
}
424+
414425
ProcMap search = { proc, NULL };
415426
ProcMap *elem = bsearch(&search, s_proc_map, NUM_PROCS, sizeof(ProcMap),
416427
compare_proc);

0 commit comments

Comments
 (0)