gameview, renderer: LoadWaterTextures is now a coroutine because it takes friggin forever (3 seconds). VFS performance is down by a factor of ten! investigating is on todo.

dyn_array.h -> allocators.h
ogl_tex: reenable performance warning
tex: comments
h_mgr: debug_printf if long filename is passed in (so we notice)
wsdl: squelch DestroyWindow warning. will look into the cause.
sysdep: slightly simplify "restrict" determination

This was SVN commit r2916.
This commit is contained in:
janwas 2005-10-12 17:19:07 +00:00
parent deaaf5236c
commit a1cddc4ac3
11 changed files with 33 additions and 28 deletions

View File

@ -129,7 +129,7 @@ void CGameView::RegisterInit(CGameAttributes *pAttribs)
RegMemFun(g_TexMan.GetSingletonPtr(), &CTextureManager::LoadTerrainTextures, L"LoadTerrainTextures", 15);
RegMemFun(g_ObjMan.GetSingletonPtr(), &CObjectManager::LoadObjects, L"LoadObjects", 1);
RegMemFun(g_Renderer.GetSingletonPtr(), &CRenderer::LoadAlphaMaps, L"LoadAlphaMaps", 45);
RegMemFun(g_Renderer.GetSingletonPtr(), &CRenderer::LoadWaterTextures, L"LoadWaterTextures", 100);
RegMemFun(g_Renderer.GetSingletonPtr(), &CRenderer::LoadWaterTextures, L"LoadWaterTextures", 3000);
}

View File

@ -1,7 +1,7 @@
#include "precompiled.h"
#include "posix.h"
#include "dyn_array.h"
#include "allocators.h"
//-----------------------------------------------------------------------------

View File

@ -27,7 +27,7 @@
#include "sysdep/sysdep.h"
#include "byte_order.h"
#include "timer.h"
#include "dyn_array.h"
#include "lib/allocators.h"
#include <vector>
#include <algorithm>

View File

