check glDebugMessageCallback

This commit is contained in:
2019-06-27 10:54:51 +02:00
parent 81e7003b05
commit db27334ce5
3 changed files with 30 additions and 25 deletions

View File

@@ -387,32 +387,35 @@ void App::upload(std::string filename, std::string name, std::function<void(floa
void App::init() void App::init()
{ {
#ifdef _WIN32 #ifdef _WIN32
static CONSOLE_SCREEN_BUFFER_INFO info; if (glDebugMessageCallback)
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
// colors: http://stackoverflow.com/questions/4053837/colorizing-text-in-the-console-with-c
glDebugMessageCallback([](GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
{ {
static std::map<GLenum, int> colors = { static CONSOLE_SCREEN_BUFFER_INFO info;
{ GL_DEBUG_SEVERITY_NOTIFICATION, 8 }, GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
{ GL_DEBUG_SEVERITY_LOW, 8 }, // colors: http://stackoverflow.com/questions/4053837/colorizing-text-in-the-console-with-c
{ GL_DEBUG_SEVERITY_MEDIUM, FOREGROUND_GREEN | FOREGROUND_INTENSITY }, glDebugMessageCallback([](GLenum source, GLenum type, GLuint id,
{ GL_DEBUG_SEVERITY_HIGH, FOREGROUND_RED | FOREGROUND_INTENSITY }, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
};
if (severity == GL_DEBUG_SEVERITY_HIGH || severity == GL_DEBUG_SEVERITY_MEDIUM || severity == GL_DEBUG_SEVERITY_LOW)
{ {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), colors[severity]); static std::map<GLenum, int> colors = {
LOG("OPENGL: %.*s", length, message); { GL_DEBUG_SEVERITY_NOTIFICATION, 8 },
FlushConsoleInputBuffer(GetStdHandle(STD_OUTPUT_HANDLE)); { GL_DEBUG_SEVERITY_LOW, 8 },
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), info.wAttributes); { GL_DEBUG_SEVERITY_MEDIUM, FOREGROUND_GREEN | FOREGROUND_INTENSITY },
#ifdef _WIN32 && _DEBUG { GL_DEBUG_SEVERITY_HIGH, FOREGROUND_RED | FOREGROUND_INTENSITY },
if (severity == GL_DEBUG_SEVERITY_HIGH) };
__debugbreak(); if (severity == GL_DEBUG_SEVERITY_HIGH || severity == GL_DEBUG_SEVERITY_MEDIUM || severity == GL_DEBUG_SEVERITY_LOW)
#endif {
} SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), colors[severity]);
}, nullptr); LOG("OPENGL: %.*s", length, message);
glEnable(GL_DEBUG_OUTPUT); FlushConsoleInputBuffer(GetStdHandle(STD_OUTPUT_HANDLE));
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), info.wAttributes);
#ifdef _WIN32 && _DEBUG
if (severity == GL_DEBUG_SEVERITY_HIGH)
__debugbreak();
#endif
}
}, nullptr);
glEnable(GL_DEBUG_OUTPUT);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
}
#endif #endif
LOG("GL version: %s", glGetString(GL_VERSION)); LOG("GL version: %s", glGetString(GL_VERSION));

View File

@@ -887,6 +887,7 @@ int main(int argc, char** argv)
} }
else else
{ {
LOG("WGL_ARB_create_context not supported");
// If not supported, go fuck yourself we are not gonna support your shitty device // If not supported, go fuck yourself we are not gonna support your shitty device
return -1; // A negative number because you are a negative one return -1; // A negative number because you are a negative one
} }

View File

@@ -2,6 +2,7 @@
mkdir content mkdir content
xcopy /I /D /Y /S "..\x64\Release\*.dll" content xcopy /I /D /Y /S "..\x64\Release\*.dll" content
xcopy /I /D /Y /S "..\x64\Release\*.pdb" content xcopy /I /D /Y /S "..\x64\Release\*.pdb" content
xcopy /I /D /Y /S "..\x64\Release\*.exe" content
robocopy ..\data\ content\data\ /MIR robocopy ..\data\ content\data\ /MIR
for /f %%i in ('git rev-parse --abbrev-ref HEAD') do set BRANCH=%%i for /f %%i in ('git rev-parse --abbrev-ref HEAD') do set BRANCH=%%i
for /f %%i in ('git log "--pretty=format:%%h" -n 1') do set HASH=%%i for /f %%i in ('git log "--pretty=format:%%h" -n 1') do set HASH=%%i
@@ -10,6 +11,6 @@ for /f %%i in ('git describe --tags "--abbrev=0"') do set TAG=%%i
set VERSION=%TAG%.%COUNT% (%HASH%-%BRANCH%) set VERSION=%TAG%.%COUNT% (%HASH%-%BRANCH%)
echo Building version %VERSION% echo Building version %VERSION%
set /p ID=<steamid.txt set /p ID=<steamid.txt
steamcmd.exe +login %ID% +drm_wrap 954880 "%~dp0..\x64\Release\PanoPainter.exe" "%~dp0content\PanoPainter.exe" drmtoolp 0 +run_app_build -desc "%VERSION%" "%~dp0scripts\app_build_954880.vdf" +quit steamcmd.exe +login %ID% +run_app_build -desc "%VERSION%" "%~dp0scripts\app_build_954880.vdf" +quit
7z.exe a "PanoPainter-Steam-%VERSION%.zip" content\* 7z.exe a "PanoPainter-Steam-%VERSION%.zip" content\*
pause pause