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

GLsizeiptr and GLintptr defined incorrectly? #246

Closed
bemoody opened this issue Mar 21, 2021 · 3 comments · Fixed by #247
Closed

GLsizeiptr and GLintptr defined incorrectly? #246

bemoody opened this issue Mar 21, 2021 · 3 comments · Fixed by #247

Comments

@bemoody
Copy link

bemoody commented Mar 21, 2021

According to the GL specs, the types GLsizeiptr and GLintptr should be the size of a pointer (as the 'ptr' suffix would suggest.)

This is supported by the <GL/glext.h> supplied by the MinGW-w64 cross compiler (mingw-w64-common 6.0.0-3 on Debian):

typedef ptrdiff_t GLsizeiptr;
typedef ptrdiff_t GLintptr;
...
typedef ptrdiff_t GLsizeiptrARB;
typedef ptrdiff_t GLintptrARB;

libepoxy 1.5.3 agrees:

typedef ptrdiff_t GLintptr;
typedef ptrdiff_t GLsizeiptr;
...
typedef ptrdiff_t GLintptrARB;
typedef ptrdiff_t GLsizeiptrARB;

However, libepoxy 1.5.5 disagrees:

typedef long khronos_intptr_t;
typedef long khronos_ssize_t;
...
typedef khronos_intptr_t GLintptr;
typedef khronos_intptr_t GLintptrARB;
typedef khronos_ssize_t GLsizeiptr;
typedef khronos_ssize_t GLsizeiptrARB;

Which is correct? What does the implementation of, say, glBindBuffersRange() expect, on 64-bit Windows?

@ebassi
Copy link
Collaborator

ebassi commented Mar 21, 2021

The header is generated from gl.xml, which says:

<type requires="khrplatform">typedef khronos_intptr_t <name>GLintptr</name>;</type>
<type requires="khrplatform">typedef khronos_ssize_t <name>GLsizeiptr</name>;</type>

but, sadly, not every system provides a khrplatform.h, and we can't detect if an header exists before including it; this means we get to define a bunch of types that should be in that header.

I guess it should be possible to change those definitions depending on the platform.

ebassi added a commit that referenced this issue Mar 21, 2021
Since we're generating stub types from khrplatform.h because we can't
include it reliably, we'll have to deal with some of the fallout of the
Win64 types.

Fixes: #246
@ebassi
Copy link
Collaborator

ebassi commented Mar 21, 2021

Could you try #247 and see if it fixes the problem? I don't have a Windows 64 bit build I can test on, at the moment.

@bemoody
Copy link
Author

bemoody commented Mar 22, 2021 via email

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 a pull request may close this issue.

2 participants