1
0
forked from 0ad/0ad

ogl_tex: max_tex_size -> ogl_max_tex_size

assert_dlg, udbg, debug.h: dialog with stack trace is now used in dev
mode for exceptions as well

This was SVN commit r2393.
This commit is contained in:
janwas 2005-06-16 21:52:35 +00:00
parent ae0f4fa731
commit 40bfeb37c1
5 changed files with 36 additions and 34 deletions

View File

@ -296,7 +296,7 @@ static int tex_validate(const uint line, const Tex* t)
msg = "width or height is 0 - texture probably not loaded successfully";
// greater than max supported tex dimension?
// no-op if oglInit not yet called
if(w > (GLsizei)max_tex_size || h > (GLsizei)max_tex_size)
if(w > (GLsizei)ogl_max_tex_size || h > (GLsizei)ogl_max_tex_size)
msg = "texture dimensions exceed OpenGL implementation limit";
// both NV_texture_rectangle and subtexture require work for the client
// (changing tex coords) => we'll just disallow non-power of 2 textures.

View File

@ -30,45 +30,48 @@
extern void debug_check_heap(void);
// user choices in the assert/unhandled exception dialog.
enum ErrorReaction
{
// ignore, continue as if nothing happened.
ER_CONTINUE = 1,
// note: don't start at 0 because that is interpreted as a
// DialogBoxParam failure.
// ignore and do not report again. only works with assert2.
ER_SUPPRESS,
// note: non-persistent; only applicable during this program run.
// trigger breakpoint, i.e. enter debugger.
ER_BREAK,
// exit the program immediately.
ER_EXIT,
// note: never returned; carried out immediately to disburden callers.
};
//////////////////////////////////////////////////////////////////////////////
//
// assert
//
enum FailedAssertUserChoice
{
// ignore, continue as if nothing happened.
ASSERT_CONTINUE,
// ignore and do not report again for this assert.
ASSERT_SUPPRESS,
// note: non-persistent; only applicable during this program run.
// trigger breakpoint, i.e. enter debugger.
ASSERT_BREAK,
// exit the program immediately.
ASSERT_EXIT
// note: carried out by debug_assert_failed;
// testing for it in assert2 would bloat code.
};
// notify the user that an assertion failed; displays a
// stack trace with local variables.
// returns one of FailedAssertUserChoice or exits the program.
extern int debug_assert_failed(const char* source_file, int line, const char* assert_expr);
// returns one of UserErrorReaction.
extern ErrorReaction debug_assert_failed(const char* source_file, int line, const char* assert_expr);
// recommended use: assert2(expr && "descriptive string")
#define assert2(expr)\
STMT(\
static int suppress__ = 0;\
if(!suppress__ && !(expr))\
static unsigned char suppress__ = 0x55;\
if(suppress__ == 0x55 && !(expr))\
switch(debug_assert_failed(__FILE__, __LINE__, #expr))\
{\
case ASSERT_SUPPRESS:\
suppress__ = 1;\
case ER_SUPPRESS:\
suppress__ = 0xaa;\
break;\
case ASSERT_BREAK:\
case ER_BREAK:\
debug_break();\
break;\
}\

View File

@ -105,8 +105,7 @@ static void launch_debugger()
// notify the user that an assertion failed.
// returns one of FailedAssertUserChoice or exits the program.
int debug_assert_failed(const char *file, int line, const char *expr)
ErrorReaction debug_assert_failed(const char* file, int line, const char* expr)
{
printf("%s:%d: Assertion `%s' failed.\n", file, line, expr);
do
@ -126,11 +125,11 @@ int debug_assert_failed(const char *file, int line, const char *expr)
// fall through
case 'b':
return ASSERT_BREAK;
return ER_BREAK;
case 'c':
return ASSERT_CONTINUE;
return ER_CONTINUE;
case 's':
return ASSERT_SUPPRESS;
return ER_SUPPRESS;
case 'a':
abort();
default:

View File

@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by assert_dlg.rc
// Used by error_dialog.rc
//
#define IDD_DIALOG1 101
#define IDC_EDIT1 1001

View File

@ -1,6 +1,6 @@
// Microsoft Visual C++ generated resource script.
//
#include "assert_dlg.h"
#include "error_dialog.h"
#include <windows.h>
/////////////////////////////////////////////////////////////////////////////
@ -20,7 +20,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
1 TEXTINCLUDE
BEGIN
"assert_dlg.h\0"
"error_dialog.h\0"
END
2 TEXTINCLUDE