Make use of webgl2 where available.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6081 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
7d7cb5f40c
commit
947d41ea95
4 changed files with 20 additions and 8 deletions
|
@ -1790,6 +1790,9 @@ ifeq ($(FTE_TARGET),web)
|
|||
# EMCC_CFLAGS+= -s BINARYEN_TRAP_MODE='clamp' #fix bigfloat->int rounding crashes
|
||||
EMCC_CFLAGS+= -s LEGACY_GL_EMULATION=0 #simplify the opengl wrappers.
|
||||
EMCC_CFLAGS+= -s NO_FILESYSTEM=1 #we have our own.
|
||||
EMCC_CFLAGS+= -s FILESYSTEM=0 #we have our own.
|
||||
EMCC_CFLAGS+= -s ALLOW_MEMORY_GROWTH=1 #reduce crashes...
|
||||
EMCC_CFLAGS+= -s MAX_WEBGL_VERSION=2 #make use of what we can.
|
||||
EMCC_LDFLAGS+=-s ERROR_ON_UNDEFINED_SYMBOLS=1 #fairly obvious. no runtime errors please.
|
||||
RELEASE_CFLAGS=-DOMIT_QCC -DGL_STATIC $(EMCC_CFLAGS)
|
||||
DEBUG_CFLAGS=-g4 -DOMIT_QCC -DGL_STATIC $(EMCC_CFLAGS)
|
||||
|
|
|
@ -4030,7 +4030,15 @@ uploadfmt_t Surf_NameToFormat(const char *nam)
|
|||
if (!Q_strcasecmp(nam, "argb1555"))
|
||||
return PTI_ARGB1555;
|
||||
if (!Q_strcasecmp(nam, "rgbx8") || !Q_strcasecmp(nam, "bgrx8") || !Q_strcasecmp(nam, "rgba8") || !Q_strcasecmp(nam, "bgra8"))
|
||||
return PTI_BGRX8; //most common formats...
|
||||
{ //most common format(s) for lightmaps in various engines...
|
||||
if (sh_config.texfmt[PTI_BGRX8])
|
||||
return PTI_BGRX8; //probably fastest
|
||||
if (sh_config.texfmt[PTI_RGBX8])
|
||||
return PTI_RGBX8; //no bgr? odd...
|
||||
if (sh_config.texfmt[PTI_BGRA8])
|
||||
return PTI_BGRA8; //no padded formats at all? erk!
|
||||
return PTI_RGBA8; //probably the slowest for pc hardware.
|
||||
}
|
||||
if (!Q_strcasecmp(nam, "rgb8") || !Q_strcasecmp(nam, "bgr8"))
|
||||
return PTI_RGB8; //generally not recommended (misaligned so the gpu has to compensate)
|
||||
if (!Q_strcasecmp(nam, "l8"))
|
||||
|
|
|
@ -159,8 +159,8 @@ void GL_SetupFormats(void)
|
|||
if (!gl_config.webgl_ie)
|
||||
{ //these should work on all gles2+webgl1 devices, but microsoft doesn't give a shit.
|
||||
glfmtc(PTI_RGB565, (ver>=3)?GL_RGB565:0, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, tc_rgb);
|
||||
// glfmtc(PTI_RGBA4444,(ver>=3)?GL_RGBA4:0, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, tc_rgba8);
|
||||
// glfmtc(PTI_RGBA5551,(ver>=3)?GL_RGB555A1:0, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, tc_rgba1);
|
||||
glfmtc(PTI_RGBA4444,(ver>=3)?GL_RGBA4:0, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, tc_rgba8);
|
||||
glfmtc(PTI_RGBA5551,(ver>=3)?GL_RGB5_A1:0, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, tc_rgba1);
|
||||
}
|
||||
if (GL_CheckExtension("GL_OES_texture_half_float"))
|
||||
glfmt(PTI_RGBA16F, (ver>=3)?GL_RGBA16F:0, GL_RGBA, GL_RGBA, GL_HALF_FLOAT_OES); //not to be confused with GL_HALF_FLOAT[_ARB] which has a different value
|
||||
|
@ -226,7 +226,7 @@ void GL_SetupFormats(void)
|
|||
glfmtc(PTI_BGRA8_SRGB, GL_SRGB8_ALPHA8_EXT,GL_SRGB_ALPHA_EXT, GL_BGRA_EXT, GL_UNSIGNED_BYTE, tc_srgba8);
|
||||
}
|
||||
}
|
||||
else if (ver >= 3.3)
|
||||
else if (ver >= 3.3 && !gl_config_gles)
|
||||
{
|
||||
glfmtsw(PTI_BGR8, GL_RGB8, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, 0, GL_BLUE, GL_GREEN, GL_RED, GL_ONE);
|
||||
glfmtsw(PTI_BGRX8, GL_RGB8, GL_RGB, GL_RGBA, GL_UNSIGNED_BYTE, tc_rgb, GL_BLUE, GL_GREEN, GL_RED, GL_ONE);
|
||||
|
|
|
@ -1190,10 +1190,11 @@ static qboolean GL_CheckExtensions (void *(*getglfunction) (char *name))
|
|||
|
||||
if (gl_config.gles)
|
||||
{ //gles has different TexImage2D arguments for specifying quality.
|
||||
gl_config.arb_depth_texture = GL_CheckExtension("GL_OES_depth_texture"); //gles2
|
||||
gl_config.arb_depth_texture |= GL_CheckExtension("GL_CHROMIUM_depth_texture"); //nacl
|
||||
gl_config.arb_depth_texture |= GL_CheckExtension("GL_WEBGL_depth_texture"); //webgl. duh.
|
||||
gl_config.arb_depth_texture |= GL_CheckExtension("GL_ANGLE_depth_texture"); //gah. should just use wildcards huh (no uploads)
|
||||
gl_config.arb_depth_texture = gl_config.glversion >= 3.0
|
||||
|| GL_CheckExtension("GL_OES_depth_texture") //gles2
|
||||
|| GL_CheckExtension("GL_CHROMIUM_depth_texture") //nacl
|
||||
|| GL_CheckExtension("GL_WEBGL_depth_texture") //webgl. duh.
|
||||
|| GL_CheckExtension("GL_ANGLE_depth_texture"); //gah. should just use wildcards huh (no uploads)
|
||||
gl_config.arb_shadow = gl_config.glversion>=3.0;//||GL_CheckExtension("GL_EXT_shadow_samplers");
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue