SampleUtils: print GLFW errors for debugging

This commit is contained in:
Corentin Wallez 2018-01-19 12:52:03 -05:00 committed by Corentin Wallez
parent e98678f886
commit 52cbcb4e47

View File

@ -28,6 +28,10 @@ void PrintDeviceError(const char* message, nxt::CallbackUserdata) {
std::cout << "Device error: " << message << std::endl; std::cout << "Device error: " << message << std::endl;
} }
void PrintGLFWError(int code, const char* message) {
std::cout << "GLFW error: " << code << " - " << message << std::endl;
}
enum class CmdBufType { enum class CmdBufType {
None, None,
Terrible, Terrible,
@ -64,6 +68,7 @@ nxt::Device CreateCppNXTDevice() {
return nxt::Device(); return nxt::Device();
} }
glfwSetErrorCallback(PrintGLFWError);
if (!glfwInit()) { if (!glfwInit()) {
return nxt::Device(); return nxt::Device();
} }