Merge branch 'Saturn-Next' into Saturn-Testing
This commit is contained in:
commit
7fa3d119e8
18 files changed
+61
-111
No files matched your search
@@ -50,9 +50,8 @@ const char *VID_GetModeName(INT32 modenum)
|
||||
return "A320x240";
|
||||
}
|
||||
|
||||
void I_UpdateNoBlit(void){}
|
||||
|
||||
void I_FinishUpdate(void) {
|
||||
void I_FinishUpdate(void)
|
||||
{
|
||||
LOGD("FRAME!");
|
||||
(*jni_env)->CallVoidMethod(jni_env, androidVideo, videoFrameCB);
|
||||
}
|
||||
|
||||
@@ -407,10 +407,6 @@ static boolean D_Display(void)
|
||||
R_ExecuteSetViewSize();
|
||||
forcerefresh = true; // force background redraw
|
||||
}
|
||||
|
||||
// draw buffered stuff to screen
|
||||
// Used only by linux GGI version
|
||||
I_UpdateNoBlit();
|
||||
}
|
||||
|
||||
// save the current screen if about to wipe
|
||||
|
||||
@@ -65,13 +65,6 @@ void I_OsPolling(void)
|
||||
I_GetConsoleEvents();
|
||||
}
|
||||
|
||||
//
|
||||
// I_UpdateNoBlit
|
||||
//
|
||||
void I_UpdateNoBlit(void)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// I_FinishUpdate
|
||||
//
|
||||
|
||||
+5
-1
@@ -477,7 +477,7 @@ extern INT32 cv_debug;
|
||||
// Misc stuff for later...
|
||||
// =======================
|
||||
|
||||
#define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180)
|
||||
#define ANG2RAD(angle) ((float)((angle)*M_PIf) / (float)ANGLE_180)
|
||||
|
||||
// Modifier key variables, accessible anywhere
|
||||
extern UINT8 shiftdown, ctrldown, altdown;
|
||||
@@ -526,6 +526,10 @@ UINT32 quickncasehash (const char *p, size_t n)
|
||||
#define M_PIl 3.1415926535897932384626433832795029L
|
||||
#endif
|
||||
|
||||
#ifndef M_PIf
|
||||
#define M_PIf 3.14159265f
|
||||
#endif
|
||||
|
||||
// Floating point comparison epsilons from float.h
|
||||
#ifndef FLT_EPSILON
|
||||
#define FLT_EPSILON 1.1920928955078125e-7f
|
||||
|
||||
@@ -384,7 +384,6 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
||||
F_DoWipe(fmask);
|
||||
|
||||
I_OsPolling();
|
||||
I_UpdateNoBlit();
|
||||
|
||||
if (rendermode != render_none && drawMenu)
|
||||
{
|
||||
|
||||
+13
-13
@@ -21,28 +21,28 @@
|
||||
|
||||
// The texture for the next polygon given to HWR_ProcessPolygon.
|
||||
// Set with HWR_SetCurrentTexture.
|
||||
GLMipmap_t *current_texture = NULL;
|
||||
static GLMipmap_t *current_texture = NULL;
|
||||
|
||||
boolean currently_batching = false;
|
||||
static boolean currently_batching = false;
|
||||
|
||||
FOutVector* finalVertexArray = NULL;// contains subset of sorted vertices and texture coordinates to be sent to gpu
|
||||
UINT32* finalVertexIndexArray = NULL;// contains indexes for glDrawElements, taking into account fan->triangles conversion
|
||||
static FOutVector* finalVertexArray = NULL;// contains subset of sorted vertices and texture coordinates to be sent to gpu
|
||||
static UINT32* finalVertexIndexArray = NULL;// contains indexes for glDrawElements, taking into account fan->triangles conversion
|
||||
// NOTE have this alloced as 3x finalVertexArray size
|
||||
int finalVertexArrayAllocSize = 65536;
|
||||
static int finalVertexArrayAllocSize = 65536;
|
||||
|
||||
//GLubyte* colorArray = NULL;// contains color data to be sent to gpu, if needed
|
||||
//int colorArrayAllocSize = 65536;
|
||||
// not gonna use this for now, just sort by color and change state when it changes
|
||||
// later maybe when using vertex attributes if it's needed
|
||||
|
||||
PolygonArrayEntry* polygonArray = NULL ;// contains the polygon data from DrawPolygon, waiting to be processed
|
||||
PolygonArrayEntry **polygonArraySorted = NULL; // contains sorted pointers to polygonArray
|
||||
int polygonArraySize = 0;
|
||||
int polygonArrayAllocSize = 65536;
|
||||
static PolygonArrayEntry* polygonArray = NULL ;// contains the polygon data from DrawPolygon, waiting to be processed
|
||||
static PolygonArrayEntry **polygonArraySorted = NULL; // contains sorted pointers to polygonArray
|
||||
static int polygonArraySize = 0;
|
||||
static int polygonArrayAllocSize = 65536;
|
||||
|
||||
FOutVector* unsortedVertexArray = NULL; // contains unsorted vertices and texture coordinates from DrawPolygon
|
||||
int unsortedVertexArraySize = 0;
|
||||
int unsortedVertexArrayAllocSize = 65536;
|
||||
static FOutVector* unsortedVertexArray = NULL; // contains unsorted vertices and texture coordinates from DrawPolygon
|
||||
static int unsortedVertexArraySize = 0;
|
||||
static int unsortedVertexArrayAllocSize = 65536;
|
||||
|
||||
// Enables batching mode. HWR_ProcessPolygon will collect polygons instead of passing them directly to the rendering backend.
|
||||
// Call HWR_RenderBatches to render all the collected geometry.
|
||||
@@ -260,7 +260,7 @@ void HWR_RenderBatches(void)
|
||||
nextSurfaceInfo.LightInfo.light_level = 0;
|
||||
nextSurfaceInfo.LightInfo.directional = false;
|
||||
|
||||
currently_batching = false;// no longer collecting batches
|
||||
currently_batching = false; // no longer collecting batches
|
||||
|
||||
if (!polygonArraySize)
|
||||
{
|
||||
|
||||
@@ -177,7 +177,7 @@ static void gld_clipper_RemoveRange(clipnode_t *range)
|
||||
|
||||
void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle)
|
||||
{
|
||||
if(startangle > endangle)
|
||||
if (startangle > endangle)
|
||||
{
|
||||
// The range has to added in two parts.
|
||||
gld_clipper_AddClipRange(startangle, ANGLE_MAX);
|
||||
@@ -319,7 +319,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
double floatangle;
|
||||
angle_t a1;
|
||||
|
||||
float tilt = (float)fabs(((double)(int)tiltangle) / ANG1);
|
||||
float tilt = fabsf(((float)(int)tiltangle) / (float)ANG1);
|
||||
|
||||
if (tilt > 90.0f)
|
||||
tilt = 90.0f;
|
||||
@@ -330,7 +330,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
|
||||
// ok, this is a gross hack that barely works...
|
||||
// but at least it doesn't overestimate too much...
|
||||
clipfov = atan(1 / (GLdouble)projMatrix[0]) * 360.0 / M_PIl;
|
||||
clipfov = atan(1 / (GLdouble)projMatrix[0]) * 360.0 / M_PI;
|
||||
floatangle = 2.0 + (45.0 + ((double)tilt / 1.9)) * clipfov / 90.0;
|
||||
if (floatangle >= 180.0)
|
||||
return 0xffffffff;
|
||||
|
||||
@@ -260,7 +260,8 @@ static void CV_screentextures_OnChange(void)
|
||||
static void CV_glframebuffer_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
if ((cv_glframebuffer.value != 0 && cv_glscreentextures.value != 2) || (!supportFBO && cv_glframebuffer.value != 0)) // screen FBO needs screen textures
|
||||
if ((cv_glframebuffer.value != 0 && cv_glscreentextures.value != 2)
|
||||
|| (!supportFBO && cv_glframebuffer.value != 0)) // screen FBO needs screen textures
|
||||
CV_SetValue(&cv_glframebuffer, 0);
|
||||
|
||||
I_DownSample();
|
||||
@@ -5113,7 +5114,7 @@ static gl_sky_t gl_sky;
|
||||
|
||||
static void HWR_SkyDomeVertex(gl_sky_t *sky, gl_skyvertex_t *vbo, int r, int c, signed char yflip, float delta, boolean foglayer)
|
||||
{
|
||||
static constexpr float radians = (float)(M_PIl / 180.0f);
|
||||
static constexpr float radians = (M_PIf / 180.0f);
|
||||
static constexpr float scale = 10000.0f;
|
||||
static constexpr float maxSideAngle = 60.0f * radians;
|
||||
|
||||
@@ -5435,10 +5436,14 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
currentportallist = &portallist;
|
||||
HWR_SetPortalState(GLPORTAL_SEARCH);
|
||||
|
||||
HWR_ClearClipper();
|
||||
HWR_SetTransform(fpov);
|
||||
|
||||
HWR_ClearSprites();
|
||||
HWR_ClearClipper();
|
||||
if (rootportal)
|
||||
{
|
||||
HWR_PortalClipping(rootportal);
|
||||
}
|
||||
|
||||
validcount++;
|
||||
|
||||
@@ -5456,14 +5461,14 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, player_t *player, int stencil_
|
||||
}
|
||||
}
|
||||
|
||||
// draw normal things in current frame in current incremented stencil buffer area
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
|
||||
|
||||
HWR_SetTransform(fpov);
|
||||
|
||||
HWR_ClearSprites();
|
||||
HWR_ClearClipper();
|
||||
|
||||
// draw normal things in current frame in current incremented stencil buffer area
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
|
||||
|
||||
if constexpr (Type == RenderViewpointType::kPortal)
|
||||
{
|
||||
if (allow_portals && rootportal)
|
||||
|
||||
@@ -38,7 +38,7 @@ void HWR_PortalClipping(gl_portal_t *portal)
|
||||
gld_clipper_SafeAddClipRange(portal->angle1, portal->angle2);
|
||||
}
|
||||
|
||||
static gl_portal_t* HWR_Portal_Add (seg_t *seg)
|
||||
static gl_portal_t* HWR_Portal_Add(seg_t *seg)
|
||||
{
|
||||
gl_portal_t *portal = Z_Malloc(sizeof(gl_portal_t), PU_STATIC, NULL);
|
||||
|
||||
@@ -120,8 +120,8 @@ void HWR_PortalFrame(gl_portal_t* portal)
|
||||
viewz = portal->viewz;
|
||||
|
||||
viewangle = portal->viewangle;
|
||||
//viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
//viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
if (portal->clipline != -1)
|
||||
{
|
||||
|
||||
@@ -1145,7 +1145,7 @@ static void GL_Perspective(GLfloat fovy, GLfloat aspect)
|
||||
return;
|
||||
}
|
||||
|
||||
const GLfloat focallength = (GLfloat)(1.0f / (GLfloat)tan(fovy * (GLfloat)M_PIl / 360.0f));
|
||||
const GLfloat focallength = (1.0f / tanf(fovy * M_PIf / 360.0f));
|
||||
|
||||
m[0][0] = focallength / aspect;
|
||||
m[1][1] = focallength;
|
||||
@@ -3196,11 +3196,13 @@ void GL_SetTransform(FTransform *stransform)
|
||||
|
||||
if (special_splitscreen)
|
||||
{
|
||||
used_fov = (atanf(tanf(used_fov * (float)M_PI / 360.0f) * 0.8f) * 360.0f / (float)M_PI);
|
||||
used_fov = (atanf(tanf(used_fov * M_PIf / 360.0f) * 0.8f) * 360.0f / M_PIf);
|
||||
GL_Perspective(used_fov, 2*ASPECT_RATIO);
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_Perspective(used_fov, ASPECT_RATIO);
|
||||
}
|
||||
|
||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
|
||||
pglMatrixMode(GL_MODELVIEW);
|
||||
|
||||
@@ -102,10 +102,6 @@ void VID_PrepareModeList(void);
|
||||
*/
|
||||
extern boolean allow_fullscreen;
|
||||
|
||||
/** \brief Update video system without updating frame
|
||||
*/
|
||||
void I_UpdateNoBlit(void);
|
||||
|
||||
/** \brief Update video system with updating frame
|
||||
*/
|
||||
void I_FinishUpdate(void);
|
||||
|
||||
@@ -7527,7 +7527,6 @@ static void M_ConnectIP(INT32 choice)
|
||||
M_DrawTextBox(56, BASEVIDHEIGHT/2-12, 24, 2);
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, 0, "Connecting to server...");
|
||||
I_OsPolling();
|
||||
I_UpdateNoBlit();
|
||||
if (rendermode == render_soft)
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
}
|
||||
|
||||
+2
-12
@@ -14,13 +14,7 @@
|
||||
/// \note no includes because this is included as part of r_draw.cpp
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define local_for_thread static __thread
|
||||
#else
|
||||
#include <threads.h>
|
||||
#define local_for_thread thread_local static
|
||||
#endif
|
||||
#define local_for_thread static thread_local
|
||||
#else
|
||||
#define local_for_thread static
|
||||
#endif
|
||||
@@ -221,11 +215,7 @@ static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspan
|
||||
const float planelightfloat = PLANELIGHTFLOAT;
|
||||
const fixed_t lightstart = FloatToFixed(iz * planelightfloat);
|
||||
const fixed_t lightend = FloatToFixed((iz + ds->szp.x * width) * planelightfloat);
|
||||
|
||||
if (tiltlighting.size() != (size_t)viewwidth)
|
||||
{
|
||||
tiltlighting.resize(viewwidth);
|
||||
}
|
||||
tiltlighting.resize((size_t)viewwidth);
|
||||
|
||||
R_CalcTiltedLighting(tiltlighting, ds->x1, ds->x2, lightstart, lightend);
|
||||
//CONS_Printf("tilted lighting %f to %f (foc %f)\n", FixedToFloat(lightstart), FixedToFloat(lightend), focallengthf);
|
||||
|
||||
+2
-8
@@ -487,11 +487,8 @@ void *R_PixelsToPatch(UINT8 *raw, INT16 width, INT16 height, INT16 leftoffset, I
|
||||
size_t maxoutsize = maxcolumnsize * width + (8 + 4 * width);
|
||||
// so, a 512x512 flat should maximally need 393,760 (384.53 KiB) bytes.
|
||||
// quite a bit smaller than 64 megabytes, and much less annoying to the windows debug allocator!
|
||||
while (imgbuf.size() < maxoutsize)
|
||||
{
|
||||
imgbuf.resize(imgbuf.size() * 2);
|
||||
}
|
||||
|
||||
imgbuf.resize(maxoutsize);
|
||||
imgptr = imgbuf.data();
|
||||
|
||||
// Write image size and offset
|
||||
@@ -621,11 +618,8 @@ void *R_MaskedFlatToPatch(UINT16 *raw, INT16 width, INT16 height, INT16 leftoffs
|
||||
size_t maxoutsize = maxcolumnsize * width + (8 + 4 * width);
|
||||
// so, a 512x512 flat should maximally need 393,760 (384.53 KiB) bytes.
|
||||
// quite a bit smaller than 64 megabytes, and much less annoying to the windows debug allocator!
|
||||
while (imgbuf.size() < maxoutsize)
|
||||
{
|
||||
imgbuf.resize(imgbuf.size() * 2);
|
||||
}
|
||||
|
||||
imgbuf.resize(maxoutsize);
|
||||
imgptr = imgbuf.data();
|
||||
|
||||
// Write image size and offset
|
||||
|
||||
@@ -128,7 +128,7 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
||||
UINT32 i;
|
||||
patch_t *rotated;
|
||||
|
||||
static std::vector<UINT16> rawdst(1024 * 1024), rawconv(1024 * 1024); // 1 MB should be enough for most cases
|
||||
static std::vector<UINT16> rawdst(512 * 1024), rawconv(512 * 1024); // 1 MB should be enough for most cases
|
||||
|
||||
UINT16 *rawout;
|
||||
size_t size;
|
||||
@@ -185,10 +185,7 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
||||
if (!size)
|
||||
size = (width * height);
|
||||
|
||||
while (rawdst.size() < size)
|
||||
{
|
||||
rawdst.resize(rawdst.size() * 2);
|
||||
}
|
||||
rawdst.resize(size);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
rawdst[i] = 0xFF00;
|
||||
|
||||
+4
-6
@@ -343,8 +343,6 @@ boolean SCR_IsAspectCorrect(INT32 width, INT32 height)
|
||||
return (width % BASEVIDWIDTH == 0 && height % BASEVIDHEIGHT == 0 && width / BASEVIDWIDTH == height / BASEVIDHEIGHT);
|
||||
}
|
||||
|
||||
double averageFPS = 0.0f;
|
||||
|
||||
#define USE_FPS_SAMPLES
|
||||
|
||||
#ifdef USE_FPS_SAMPLES
|
||||
@@ -352,16 +350,16 @@ double averageFPS = 0.0f;
|
||||
#define NUM_FPS_SAMPLES (32) // Number of samples to store
|
||||
|
||||
static double total_frame_time = 0.0;
|
||||
static int frame_index;
|
||||
|
||||
static double fps_samples[NUM_FPS_SAMPLES];
|
||||
#endif
|
||||
|
||||
static boolean fps_init = false;
|
||||
static precise_t fps_enter = 0;
|
||||
static double averageFPS = 0.0f;
|
||||
|
||||
void SCR_CalculateFPS(void)
|
||||
{
|
||||
static boolean fps_init = false;
|
||||
static int frame_index = 0;
|
||||
static precise_t fps_enter = 0;
|
||||
precise_t fps_finish = 0;
|
||||
|
||||
double frameElapsed = 0.0;
|
||||
|
||||
+10
-4
@@ -283,7 +283,7 @@ static void I_ShutdownConsole(void)
|
||||
{
|
||||
I_OutputMsg("Shutdown tty console\n");
|
||||
consolevent = SDL_FALSE;
|
||||
tcsetattr (STDIN_FILENO, TCSADRAIN, &tty_tc);
|
||||
tcsetattr(STDIN_FILENO, TCSADRAIN, &tty_tc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,8 @@ static void I_StartupConsole(void)
|
||||
if (framebuffer)
|
||||
consolevent = SDL_FALSE;
|
||||
|
||||
if (!consolevent) return;
|
||||
if (!consolevent)
|
||||
return;
|
||||
|
||||
if (isatty(STDIN_FILENO)!=1)
|
||||
{
|
||||
@@ -311,6 +312,7 @@ static void I_StartupConsole(void)
|
||||
consolevent = SDL_FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&tty_con, 0x00, sizeof(tty_con));
|
||||
tcgetattr (0, &tty_tc);
|
||||
tty_erase = tty_tc.c_cc[VERASE];
|
||||
@@ -372,6 +374,7 @@ void I_GetConsoleEvents(void)
|
||||
tty_con.buffer[tty_con.cursor] = '\0';
|
||||
tty_Back();
|
||||
}
|
||||
|
||||
ev.data1 = KEY_BACKSPACE;
|
||||
}
|
||||
else if (key < ' ') // check if this is a control char
|
||||
@@ -387,7 +390,8 @@ void I_GetConsoleEvents(void)
|
||||
// shut down, most unix programs behave this way
|
||||
I_Quit();
|
||||
}
|
||||
else continue;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else if (tty_con.cursor < sizeof(tty_con.buffer))
|
||||
{
|
||||
@@ -397,7 +401,9 @@ void I_GetConsoleEvents(void)
|
||||
// print the current line (this is differential)
|
||||
write(STDOUT_FILENO, &key, 1);
|
||||
}
|
||||
if (ev.data1) D_PostEvent(&ev);
|
||||
|
||||
if (ev.data1)
|
||||
D_PostEvent(&ev);
|
||||
//tty_FlushIn();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,6 @@ static UINT32 localPalette[256];
|
||||
Uint16 realwidth = BASEVIDWIDTH;
|
||||
Uint16 realheight = BASEVIDHEIGHT;
|
||||
#define HalfWarpMouse(x,y) if (wrapmouseok) SDL_WarpMouseInWindow(window, (Uint16)(x/2),(Uint16)(y/2))
|
||||
static SDL_bool exposevideo = SDL_FALSE;
|
||||
static SDL_bool usesdl2soft = SDL_FALSE;
|
||||
static SDL_bool borderlesswindow = SDL_FALSE;
|
||||
|
||||
@@ -1380,31 +1379,6 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// I_UpdateNoBlit
|
||||
//
|
||||
void I_UpdateNoBlit(void)
|
||||
{
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
if (exposevideo)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
OglSdlFinishUpdate(cv_vidwait.value);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
exposevideo = SDL_FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// I_FinishUpdate
|
||||
//
|
||||
@@ -1464,8 +1438,6 @@ void I_FinishUpdate(void)
|
||||
SDL_RenderCopy(renderer, texture, &src_rect, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
exposevideo = SDL_FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user