Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void InitDebugContext()
- {
- // Set the debug output callback if the driver supports it.
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 1"));
- VERIFY_GL(__FUNCTION__);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 2"));
- bool bDebugOutputInitialized = false;
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 3"));
- #if !ENABLE_VERIFY_GL
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 4"));
- #if defined(GL_ARB_debug_output)
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 5"));
- if (glDebugMessageCallbackARB)
- {
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 6"));
- // Synchronous output can slow things down, but we'll get better callstack if breaking in or crashing in the callback. This is debug only after all.
- glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 7"));
- glDebugMessageCallbackARB(GLDEBUGPROCARB(OpenGLDebugMessageCallbackARB), /*UserParam=*/ NULL);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 8"));
- bDebugOutputInitialized = (glGetError() == GL_NO_ERROR);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 9"));
- }
- #elif defined(GL_KHR_debug)
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 10"));
- // OpenGLES names the debug functions differently, but they behave the same
- if (glDebugMessageCallbackKHR)
- {
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 11"));
- glDebugMessageCallbackKHR(GLDEBUGPROCKHR(OpenGLDebugMessageCallbackARB), /*UserParam=*/ NULL);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 12"));
- bDebugOutputInitialized = (glGetError() == GL_NO_ERROR);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 13"));
- }
- #endif // GL_ARB_debug_output / GL_KHR_debug
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 14"));
- #if defined(GL_AMD_debug_output)
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 15"));
- if (glDebugMessageCallbackAMD && !bDebugOutputInitialized)
- {
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 16"));
- glDebugMessageCallbackAMD(OpenGLDebugMessageCallbackAMD, /*UserParam=*/ NULL);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 17"));
- bDebugOutputInitialized = (glGetError() == GL_NO_ERROR);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 18"));
- }
- #endif // GL_AMD_debug_output
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 19"));
- #endif // !ENABLE_VERIFY_GL
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 20"));
- if (!bDebugOutputInitialized && !PLATFORM_MAC)
- {
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 21"));
- UE_LOG(LogRHI,Warning,TEXT("OpenGL debug output extension not supported!"));
- }
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 22"));
- // this is to suppress feeding back of the debug markers and groups to the log, since those originate in the app anyways...
- #if ENABLE_OPENGL_DEBUG_GROUPS && GL_ARB_debug_output && GL_KHR_debug && !OPENGL_ES31
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 23"));
- if(glDebugMessageControlARB && bDebugOutputInitialized)
- {
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 24"));
- glDebugMessageControlARB(GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_MARKER, GL_DONT_CARE, 0, NULL, GL_FALSE);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 25"));
- glDebugMessageControlARB(GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_PUSH_GROUP, GL_DONT_CARE, 0, NULL, GL_FALSE);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 26"));
- glDebugMessageControlARB(GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_POP_GROUP, GL_DONT_CARE, 0, NULL, GL_FALSE);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 27"));
- #ifdef GL_KHR_debug
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 28"));
- glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB, GL_DEBUG_TYPE_OTHER_ARB, GL_DEBUG_SEVERITY_NOTIFICATION, 0, NULL, GL_FALSE);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 29"));
- #endif
- UE_LOG(LogRHI,Verbose,TEXT("disabling reporting back of debug groups and markers to the OpenGL debug output callback"));
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 30"));
- }
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 31"));
- #elif ENABLE_OPENGL_DEBUG_GROUPS && !defined(GL_ARB_debug_output) && GL_KHR_debug
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 32"));
- if(glDebugMessageControlKHR)
- {
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 33"));
- glDebugMessageControlKHR(GL_DEBUG_SOURCE_APPLICATION_KHR, GL_DEBUG_TYPE_MARKER, GL_DONT_CARE, 0, NULL, GL_FALSE);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 34"));
- glDebugMessageControlKHR(GL_DEBUG_SOURCE_APPLICATION_KHR, GL_DEBUG_TYPE_PUSH_GROUP, GL_DONT_CARE, 0, NULL, GL_FALSE);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 35"));
- glDebugMessageControlKHR(GL_DEBUG_SOURCE_APPLICATION_KHR, GL_DEBUG_TYPE_POP_GROUP, GL_DONT_CARE, 0, NULL, GL_FALSE);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 36"));
- glDebugMessageControlKHR(GL_DEBUG_SOURCE_API_KHR, GL_DEBUG_TYPE_OTHER_KHR, GL_DEBUG_SEVERITY_NOTIFICATION, 0, NULL, GL_FALSE);
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 37"));
- UE_LOG(LogRHI,Verbose,TEXT("disabling reporting back of debug groups and markers to the OpenGL debug output callback"));
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 38"));
- }
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 39"));
- #endif
- FPlatformMisc::LowLevelOutputDebugString(TEXT("Debug 40"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement