Commit 6e61f8b9 authored by Richard Gobeille's avatar Richard Gobeille
Browse files

engine: fix USE_OPENGL=0 build and remove software mode hightile dependence on USE_OPENGL=1 builds

This should allow stuff like the upscale pack to work on devices where OpenGL isn't available at all.
parent ce205538
......@@ -112,10 +112,6 @@ extern float g_videoGamma, g_videoContrast, g_videoBrightness;
#define GAMMA_CALC ((int32_t)(min(max((float)((g_videoGamma - 1.0f) * 10.0f), 0.f), 15.f)))
#ifdef USE_OPENGL
extern int32_t (*baselayer_osdcmd_vidmode_func)(osdcmdptr_t parm);
extern int osdcmd_glinfo(osdcmdptr_t parm);
struct glinfo_t {
const char *vendor;
const char *renderer;
......@@ -155,6 +151,9 @@ struct glinfo_t {
extern struct glinfo_t glinfo;
#ifdef USE_OPENGL
extern int32_t (*baselayer_osdcmd_vidmode_func)(osdcmdptr_t parm);
extern int osdcmd_glinfo(osdcmdptr_t parm);
extern void fill_glinfo(void);
#endif
......
......@@ -1057,8 +1057,10 @@ enum
VF_NOTRANS = 1,
};
extern int32_t usehightile;
#ifdef USE_OPENGL
extern int32_t usemodels, usehightile;
extern int32_t usemodels;
extern int32_t rendmode;
#endif
extern uint8_t globalr, globalg, globalb;
......
......@@ -477,6 +477,19 @@ int32_t vsync=0;
int32_t r_finishbeforeswap=0;
int32_t r_glfinish=0;
struct glinfo_t glinfo =
{
"Unknown", // vendor
"Unknown", // renderer
"0.0.0", // version
"", // extensions
1.0, // max anisotropy
64, // max texture size
0, // structure filled
0, // supported extensions
};
// DEBUG OUTPUT
#ifdef USE_OPENGL
void PR_CALLBACK gl_debugOutputCallback(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam)
......@@ -509,19 +522,6 @@ void PR_CALLBACK gl_debugOutputCallback(GLenum source,GLenum type,GLuint id,GLen
VLOG_F(type == GL_DEBUG_TYPE_ERROR_ARB ? (int)loguru::Verbosity_ERROR : LOG_GL, "%s (%s severity)", message, s);
}
struct glinfo_t glinfo =
{
"Unknown", // vendor
"Unknown", // renderer
"0.0.0", // version
"", // extensions
1.0, // max anisotropy
64, // max texture size
0, // structure filled
0, // supported extensions
};
void fill_glinfo(void)
{
glinfo.extensions = (const char *)glGetString(GL_EXTENSIONS);
......@@ -799,6 +799,7 @@ int32_t baselayer_init(void)
{ "r_screenaspect","if using r_usenewaspect and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",
(void *) &r_screenxy, SCREENASPECT_CVAR_TYPE, 0, 9999 },
{ "r_fpgrouscan","use floating-point numbers for slope rendering",(void *) &r_fpgrouscan, CVAR_BOOL, 0, 1 },
{ "r_hightile","enable/disable hightile texture rendering",(void *) &usehightile, CVAR_BOOL, 0, 1 },
{ "r_novoxmips","turn off/on the use of mipmaps when rendering 8-bit voxels",(void *) &novoxmips, CVAR_BOOL, 0, 1 },
{ "r_rotatespriteinterp", "interpolate repeated rotatesprite calls", (void *)&r_rotatespriteinterp, CVAR_BOOL, 0, 1 },
{ "r_voxels","enable/disable automatic sprite->voxel rendering",(void *) &usevoxels, CVAR_BOOL, 0, 1 },
......
......@@ -11,17 +11,13 @@
#include "baselayer.h"
#include "scriptfile.h"
#include "cache1d.h"
#include "hightile.h"
#include "kplib.h"
#include "lz4.h"
#include "common.h"
#include "mdsprite.h" // md3model_t
#include "colmatch.h"
#include "screentext.h"
#ifdef USE_OPENGL
# include "hightile.h"
#endif
#include "vfs.h"
enum scripttoken_t
......@@ -508,9 +504,7 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getnumber(script,&g)) break;
if (scriptfile_getnumber(script,&b)) break;
if (scriptfile_getnumber(script,&f)) break; //effects
#ifdef USE_OPENGL
hicsetpalettetint(pal,r,g,b,0,0,0,f);
#endif
}
break;
case T_ALPHAHACK:
......@@ -2214,9 +2208,7 @@ static int32_t defsparser(scriptfile *script)
break;
}
#ifdef USE_OPENGL
hicsetpalettetint(pal,red,green,blue,shadered,shadegreen,shadeblue,flags);
#endif
}
break;
case T_MAKEPALOOKUP:
......@@ -2348,9 +2340,7 @@ static int32_t defsparser(scriptfile *script)
int32_t pal=-1, xsiz = 0, ysiz = 0;
char *fn = NULL;
double alphacut = -1.0, xscale = 1.0, yscale = 1.0, specpower = 1.0, specfactor = 1.0;
#ifdef USE_OPENGL
char flags = 0;
#endif
static const tokenlist texturetokens_pal[] =
{
......@@ -2386,7 +2376,6 @@ static int32_t defsparser(scriptfile *script)
scriptfile_getdouble(script,&specpower); break;
case T_SPECFACTOR:
scriptfile_getdouble(script,&specfactor); break;
#ifdef USE_OPENGL
case T_NOCOMPRESS:
flags |= HICR_NOTEXCOMPRESS; break;
case T_NODOWNSIZE:
......@@ -2397,7 +2386,6 @@ static int32_t defsparser(scriptfile *script)
flags |= HICR_ARTIMMUNITY; break;
case T_INDEXED:
flags |= HICR_INDEXED|HICR_NOTEXCOMPRESS|HICR_NODOWNSIZE; break;
#endif
case T_ORIGSIZEX:
scriptfile_getnumber(script, &xsiz);
break;
......@@ -2430,12 +2418,10 @@ static int32_t defsparser(scriptfile *script)
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
tileSetupDummy(tile);
}
#ifdef USE_OPENGL
xscale = 1.0f / xscale;
yscale = 1.0f / yscale;
hicsetsubsttex(tile,pal,fn,alphacut,xscale,yscale, specpower, specfactor,flags);
#endif
}
break;
case T_DETAIL: case T_GLOW: case T_SPECULAR: case T_NORMAL:
......
......@@ -19,6 +19,7 @@
#include "crc32.h"
#include "editor.h"
#include "engine_priv.h"
#include "hightile.h"
#include "kplib.h"
#include "lz4.h"
#include "microprofile.h"
......@@ -32,7 +33,6 @@
#ifdef USE_OPENGL
# include "glad/glad.h"
# include "glsurface.h"
# include "hightile.h"
# include "mdsprite.h"
# ifdef POLYMER
# include "polymer.h"
......
......@@ -6,8 +6,6 @@
#include "build.h"
#include "hightile.h"
#ifdef USE_OPENGL
#include "baselayer.h"
#include "compat.h"
#include "engine_priv.h"
......@@ -17,6 +15,7 @@ polytint_t hictinting[MAXPALOOKUPS];
hicreplctyp *hicreplc[MAXTILES];
int32_t hicinitcounter = 0;
int32_t usehightile=1;
//
// find the index into hicreplc[] which contains the replacement tile particulars
......@@ -334,51 +333,3 @@ void hictinting_applypixcolor(coltype* tcol, uint8_t pal, bool no_rb_swap)
break;
}
}
#else /* USE_OPENGL */
#include "compat.h"
void hicsetpalettetint(int32_t palnum, char r, char g, char b, char sr, char sg, char sb, polytintflags_t effect)
{
UNREFERENCED_PARAMETER(palnum);
UNREFERENCED_PARAMETER(r);
UNREFERENCED_PARAMETER(g);
UNREFERENCED_PARAMETER(b);
UNREFERENCED_PARAMETER(sr);
UNREFERENCED_PARAMETER(sg);
UNREFERENCED_PARAMETER(sb);
UNREFERENCED_PARAMETER(effect);
}
int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut)
{
UNREFERENCED_PARAMETER(picnum);
UNREFERENCED_PARAMETER(palnum);
UNREFERENCED_PARAMETER(filen);
UNREFERENCED_PARAMETER(alphacut);
return 0;
}
int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6], int32_t flags)
{
UNREFERENCED_PARAMETER(picnum);
UNREFERENCED_PARAMETER(palnum);
UNREFERENCED_PARAMETER(faces);
UNREFERENCED_PARAMETER(flags);
return 0;
}
int32_t hicclearsubst(int32_t picnum, int32_t palnum)
{
UNREFERENCED_PARAMETER(picnum);
UNREFERENCED_PARAMETER(palnum);
return 0;
}
void hictinting_applypixcolor(coltype* tcol, uint8_t pal, bool no_rb_swap)
{
UNREFERENCED_PARAMETER(tcol);
UNREFERENCED_PARAMETER(pal);
UNREFERENCED_PARAMETER(no_rb_swap);
}
#endif
......@@ -55,7 +55,6 @@ extern char textfont[2048], smalltextfont[2048];
int32_t rendmode=0;
int32_t usemodels=1;
int32_t usehightile=1;
typedef struct { float x, cy[2], fy[2]; int32_t tag; int16_t n, p, ctag, ftag; } vsptyp;
#define VSPMAX 2048 //<- careful!
......@@ -9990,7 +9989,6 @@ void polymost_initosdfuncs(void)
{ "r_finishbeforeswap", "run glFinish() before swapping when 'r_glfinish' is 1 and when not using KMT vsync", (void *) &r_finishbeforeswap, CVAR_BOOL, 0, 1 },
{ "r_fullbrights","enable/disable fullbright textures",(void *) &r_fullbrights, CVAR_BOOL, 0, 1 },
{ "r_glfinish", "run glFinish() after swapping buffers when not using KMT vsync", (void *) &r_glfinish, CVAR_BOOL, 0, 1 },
{ "r_hightile","enable/disable hightile texture rendering",(void *) &usehightile, CVAR_BOOL, 0, 1 },
{ "r_models", "enable/disable model rendering", (void *)&usemodels, CVAR_BOOL, 0, 1 },
{ "r_nofog", "enable/disable GL fog", (void *)&nofog, CVAR_BOOL, 0, 1},
{ "r_npotwallmode", "enable/disable emulation of walls with non-power-of-two height textures (Polymost, r_hightile 0)",
......
......@@ -419,7 +419,7 @@ static void G_DoLoadScreen(const char *statustext, int percent)
}
static void cacheExtraTextureMaps(int tileNum, int type)
{
{
#ifdef USE_OPENGL
for (int i = 0; i < MAXPALOOKUPS-RESERVEDPALS-1; i++)
{
......@@ -428,6 +428,9 @@ static void cacheExtraTextureMaps(int tileNum, int type)
#endif
polymost_precache(tileNum, i, type);
}
#else
UNREFERENCED_PARAMETER(tileNum);
UNREFERENCED_PARAMETER(type);
#endif
#ifdef USE_GLEXT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment