Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 8709 → Rev 8710

/source/build/include/baselayer.h
102,31 → 102,37
const char *extensions;
 
float maxanisotropy;
char bgra;
char clamptoedge;
char texcompr;
char texnpot;
char arbfp;
char depthtex;
char shadow;
char fbos;
char rect;
char multitex;
char envcombine;
char vbos;
char vsync;
char sm4;
char occlusionqueries;
char glsl;
char debugoutput;
char bufferstorage;
char sync;
char depthclamp;
char clipcontrol;
char dumped;
 
int filled;
 
union {
uint32_t features;
struct
{
int bgra : 1;
int bufferstorage : 1;
int clamptoedge : 1;
int debugoutput : 1;
int depthclamp : 1;
int depthtex : 1;
int fbos : 1;
int glsl : 1;
int multitex : 1;
int occlusionqueries : 1;
int rect : 1;
int shadow : 1;
int sync : 1;
int texcompr : 1;
int texnpot : 1;
int vbos : 1;
int vsync : 1;
};
};
};
 
extern struct glinfo_t glinfo;
 
extern void fill_glinfo(void);
#endif
 
vec2_t CONSTEXPR const g_defaultVideoModes []
/source/build/src/baselayer.cpp
266,30 → 266,85
"", // extensions
 
1.0, // max anisotropy
0, // brga texture format
0, // clamp-to-edge support
0, // texture compression
0, // non-power-of-two textures
0, // ARBfp
0, // depth textures
0, // shadow comparison
0, // Frame Buffer Objects
0, // rectangle textures
0, // multitexturing
0, // env_combine
0, // Vertex Buffer Objects
0, // VSync support
0, // Shader Model 4 support
0, // Occlusion Queries
0, // GLSL
0, // Debug Output
0, // Buffer storage
0, // Sync
0, // Depth Clamp
0, // Clip Control
0, // GL info dumped
0, // structure filled
0, // supported extensions
};
 
void fill_glinfo(void)
{
glinfo.extensions = (const char *)glGetString(GL_EXTENSIONS);
glinfo.renderer = (const char *)glGetString(GL_RENDERER);
glinfo.vendor = (const char *)glGetString(GL_VENDOR);
glinfo.version = (const char *)glGetString(GL_VERSION);
 
#ifdef POLYMER
if (!Bstrcmp(glinfo.vendor, "ATI Technologies Inc."))
{
pr_ati_fboworkaround = 1;
initprintf("Enabling ATI FBO color attachment workaround.\n");
 
if (Bstrstr(glinfo.renderer, "Radeon X1"))
{
pr_ati_nodepthoffset = 1;
initprintf("Enabling ATI R520 polygon offset workaround.\n");
}
# ifdef __APPLE__
// See bug description at http://lists.apple.com/archives/mac-opengl/2005/Oct/msg00169.html
if (!Bstrncmp(glinfo.renderer, "ATI Radeon 9600", 15))
{
pr_ati_textureformat_one = 1;
initprintf("Enabling ATI Radeon 9600 texture format workaround.\n");
}
# endif
}
#endif // defined POLYMER
 
// process the extensions string and flag stuff we recognize
glinfo.depthtex = !!Bstrstr(glinfo.extensions, "GL_ARB_depth_texture");
glinfo.fbos = !!Bstrstr(glinfo.extensions, "GL_EXT_framebuffer_object") || !!Bstrstr(glinfo.extensions, "GL_OES_framebuffer_object");
glinfo.shadow = !!Bstrstr(glinfo.extensions, "GL_ARB_shadow");
glinfo.texnpot = !!Bstrstr(glinfo.extensions, "GL_ARB_texture_non_power_of_two") || !!Bstrstr(glinfo.extensions, "GL_OES_texture_npot");
 
#if !defined EDUKE32_GLES
glinfo.bgra = !!Bstrstr(glinfo.extensions, "GL_EXT_bgra");
glinfo.bufferstorage = !!Bstrstr(glinfo.extensions, "GL_ARB_buffer_storage");
glinfo.clamptoedge = !!Bstrstr(glinfo.extensions, "GL_EXT_texture_edge_clamp") || !!Bstrstr(glinfo.extensions, "GL_SGIS_texture_edge_clamp");
glinfo.debugoutput = !!Bstrstr(glinfo.extensions, "GL_ARB_debug_output");
glinfo.depthclamp = !!Bstrstr(glinfo.extensions, "GL_ARB_depth_clamp");
glinfo.glsl = !!Bstrstr(glinfo.extensions, "GL_ARB_shader_objects");
glinfo.multitex = !!Bstrstr(glinfo.extensions, "GL_ARB_multitexture");
glinfo.occlusionqueries = !!Bstrstr(glinfo.extensions, "GL_ARB_occlusion_query");
glinfo.rect = !!Bstrstr(glinfo.extensions, "GL_NV_texture_rectangle") || !!Bstrstr(glinfo.extensions, "GL_EXT_texture_rectangle");
glinfo.sync = !!Bstrstr(glinfo.extensions, "GL_ARB_sync");
glinfo.texcompr = !!Bstrstr(glinfo.extensions, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor, "ATI Technologies Inc.");
glinfo.vbos = !!Bstrstr(glinfo.extensions, "GL_ARB_vertex_buffer_object");
glinfo.vsync = !!Bstrstr(glinfo.extensions, "WGL_EXT_swap_control") || !!Bstrstr(glinfo.extensions, "GLX_EXT_swap_control");
 
# ifdef DYNAMIC_GLEXT
if (glinfo.texcompr && (!glCompressedTexImage2D || !glGetCompressedTexImage))
{
// lacking the necessary extensions to do this
initprintf("Warning: the GL driver lacks necessary functions to use caching\n");
glinfo.texcompr = 0;
}
# endif
#else
// don't bother checking because ETC2 et al. are not listed in extensions anyway
glinfo.texcompr = 1; // !!Bstrstr(glinfo.extensions, "GL_OES_compressed_ETC1_RGB8_texture");
#endif
 
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
 
if (!glinfo.filled)
{
int32_t oldbpp = bpp;
bpp = 32;
osdcmd_glinfo(NULL);
glinfo.filled = 1;
bpp = oldbpp;
}
}
 
// Used to register the game's / editor's osdcmd_vidmode() functions here.
int32_t (*baselayer_osdcmd_vidmode_func)(osdcmdptr_t parm);
 
388,7 → 443,7
initprintf("OpenGL information\n %s %s %s\n",
glinfo.vendor, glinfo.renderer, glinfo.version);
 
if (!glinfo.dumped)
if (!glinfo.filled)
return OSDCMD_OK;
 
char const *s[] = { "supported", "not supported" };
396,24 → 451,21
#define SUPPORTED(x) (x ? s[0] : s[1])
 
initprintf(" BGRA textures: %s\n", SUPPORTED(glinfo.bgra));
initprintf(" Non-power-of-2 textures: %s\n", SUPPORTED(glinfo.texnpot));
initprintf(" Clamp-to-edge: %s\n", SUPPORTED(glinfo.clamptoedge));
initprintf(" Framebuffer objects: %s\n", SUPPORTED(glinfo.fbos));
initprintf(" Multi-texturing: %s\n", SUPPORTED(glinfo.multitex));
initprintf(" Framebuffer objects: %s\n", SUPPORTED(glinfo.fbos));
initprintf(" Non-power-of-2 textures: %s\n", SUPPORTED(glinfo.texnpot));
#ifndef EDUKE32_GLES
initprintf(" Texture compression: %s\n", SUPPORTED(glinfo.texcompr));
initprintf(" ARBfp fragment programs: %s\n", SUPPORTED(glinfo.arbfp));
initprintf(" Buffer storage: %s\n", SUPPORTED(glinfo.bufferstorage));
initprintf(" Debug output: %s\n", SUPPORTED(glinfo.debugoutput));
initprintf(" Depth textures: %s\n", SUPPORTED(glinfo.depthtex));
initprintf(" GLSL: %s\n", SUPPORTED(glinfo.glsl));
initprintf(" Occlusion queries: %s\n", SUPPORTED(glinfo.occlusionqueries));
initprintf(" Rectangle textures: %s\n", SUPPORTED(glinfo.rect));
initprintf(" Shadow textures: %s\n", SUPPORTED(glinfo.shadow));
initprintf(" Rectangle textures: %s\n", SUPPORTED(glinfo.rect));
initprintf(" env_combine: %s\n", SUPPORTED(glinfo.envcombine));
initprintf(" Sync: %s\n", SUPPORTED(glinfo.sync));
initprintf(" Texture compression: %s\n", SUPPORTED(glinfo.texcompr));
initprintf(" Vertex buffer objects: %s\n", SUPPORTED(glinfo.vbos));
initprintf(" Shader model 4: %s\n", SUPPORTED(glinfo.sm4));
initprintf(" Occlusion queries: %s\n", SUPPORTED(glinfo.occlusionqueries));
initprintf(" GLSL: %s\n", SUPPORTED(glinfo.glsl));
initprintf(" Debug output: %s\n", SUPPORTED(glinfo.debugoutput));
initprintf(" Buffer storage: %s\n", SUPPORTED(glinfo.bufferstorage));
initprintf(" Sync: %s\n", SUPPORTED(glinfo.sync));
#endif
initprintf(" Maximum anisotropy: %.1f%s\n", glinfo.maxanisotropy, glinfo.maxanisotropy > 1.0 ? "" : " (no anisotropic filtering)");
 
/source/build/src/sdlayer.cpp
1424,109 → 1424,8
glDisable(GL_DITHER);
#endif
 
glinfo.vendor = (const char *) glGetString(GL_VENDOR);
glinfo.renderer = (const char *) glGetString(GL_RENDERER);
glinfo.version = (const char *) glGetString(GL_VERSION);
glinfo.extensions = (const char *) glGetString(GL_EXTENSIONS);
fill_glinfo();
 
#ifdef POLYMER
if (!Bstrcmp(glinfo.vendor, "ATI Technologies Inc."))
{
pr_ati_fboworkaround = 1;
initprintf("Enabling ATI FBO color attachment workaround.\n");
 
if (Bstrstr(glinfo.renderer, "Radeon X1"))
{
pr_ati_nodepthoffset = 1;
initprintf("Enabling ATI R520 polygon offset workaround.\n");
}
else
pr_ati_nodepthoffset = 0;
#ifdef __APPLE__
// See bug description at http://lists.apple.com/archives/mac-opengl/2005/Oct/msg00169.html
if (!Bstrncmp(glinfo.renderer, "ATI Radeon 9600", 15))
{
pr_ati_textureformat_one = 1;
initprintf("Enabling ATI Radeon 9600 texture format workaround.\n");
}
else
pr_ati_textureformat_one = 0;
#endif
}
else
pr_ati_fboworkaround = 0;
#endif // defined POLYMER
 
glinfo.maxanisotropy = 1.0;
glinfo.bgra = 0;
glinfo.clamptoedge = 1;
glinfo.multitex = 1;
 
// process the extensions string and flag stuff we recognize
 
glinfo.texnpot = !!Bstrstr(glinfo.extensions, "GL_ARB_texture_non_power_of_two") || !!Bstrstr(glinfo.extensions, "GL_OES_texture_npot");
glinfo.arbfp = !!Bstrstr(glinfo.extensions, "GL_ARB_fragment_program");
glinfo.depthtex = !!Bstrstr(glinfo.extensions, "GL_ARB_depth_texture");
glinfo.shadow = !!Bstrstr(glinfo.extensions, "GL_ARB_shadow");
glinfo.fbos = !!Bstrstr(glinfo.extensions, "GL_EXT_framebuffer_object") || !!Bstrstr(glinfo.extensions, "GL_OES_framebuffer_object");
 
#if !defined EDUKE32_GLES
glinfo.texcompr = !!Bstrstr(glinfo.extensions, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor, "ATI Technologies Inc.");
# ifdef DYNAMIC_GLEXT
if (glinfo.texcompr && (!glCompressedTexImage2D || !glGetCompressedTexImage))
{
// lacking the necessary extensions to do this
initprintf("Warning: the GL driver lacks necessary functions to use caching\n");
glinfo.texcompr = 0;
}
# endif
 
glinfo.bgra = !!Bstrstr(glinfo.extensions, "GL_EXT_bgra");
glinfo.clamptoedge = !!Bstrstr(glinfo.extensions, "GL_EXT_texture_edge_clamp") ||
!!Bstrstr(glinfo.extensions, "GL_SGIS_texture_edge_clamp");
glinfo.rect =
!!Bstrstr(glinfo.extensions, "GL_NV_texture_rectangle") || !!Bstrstr(glinfo.extensions, "GL_EXT_texture_rectangle");
 
glinfo.multitex = !!Bstrstr(glinfo.extensions, "GL_ARB_multitexture");
 
glinfo.envcombine = !!Bstrstr(glinfo.extensions, "GL_ARB_texture_env_combine");
glinfo.vbos = !!Bstrstr(glinfo.extensions, "GL_ARB_vertex_buffer_object");
glinfo.sm4 = !!Bstrstr(glinfo.extensions, "GL_EXT_gpu_shader4");
glinfo.occlusionqueries = !!Bstrstr(glinfo.extensions, "GL_ARB_occlusion_query");
glinfo.glsl = !!Bstrstr(glinfo.extensions, "GL_ARB_shader_objects");
glinfo.debugoutput = !!Bstrstr(glinfo.extensions, "GL_ARB_debug_output");
glinfo.bufferstorage = !!Bstrstr(glinfo.extensions, "GL_ARB_buffer_storage");
glinfo.sync = !!Bstrstr(glinfo.extensions, "GL_ARB_sync");
glinfo.depthclamp = !!Bstrstr(glinfo.extensions, "GL_ARB_depth_clamp");
glinfo.clipcontrol = !!Bstrstr(glinfo.extensions, "GL_ARB_clip_control");
 
#if 0
if (Bstrstr(glinfo.extensions, "WGL_3DFX_gamma_control"))
{
static int32_t warnonce;
// 3dfx cards have issues with fog
nofog = 1;
if (!(warnonce & 1))
initprintf("3dfx card detected: OpenGL fog disabled\n");
warnonce |= 1;
}
#endif
#else
// don't bother checking because ETC2 et al. are not listed in extensions anyway
glinfo.texcompr = 1; // !!Bstrstr(glinfo.extensions, "GL_OES_compressed_ETC1_RGB8_texture");
#endif
 
// if (Bstrstr(glinfo.extensions, "GL_EXT_texture_filter_anisotropic"))
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
 
if (!glinfo.dumped)
{
int32_t oldbpp = bpp;
bpp = 32;
osdcmd_glinfo(NULL);
glinfo.dumped = 1;
bpp = oldbpp;
}
}
#endif // defined USE_OPENGL
 
/source/build/src/winlayer.cpp
94,7 → 94,7
int32_t fullscreen=0;
int32_t bpp=0;
int32_t bytesperline=0;
int32_t refreshfreq=-1;
double refreshfreq;
int32_t lockcount=0;
int32_t glcolourdepth=32;
static int32_t vsync_renderlayer;
548,7 → 548,7
//
void system_getcvars(void)
{
windowsDwmSetupComposition(c == 8);
windowsDwmSetupComposition(0);
vsync = videoSetVsync(vsync);
}
 
