mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-28 06:42:09 +00:00
- on older ATI drivers where the clip planes are broken, only disable the clip planes themselves, but not OpenGL 3.x so that dynamic lights still work as intended.
- only disable clip planes on Windows, but not on Linux or macOS. - If a driver reports full OpenGL 4.5 support, assume that all features are working properly.
This commit is contained in:
parent
2ac91f0c5a
commit
9c9edbffdb
7 changed files with 27 additions and 11 deletions
|
@ -344,12 +344,12 @@ void FRenderState::SetClipHeight(float height, float direction)
|
|||
mClipHeightDirection = direction;
|
||||
#if 1
|
||||
// This still doesn't work... :(
|
||||
if (gl.glslversion < 1.3f) return;
|
||||
if (gl.flags & RFL_NO_CLIP_PLANES) return;
|
||||
#endif
|
||||
if (direction != 0.f)
|
||||
{
|
||||
/*
|
||||
if (gl.glslversion < 1.3f)
|
||||
if (gl.flags & RFL_NO_CLIP_PLANES)
|
||||
{
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
|
|
|
@ -237,7 +237,7 @@ public:
|
|||
|
||||
void EnableSplit(bool on)
|
||||
{
|
||||
if (gl.glslversion >= 1.3f)
|
||||
if (!(gl.flags & RFL_NO_CLIP_PLANES))
|
||||
{
|
||||
mSplitEnabled = on;
|
||||
if (on)
|
||||
|
@ -260,7 +260,7 @@ public:
|
|||
|
||||
void EnableClipLine(bool on)
|
||||
{
|
||||
if (gl.glslversion >= 1.3f)
|
||||
if (!(gl.flags & RFL_NO_CLIP_PLANES))
|
||||
{
|
||||
mClipLineEnabled = on;
|
||||
if (on)
|
||||
|
|
|
@ -972,7 +972,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
|||
if (thing->Sector->e->XFloor.lightlist.Size() != 0 && gl_fixedcolormap == CM_DEFAULT && !fullbright &&
|
||||
RenderStyle.BlendOp != STYLEOP_Shadow && RenderStyle.BlendOp != STYLEOP_RevSub)
|
||||
{
|
||||
if (gl.glslversion < 1.3) // on old hardware we are rather limited...
|
||||
if (gl.flags & RFL_NO_CLIP_PLANES) // on old hardware we are rather limited...
|
||||
{
|
||||
lightlist = NULL;
|
||||
if (!drawWithXYBillboard && !modelframe)
|
||||
|
|
|
@ -403,7 +403,7 @@ void GLWall::SplitWall(sector_t * frontsector, bool translucent)
|
|||
(maplightbottomleft<zbottom[0] && maplightbottomright>zbottom[1]) ||
|
||||
(maplightbottomleft > zbottom[0] && maplightbottomright < zbottom[1]))
|
||||
{
|
||||
if (gl.glslversion >= 1.3f)
|
||||
if (!(gl.flags & RFL_NO_CLIP_PLANES))
|
||||
{
|
||||
// Use hardware clipping if this cannot be done cleanly.
|
||||
this->lightlist = &lightlist;
|
||||
|
|
|
@ -169,6 +169,12 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
FShaderProgram::PatchVertShader(vp_comb);
|
||||
FShaderProgram::PatchFragShader(fp_comb);
|
||||
}
|
||||
else if (gl.flags & RFL_NO_CLIP_PLANES)
|
||||
{
|
||||
// On ATI's GL3 drivers we have to disable gl_ClipDistance because it's hopelessly broken.
|
||||
// This will cause some glitches and regressions but is the only way to avoid total display garbage.
|
||||
vp_comb.Substitute("gl_ClipDistance", "//");
|
||||
}
|
||||
|
||||
hVertProg = glCreateShader(GL_VERTEX_SHADER);
|
||||
hFragProg = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
|
|
@ -192,6 +192,7 @@ void gl_LoadExtensions()
|
|||
gl.version = 2.11f;
|
||||
gl.glslversion = 0;
|
||||
gl.lightmethod = LM_SOFTWARE;
|
||||
gl.flags |= RFL_NO_CLIP_PLANES;
|
||||
}
|
||||
else if (gl.version < 3.0f)
|
||||
{
|
||||
|
@ -200,17 +201,18 @@ void gl_LoadExtensions()
|
|||
|
||||
if (!CheckExtension("GL_EXT_packed_float")) gl.flags |= RFL_NO_RGBA16F;
|
||||
if (!CheckExtension("GL_EXT_packed_depth_stencil")) gl.flags |= RFL_NO_DEPTHSTENCIL;
|
||||
gl.flags |= RFL_NO_CLIP_PLANES;
|
||||
}
|
||||
else if (gl.version < 4.f)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (strstr(gl.vendorstring, "ATI Tech"))
|
||||
{
|
||||
gl.version = 2.11f;
|
||||
gl.glslversion = 1.21f;
|
||||
gl.lightmethod = LM_SOFTWARE; // do not use uniform buffers with the fallback shader, it may cause problems.
|
||||
gl.flags |= RFL_NO_CLIP_PLANES; // gl_ClipDistance is horribly broken on ATI GL3 drivers for Windows.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
else if (gl.version < 4.5f)
|
||||
{
|
||||
// don't use GL 4.x features when running in GL 3 emulation mode.
|
||||
if (CheckExtension("GL_ARB_buffer_storage"))
|
||||
|
@ -234,6 +236,13 @@ void gl_LoadExtensions()
|
|||
gl.version = 3.3f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume that everything works without problems on GL 4.5 drivers where these things are core features.
|
||||
gl.flags |= RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE;
|
||||
gl.lightmethod = LM_DIRECT;
|
||||
gl.buffermethod = BM_PERSISTENT;
|
||||
}
|
||||
|
||||
const char *lm = Args->CheckValue("-lightmethod");
|
||||
if (lm != NULL)
|
||||
|
|
|
@ -22,7 +22,8 @@ enum RenderFlags
|
|||
RFL_SAMPLER_OBJECTS = 16,
|
||||
|
||||
RFL_NO_RGBA16F = 32,
|
||||
RFL_NO_DEPTHSTENCIL = 64
|
||||
RFL_NO_DEPTHSTENCIL = 64,
|
||||
RFL_NO_CLIP_PLANES = 128
|
||||
};
|
||||
|
||||
enum TexMode
|
||||
|
|
Loading…
Reference in a new issue