Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
148bd1ab4d | ||
|
|
473619ab66 | ||
|
|
d75638cbfc | ||
|
|
f09b591989 | ||
|
|
79d75aa08d | ||
|
|
486560d79e | ||
|
|
953b0c8f94 | ||
|
|
5639e872f1 | ||
|
|
80da0fc538 | ||
|
|
014126b57d | ||
|
|
d7b150a04f | ||
|
|
5751f9b29b |
No files matched your search
@@ -292,7 +292,6 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
||||
lua_script.c
|
||||
lua_skinlib.c
|
||||
lua_thinkerlib.c
|
||||
lua_udatalib.c
|
||||
lua_glib.c
|
||||
)
|
||||
set(SRB2_LUA_HEADERS
|
||||
@@ -302,7 +301,6 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
||||
lua_profile.h
|
||||
lua_libs.h
|
||||
lua_script.h
|
||||
lua_udatalib.h
|
||||
lua_glib.h
|
||||
)
|
||||
|
||||
|
||||
@@ -97,6 +97,5 @@ lua_playerlib.c
|
||||
lua_script.c
|
||||
lua_skinlib.c
|
||||
lua_thinkerlib.c
|
||||
lua_udatalib.c
|
||||
lua_glib.c
|
||||
lua_profile.cpp
|
||||
+27
-58
@@ -63,7 +63,6 @@
|
||||
|
||||
// for replay dates
|
||||
#include <time.h>
|
||||
#include <locale.h>
|
||||
|
||||
// menu demo things
|
||||
UINT32 demoDelayTime = 15*TICRATE;
|
||||
@@ -2387,7 +2386,9 @@ void G_LoadDemoInfo(menudemo_t *pdemo)
|
||||
#if defined (_WIN32)
|
||||
// return the file creation time
|
||||
// useful for demos that were renamed
|
||||
static long G_GetCreationTime(char *filepath)
|
||||
// windows only, as file creation times are
|
||||
// very unreliable (or non existant depending on fs) on linux
|
||||
static time_t G_GetCreationTime(char *filepath)
|
||||
{
|
||||
struct stat fileinfo;
|
||||
|
||||
@@ -2398,35 +2399,24 @@ static long G_GetCreationTime(char *filepath)
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *G_GetDemoDate(menudemo_t *pdemo)
|
||||
static char *G_GetDemoDate(menudemo_t *pdemo, const char *dateformat)
|
||||
{
|
||||
char *endPos = NULL;
|
||||
static char datetime[11];
|
||||
char *datetime;
|
||||
time_t file_time = 0;
|
||||
const char *format = NULL;
|
||||
struct tm *tm_buf = NULL;
|
||||
struct tm tm_buf;
|
||||
CLEANUP(pfree) char *filename = NULL;
|
||||
|
||||
// get le filepath
|
||||
filename = strdup(pdemo->filepath);
|
||||
|
||||
if (!filename)
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
// if we cant get a filename try just getting the file creation time
|
||||
file_time = G_GetCreationTime(pdemo->filepath);
|
||||
goto skipfilenametime;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
// get the actual filename Zzz...
|
||||
nameonly(filename);
|
||||
|
||||
// the first 10 characters of a replay name usually is a unix timestamp
|
||||
|
||||
// not long enough to contain a valid timestamp
|
||||
// the first 10 characters of a replay name is a unix timestamp
|
||||
if (strlen(filename) < 10)
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
@@ -2458,67 +2448,49 @@ static char *G_GetDemoDate(menudemo_t *pdemo)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (_WIN32)
|
||||
skipfilenametime:
|
||||
#endif
|
||||
|
||||
// then throw it into localtime to get an actual human readable format lmao
|
||||
tm_buf = localtime(&file_time);
|
||||
|
||||
// cant believe we ended up in 1970
|
||||
if (tm_buf == NULL || tm_buf->tm_year <= 110)
|
||||
#if defined(_WIN32)
|
||||
skipfilenametime:
|
||||
if ((localtime_s(&tm_buf, &file_time) != 0) ||
|
||||
(tm_buf.tm_year <= 110)) // cant believe we ended up in 1970
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
// uh ohh, we got an invalid time
|
||||
// try one more time getting the creation time
|
||||
file_time = G_GetCreationTime(pdemo->filepath);
|
||||
tm_buf = localtime(&file_time);
|
||||
|
||||
if (tm_buf == NULL || tm_buf->tm_year <= 110)
|
||||
if ((localtime_s(&tm_buf, &file_time) != 0) ||
|
||||
(tm_buf.tm_year <= 110))
|
||||
return NULL;
|
||||
|
||||
goto gotcreationtime;
|
||||
}
|
||||
#else
|
||||
if ((localtime_r(&file_time, &tm_buf) == NULL) ||
|
||||
(tm_buf.tm_year <= 110)) // cant believe we ended up in 1970
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (_WIN32)
|
||||
gotcreationtime:
|
||||
#endif
|
||||
datetime = malloc(sizeof(pdemo->date)); // mallocma balls
|
||||
|
||||
// US ppl are special (:
|
||||
if (cv_demodateformat.value == 2)
|
||||
format = "%m.%d.%Y";
|
||||
else if (cv_demodateformat.value == 1)
|
||||
format = "%d.%m.%Y";
|
||||
else
|
||||
{
|
||||
const char *locale = setlocale(LC_TIME, NULL);
|
||||
// no mallocma balls... :c
|
||||
if (!datetime)
|
||||
return NULL;
|
||||
|
||||
if (locale == NULL)
|
||||
format = "%d.%m.%Y"; // fallback to non US format
|
||||
else if (strstr(locale, "en_US"))
|
||||
format = "%m.%d.%Y";
|
||||
else
|
||||
format = "%d.%m.%Y";
|
||||
}
|
||||
|
||||
if (strftime(datetime, sizeof(datetime), format, tm_buf) == 0)
|
||||
if (strftime(datetime, sizeof(pdemo->date), dateformat, &tm_buf) == 0)
|
||||
{
|
||||
free(datetime);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return datetime;
|
||||
}
|
||||
|
||||
void G_LoadDemoTitle(menudemo_t *pdemo)
|
||||
void G_LoadDemoTitle(menudemo_t *pdemo, const char *dateformat)
|
||||
{
|
||||
UINT8 infobuffer[96], *info_p;
|
||||
UINT16 pdemoversion;
|
||||
char *demodate = NULL;
|
||||
size_t count;
|
||||
|
||||
memset(pdemo->date, 0, sizeof(pdemo->date));
|
||||
|
||||
FILE *handle = fopen(pdemo->filepath, "rb");
|
||||
|
||||
if (!handle)
|
||||
@@ -2546,8 +2518,6 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
|
||||
|
||||
pdemoversion = READUINT16(info_p);
|
||||
|
||||
memset(pdemo->date, 0, sizeof(pdemo->date));
|
||||
|
||||
switch (pdemoversion)
|
||||
{
|
||||
case DEMOVERSION: // latest always supported
|
||||
@@ -2555,13 +2525,12 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
|
||||
memcpy(pdemo->title, info_p, 64);
|
||||
|
||||
// demo date
|
||||
demodate = G_GetDemoDate(pdemo);
|
||||
|
||||
char *demodate = G_GetDemoDate(pdemo, dateformat);
|
||||
if (demodate)
|
||||
{
|
||||
strlcpy(pdemo->date, demodate, sizeof(pdemo->date));
|
||||
free(demodate);
|
||||
}
|
||||
|
||||
break;
|
||||
#ifdef DEMO_COMPAT_100
|
||||
case 0x0001:
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ void G_SetDemoTime(UINT32 ptime, UINT32 plap);
|
||||
UINT8 G_CmpDemoTime(char *oldname, char *newname);
|
||||
|
||||
void G_LoadDemoInfo(menudemo_t *pdemo);
|
||||
void G_LoadDemoTitle(menudemo_t *pdemo); // For use in replay search feature
|
||||
void G_LoadDemoTitle(menudemo_t *pdemo, const char *dateformat); // For use in replay search feature
|
||||
void G_DeferedPlayDemo(const char *demo);
|
||||
|
||||
typedef enum
|
||||
|
||||
@@ -255,6 +255,7 @@ static void CV_screentextures_OnChange(void)
|
||||
#endif
|
||||
intermissionbginit = false;
|
||||
}
|
||||
|
||||
GL_SetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
|
||||
M_UpdateOGLMenu();
|
||||
}
|
||||
@@ -263,12 +264,11 @@ 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
|
||||
CV_SetValue(&cv_glframebuffer, 0);
|
||||
// screen FBO needs screen textures currently
|
||||
if (cv_glframebuffer.value != 0 && ((cv_glscreentextures.value != 2) || !supportFBO))
|
||||
CV_StealthSetValue(&cv_glframebuffer, 0); // dont recursively call this lul
|
||||
|
||||
I_DownSample();
|
||||
RefreshOGLSDLSurface();
|
||||
I_CheckDownSampleState(true);
|
||||
M_UpdateOGLMenu();
|
||||
intermissionbginit = false;
|
||||
}
|
||||
@@ -5899,7 +5899,7 @@ void HWR_Startup(void)
|
||||
HWR_TogglePaletteRendering();
|
||||
|
||||
if (msaa)
|
||||
GL_SetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
|
||||
GL_SetSpecialState(HWD_SET_MSAA, 1);
|
||||
|
||||
HWR_RegisterCommands();
|
||||
}
|
||||
@@ -5987,7 +5987,7 @@ void HWR_Shutdown(void)
|
||||
GL_FlushScreenTextures();
|
||||
HWR_ClearAllTextures();
|
||||
#ifdef USE_FBO_OGL
|
||||
GL_Framebuffer_Disable();
|
||||
GL_FBO_Disable();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ void HWR_Startup(void);
|
||||
void HWR_Shutdown(void);
|
||||
|
||||
extern unsigned msaa;
|
||||
extern boolean a2c;
|
||||
|
||||
extern FTransform atransform;
|
||||
extern float gl_viewsin, gl_viewcos;
|
||||
|
||||
@@ -193,26 +193,6 @@
|
||||
"}\n" \
|
||||
"#endif\0"
|
||||
|
||||
#define GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform vec4 poly_color;\n" \
|
||||
"uniform vec4 tint_color;\n" \
|
||||
"uniform vec4 fade_color;\n" \
|
||||
"uniform float lighting;\n" \
|
||||
"uniform float fade_start;\n" \
|
||||
"uniform float fade_end;\n" \
|
||||
GLSL_DOOM_COLORMAP \
|
||||
GLSL_DOOM_LIGHT_EQUATION \
|
||||
"void main(void) {\n" \
|
||||
"vec4 texel = texture2D(tex, gl_TexCoord[0].st);\n" \
|
||||
"vec4 base_color = texel * poly_color;\n" \
|
||||
"vec4 final_color = base_color;\n" \
|
||||
GLSL_SOFTWARE_TINT_EQUATION \
|
||||
GLSL_SOFTWARE_FADE_EQUATION \
|
||||
"final_color.a = texel.a * poly_color.a;\n" \
|
||||
"gl_FragColor = final_color;\n" \
|
||||
"}\n" \
|
||||
|
||||
// hand tuned adjustments for light level calculation
|
||||
#define GLSL_FLOOR_FUDGES \
|
||||
"#define STARTMAP_FUDGE 1.06\n" \
|
||||
|
||||
@@ -136,8 +136,7 @@ enum
|
||||
{
|
||||
FBO_NONE,
|
||||
FBO_ARB,
|
||||
FBO_EXT,
|
||||
FBO_EXT_STENCIL // supports stencil attachment
|
||||
FBO_EXT
|
||||
};
|
||||
|
||||
typedef struct
|
||||
@@ -161,7 +160,7 @@ GL_DEPTH24_STENCIL8 GL_DEPTH_COMPONENT_EXT
|
||||
GL_DEPTH_STENCIL_ATTACHMENT GL_DEPTH_ATTACHMENT_EXT
|
||||
#endif
|
||||
|
||||
static void GL_Framebuffer_DeleteAttachments(void);
|
||||
static void GL_FBO_DeleteAttachments(void);
|
||||
#endif
|
||||
|
||||
// needed for glportals
|
||||
@@ -769,28 +768,22 @@ static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
#ifdef USE_FBO_OGL
|
||||
static int GLFramebuffer_CheckExt(void)
|
||||
{
|
||||
// in opengl 3.0 and up fbos are standart and always supported
|
||||
if (majorGL >= 3)
|
||||
return FBO_ARB;
|
||||
|
||||
// gl versions from 2.1 may still support framebuffer objects
|
||||
|
||||
// maybe, just maybe, we support the standart extensions
|
||||
// check for the standard arb extensions
|
||||
// these should be there from version 3.0 onwards
|
||||
if (GL_isExtAvailable("GL_ARB_framebuffer_no_attachments", gl_extensions) &&
|
||||
GL_isExtAvailable("GL_ARB_framebuffer_object", gl_extensions) &&
|
||||
GL_isExtAvailable("GL_ARB_framebuffer_sRGB", gl_extensions))
|
||||
{
|
||||
return FBO_ARB;
|
||||
}
|
||||
|
||||
// nope, try the older 2.1 extensions
|
||||
// gl versions from 2.1 and older may still support framebuffer objects
|
||||
// depending on vendor and driver support
|
||||
if (GL_isExtAvailable("GL_EXT_framebuffer_no_attachments", gl_extensions) &&
|
||||
GL_isExtAvailable("GL_EXT_framebuffer_object", gl_extensions) &&
|
||||
GL_isExtAvailable("GL_EXT_framebuffer_sRGB", gl_extensions))
|
||||
GL_isExtAvailable("GL_EXT_framebuffer_sRGB", gl_extensions) &&
|
||||
GL_isExtAvailable("GL_EXT_packed_depth_stencil", gl_extensions)) // we use the stencil buffer for stuff like portals, so its better to make stencil extension a requirement
|
||||
{
|
||||
// perhaps we may even support a stencil attachment
|
||||
if (GL_isExtAvailable("GL_EXT_packed_depth_stencil", gl_extensions))
|
||||
return FBO_EXT_STENCIL;
|
||||
|
||||
// no stencil support, sad
|
||||
return FBO_EXT;
|
||||
}
|
||||
|
||||
@@ -908,36 +901,41 @@ void SetupGLFunc4(void)
|
||||
|
||||
GL_DBG_Printf("\nFBO: ARB extensions found\n");
|
||||
}
|
||||
else if (fbocheck == FBO_EXT || fbocheck == FBO_EXT_STENCIL) // uh oh only support for EXT prefix fbos...
|
||||
else if (fbocheck == FBO_EXT) // uh oh only support old fbo extensions...
|
||||
{
|
||||
GetGLfunc(glGenFramebuffersEXT);
|
||||
GetGLfunc(glBindFramebufferEXT);
|
||||
GetGLfunc(glDeleteFramebuffersEXT);
|
||||
GetGLfunc(glFramebufferTexture2DEXT);
|
||||
GetGLfunc(glCheckFramebufferStatusEXT);
|
||||
GetGLfunc(glGenRenderbuffersEXT);
|
||||
GetGLfunc(glBindRenderbufferEXT);
|
||||
GetGLfunc(glDeleteRenderbuffersEXT);
|
||||
GetGLfunc(glRenderbufferStorageEXT);
|
||||
GetGLfunc(glFramebufferRenderbufferEXT);
|
||||
|
||||
// remapping galore huehue
|
||||
// do this so we dont have to dupe half our code
|
||||
GetGLfunc(glGenFramebuffersEXT);
|
||||
pglGenFramebuffers = pglGenFramebuffersEXT;
|
||||
|
||||
GetGLfunc(glBindFramebufferEXT);
|
||||
pglBindFramebuffer = pglBindFramebufferEXT;
|
||||
|
||||
GetGLfunc(glDeleteFramebuffersEXT);
|
||||
pglDeleteFramebuffers = pglDeleteFramebuffersEXT;
|
||||
|
||||
GetGLfunc(glFramebufferTexture2DEXT);
|
||||
pglFramebufferTexture2D = pglFramebufferTexture2DEXT;
|
||||
|
||||
GetGLfunc(glCheckFramebufferStatusEXT);
|
||||
pglCheckFramebufferStatus = pglCheckFramebufferStatusEXT;
|
||||
|
||||
GetGLfunc(glGenRenderbuffersEXT);
|
||||
pglGenRenderbuffers = pglGenRenderbuffersEXT;
|
||||
|
||||
GetGLfunc(glBindRenderbufferEXT);
|
||||
pglBindRenderbuffer = pglBindRenderbufferEXT;
|
||||
|
||||
GetGLfunc(glDeleteRenderbuffersEXT);
|
||||
pglDeleteRenderbuffers = pglDeleteRenderbuffersEXT;
|
||||
|
||||
GetGLfunc(glRenderbufferStorageEXT);
|
||||
pglRenderbufferStorage = pglRenderbufferStorageEXT;
|
||||
|
||||
GetGLfunc(glFramebufferRenderbufferEXT);
|
||||
pglFramebufferRenderbuffer = pglFramebufferRenderbufferEXT;
|
||||
|
||||
if (fbocheck == FBO_EXT)
|
||||
GL_DBG_Printf("\nFBO: EXT extensions found, no stencil\n");
|
||||
else if (fbocheck == FBO_EXT_STENCIL)
|
||||
GL_DBG_Printf("\nFBO: EXT extensions with packed depth-stencil\n");
|
||||
GL_DBG_Printf("\nFBO: EXT extensions with packed depth-stencil\n");
|
||||
}
|
||||
|
||||
supportFBO = fbocheck;
|
||||
@@ -1151,7 +1149,7 @@ void GL_SetModelView(GLint w, GLint h)
|
||||
GL_FlushScreenTextures();
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
GL_Framebuffer_DeleteAttachments();
|
||||
GL_FBO_DeleteAttachments();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2641,11 +2639,7 @@ void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value)
|
||||
|
||||
case HWD_SET_MSAA:
|
||||
if (Value)
|
||||
{
|
||||
pglEnable(GL_MULTISAMPLE);
|
||||
if (Value == 2)
|
||||
pglEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||
}
|
||||
break;
|
||||
|
||||
case HWD_SET_TEXTUREANISOTROPICMODE:
|
||||
@@ -3246,7 +3240,7 @@ void GL_SetTransform(FTransform *stransform)
|
||||
}
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
static void GL_Framebuffer_DeleteAttachments(void)
|
||||
static void GL_FBO_DeleteAttachments(void)
|
||||
{
|
||||
if (supportFBO == FBO_NONE || !framebufferobject.init)
|
||||
return;
|
||||
@@ -3266,9 +3260,9 @@ static void GL_Framebuffer_DeleteAttachments(void)
|
||||
framebufferobject.init = false;
|
||||
}
|
||||
|
||||
static void GL_Framebuffer_Generate(void)
|
||||
static void GL_FBO_Generate(void)
|
||||
{
|
||||
if (supportFBO == FBO_NONE || framebufferobject.init || !UseScreenFBO())
|
||||
if (supportFBO == FBO_NONE || framebufferobject.init)
|
||||
return;
|
||||
|
||||
// Generate the framebuffer
|
||||
@@ -3283,7 +3277,7 @@ static void GL_Framebuffer_Generate(void)
|
||||
{
|
||||
pglGenTextures(1, &framebufferobject.tex);
|
||||
pglBindTexture(GL_TEXTURE_2D, framebufferobject.tex);
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, screen_width, screen_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, screen_width, screen_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
Clamp2D(GL_TEXTURE_WRAP_S);
|
||||
@@ -3306,18 +3300,13 @@ static void GL_Framebuffer_Generate(void)
|
||||
pglRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8, screen_width, screen_height);
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER_EXT, framebufferobject.rboobj);
|
||||
}
|
||||
else if (supportFBO == FBO_EXT || supportFBO == FBO_EXT_STENCIL)
|
||||
else if (supportFBO == FBO_EXT)
|
||||
{
|
||||
pglRenderbufferStorage(GL_RENDERBUFFER_EXT, (supportFBO == FBO_EXT_STENCIL) ? GL_DEPTH_STENCIL_EXT : GL_DEPTH_COMPONENT, screen_width, screen_height);
|
||||
|
||||
// attach a renderbuffer to depth attachment point
|
||||
pglRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_STENCIL_EXT, screen_width, screen_height);
|
||||
// attach the renderbuffer to depth attachment point
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, framebufferobject.rboobj);
|
||||
|
||||
if (supportFBO == FBO_EXT_STENCIL)
|
||||
{
|
||||
// attach a renderbuffer to stencil attachment point
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, framebufferobject.rboobj);
|
||||
}
|
||||
// attach the renderbuffer to stencil attachment point
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, framebufferobject.rboobj);
|
||||
}
|
||||
|
||||
// Clear the renderbuffer
|
||||
@@ -3329,7 +3318,7 @@ static void GL_Framebuffer_Generate(void)
|
||||
if (pglCheckFramebufferStatus(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||
{
|
||||
//pglGetError(); TODO:implement this or smth
|
||||
GL_MSG_Error("GL_Framebuffer_Generate: Failed to create Framebuffer Object");
|
||||
GL_MSG_Error("GL_FBO_Generate: Failed to create Framebuffer Object");
|
||||
|
||||
// if this fails, dont retry it a gazillion times
|
||||
// this wouldnt recover
|
||||
@@ -3344,7 +3333,7 @@ static void GL_Framebuffer_Generate(void)
|
||||
framebufferobject.init = true;
|
||||
}
|
||||
|
||||
void GL_Framebuffer_Unbind(void)
|
||||
void GL_FBO_BindMainFrameBuffer(void)
|
||||
{
|
||||
if (supportFBO == FBO_NONE || !framebufferobject.init)
|
||||
return;
|
||||
@@ -3353,22 +3342,22 @@ void GL_Framebuffer_Unbind(void)
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);
|
||||
}
|
||||
|
||||
void GL_Framebuffer_Enable(void)
|
||||
void GL_FBO_Enable(void)
|
||||
{
|
||||
if (supportFBO == FBO_NONE || !UseScreenFBO())
|
||||
if (supportFBO == FBO_NONE)
|
||||
return;
|
||||
|
||||
GL_Framebuffer_Generate();
|
||||
GL_FBO_Generate();
|
||||
|
||||
// failed
|
||||
if (supportFBO == FBO_NONE || !framebufferobject.init)
|
||||
if (!framebufferobject.init)
|
||||
return;
|
||||
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER_EXT, framebufferobject.fboobj);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER_EXT, framebufferobject.rboobj);
|
||||
}
|
||||
|
||||
void GL_Framebuffer_Disable(void)
|
||||
void GL_FBO_Disable(void)
|
||||
{
|
||||
if (supportFBO == FBO_NONE || !framebufferobject.init)
|
||||
return;
|
||||
@@ -3381,7 +3370,7 @@ void GL_Framebuffer_Disable(void)
|
||||
pglDeleteFramebuffers(1, &framebufferobject.fboobj);
|
||||
framebufferobject.fboobj = 0;
|
||||
|
||||
GL_Framebuffer_DeleteAttachments();
|
||||
GL_FBO_DeleteAttachments();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3732,6 +3721,7 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
|
||||
void GL_MakeScreenTexture(int tex)
|
||||
{
|
||||
boolean firstTime;
|
||||
static GLint lastfiltermode[NUMSCREENTEXTURES] = {-1, -1, -1, -1, -1};
|
||||
|
||||
if (!gl_enable_screen_textures)
|
||||
return;
|
||||
@@ -3744,16 +3734,29 @@ void GL_MakeScreenTexture(int tex)
|
||||
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
// if were downsampling, choose to do that with linear filter instead of nearest neighbor
|
||||
// otherwise well get ugly mixels
|
||||
GLint filtermode = I_IsDownsampling() ? GL_LINEAR : GL_NEAREST;
|
||||
|
||||
// avoid redundant calls to this, prob doesent really matter tbh
|
||||
if (filtermode != lastfiltermode[tex] || firstTime)
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtermode);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtermode);
|
||||
|
||||
lastfiltermode[tex] = filtermode;
|
||||
}
|
||||
|
||||
if (firstTime)
|
||||
{
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
Clamp2D(GL_TEXTURE_WRAP_S);
|
||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, screen_texsizew, screen_texsizeh, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, screen_texsizew, screen_texsizeh);
|
||||
}
|
||||
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ extern PFNglGetString pglGetString;
|
||||
#endif
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void GL_Framebuffer_Unbind(void);
|
||||
void GL_Framebuffer_Enable(void);
|
||||
void GL_Framebuffer_Disable(void);
|
||||
void GL_FBO_BindMainFrameBuffer(void);
|
||||
void GL_FBO_Enable(void);
|
||||
void GL_FBO_Disable(void);
|
||||
extern int supportFBO;
|
||||
#endif
|
||||
|
||||
|
||||
+2
-4
@@ -126,11 +126,9 @@ boolean I_CheckNativeRes(void);
|
||||
void I_SetBorderlessWindow(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
|
||||
void RefreshOGLSDLSurface(void);
|
||||
void I_DownSample(void);
|
||||
void I_CheckDownSampleState(boolean forcerefresh);
|
||||
boolean I_IsDownsampling(void);
|
||||
boolean UseScreenFBO(void);
|
||||
extern boolean downsample;
|
||||
#endif
|
||||
|
||||
// So we can call this from i_video event loop
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "p_slopes.h"
|
||||
#include "r_main.h"
|
||||
|
||||
#include "lua_udatalib.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
#include "lua_hud.h" // hud_running errors
|
||||
@@ -256,15 +255,6 @@ static const char *const vector_opt[] = {
|
||||
static const char *const array_opt[] ={"iterate",NULL};
|
||||
static const char *const valid_opt[] ={"valid",NULL};
|
||||
|
||||
#define pushsubsector(L, subsector) LUA_PushUserdata(L, subsector, META_SUBSECTOR)
|
||||
int udatalib_getter_subsector(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(subsector_t*, pushsubsector)
|
||||
#undef pushsubsector
|
||||
|
||||
#define pushslope(L, slope) LUA_PushUserdata(L, slope, META_SLOPE)
|
||||
int udatalib_getter_slope(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(pslope_t*, pushslope)
|
||||
#undef pushslope
|
||||
// iterates through a sector's thinglist!
|
||||
static int lib_iterateSectorThinglist(lua_State *L)
|
||||
{
|
||||
|
||||
+767
-734
File diff suppressed because it is too large.
Load diff
+847
-422
File diff suppressed because it is too large.
Load diff
@@ -1,137 +0,0 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file lua_udatalib.c
|
||||
/// \brief Implementation of lua userdata object metatables based on getter/setter functions
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "m_fixed.h"
|
||||
#include "lua_udatalib.h"
|
||||
|
||||
// Getters
|
||||
int udatalib_getter_fixed(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(fixed_t, lua_pushinteger)
|
||||
|
||||
int udatalib_getter_angle(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(angle_t, lua_pushangle)
|
||||
|
||||
int udatalib_getter_uint8(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(UINT8, lua_pushinteger)
|
||||
|
||||
int udatalib_getter_sint8(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(SINT8, lua_pushinteger)
|
||||
|
||||
int udatalib_getter_uint16(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(UINT16, lua_pushinteger)
|
||||
|
||||
int udatalib_getter_int16(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(INT16, lua_pushinteger)
|
||||
|
||||
int udatalib_getter_uint32(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(UINT32, lua_pushinteger)
|
||||
|
||||
int udatalib_getter_int32(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(INT32, lua_pushinteger)
|
||||
|
||||
int udatalib_getter_uint64(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(UINT64, lua_pushinteger)
|
||||
|
||||
int udatalib_getter_int64(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(INT64, lua_pushinteger)
|
||||
|
||||
int udatalib_getter_string(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(const char*, lua_pushstring)
|
||||
|
||||
int udatalib_getter_boolean(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(boolean, lua_pushboolean)
|
||||
|
||||
int udatalib_getter_spritenum(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(spritenum_t, lua_pushinteger)
|
||||
|
||||
int udatalib_getter_tic(lua_State *L)
|
||||
UDATALIB_SIMPLE_GETTER(tic_t, lua_pushinteger)
|
||||
|
||||
// Setters
|
||||
int udatalib_setter_fixed(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(fixed_t, luaL_checkfixed)
|
||||
|
||||
int udatalib_setter_angle(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(angle_t, luaL_checkangle)
|
||||
|
||||
int udatalib_setter_uint8(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(UINT8, (UINT8)luaL_checkinteger)
|
||||
|
||||
int udatalib_setter_sint8(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(SINT8, luaL_checkinteger)
|
||||
|
||||
int udatalib_setter_uint16(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(UINT16, (UINT16)luaL_checkinteger)
|
||||
|
||||
int udatalib_setter_int16(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(INT16, luaL_checkinteger)
|
||||
|
||||
int udatalib_setter_uint32(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(UINT32, (UINT32)luaL_checkinteger)
|
||||
|
||||
int udatalib_setter_int32(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(INT32, luaL_checkinteger)
|
||||
|
||||
int udatalib_setter_uint64(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(UINT64, (UINT64)luaL_checkinteger)
|
||||
|
||||
int udatalib_setter_int64(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(INT64, luaL_checkinteger)
|
||||
|
||||
int udatalib_setter_string(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(const char*, luaL_checkstring)
|
||||
|
||||
int udatalib_setter_boolean(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(boolean, luaL_checkboolean)
|
||||
|
||||
// ffs
|
||||
int udatalib_setter_boolean_nocheck(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(boolean, lua_toboolean)
|
||||
|
||||
int udatalib_setter_spritenum(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(spritenum_t, luaL_checkinteger)
|
||||
|
||||
int udatalib_setter_tic(lua_State *L)
|
||||
UDATALIB_SIMPLE_SETTER(tic_t, (tic_t)luaL_checkinteger)
|
||||
|
||||
|
||||
void udatalib_addfield(lua_State *L, int mt, udata_field_t field)
|
||||
{
|
||||
int idx = abs_index(L, mt);
|
||||
|
||||
lua_createtable(L, 2, 0); // Push table
|
||||
|
||||
lua_pushinteger(L, field.offset); // Push offset
|
||||
lua_pushcclosure(L, field.getter, 1); // Pop offset, push closure
|
||||
|
||||
lua_rawseti(L, -2, UDATALIB_GETTER); // Pop closure, add to table
|
||||
|
||||
lua_pushinteger(L, field.offset); // Push offset
|
||||
lua_pushcclosure(L, field.setter, 1); // Pop offset, push closure
|
||||
|
||||
lua_rawseti(L, -2, UDATALIB_SETTER); // Pop closure, add to table
|
||||
|
||||
lua_pushstring(L, field.name); // Push field name
|
||||
lua_pushvalue(L, -2); // Copy table
|
||||
lua_rawset(L, idx); // Pop field name and table, add to metatable
|
||||
|
||||
lua_pop(L, 1); // Pop field table
|
||||
}
|
||||
|
||||
void udatalib_addfields(lua_State *L, int mt, const udata_field_t fields[])
|
||||
{
|
||||
for (unsigned i = 0; fields[i].name != NULL; ++i)
|
||||
{
|
||||
udatalib_addfield(L, mt, fields[i]);
|
||||
//CONS_Printf("Add field name=%s, offset=%d, getter=%p, setter=%p\n", fields[i].name, fields[i].offset, fields[i].getter, fields[i].setter);
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
// SONIC ROBO BLAST 2 KART SATURN
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2025 by Indev.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file lua_udatalib.h
|
||||
/// \brief Implementation of lua userdata object metatables based on getter/setter functions
|
||||
|
||||
#ifndef __LUA_UDATALIB_H__
|
||||
#define __LUA_UDATALIB_H__
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
#include "fastcmp.h"
|
||||
|
||||
// Indices in getter/setter tables for fields
|
||||
#define UDATALIB_GETTER 1
|
||||
#define UDATALIB_SETTER 2
|
||||
|
||||
typedef struct udata_field_s {
|
||||
const char *name;
|
||||
size_t offset;
|
||||
lua_CFunction getter;
|
||||
lua_CFunction setter;
|
||||
} udata_field_t;
|
||||
|
||||
// Simple setters and getters, for situations where getter is simply
|
||||
// "return obj.field" and setter is "obj.field = value"
|
||||
int udatalib_getter_fixed(lua_State *L);
|
||||
int udatalib_getter_angle(lua_State *L);
|
||||
int udatalib_getter_uint8(lua_State *L);
|
||||
int udatalib_getter_sint8(lua_State *L);
|
||||
int udatalib_getter_uint16(lua_State *L);
|
||||
int udatalib_getter_int16(lua_State *L);
|
||||
int udatalib_getter_uint32(lua_State *L);
|
||||
int udatalib_getter_int32(lua_State *L);
|
||||
int udatalib_getter_uint64(lua_State *L);
|
||||
int udatalib_getter_int64(lua_State *L);
|
||||
int udatalib_getter_string(lua_State *L);
|
||||
int udatalib_getter_boolean(lua_State *L);
|
||||
int udatalib_getter_spritenum(lua_State *L);
|
||||
int udatalib_getter_mobj(lua_State *L);
|
||||
int udatalib_getter_subsector(lua_State *L);
|
||||
int udatalib_getter_mobjtype(lua_State *L);
|
||||
int udatalib_getter_player(lua_State *L);
|
||||
int udatalib_getter_mapthing(lua_State *L);
|
||||
int udatalib_getter_slope(lua_State *L);
|
||||
int udatalib_getter_cmd(lua_State *L);
|
||||
int udatalib_getter_playerstate(lua_State *L);
|
||||
int udatalib_getter_powers(lua_State *L);
|
||||
int udatalib_getter_kartstuff(lua_State *L);
|
||||
int udatalib_getter_pflags(lua_State *L);
|
||||
int udatalib_getter_panim(lua_State *L);
|
||||
int udatalib_getter_tic(lua_State *L);
|
||||
|
||||
int udatalib_setter_fixed(lua_State *L);
|
||||
int udatalib_setter_angle(lua_State *L);
|
||||
int udatalib_setter_uint8(lua_State *L);
|
||||
int udatalib_setter_sint8(lua_State *L);
|
||||
int udatalib_setter_uint16(lua_State *L);
|
||||
int udatalib_setter_int16(lua_State *L);
|
||||
int udatalib_setter_uint32(lua_State *L);
|
||||
int udatalib_setter_int32(lua_State *L);
|
||||
int udatalib_setter_uint64(lua_State *L);
|
||||
int udatalib_setter_int64(lua_State *L);
|
||||
int udatalib_setter_string(lua_State *L);
|
||||
int udatalib_setter_boolean(lua_State *L);
|
||||
int udatalib_setter_boolean_nocheck(lua_State *L);
|
||||
int udatalib_setter_spritenum(lua_State *L);
|
||||
int udatalib_setter_mobj(lua_State *L);
|
||||
int udatalib_setter_playerstate(lua_State *L);
|
||||
int udatalib_setter_pflags(lua_State *L);
|
||||
int udatalib_setter_panim(lua_State *L);
|
||||
int udatalib_setter_tic(lua_State *L);
|
||||
|
||||
// Adds setter and getter for field and stores it as field.name..".get" and
|
||||
// field.name..".set" in table at index mt. (metatable, usually)
|
||||
void udatalib_addfield(lua_State *L, int mt, udata_field_t field);
|
||||
|
||||
// Convinience function to add array of fields at once.
|
||||
void udatalib_addfields(lua_State *L, int mt, const udata_field_t fields[]);
|
||||
|
||||
// I miss C++ template functons :(
|
||||
|
||||
// Get pointer to field value within getter or setter
|
||||
#define UDATALIB_GETFIELD(type, field) \
|
||||
{ \
|
||||
size_t offset = lua_tointeger(L, lua_upvalueindex(1)); \
|
||||
field = (type*)((uint8_t*)lua_touserdata(L, 1) + offset); \
|
||||
}
|
||||
|
||||
// Creates implementation for simple getter and setter. Super lazy, yes.
|
||||
// Assumes userdata is a pointer to actual data. Maybe not really safe.
|
||||
#define UDATALIB_SIMPLE_GETTER(type, pushf) \
|
||||
{ \
|
||||
type *field; \
|
||||
UDATALIB_GETFIELD(type, field) \
|
||||
pushf(L, *field); \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#define UDATALIB_SIMPLE_SETTER(type, checkf) \
|
||||
{ \
|
||||
type *field; \
|
||||
UDATALIB_GETFIELD(type, field) \
|
||||
*field = checkf(L, 2); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#endif
|
||||
+1
-2
@@ -14,8 +14,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#include <threads.h>
|
||||
#define local_for_thread thread_local
|
||||
#define local_for_thread _Thread_local
|
||||
#else
|
||||
#define local_for_thread
|
||||
#endif
|
||||
|
||||
+18
-7
@@ -3989,6 +3989,10 @@ boolean replaynamesloaded = false;
|
||||
// If it's not equal, that means we started more than one thread (left and re-entered menu for example)
|
||||
size_t replaythreadnum = 0;
|
||||
|
||||
// for replay dates
|
||||
#include <locale.h>
|
||||
const char *demodateformat = "%d.%m.%Y";
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
I_mutex replayquerymutex;
|
||||
|
||||
@@ -4025,6 +4029,7 @@ static void ReplayNamesLoadThread(void* userdata)
|
||||
menudemo_t *demolist_all_local = (menudemo_t*)malloc(sizeof(menudemo_t)*demolist_all_size_local);
|
||||
memcpy(demolist_all_local, demolist_all, sizeof(menudemo_t)*demolist_all_size_local);
|
||||
size_t localreplaythreadnum = replaythreadnum;
|
||||
const char *localdemodateformat = demodateformat;
|
||||
|
||||
Unlock_search_state();
|
||||
|
||||
@@ -4032,13 +4037,7 @@ static void ReplayNamesLoadThread(void* userdata)
|
||||
{
|
||||
if (demolist_all_local[i].type != MD_SUBDIR)
|
||||
{
|
||||
G_LoadDemoTitle(&demolist_all_local[i]);
|
||||
|
||||
// this is fucking horrid, but i wanna be able to search for dates
|
||||
/*if (demolist_all_local[i].date[0] != '\0')
|
||||
{
|
||||
snprintf(demolist_all_local[i].title, sizeof(demolist_all_local[i].title), "%s %s", demolist_all_local[i].title, demolist_all_local[i].date);
|
||||
}*/
|
||||
G_LoadDemoTitle(&demolist_all_local[i], localdemodateformat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4061,6 +4060,18 @@ static void LoadReplayNames(void)
|
||||
Lock_search_state();
|
||||
replaythreadnum++;
|
||||
replaynamesloaded = false;
|
||||
if (cv_demodateformat.value == 2)
|
||||
demodateformat = "%m.%d.%Y";
|
||||
else if (cv_demodateformat.value == 1)
|
||||
demodateformat = "%d.%m.%Y";
|
||||
else
|
||||
{
|
||||
// get the date format here
|
||||
// setlocale reads/writes global state
|
||||
const char *locale = setlocale(LC_TIME, NULL);
|
||||
// US ppl are special (:
|
||||
demodateformat = (locale && strstr(locale, "en_US")) ? "%m.%d.%Y" : "%d.%m.%Y";
|
||||
}
|
||||
Unlock_search_state();
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
|
||||
+32
-67
@@ -97,11 +97,9 @@ static char vidModeName[33][32]; // allow 33 different modes
|
||||
rendermode_t rendermode = render_none;
|
||||
|
||||
#ifdef HWRENDER
|
||||
unsigned msaa = 0;
|
||||
|
||||
// Eee probably the way i organize it isn't best ><
|
||||
// Just don't know where do i put declaration and "implementation"
|
||||
boolean a2c = false;
|
||||
unsigned msaa = 0;
|
||||
#endif
|
||||
|
||||
static void KeyboardLayout_OnChange(void)
|
||||
@@ -197,10 +195,6 @@ static INT32 custom_height = 0;
|
||||
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
|
||||
static void Impl_SetWindowIcon(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
boolean downsample = false;
|
||||
#endif
|
||||
|
||||
static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code)
|
||||
{
|
||||
if (code >= SDL_SCANCODE_A && code <= SDL_SCANCODE_Z)
|
||||
@@ -522,7 +516,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
{
|
||||
I_CheckDesktopRes();
|
||||
#ifdef USE_FBO_OGL
|
||||
I_DownSample();
|
||||
I_CheckDownSampleState(false);
|
||||
#endif
|
||||
windowmoved = SDL_FALSE;
|
||||
}
|
||||
@@ -1263,8 +1257,9 @@ static void I_CheckDesktopRes(void)
|
||||
int currentDisplayIndex = -1;
|
||||
SDL_DisplayMode curmode;
|
||||
|
||||
desktopwidth = 0;
|
||||
desktopheight = 0;
|
||||
// just fallback to game res ig?
|
||||
desktopwidth = vid.width;
|
||||
desktopheight = vid.height;
|
||||
|
||||
currentDisplayIndex = SDL_GetWindowDisplayIndex(window);
|
||||
|
||||
@@ -1274,7 +1269,7 @@ static void I_CheckDesktopRes(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (SDL_GetDesktopDisplayMode(currentDisplayIndex, &curmode) != 0)
|
||||
if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1289,47 +1284,39 @@ boolean I_CheckNativeRes(void)
|
||||
return (vid.width == desktopwidth && vid.height == desktopheight);
|
||||
}
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
|
||||
void RefreshOGLSDLSurface(void)
|
||||
static boolean I_CheckAboveDesktopRes(INT32 width, INT32 height)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
OglSdlSurface(vid.width, vid.height);
|
||||
return (width > desktopwidth || height > desktopheight);
|
||||
}
|
||||
|
||||
void I_DownSample(void)
|
||||
#ifdef USE_FBO_OGL
|
||||
static boolean vid_downsampling = false;
|
||||
|
||||
boolean I_IsDownsampling(void)
|
||||
{
|
||||
boolean needrefresh = false;
|
||||
return vid_downsampling;
|
||||
}
|
||||
|
||||
if (!cv_glframebuffer.value || !supportFBO || (cv_glscreentextures.value == 0)) // no sense to do this crap if we cant benefit from it
|
||||
void I_CheckDownSampleState(boolean forcerefresh)
|
||||
{
|
||||
// no fbo support so we dont care
|
||||
if (!supportFBO)
|
||||
{
|
||||
downsample = false;
|
||||
vid_downsampling = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (I_CheckNativeRes() && (downsample == true))
|
||||
// no sense to do this crap if we cant benefit from it
|
||||
const boolean newdownsamplestate = cv_glframebuffer.value && (cv_glscreentextures.value == 2) && I_CheckAboveDesktopRes(vid.width, vid.height);
|
||||
|
||||
// state changed or fbo was toggled
|
||||
if (vid_downsampling != newdownsamplestate || forcerefresh)
|
||||
{
|
||||
downsample = false;
|
||||
RefreshOGLSDLSurface();
|
||||
return;
|
||||
//printf("downsample changed from %d to %d\n", vid_downsampling, curdownsamplestate);
|
||||
OglSdlSurface(vid.width, vid.height);
|
||||
}
|
||||
|
||||
if ((vid.width > desktopwidth) || (vid.height > desktopheight)) //check if current resolution is higher than current display resolution
|
||||
{
|
||||
downsample = true;
|
||||
needrefresh = true;
|
||||
}
|
||||
else if (downsample == true)
|
||||
{
|
||||
downsample = false;
|
||||
needrefresh = true;
|
||||
}
|
||||
|
||||
if (needrefresh)
|
||||
{
|
||||
RefreshOGLSDLSurface();
|
||||
needrefresh = false;
|
||||
}
|
||||
vid_downsampling = newdownsamplestate;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1359,10 +1346,11 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||
}
|
||||
|
||||
// Reposition window only in windowed mode
|
||||
const int windowpos = SDL_GetWindowDisplayIndex(window);
|
||||
SDL_SetWindowSize(window, width, height);
|
||||
SDL_SetWindowPosition(window,
|
||||
SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_GetWindowDisplayIndex(window)),
|
||||
SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_GetWindowDisplayIndex(window))
|
||||
SDL_WINDOWPOS_CENTERED_DISPLAY(windowpos),
|
||||
SDL_WINDOWPOS_CENTERED_DISPLAY(windowpos)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1384,7 +1372,7 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||
{
|
||||
I_CheckDesktopRes();
|
||||
#ifdef USE_FBO_OGL
|
||||
I_DownSample();
|
||||
I_CheckDownSampleState(false);
|
||||
#endif
|
||||
OglSdlSurface(vid.width, vid.height);
|
||||
}
|
||||
@@ -1825,7 +1813,6 @@ void I_StartupGraphics(void)
|
||||
rendermode = render_opengl;
|
||||
|
||||
msaa = 0; boolean msaa_set = false;
|
||||
a2c = false; boolean a2c_set = false;
|
||||
|
||||
// MSAA antialiasing
|
||||
if (M_CheckParm("-msaa") && M_IsNextParm())
|
||||
@@ -1837,16 +1824,6 @@ void I_StartupGraphics(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (M_CheckParm("-a2c"))
|
||||
{
|
||||
a2c = true;
|
||||
a2c_set = true;
|
||||
}
|
||||
else if (M_CheckParm("-noa2c"))
|
||||
{
|
||||
a2c_set = true;
|
||||
}
|
||||
|
||||
{
|
||||
char line[16];
|
||||
char * word;
|
||||
@@ -1890,19 +1867,10 @@ void I_StartupGraphics(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("Using last know MSAA value: %u\n", msaa);
|
||||
CONS_Printf("Using last known MSAA value: %u\n", msaa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!a2c_set)
|
||||
{
|
||||
if (fasticmp(word, "a2c"))
|
||||
{
|
||||
a2c = true;
|
||||
CONS_Printf("Using a2c because it was specified to be used earlier\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
@@ -1937,9 +1905,6 @@ void I_StartupGraphics(void)
|
||||
|
||||
#ifdef HWRENDER
|
||||
fprintf(file, "msaa %u\n", msaa);
|
||||
|
||||
if (a2c)
|
||||
fputs("a2c\n", file);
|
||||
#endif
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
+6
-10
@@ -65,7 +65,7 @@ PFNglGetString pglGetString;
|
||||
#ifdef USE_FBO_OGL
|
||||
boolean UseScreenFBO(void)
|
||||
{
|
||||
return (supportFBO && cv_glframebuffer.value && downsample);
|
||||
return (supportFBO && cv_glframebuffer.value && I_IsDownsampling() && (cv_glscreentextures.value == 2));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -203,9 +203,9 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (UseScreenFBO())
|
||||
GL_Framebuffer_Enable();
|
||||
GL_FBO_Enable();
|
||||
else
|
||||
GL_Framebuffer_Disable();
|
||||
GL_FBO_Disable();
|
||||
#endif
|
||||
|
||||
if (!first_init)
|
||||
@@ -235,9 +235,7 @@ void OglSdlFinishUpdate(SDL_Window *window)
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (usefbo)
|
||||
{
|
||||
GL_Framebuffer_Unbind();
|
||||
}
|
||||
GL_FBO_BindMainFrameBuffer();
|
||||
#endif
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
@@ -255,9 +253,7 @@ void OglSdlFinishUpdate(SDL_Window *window)
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (usefbo)
|
||||
{
|
||||
GL_Framebuffer_Enable();
|
||||
}
|
||||
GL_FBO_Enable();
|
||||
#endif
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
@@ -268,7 +264,7 @@ void OglSdlFinishUpdate(SDL_Window *window)
|
||||
// effects that want to take the old screen can do so after this
|
||||
// well we dont need it on native res it seems
|
||||
#ifdef USE_FBO_OGL
|
||||
if ((!I_CheckNativeRes() && !usefbo) || WipeInAction)
|
||||
if (!usefbo && (!I_CheckNativeRes() || WipeInAction))
|
||||
#else
|
||||
if (!I_CheckNativeRes() || WipeInAction)
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user