Skip to content

Commit

Permalink
functions: add lookup for ARB functions
Browse files Browse the repository at this point in the history
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").
  • Loading branch information
mardy authored and WinterMute committed Nov 3, 2024
1 parent 3a9ff40 commit c3f47fe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,17 @@ static int compare_proc(const void *a_ptr, const void *b_ptr)

void *ogx_get_proc_address(const char *proc)
{
char buffer[64];
size_t len;

/* If the string ends with the "ARB" suffix, remove it */
len = strlen(proc);
if (len > 3 && strcmp(proc + len - 3, "ARB") == 0) {
strncpy(buffer, proc, len - 3);
buffer[len - 3] = '\0';
proc = buffer;
}

ProcMap search = { proc, NULL };
ProcMap *elem = bsearch(&search, s_proc_map, NUM_PROCS, sizeof(ProcMap),
compare_proc);
Expand Down

0 comments on commit c3f47fe

Please sign in to comment.