- this is the state I want to build.

This commit is contained in:
Christoph Oelckers 2019-09-13 21:43:05 +02:00
parent 21217585c9
commit aecdd9b4c5
7 changed files with 183 additions and 7387 deletions

View file

@ -5,7 +5,7 @@
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;RENDERTYPESDL=1;MIXERTYPEWIN=1;SDL_USEFOLDER;SDL_TARGET=2;USE_OPENGL=1;POLYMER=1;STARTUP_WINDOW;USE_LIBVPX;HAVE_VORBIS;HAVE_XMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;RENDERTYPESDL=1;MIXERTYPEWIN=1;SDL_USEFOLDER;SDL_TARGET=2;USE_OPENGL=1;STARTUP_WINDOW;USE_LIBVPX;HAVE_VORBIS;HAVE_XMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>./include;./include/vpx/;./include/sdl2/;../../source/build/include;../../source/mact/include;../../source/audiolib/include;../../source/enet/include;../../source/glad/include;../../source/libxmp-lite/include;../../source/libxmp-lite/include/libxmp-lite</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996;4244;4018;4267</DisableSpecificWarnings>
<AdditionalOptions>/J %(AdditionalOptions)</AdditionalOptions>

View file

@ -902,7 +902,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
if (pal < (MAXPALOOKUPS - RESERVEDPALS))
m->usesalpha = hasalpha;
if ((doalloc&3)==1)
glGenTextures(1, texidx);
GetTextureHandle(texidx);
glBindTexture(GL_TEXTURE_2D, *texidx);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1763,14 +1763,26 @@ void videoShowFrame(int32_t w)
glsurface_blitBuffer();
}
static uint32_t lastSwapTime = 0;
#ifdef TIMING
cycle_t clock;
clock.Reset();
clock.Clock();
#endif
glFinish();
#ifdef TIMING
clock.Unclock();
OSD_Printf("glfinish time: %2.3f\n", clock.TimeMS());
#endif
SDL_GL_SwapWindow(sdl_window);
/*
if (vsync)
{
static uint32_t lastSwapTime = 0;
// busy loop until we're ready to update again
while (SDL_GetTicks()-lastSwapTime < currentVBlankInterval) {}
lastSwapTime = SDL_GetTicks();
}
*/
lastSwapTime = SDL_GetTicks();
return;
}
#endif

View file

@ -76,7 +76,17 @@ static pthtyp *texcache_tryart(int32_t const dapicnum, int32_t const dapalnum, i
pth = (pthtyp *)Xcalloc(1,sizeof(pthtyp));
gloadtile_art(dapicnum, searchpalnum, tintpalnum, dashade, dameth, pth, 1);
#ifdef TIMING
cycle_t clock;
clock.Reset();
clock.Clock();
#endif
gloadtile_art(dapicnum, searchpalnum, tintpalnum, dashade, dameth, pth, 1);
//thl.AddToCache(dapicnum, dapalnum, dameth);
#ifdef TIMING
clock.Unclock();
OSD_Printf("Loaded texture %d, palnum %d, meth %d -> %2.3f\n", dapicnum, dapalnum, dameth, clock.TimeMS());
#endif
pth->palnum = dapalnum;
pth->next = texcache.list[j];
@ -181,9 +191,16 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3
if (dapalnum == DETAILPAL && texcache_fetchmulti(pth, si, dapicnum, dameth))
return pth;
int32_t tilestat =
gloadtile_hi(dapicnum, dapalnum, drawingskybox, si, dameth, pth, 1, (checktintpal > 0) ? 0 : tintflags);
#ifdef TIMING
cycle_t clock;
clock.Reset();
clock.Clock();
#endif
int32_t tilestat = gloadtile_hi(dapicnum, dapalnum, drawingskybox, si, dameth, pth, 1, (checktintpal > 0) ? 0 : tintflags);
#ifdef TIMING
clock.Unclock();
OSD_Printf("Loaded texture %d, palnum %d, meth %d -> %2.3f\n", dapicnum, dapalnum, dameth, clock.TimeMS());
#endif
if (!tilestat)
{
pth->next = texcache.list[j];

View file

@ -253,10 +253,11 @@ void win_close(void)
}
// Keyboard layout switching
// Keyboard layout switching (disable because this is rude.)
static void switchlayout(char const * layout)
{
/*
char layoutname[KL_NAMELENGTH];
GetKeyboardLayoutName(layoutname);
@ -266,17 +267,19 @@ static void switchlayout(char const * layout)
initprintf("Switching keyboard layout from %s to %s\n", layoutname, layout);
LoadKeyboardLayout(layout, KLF_ACTIVATE|KLF_SETFORPROCESS|KLF_SUBSTITUTE_OK);
*/
}
static char OriginalLayoutName[KL_NAMELENGTH];
void Win_GetOriginalLayoutName(void)
{
GetKeyboardLayoutName(OriginalLayoutName);
//GetKeyboardLayoutName(OriginalLayoutName);
}
void Win_SetKeyboardLayoutUS(int const toggle)
{
/*
static int currentstate;
if (toggle != currentstate)
@ -293,6 +296,7 @@ void Win_SetKeyboardLayoutUS(int const toggle)
currentstate = toggle;
}
}
*/
}
@ -411,6 +415,78 @@ int32_t win_buildargs(char **argvbuf)
}
//==========================================================================
//
// CalculateCPUSpeed
//
// Make a decent guess at how much time elapses between TSC steps. This can
// vary over runtime depending on power management settings, so should not
// be used anywhere that truely accurate timing actually matters.
//
//==========================================================================
double PerfToSec, PerfToMillisec;
#include "stats.h"
static void CalculateCPUSpeed()
{
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
if (freq.QuadPart != 0)
{
LARGE_INTEGER count1, count2;
cycle_t ClockCalibration;
DWORD min_diff;
ClockCalibration.Reset();
// Count cycles for at least 55 milliseconds.
// The performance counter may be very low resolution compared to CPU
// speeds today, so the longer we count, the more accurate our estimate.
// On the other hand, we don't want to count too long, because we don't
// want the user to notice us spend time here, since most users will
// probably never use the performance statistics.
min_diff = freq.LowPart * 11 / 200;
// Minimize the chance of task switching during the testing by going very
// high priority. This is another reason to avoid timing for too long.
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
// Make sure we start timing on a counter boundary.
QueryPerformanceCounter(&count1);
do
{
QueryPerformanceCounter(&count2);
} while (count1.QuadPart == count2.QuadPart);
// Do the timing loop.
ClockCalibration.Clock();
do
{
QueryPerformanceCounter(&count1);
} while ((count1.QuadPart - count2.QuadPart) < min_diff);
ClockCalibration.Unclock();
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
PerfToSec = double(count1.QuadPart - count2.QuadPart) / (double(ClockCalibration.GetRawCounter()) * freq.QuadPart);
PerfToMillisec = PerfToSec * 1000.0;
}
}
class Initer
{
public:
Initer() { CalculateCPUSpeed(); }
};
static Initer initer;
// Workaround for a bug in mingwrt-4.0.0 and up where a function named main() in misc/src/libcrt/gdtoa/qnan.c takes precedence over the proper one in src/libcrt/crt/main.c.
#if (defined __MINGW32__ && EDUKE32_GCC_PREREQ(4,8)) || EDUKE32_CLANG_PREREQ(3,4)
# undef main