@ -741,7 +741,7 @@ int ogl_tex_upload(const Handle ht, GLenum fmt_ovr, uint q_flags_ovr, GLint int_
static const bool have_s3tc = detect_s3tc();
if((t->flags & TEX_DXT) && !have_s3tc)
{
//ONCE(DISPLAY_ERROR(L"Performance warning: your graphics card does not support compressed textures. The game will try to continue anyway, but may be slower than expected. Please try updating your graphics drivers; if that doesn't help, please try upgrading your hardware."));
ONCE(DISPLAY_ERROR(L"Performance warning: your graphics card does not support compressed textures. The game will try to continue anyway, but may be slower than expected. Please try updating your graphics drivers; if that doesn't help, please try upgrading your hardware."));
(void)tex_transform_to(t, t->flags & ~TEX_DXT);
}

View File

@ -544,11 +544,10 @@ static int tex_codec_transform(Tex* t, uint transforms)
static int tex_load_impl(void* file_, size_t file_size, Tex* t)
{
u8* file = (u8*)file_;
const TexCodecVTbl* c;
RETURN_ERR(tex_codec_for_header(file, file_size, &c));
// get header make sure enough of the file has been read
// make sure the entire header has been read
const size_t min_hdr_size = c->hdr_size(0);
if(file_size < min_hdr_size)
return ERR_TEX_HEADER_NOT_COMPLETE;

View File

@ -2,7 +2,7 @@
#define TEX_CODEC_H__
#include "tex.h"
#include "dyn_array.h"
#include "lib/allocators.h"
// rationale: no C++ to allow us to store const char* name in vtbl.

View File

@ -20,7 +20,7 @@
#include "lib.h"
#include "h_mgr.h"
#include "dyn_array.h"
#include "lib/allocators.h"
#include <limits.h> // CHAR_BIT
#include <string.h>
@ -403,20 +403,19 @@ static void fn_store(HDATA* hd, const char* fn)
ONCE(fn_init());
const size_t len = strlen(fn);
debug_printf("FN_STORE %d %s\n", len, fn);
hd->fn = 0;
// this is disabled until it's determined that strings are actually likely
// to fit there (unlikely)
// stuff it in unused space at the end of HDATA
if(hd->type->user_size + len < HDATA_USER_SIZE)
hd->fn = (const char*)hd->user + hd->type->user_size;
else if(len+1 <= FN_POOL_EL_SIZE)
hd->fn = (const char*)pool_alloc(&fn_pool);
// in case none of the above applied and were successful:
// in case none of the above applied and/or were successful:
// fall back to heap alloc.
if(!hd->fn)
{
debug_printf("fn_store: very long filename (%d) %s\n", len, fn);
hd->fn = (const char*)malloc(len+1);
// still failed - bail (avoid strcpy to 0)
if(!hd->fn)

View File

@ -47,19 +47,17 @@ extern void* alloca(size_t size);
#endif
// restrict
// .. for some reason, g++-3.3 claims to support C99 (according to
// __STDC_VERSION__) but doesn't have the restrict keyword.
// use the extension __restrict__ instead.
#if GCC_VERSION
// for some reason, g++-3.3 claims to support C99 (according to __STDC_VERSION__)
// but doesn't have the restrict keyword.
// use the extension __restrict__ instead.
#define restrict __restrict__
# define restrict __restrict__
// .. already available; need do nothing
#elif HAVE_C99
// .. unsupported; remove it from code
#else
#if HAVE_C99
// .. already available
#else
// .. unsupported
# define restrict
#endif
#endif

View File

@ -194,7 +194,7 @@ static LRESULT CALLBACK wndproc(HWND hWnd, unsigned int uMsg, WPARAM wParam, LPA
{
case WM_DESTROY:
got_quit_msg = true;
return 0;
break;
case WM_PAINT:
PAINTSTRUCT ps;
@ -671,7 +671,9 @@ static int wsdl_shutdown()
if(hWnd != INVALID_HANDLE_VALUE)
{
WARN_IF_FALSE(DestroyWindow(hWnd));
// this also seems to fail spuriously with GetLastError == 0,
// so don't complain.
(void)DestroyWindow(hWnd);
hWnd = (HWND)INVALID_HANDLE_VALUE;
}

View File

@ -44,7 +44,7 @@
#include "lib/res/graphics/tex.h"
#include "lib/res/graphics/ogl_tex.h"
#include "lib/res/file/vfs.h"
#include "timer.h"
#include "ps/Loader.h"
#include "renderer/RenderPathVertexShader.h"
@ -1461,14 +1461,19 @@ void CRenderer::UnloadAlphaMaps()
int CRenderer::LoadWaterTextures()
{
int i;
uint i;
const uint num_textures = ARRAY_SIZE(m_WaterTexture);
// yield after this time is reached. balances increased progress bar
// smoothness vs. slowing down loading.
const double end_time = get_time() + 50e-3;
// initialize to 0 in case something fails below
// (we then abort the loop, but don't want undefined values in here)
for (i = 0; i < ARRAY_SIZE(m_WaterTexture); i++)
for (i = 0; i < num_textures; i++)
m_WaterTexture[i] = 0;
for (i = 0; i < ARRAY_SIZE(m_WaterTexture); i++)
for (i = 0; i < num_textures; i++)
{
char waterName[VFS_MAX_PATH];
// TODO: add a member variable and setter for this. (can't make this
@ -1483,6 +1488,8 @@ int CRenderer::LoadWaterTextures()
}
m_WaterTexture[i]=ht;
RETURN_ERR(ogl_tex_upload(ht));
LDR_CHECK_TIMEOUT(i, num_textures);
}
return 0;

View File

@ -10,7 +10,7 @@
#include "Unit.h"
#include "Bound.h"
#include "Model.h"
#include "dyn_array.h"
#include "lib/allocators.h"
using namespace std;