Skip to content

Commit

Permalink
MOGL: Fix wrong definition of glPathGlyphIndexRangeNV().
Browse files Browse the repository at this point in the history
This causes compiler errors recently, so fix it. This due to spec weirdness:

Spec says GLuint baseAndCount[2] in some places, GLuint* baseAndCount in others,
and our parser chose the first definition as GLuint baseAndCount, because it does not
know how to handle this one and only instance ever, where an array is defined.

Fix this up by manual implementation and fixup interface on Matlab side as well.
  • Loading branch information
kleinerm committed Mar 21, 2024
1 parent 9d5a717 commit cca01ed
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
1 change: 1 addition & 0 deletions Psychtoolbox/PsychOpenGL/MOGL/source/autono.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ glTransformFeedbackVaryingsNV - Arrays of strings - manually implemented.
- these use pointers to structs and other impossible to handle stuff
glCreateSyncFromCLeventARB
glGetUniformIndices
glPathGlyphIndexRangeNV

- these are part of the ARB_imaging extension, which we will never ever support:
glGetColorTable
Expand Down
16 changes: 1 addition & 15 deletions Psychtoolbox/PsychOpenGL/MOGL/source/gl_auto.c
Original file line number Diff line number Diff line change
Expand Up @@ -21629,19 +21629,6 @@ void gl_stencilthencoverstrokepathinstancednv( int nlhs, mxArray *plhs[], int nr

}

void gl_pathglyphindexrangenv( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {

if (NULL == glPathGlyphIndexRangeNV) mogl_glunsupported("glPathGlyphIndexRangeNV");
plhs[0]=mxCreateDoubleMatrix(1,1,mxREAL);
*mxGetPr(plhs[0])=(double)glPathGlyphIndexRangeNV((GLenum)mxGetScalar(prhs[0]),
(const void*)mxGetData(prhs[1]),
(GLbitfield)mxGetScalar(prhs[2]),
(GLuint)mxGetScalar(prhs[3]),
(GLfloat)mxGetScalar(prhs[4]),
(GLuint)mxGetScalar(prhs[5]));

}

void gl_pathglyphindexarraynv( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {

if (NULL == glPathGlyphIndexArrayNV) mogl_glunsupported("glPathGlyphIndexArrayNV");
Expand Down Expand Up @@ -24648,7 +24635,7 @@ void gl_replacementcodeuitexcoord2fcolor4fnormal3fvertex3fvsun( int nlhs, mxArra

}

int gl_auto_map_count=2618;
int gl_auto_map_count=2617;
cmdhandler gl_auto_map[] = {
{ "glAccum", gl_accum },
{ "glAcquireKeyedMutexWin32EXT", gl_acquirekeyedmutexwin32ext },
Expand Down Expand Up @@ -26074,7 +26061,6 @@ cmdhandler gl_auto_map[] = {
{ "glPathDashArrayNV", gl_pathdasharraynv },
{ "glPathFogGenNV", gl_pathfoggennv },
{ "glPathGlyphIndexArrayNV", gl_pathglyphindexarraynv },
{ "glPathGlyphIndexRangeNV", gl_pathglyphindexrangenv },
{ "glPathGlyphRangeNV", gl_pathglyphrangenv },
{ "glPathGlyphsNV", gl_pathglyphsnv },
{ "glPathMemoryGlyphIndexArrayNV", gl_pathmemoryglyphindexarraynv },
Expand Down
15 changes: 14 additions & 1 deletion Psychtoolbox/PsychOpenGL/MOGL/source/gl_manual.c
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,18 @@ void glu_tesscallback( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[

}

void gl_pathglyphindexrangenv( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {

if (NULL == glPathGlyphIndexRangeNV) mogl_glunsupported("glPathGlyphIndexRangeNV");
plhs[0]=mxCreateDoubleMatrix(1,1,mxREAL);
*mxGetPr(plhs[0])=(double)glPathGlyphIndexRangeNV((GLenum)mxGetScalar(prhs[0]),
(const void*)mxGetData(prhs[1]),
(GLbitfield)mxGetScalar(prhs[2]),
(GLuint)mxGetScalar(prhs[3]),
(GLfloat)mxGetScalar(prhs[4]),
(GLuint*)mxGetData(prhs[5]));
}

// GLES emulation wrapper wrappers:
void gles_color4f( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {

Expand Down Expand Up @@ -983,7 +995,7 @@ void gles_end( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) {
// *** it's important that this list be kept in alphabetical order,
// and that gl_manual_map_count be updated
// for each new entry ***
int gl_manual_map_count=46;
int gl_manual_map_count=47;
cmdhandler gl_manual_map[] = {
{ "ftglBegin", gles_begin },
{ "ftglColor4f", gles_color4f },
Expand All @@ -1002,6 +1014,7 @@ cmdhandler gl_manual_map[] = {
{ "glGetString", gl_getstring },
{ "glGetVertexAttribPointerv", gl_getvertexattribpointerv },
{ "glNormalPointer", gl_normalpointer },
{ "glPathGlyphIndexRangeNV", gl_pathglyphindexrangenv },
{ "glReadPixels", gl_readpixels },
{ "glSamplePass", gl_samplepass },
{ "glSelectBuffer", gl_selectbuffer },
Expand Down
12 changes: 8 additions & 4 deletions Psychtoolbox/PsychOpenGL/MOGL/wrap/glPathGlyphIndexRangeNV.m
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
function r = glPathGlyphIndexRangeNV( fontTarget, fontName, fontStyle, pathParameterTemplate, emScale, baseAndCount )
function [r, baseAndCount] = glPathGlyphIndexRangeNV( fontTarget, fontName, fontStyle, pathParameterTemplate, emScale, baseAndCount )

% glPathGlyphIndexRangeNV Interface to OpenGL function glPathGlyphIndexRangeNV
%
% usage: r = glPathGlyphIndexRangeNV( fontTarget, fontName, fontStyle, pathParameterTemplate, emScale, baseAndCount )
% usage: [r, baseAndCount] = glPathGlyphIndexRangeNV( fontTarget, fontName, fontStyle, pathParameterTemplate, emScale )
%
% C function: GLenum glPathGlyphIndexRangeNV(GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount)
% C function: GLenum glPathGlyphIndexRangeNV(GLenum fontTarget, const void* fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2])

% 08-Aug-2020 -- created (generated automatically from header files)

if nargin~=6,
% ---allocate---
% ---protected---

if nargin~=5
error('invalid number of arguments');
end

baseAndCount = zeros(2, 1, 'uint32');
r = moglcore( 'glPathGlyphIndexRangeNV', fontTarget, fontName, fontStyle, pathParameterTemplate, emScale, baseAndCount );

return

0 comments on commit cca01ed

Please sign in to comment.