|
1 | 1 | /* |
2 | | - * Copyright 2019-2022 Diligent Graphics LLC |
| 2 | + * Copyright 2019-2024 Diligent Graphics LLC |
3 | 3 | * Copyright 2015-2019 Egor Yusov |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -38,38 +38,47 @@ namespace Diligent |
38 | 38 |
|
39 | 39 | void WindowsStoreDebug::AssertionFailed(const Char* Message, const char* Function, const char* File, int Line) |
40 | 40 | { |
41 | | - auto AssertionFailedMessage = FormatAssertionFailedMessage(Message, Function, File, Line); |
42 | | - OutputDebugMessage(DEBUG_MESSAGE_SEVERITY_ERROR, AssertionFailedMessage.c_str(), nullptr, nullptr, 0); |
| 41 | + String AssertionFailedMessage = FormatAssertionFailedMessage(Message, Function, File, Line); |
| 42 | + if (DebugMessageCallback) |
| 43 | + { |
| 44 | + DebugMessageCallback(DEBUG_MESSAGE_SEVERITY_ERROR, AssertionFailedMessage.c_str(), nullptr, nullptr, 0); |
| 45 | + } |
| 46 | + else |
| 47 | + { |
| 48 | + OutputDebugMessage(DEBUG_MESSAGE_SEVERITY_ERROR, AssertionFailedMessage.c_str(), nullptr, nullptr, 0); |
| 49 | + if (GetBreakOnError()) |
| 50 | + { |
| 51 | + __debugbreak(); |
| 52 | + //int nCode = MessageBoxA(NULL, |
| 53 | + // FullMsg.c_str(), |
| 54 | + // "Runtime assertion failed", |
| 55 | + // MB_TASKMODAL|MB_ICONHAND|MB_ABORTRETRYIGNORE|MB_SETFOREGROUND); |
43 | 56 |
|
44 | | - __debugbreak(); |
45 | | - //int nCode = MessageBoxA(NULL, |
46 | | - // FullMsg.c_str(), |
47 | | - // "Runtime assertion failed", |
48 | | - // MB_TASKMODAL|MB_ICONHAND|MB_ABORTRETRYIGNORE|MB_SETFOREGROUND); |
| 57 | + //// Abort: abort the program |
| 58 | + //if (nCode == IDABORT) |
| 59 | + //{ |
| 60 | + // // raise abort signal |
| 61 | + // raise(SIGABRT); |
49 | 62 |
|
50 | | - //// Abort: abort the program |
51 | | - //if (nCode == IDABORT) |
52 | | - //{ |
53 | | - // // raise abort signal |
54 | | - // raise(SIGABRT); |
| 63 | + // // We usually won't get here, but it's possible that |
| 64 | + // // SIGABRT was ignored. So exit the program anyway. |
| 65 | + // exit(3); |
| 66 | + //} |
55 | 67 |
|
56 | | - // // We usually won't get here, but it's possible that |
57 | | - // // SIGABRT was ignored. So exit the program anyway. |
58 | | - // exit(3); |
59 | | - //} |
| 68 | + //// Retry: call the debugger |
| 69 | + //if (nCode == IDRETRY) |
| 70 | + //{ |
| 71 | + // DebugBreak(); |
| 72 | + // /* return to user code */ |
| 73 | + // return; |
| 74 | + //} |
60 | 75 |
|
61 | | - //// Retry: call the debugger |
62 | | - //if (nCode == IDRETRY) |
63 | | - //{ |
64 | | - // DebugBreak(); |
65 | | - // /* return to user code */ |
66 | | - // return; |
67 | | - //} |
68 | | - |
69 | | - //// Ignore: continue execution |
70 | | - //if (nCode == IDIGNORE) |
71 | | - // return; |
72 | | -}; |
| 76 | + //// Ignore: continue execution |
| 77 | + //if (nCode == IDIGNORE) |
| 78 | + // return; |
| 79 | + } |
| 80 | + } |
| 81 | +} |
73 | 82 |
|
74 | 83 | void WindowsStoreDebug::OutputDebugMessage(DEBUG_MESSAGE_SEVERITY Severity, |
75 | 84 | const Char* Message, |
|
0 commit comments