1
0
forked from 0ad/0ad

further debug_out -> debug_printf; (comment) cleanup

ogl_tex: minor formatting improvements

This was SVN commit r2286.
This commit is contained in:
janwas 2005-05-11 22:40:19 +00:00
parent fd4eb91e93
commit 758251edfd
5 changed files with 40 additions and 41 deletions

View File

@ -111,7 +111,7 @@ STMT(\
int err__ = (int)((func) & UINT_MAX);\
if(err__ < 0)\
{\
debug_out("%s:%d: FYI: CHECK_ERR reports that a function failed."\
debug_printf("%s:%d: FYI: CHECK_ERR reports that a function failed."\
"feel free to ignore or suppress this warning.\n", __FILE__, __LINE__);\
return err__;\
}\

View File

@ -326,7 +326,7 @@ static int tex_validate(const uint line, const Tex* t)
if(msg)
{
debug_out("tex_validate at line %d failed: %s (error code %d)\n", line, msg, err);
debug_printf("tex_validate at line %d failed: %s (error code %d)\n", line, msg, err);
debug_warn("tex_validate failed");
return err;
}
@ -439,8 +439,15 @@ int tex_upload(const Handle ht, int filter_ovr, int int_fmt_ovr, int fmt_ovr)
bool is_compressed = fmt_is_s3tc(fmt);
bool has_mipmaps = (t->ti.flags & TEX_MIPMAPS ? true : false);
enum { auto_uncomp, auto_comp, mipped_uncomp, mipped_comp, normal_uncomp, normal_comp, broken_comp, glubuild };
int states[4][4] = {
enum UploadState
{
auto_uncomp, auto_comp,
mipped_uncomp, mipped_comp,
normal_uncomp, normal_comp,
broken_comp,
glubuild
};
static const int states[4][4] = {
{ auto_uncomp, mipped_uncomp, normal_uncomp, normal_uncomp },
{ auto_comp, mipped_comp, normal_comp, normal_comp },
{ broken_comp, mipped_comp, normal_comp, normal_comp },
@ -452,7 +459,7 @@ int tex_upload(const Handle ht, int filter_ovr, int int_fmt_ovr, int fmt_ovr)
if(state == auto_uncomp || state == auto_comp)
{
glTexParameteri(GL_TEXTURE_2D, auto_mipmap_gen, GL_TRUE);
state = (state == auto_uncomp ? normal_uncomp : normal_comp);
state = (state == auto_uncomp)? normal_uncomp : normal_comp;
}
if(state == broken_comp)
@ -463,17 +470,14 @@ int tex_upload(const Handle ht, int filter_ovr, int int_fmt_ovr, int fmt_ovr)
if(state == glubuild)
gluBuild2DMipmaps(GL_TEXTURE_2D, int_fmt, w, h, fmt, GL_UNSIGNED_BYTE, tex_data);
else
if(state == normal_uncomp)
else if(state == normal_uncomp)
glTexImage2D(GL_TEXTURE_2D, 0, int_fmt, w, h, 0, fmt, GL_UNSIGNED_BYTE, tex_data);
else
if(state == normal_comp)
else if(state == normal_comp)
{
const GLsizei tex_size = w * h * bpp / 8;
glCompressedTexImage2DARB(GL_TEXTURE_2D, 0, fmt, w, h, 0, tex_size, tex_data);
}
else
if(state == mipped_uncomp || state == mipped_comp)
else if(state == mipped_uncomp || state == mipped_comp)
{
int level = 0;
GLsizei level_w = w;

View File

@ -68,10 +68,14 @@ char win_exe_dir[MAX_PATH+1];
// (they're more convenient)
//
inline void debug_check_heap()
void display_msg(const char* caption, const char* msg)
{
_heapchk();
MessageBoxA(0, msg, caption, MB_ICONEXCLAMATION);
}
void wdisplay_msg(const wchar_t* caption, const wchar_t* msg)
{
MessageBoxW(0, msg, caption, MB_ICONEXCLAMATION);
}
@ -122,24 +126,11 @@ int pick_directory(char* path, size_t buf_size)
}
void display_msg(const char* caption, const char* msg)
{
MessageBoxA(0, msg, caption, MB_ICONEXCLAMATION);
}
void wdisplay_msg(const wchar_t* caption, const wchar_t* msg)
{
MessageBoxW(0, msg, caption, MB_ICONEXCLAMATION);
}
///////////////////////////////////////////////////////////////////////////////
//
// clipboard
//
///////////////////////////////////////////////////////////////////////////////
int clipboard_set(const wchar_t* text)
{
@ -221,7 +212,7 @@ int clipboard_free(wchar_t* copy)
///////////////////////////////////////////////////////////////////////////////
//
// init and shutdown mechanism
// module init and shutdown mechanism
//
///////////////////////////////////////////////////////////////////////////////
@ -291,14 +282,14 @@ static void call_func_tbl(_PIFV* begin, _PIFV* end)
///////////////////////////////////////////////////////////////////////////////
//
// locking for win-specific code
//
///////////////////////////////////////////////////////////////////////////////
// several init functions are before _cinit.
// can't guarantee POSIX static mutex init has been done by then.
static CRITICAL_SECTION cs[NUM_CS];
static bool cs_valid;
@ -335,7 +326,10 @@ static void cs_shutdown()
///////////////////////////////////////////////////////////////////////////////
//
// startup
//
///////////////////////////////////////////////////////////////////////////////
// entry -> pre_libc -> WinMainCRTStartup -> WinMain -> pre_main -> main
// at_exit is called as the last of the atexit handlers
@ -424,6 +418,7 @@ void memory_debug_extreme_turbo_plus()
}
#endif
int entry()
{
pre_libc_init();

View File

@ -75,7 +75,7 @@ int open(const char* fn, int oflag, ...)
WIN_RESTORE_LAST_ERROR;
#ifdef PARANOIA
debug_out("open %s = %d\n", fn, fd);
debug_printf("open %s = %d\n", fn, fd);
#endif
// cases when we don't want to open a second AIO-capable handle:
@ -110,7 +110,7 @@ no_aio:
int close(int fd)
{
#ifdef PARANOIA
debug_out("close %d\n", fd);
debug_printf("close %d\n", fd);
#endif
assert(3 <= fd && fd < 256);

View File

@ -293,7 +293,7 @@ int pthread_cancel(pthread_t thread)
{
HANDLE hThread = pthread_t_to_HANDLE(thread);
TerminateThread(hThread, 0);
debug_out("WARNING: pthread_cancel is unsafe\n");
debug_printf("WARNING: pthread_cancel is unsafe\n");
return 0;
}