Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow "private" gl symbol loader #111

Merged
merged 1 commit into from
Mar 22, 2019
Merged

Allow "private" gl symbol loader #111

merged 1 commit into from
Mar 22, 2019

Conversation

barbudreadmon
Copy link
Contributor

So, with the yabasanshiro libretro core, i can't use glsm on android without adding some definition to glsm.

The first idea was to apply this patch : https://pastebin.com/raw/gGuYwbnz , however it would end up disappearing if someone decided to regenerate those files

The second idea was to generate glsym_es31.h and glsym_es31.c by running glgen.py on GLES3/gl31.h, but the generated files didn't end up well (i had to tinker with them to build the core, and when it finally built, it crashed)

That's why i came up with this third solution : it allows the developper to add his own gl symbol by simply defining HAVE_GLSYM_PRIVATE and having a file named glsym_private.h in the include dirs, it works well, is flexible, and is less intrusive than the other solutions.

As a proof of concept i managed to deal with all my issues by creating the following files :

  • glsym_private.h :
#ifndef RGLGEN_PRIV_DECL_H__
#define RGLGEN_PRIV_DECL_H__
#ifdef __cplusplus
extern "C" {
#endif

typedef double GLclampd;
typedef double GLdouble;
typedef void (GL_APIENTRYP RGLSYMGLMEMORYBARRIERPROC) (GLbitfield barriers);

#define glMemoryBarrier __rglgen_glMemoryBarrier

#define GL_PATCHES                        0x000E
#define GL_FRAMEBUFFER_BARRIER_BIT        0x00000400
#define GL_TEXTURE_UPDATE_BARRIER_BIT     0x00000100
#define GL_TEXTURE_FETCH_BARRIER_BIT      0x00000008
#define GL_TESS_CONTROL_SHADER            0x8E88
#define GL_TESS_EVALUATION_SHADER         0x8E87
#define GL_GEOMETRY_SHADER                0x8DD9

extern RGLSYMGLMEMORYBARRIERPROC __rglgen_glMemoryBarrier;

#ifdef __cplusplus
}
#endif
#endif
  • glsym_private.c :
#include "glsym/glsym.h"

RGLSYMGLMEMORYBARRIERPROC __rglgen_glMemoryBarrier;

@inactive123 inactive123 merged commit 5cd0721 into libretro:master Mar 22, 2019
@barbudreadmon barbudreadmon deleted the patch-2 branch March 22, 2019 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants