fix up gles2-only targets

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5218 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-03-05 04:00:56 +00:00
parent 685404250f
commit 0da0e97fc5
8 changed files with 55 additions and 30 deletions

View file

@ -539,9 +539,9 @@ else
#at the same time, -print-multiarch is not present, buggy, or just screwed in many gcc builds (ones that target a single arch will unhelpfully just give an empty string).
#so try multiarch first, and if that fails risk dumpmachine giving the wrong values.
#really we want dumpmachine's more specific cpu arch included here, so lets hope that idiot burns for all eternity. or something equally melodramatic.
ARCH:=$(shell $(CC) -print-multiarch)
ARCH:=$(shell $(CC) -print-multiarch 2>/dev/null)
ifneq ($(words $(ARCH)),1)
ARCH:=$(shell $(CC) -dumpmachine)
ARCH:=$(shell $(CC) -dumpmachine 2>/dev/null)
endif
#foo:=$(shell echo ARCH is $(ARCH) 1>&2 )
endif

View file

@ -2767,6 +2767,9 @@ void Image_WriteKTXFile(const char *filename, struct pendingtextureinfo *mips)
case PTI_DEPTH32: header.glinternalformat = 0x81A7/*GL_DEPTH_COMPONENT32*/; header.glbaseinternalformat = 0x1902/*GL_DEPTH_COMPONENT*/; header.glformat = 0x1902/*GL_DEPTH_COMPONENT*/; header.gltype = 0x1406/*GL_FLOAT*/; header.gltypesize = 4; break;
case PTI_DEPTH24_8: header.glinternalformat = 0x88F0/*GL_DEPTH24_STENCIL8*/; header.glbaseinternalformat = 0x84F9/*GL_DEPTH_STENCIL*/; header.glformat = 0x84F9/*GL_DEPTH_STENCIL*/; header.gltype = 0x84FA/*GL_UNSIGNED_INT_24_8*/; header.gltypesize = 4; break;
#ifdef FTE_TARGET_WEB
case PTI_WHOLEFILE:
#endif
case PTI_EMULATED:
case PTI_MAX:
return;

View file

@ -814,7 +814,7 @@ qboolean GL_LoadTextureMips(texid_t tex, const struct pendingtextureinfo *mips)
if (gl_config.formatinfo[encoding].type)
qglTexImage3D (targ, i, ifmt, mips->mip[i].width, mips->mip[i].height, mips->mip[0].depth, 0, gl_config.formatinfo[encoding].format, gl_config.formatinfo[encoding].type, mips->mip[i].data);
else
qglCompressedTexImage3DARB (targ, i, ifmt, mips->mip[i].width, mips->mip[i].height, mips->mip[0].depth, 0, mips->mip[i].datasize, mips->mip[i].data);
qglCompressedTexImage3D (targ, i, ifmt, mips->mip[i].width, mips->mip[i].height, mips->mip[0].depth, 0, mips->mip[i].datasize, mips->mip[i].data);
}
}
}
@ -867,7 +867,7 @@ qboolean GL_LoadTextureMips(texid_t tex, const struct pendingtextureinfo *mips)
if (gl_config.formatinfo[encoding].type)
qglTexImage2D (targface, j, ifmt, mips->mip[i].width, mips->mip[i].height, 0, gl_config.formatinfo[encoding].format, gl_config.formatinfo[encoding].type, mips->mip[i].data);
else
qglCompressedTexImage2DARB (targface, j, ifmt, mips->mip[i].width, mips->mip[i].height, 0, mips->mip[i].datasize, mips->mip[i].data);
qglCompressedTexImage2D (targface, j, ifmt, mips->mip[i].width, mips->mip[i].height, 0, mips->mip[i].datasize, mips->mip[i].data);
}
}
@ -965,7 +965,7 @@ qboolean GL_LoadTextureMips(texid_t tex, const struct pendingtextureinfo *mips)
out.mip[i].width = mips->mip[i].width;
out.mip[i].height = mips->mip[i].height;
out.mip[i].depth = mips->mip[i].depth;
qglGetCompressedTexImageARB(targ, j, out.mip[i].data);
qglGetCompressedTexImage(targ, j, out.mip[i].data);
}
Image_WriteKTXFile(va("textures/%s.ktx", tex->ident), &out);

View file

@ -33,10 +33,6 @@ void R_RenderBrushPoly (msurface_t *fa);
extern int gl_stencilbits;
FTEPFNGLCOMPRESSEDTEXIMAGE3DARBPROC qglCompressedTexImage3DARB;
FTEPFNGLCOMPRESSEDTEXIMAGE2DARBPROC qglCompressedTexImage2DARB;
FTEPFNGLGETCOMPRESSEDTEXIMAGEARBPROC qglGetCompressedTexImageARB;
extern int r_visframecount; // bumped when going to a new PVS
extern int r_framecount; // used for dlight push checking

View file

@ -45,6 +45,9 @@ void (APIENTRY *qglStencilOp) (GLenum fail, GLenum zfail, GLenum zpass);
void (APIENTRY *qglStencilFunc) (GLenum func, GLint ref, GLuint mask);
void (APIENTRY *qglDeleteTextures) (GLsizei n, const GLuint *textures);
FTEPFNGLCOMPRESSEDTEXIMAGE2DARBPROC qglCompressedTexImage2D;
void (APIENTRY *qglCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); //gl1.3
void (APIENTRY *qglGenFramebuffersEXT)(GLsizei n, GLuint* ids);
void (APIENTRY *qglDeleteFramebuffersEXT)(GLsizei n, const GLuint* ids);
void (APIENTRY *qglBindFramebufferEXT)(GLenum target, GLuint id);
@ -193,8 +196,9 @@ void *(APIENTRY *qglMapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr l
void (APIENTRY *qglTexStorage2D)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); //gl4.2
void (APIENTRY *qglTexStorage3D)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); //gl4.2
FTEPFNGLGETCOMPRESSEDTEXIMAGEARBPROC qglGetCompressedTexImage;
void (APIENTRY *qglCompressedTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); //gl1.3
void (APIENTRY *qglCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); //gl1.3
FTEPFNGLCOMPRESSEDTEXIMAGE3DARBPROC qglCompressedTexImage3D;
void (APIENTRY *qglGenVertexArrays)(GLsizei n, GLuint *arrays);
void (APIENTRY *qglBindVertexArray)(GLuint vaoarray);
@ -781,39 +785,41 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
if (GL_CheckExtension("GL_ARB_depth_clamp") || GL_CheckExtension("GL_NV_depth_clamp"))
gl_config.arb_depth_clamp = true;
#ifndef GL_STATIC
if (gl_config.gles)
{ //GL_ARB_texture_compression is not quite supported in gles, but works for custom compressed formats (like etc2).
qglCompressedTexImage2DARB = (void *)getglext("glCompressedTexImage2D");
qglCompressedTexImage3DARB = (void *)getglext("glCompressedTexImage3D");
qglCompressedTexImage2D = (void *)getglext("glCompressedTexImage2D");
qglCompressedTexImage3D = (void *)getglext("glCompressedTexImage3D");
qglCompressedTexSubImage2D = (void *)getglext("glCompressedTexSubImage2D");
qglCompressedTexSubImage3D = (void *)getglext("glCompressedTexSubImage3D");
qglGetCompressedTexImageARB = NULL;
qglGetCompressedTexImage = NULL;
}
else if (!gl_config.gles && gl_config.glversion > 1.3)
{ //GL_ARB_texture_compression is core in gl1.3
qglCompressedTexImage2DARB = (void *)getglext("glCompressedTexImage2D");
qglCompressedTexImage3DARB = (void *)getglext("glCompressedTexImage3D");
qglCompressedTexImage2D = (void *)getglext("glCompressedTexImage2D");
qglCompressedTexImage3D = (void *)getglext("glCompressedTexImage3D");
qglCompressedTexSubImage2D = (void *)getglext("glCompressedTexSubImage2D");
qglCompressedTexSubImage3D = (void *)getglext("glCompressedTexSubImage3D");
qglGetCompressedTexImageARB = (void *)getglext("glGetCompressedTexImage");
qglGetCompressedTexImage = (void *)getglext("glGetCompressedTexImage");
gl_config.arb_texture_compression = true;
}
else if (GL_CheckExtension("GL_ARB_texture_compression"))
{
qglCompressedTexImage2DARB = (void *)getglext("glCompressedTexImage2DARB");
qglCompressedTexImage3DARB = (void *)getglext("glCompressedTexImage3DARB");
qglCompressedTexImage2D = (void *)getglext("glCompressedTexImage2DARB");
qglCompressedTexImage3D = (void *)getglext("glCompressedTexImage3DARB");
qglCompressedTexSubImage2D = (void *)getglext("glCompressedTexSubImage2DARB");
qglCompressedTexSubImage3D = (void *)getglext("glCompressedTexSubImage3DARB");
qglGetCompressedTexImageARB = (void *)getglext("glGetCompressedTexImageARB");
qglGetCompressedTexImage = (void *)getglext("glGetCompressedTexImageARB");
if (!qglCompressedTexImage2DARB || !qglGetCompressedTexImageARB)
if (!qglCompressedTexImage2D || !qglGetCompressedTexImage)
{
qglCompressedTexImage2DARB = NULL;
qglGetCompressedTexImageARB = NULL;
qglCompressedTexImage2D = NULL;
qglGetCompressedTexImage = NULL;
}
else
gl_config.arb_texture_compression = true;
}
#endif
/*
if (GL_CheckExtension("GL_EXT_depth_bounds_test"))
qglDepthBoundsEXT = (void *)getglext("glDepthBoundsEXT");

View file

@ -198,9 +198,6 @@ extern DELTEXFUNCPTR delTexFunc;
extern TEXSUBIMAGEPTR TexSubImage2DFunc;
extern void (APIENTRY *qglStencilOpSeparateATI) (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
#endif
extern FTEPFNGLCOMPRESSEDTEXIMAGE2DARBPROC qglCompressedTexImage2DARB;
extern FTEPFNGLCOMPRESSEDTEXIMAGE3DARBPROC qglCompressedTexImage3DARB;
extern FTEPFNGLGETCOMPRESSEDTEXIMAGEARBPROC qglGetCompressedTexImageARB;
extern FTEPFNGLPNTRIANGLESIATIPROC qglPNTrianglesiATI;
extern FTEPFNGLPNTRIANGLESFATIPROC qglPNTrianglesfATI;
extern void (APIENTRY *qglPatchParameteriARB)(GLenum pname, GLint value); //core in gl4
@ -237,7 +234,7 @@ typedef struct {
qboolean arb_texture_env_dot3;
qboolean arb_texture_cube_map;
qboolean arb_texture_compression;
qboolean arb_texture_compression; //means we support dynamic compression, rather than any specific compressed texture formats
qboolean geometryshaders;
@ -680,6 +677,8 @@ extern void (APIENTRY *qglTexParameteri) (GLenum target, GLenum pname, GLint par
extern void (APIENTRY *qglTexParameteriv) (GLenum target, GLenum pname, const GLint *params);
extern void (APIENTRY *qglTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
extern void (APIENTRY *qglViewport) (GLint x, GLint y, GLsizei width, GLsizei height);
extern FTEPFNGLCOMPRESSEDTEXIMAGE2DARBPROC qglCompressedTexImage2D;
extern void (APIENTRY *qglCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); //gl1.3
extern void (APIENTRY *qglGenFramebuffersEXT)(GLsizei n, GLuint* ids);
extern void (APIENTRY *qglDeleteFramebuffersEXT)(GLsizei n, const GLuint* ids);
@ -1021,6 +1020,10 @@ extern void (APIENTRY *qglTranslatef) (GLfloat x, GLfloat y, GLfloat z);
extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4x3fv;
extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix3x4fv;
extern FTEPFNGLCOMPRESSEDTEXIMAGE3DARBPROC qglCompressedTexImage3D;
extern void (APIENTRY *qglCompressedTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); //gl1.3
extern FTEPFNGLGETCOMPRESSEDTEXIMAGEARBPROC qglGetCompressedTexImage;
extern const GLubyte * (APIENTRY * qglGetStringi) (GLenum name, GLuint index);
/*
@ -1081,9 +1084,6 @@ extern void (APIENTRY *qglBindVertexArray)(GLuint vaoarray);
extern void (APIENTRY *qglTexStorage2D)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); //gl4.2
extern void (APIENTRY *qglTexStorage3D)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); //gl4.2
extern void (APIENTRY *qglCompressedTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); //gl1.3
extern void (APIENTRY *qglCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); //gl1.3
//glslang helper api

View file

@ -891,6 +891,26 @@ typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);
#define GL_RGBA32F_ARB 0x8814
#endif
#ifndef GL_RED
//gles2 does not support swizzles, but gles3 does
#define GL_RED 0x1903
#define GL_GREEN 0x1904
#define GL_BLUE 0x1905
#endif
#ifndef GL_RGBA8
//gles2 does not support sized formats, but gl1.1 and gles3 do.
#define GL_RGBA8 0x8058
#define GL_RGB8 0x8051
#define GL_RGB10_A2 0x8059
#define GL_RGB5 0x8050 //note: not in gles3. a poor-man's substitute for rgb565
#define GL_RGBA4 0x8056
#define GL_RGB5_A1 0x8057
#endif
#ifndef GL_LUMINANCE8
#define GL_LUMINANCE8 0x8040 //not in gles2, nor gl3core (use gl_red+swizzles for gles3)
#define GL_LUMINANCE8_ALPHA8 0x8045 //not in gles2, nor gl3core (use gl_red+swizzles for gles3)
#endif
#ifndef GL_SAMPLES_PASSED_ARB
#define GL_SAMPLES_PASSED_ARB 0x8914

View file

@ -261,7 +261,7 @@ static int QDECL FSWEB_EnumerateFiles (searchpathfuncs_t *handle, const char *ma
}
searchpathfuncs_t *QDECL FSWEB_OpenPath(vfsfile_t *mustbenull, const char *desc, const char *prefix)
searchpathfuncs_t *QDECL FSWEB_OpenPath(vfsfile_t *mustbenull, searchpathfuncs_t *parent, const char *filename, const char *desc, const char *prefix)
{
webpath_t *np;
int dlen = strlen(desc);