2521,7 → 2521,7
};
GLuint PixelFormat;
int32_t minidriver;
int32_t err;
int32_t err = 0;
pfd.cColorBits = bitspp;
 
hGLWindow = CreateWindow(
2648,198 → 2648,67
glHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST);
glDisable(GL_DITHER);
 
{
GLubyte *p,*p2,*p3;
int32_t err = 0;
fill_glinfo();
 
glinfo.vendor = (char const *)glGetString(GL_VENDOR);
glinfo.renderer = (char const *)glGetString(GL_RENDERER);
glinfo.version = (char const *)glGetString(GL_VERSION);
glinfo.extensions = (char const *)glGetString(GL_EXTENSIONS);
err = 0;
 
// GL driver blacklist
 
if (!Bstrcmp(glinfo.vendor,"Microsoft Corporation")) err = 1;
// GL driver blacklist
if (!Bstrcmp(glinfo.vendor,"Microsoft Corporation")) err = 1;
#if 0
else if (!Bstrcmp(glinfo.vendor,"SiS")) err = 1;
else if (!Bstrcmp(glinfo.vendor,"3Dfx Interactive Inc.")) err = 1;
else if (!Bstrcmp(glinfo.vendor,"SiS")) err = 1;
else if (!Bstrcmp(glinfo.vendor,"3Dfx Interactive Inc.")) err = 1;
#endif
#ifdef POLYMER
else if (!Bstrcmp(glinfo.vendor, "Intel"))
pr_ati_fboworkaround = 1;
else if (!Bstrcmp(glinfo.vendor, "Intel"))
pr_ati_fboworkaround = 1;
#endif
else
else
{
if (!Bstrcmp(glinfo.vendor,"ATI Technologies Inc."))
{
if (!Bstrcmp(glinfo.vendor,"ATI Technologies Inc."))
{
winlayer_have_ATI = 1;
winlayer_have_ATI = 1;
#ifdef POLYMER
pr_ati_fboworkaround = 1;
pr_ati_fboworkaround = 1;
#endif
if (Bstrstr(glinfo.renderer,"Radeon X1"))
{
if (Bstrstr(glinfo.renderer,"Radeon X1"))
{
#ifdef POLYMER
pr_ati_nodepthoffset = 1;
initprintf("Enabling ATI R520 polygon offset workaround.\n");
pr_ati_nodepthoffset = 1;
initprintf("Enabling ATI R520 polygon offset workaround.\n");
#endif
}
#ifdef POLYMER
else
pr_ati_nodepthoffset = 0;
#endif
}
#ifdef POLYMER
else
pr_ati_fboworkaround = 0;
pr_ati_nodepthoffset = 0;
#endif
}
 
#ifdef POLYMER
if (pr_ati_fboworkaround)
initprintf("Enabling Intel/ATI FBO color attachment workaround.\n");
else
pr_ati_fboworkaround = 0;
#endif
}
 
if (!forcegl && err)
{
OSD_Printf("Unsupported OpenGL driver detected. GL modes will be unavailable. Use -forcegl to override.\n");
wm_msgbox("Unsupported OpenGL driver", "Unsupported OpenGL driver detected. GL modes will be unavailable.");
ReleaseOpenGL();
//POGO: there is no equivalent to unloadgldriver() with GLAD's loader, but this shouldn't be a problem.
//unloadgldriver();
unloadwgl();
nogl = 1;
modeschecked = 0;
videoGetModes();
return TRUE;
}
 
glinfo.maxanisotropy = 1.0;
glinfo.bgra = 0;
glinfo.texcompr = 0;
 
// process the extensions string and flag stuff we recognize
p = (GLubyte *)Xstrdup(glinfo.extensions);
p3 = p;
while ((p2 = (GLubyte *)Bstrtoken(p3==p?(char *)p:NULL, " ", (char **)&p3, 1)) != NULL)
{
if (!Bstrcmp((char *)p2, "GL_EXT_texture_filter_anisotropic"))
{
// supports anisotropy. get the maximum anisotropy level
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
}
else if (!Bstrcmp((char *)p2, "GL_EXT_texture_edge_clamp") ||
!Bstrcmp((char *)p2, "GL_SGIS_texture_edge_clamp"))
{
// supports GL_CLAMP_TO_EDGE or GL_CLAMP_TO_EDGE_SGIS
glinfo.clamptoedge = 1;
}
else if (!Bstrcmp((char *)p2, "GL_EXT_bgra"))
{
// support bgra textures
glinfo.bgra = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor,"ATI Technologies Inc."))
{
// support texture compression
glinfo.texcompr = 1;
 
#ifdef DYNAMIC_GLEXT
if (!glCompressedTexImage2D || !glGetCompressedTexImage)
{
// lacking the necessary extensions to do this
initprintf("Warning: the GL driver lacks necessary functions to use caching\n");
glinfo.texcompr = 0;
}
#ifdef POLYMER
if (pr_ati_fboworkaround)
initprintf("Enabling Intel/ATI FBO color attachment workaround.\n");
#endif
}
else if (!Bstrcmp((char *)p2, "GL_ARB_texture_non_power_of_two"))
{
// support non-power-of-two texture sizes
glinfo.texnpot = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_fragment_program"))
{
glinfo.arbfp = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_depth_texture"))
{
glinfo.depthtex = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_shadow"))
{
glinfo.shadow = 1;
}
else if (!Bstrcmp((char *)p2, "GL_EXT_framebuffer_object"))
{
glinfo.fbos = 1;
}
else if (!Bstrcmp((char *)p2, "GL_NV_texture_rectangle") ||
!Bstrcmp((char *)p2, "GL_EXT_texture_rectangle"))
{
glinfo.rect = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_multitexture"))
{
glinfo.multitex = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_texture_env_combine"))
{
glinfo.envcombine = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_vertex_buffer_object"))
{
glinfo.vbos = 1;
}
else if (!Bstrcmp((char *)p2, "WGL_EXT_swap_control"))
{
glinfo.vsync = 1;
}
else if (!Bstrcmp((char *)p2, "GL_EXT_gpu_shader4"))
{
glinfo.sm4 = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_occlusion_query"))
{
glinfo.occlusionqueries = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_shader_objects"))
{
glinfo.glsl = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_debug_output"))
{
glinfo.debugoutput = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_buffer_storage"))
{
glinfo.bufferstorage = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_sync"))
{
glinfo.sync = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_depth_clamp"))
{
glinfo.depthclamp = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_clipcontrol"))
{
glinfo.clipcontrol = 1;
}
}
Xfree(p);
}
numpages = 2; // KJS 20031225: tell rotatesprite that it's double buffered!
 
if (!glinfo.dumped)
if (!forcegl && err)
{
int32_t oldbpp = bpp;
bpp = 32;
osdcmd_glinfo(NULL);
glinfo.dumped = TRUE;
bpp = oldbpp;
OSD_Printf("Unsupported OpenGL driver detected. GL modes will be unavailable. Use -forcegl to override.\n");
wm_msgbox("Unsupported OpenGL driver", "Unsupported OpenGL driver detected. GL modes will be unavailable.");
ReleaseOpenGL();
//POGO: there is no equivalent to unloadgldriver() with GLAD's loader, but this shouldn't be a problem.
//unloadgldriver();
unloadwgl();
nogl = 1;
modeschecked = 0;
videoGetModes();
return TRUE;
}
 
numpages = 2; // KJS 20031225: tell rotatesprite that it's double buffered!
 
return FALSE;
}
#endif