OpenCL kernel debugging doesn’t, but most everything else does (OGL call history, state debugging, memory inspection, etc). CodeXL issues a warning to this effect when you start debugging.
It’s part of a larger codebase, but I’ve unwrapped the code into a fairly straightforward example that exhibits the same issue. I didn’t bother removing/keeping all the error handling that the actual code does either, but no API calls seem to be failing. Also, ignore the exception safety issues…they’re properly handled outside of the example. I don’t actually try to render or anything in the example since my vertex shader shouldn’t even compile (but I get no compilation errors and a valid ID is returned), so glCreateShaderProgramv() not behaving properly seems to be my issue.
try
{
HWND hwnd = *( window.GetSystemHandle() );
HDC hdc = GetDC( hwnd );
PIXELFORMATDESCRIPTOR pfd = {};
pfd.nSize = sizeof( PIXELFORMATDESCRIPTOR );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.dwLayerMask = PFD_MAIN_PLANE;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
pfd.cDepthBits = 24;
pfd.cAccumBits = 0;
pfd.cStencilBits = 8;
int pixelFormat = ChoosePixelFormat( hdc, &pfd );
if( !pixelFormat )
{
throw Win32Error( "ChoosePixelFormat()", allocator );
}
if( !SetPixelFormat( hdc, pixelFormat, &pfd) )
{
throw Win32Error( "SetPixelFormat()", allocator );
}
HGLRC oglContext = wglCreateContext( hdc );
if( !oglContext )
{
throw Win32Error( "wglCreateContext()", allocator );
}
wglMakeCurrent( hdc, oglContext );
glewExperimental = GL_TRUE;
if( glewInit() != GLEW_OK )
{
throw OGLRuntimeError( GL_INVALID_OPERATION );
}
int attributes[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
0
};
if( wglewIsSupported( "WGL_ARB_create_context ") )
{
wglMakeCurrent( 0, 0 );
wglDeleteContext( oglContext );
oglContext = wglCreateContextAttribsARB( hdc, 0, attributes );
if( !oglContext )
{
throw Win32Error( "wglCreateContextAttribsARB()", allocator );
}
wglMakeCurrent( hdc, oglContext );
}
else
{
// doesn't happen so not relevant for example
}
const char* vertSource = "\
#version 430 core\
deliberate_syntax_error\
in vec3 inPosition;\
in vec3 inColor;\
out vec3 passColor;\
\
out gl_PerVertex\
{\
vec4 gl_Position;\
};\
\
uniform mat4 modelViewMatrix;\
uniform mat4 projectionMatrix;\
\
void main(void)\
{\
gl_Position = projectionMatrix * modelViewMatrix * vec4( inPosition, 1.0 );\
passColor = inColor;\
}";
const char* fragSource = "\
#version 430 core\
\
in vec3 passColor;\
out vec4 outColor;\
\
void main(void)\
{\
outColor = vec4( passColor, 1.0 );\
}\
\
void main(void)\
{\
gl_Position = projectionMatrix * modelViewMatrix * vec4( inPosition, 1.0 );\
passColor = inColor;\
}";
glGetError();
GLuint vertProg = glCreateShaderProgramv( GL_VERTEX_SHADER , 1, &vertSource );
GLenum errorCode = glGetError();
if( GL_NO_ERROR != errorCode )
{
throw OGLRuntimeError( errorCode ); // not triggered, even with a junk shader
}
GLuint fragProg = glCreateShaderProgramv( GL_FRAGMENT_SHADER, 1, &fragSource );
errorCode = glGetError();
if( GL_NO_ERROR != errorCode )
{
throw OGLRuntimeError( errorCode ); // not triggered, even with a junk shader
}
GLuint pipeline;
glGenProgramPipelines( 1, &pipeline );
glUseProgramStages( pipeline, GL_VERTEX_SHADER_BIT , vertProg );
glUseProgramStages( pipeline, GL_FRAGMENT_SHADER_BIT, fragProg );
glBindProgramPipeline( pipeline );
while( true )
{
window.Update();
SwapBuffers( hdc );
}
}
catch( std::exception& e )
{
MessageBox( 0, e.what(), "Error", MB_OK );
}