Skip to content

Commit

Permalink
Allow shader compile log length of 1 without erroring
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugh Sanderson committed Aug 21, 2024
1 parent 5a99626 commit 9e252c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
22 changes: 15 additions & 7 deletions project/src/opengl/OGLShaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,28 +111,36 @@ void OGLProg::recreate()
// Check the status of the compile/link
int logLen = 0;
glGetProgramiv(mProgramId, GL_INFO_LOG_LENGTH, &logLen);
if(logLen > 0 || !linkStatus)
if(logLen > 1 || !linkStatus)
{
// Show any errors as appropriate
ELOG("----");
ELOG("---- ll=%d, !linkStatus=%d\n",logLen,!linkStatus);
ELOG("VERT: %s", mVertProg.c_str());
ELOG("FRAG: %s", mFragProg.c_str());
if (logLen>0)
{
char *log = new char[logLen];
glGetProgramInfoLog(mProgramId, logLen, &logLen, log);
ELOG("ERROR:\n%s\n", log);
ELOG("ERROR:x%d\n%s\n",logLen, log);
delete [] log;
}
else
{
ELOG("no error message.");
}

glDeleteShader(mVertId);
glDeleteShader(mFragId);
glDeleteProgram(mProgramId);
mVertId = mFragId = mProgramId = 0;
if (!linkStatus)
{
ELOG("Could not link.");
glDeleteShader(mVertId);
glDeleteShader(mFragId);
glDeleteProgram(mProgramId);
mVertId = mFragId = mProgramId = 0;
}
else
{
ELOG("non fatal.");
}
}

vertexSlot = glGetAttribLocation(mProgramId, "aVertex");
Expand Down
7 changes: 7 additions & 0 deletions src/nme/gl/GL.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,13 @@ class GL

#else // not (neko||cpp)


public static inline function getSupportedExtensions():Array<String>
{
var result = new Array<String>();
return result;
}

// Stub to get flixel to compile
public static function getParameter(pname:Int):Dynamic
{
Expand Down

0 comments on commit 9e252c0

Please sign in to comment.