Hello,
Your latest Catalyst Drivers (14.4) are crashing out if you end a shader source file with an #endif statement with no newline after it. Details are:
1) Windows 7 64Bit SP1
2) Visual Studio 2010 SP1 + CodeXL
3) OpenGL 3.2 Core Context
4) Radeon 5870 Mobile on a Asus G73 Gaming Notebook
5) Completely crashes the program after glCompileShader() in a call to glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled)
6) Crash makes CodeXL exit: CodeXL - Debug String: Critical error detected c0000374
7) Same code works fine on an Intel HD4000 and other GPU's
😎 I am running all OpenGL functionality on a separate thread from the applications main thread after context creation with seemingly no issues
CodeXL relevant output:
CodeXL - Checking for memory leaks - Context 1 deleted
CodeXL - No memory leaks were found
CodeXL - OpenGL Render Context 1 Deleted
CodeXL - Thread Created: 8100
CodeXL - Thread Created: 8324
CodeXL - Thread Created: 8272
CodeXL - Thread Created: 10188
CodeXL - Thread Created: 8660
CodeXL - Thread Created: 7208
CodeXL - Thread Created: 8536
CodeXL - Thread Created: 2804
CodeXL - Thread Created: 6708
CodeXL - Thread Created: 9192
CodeXL - Debug String: DrawWindowsThread entered
CodeXL - DLL Loaded: C:\Program Files\WIDCOMM\Bluetooth Software\BtMmHook.dll
CodeXL - DLL Loaded: C:\Windows\System32\cryptbase.dll
CodeXL - DLL Loaded: C:\Windows\System32\clbcatq.dll
CodeXL - Debug String: Detected error: The debugged process asked for an extension function pointer (wglChoosePixelFormatARB) from one render context, but called this function pointer in another render context (context #0)
CodeXL - Debug String: Detected error: The debugged process asked for an extension function pointer (wglCreateContextAttribsARB) from one render context, but called this function pointer in another render context (context #0)
CodeXL - OpenGL Render Context 2 Created
CodeXL - OpenGL Error: glGetString - GL_INVALID_ENUM
CodeXL - Debug String: Created OpenGL context
CodeXL - Debug String: Creating shader
CodeXL - Debug String: Setting shader source
CodeXL - Debug String: Compiling shader
CodeXL - Breakpoint Hit: glCompileShader
CodeXL - Thread Created: 3564
CodeXL - Debug String: Critical error detected c0000374
CodeXL - Second Chance Exception
CodeXL - Thread Terminated: 10152
CodeXL - Thread Terminated: 8100
CodeXL - Thread Terminated: 9700
CodeXL - Thread Terminated: 8324
CodeXL - Thread Terminated: 8272
CodeXL - Thread Terminated: 8520
CodeXL - Thread Terminated: 10188
CodeXL - Thread Terminated: 8660
CodeXL - Thread Terminated: 7208
CodeXL - Thread Terminated: 6708
CodeXL - Thread Terminated: 9192
CodeXL - Thread Terminated: 8536
CodeXL - Thread Terminated: 2804
CodeXL - Process Exit
CodeXL - Checking for memory leaks - Context 1 deleted
CodeXL - No memory leaks were found
CodeXL - OpenGL Render Context 1 Deleted
CodeXL - Thread Created: 8100
CodeXL - Thread Created: 8324
CodeXL - Thread Created: 8272
CodeXL - Thread Created: 10188
CodeXL - Thread Created: 8660
CodeXL - Thread Created: 7208
CodeXL - Thread Created: 8536
CodeXL - Thread Created: 2804
CodeXL - Thread Created: 6708
CodeXL - Thread Created: 9192
CodeXL - Debug String: DrawWindowsThread entered
The shader is:
#version 150 core
#define COMPILE_VERTEX_SHADER
#ifdef COMPILE_FRAGMENT_SHADER
out vec4 RenderTarget0;
void main()
{
RenderTarget0 = vec4(1.0, 1.0, 1.0, 1.0);
}
#else
in vec3 VertexPosition;
void main()
{
gl_Position = vec4(VertexPosition, 1.0);
}
#endif // Needs a newline here otherwise it will crash
The shader is assembled using glShaderSource() passing three source strings. No lengths are passed and they are all properly null terminated from double checking in the visual studio memory view. First source string is the shader version, second the #define for vertex or fragment shader, third the actual #ifdef shaders bit.
Attached is the shader as saved directly out of CodeXL just before the glCompileShader().