Skip to content
Permalink
Browse files

put last ATI hack to rest

  • Loading branch information...
rt
rt committed Apr 28, 2019
1 parent c2a221b commit 3f54ff4785a2317466cdeb9bfc3d4ee0544d0cd4
Showing with 23 additions and 46 deletions.
  1. +0 −1 rts/Rendering/GL/myGL.cpp
  2. +16 −30 rts/Rendering/GlobalRendering.cpp
  3. +7 −15 rts/Rendering/GlobalRendering.h
@@ -12,7 +12,6 @@
#include "Rendering/GlobalRendering.h"
#include "Rendering/Textures/Bitmap.h"
#include "System/Log/ILog.h"
#include "System/FileSystem/FileHandler.h"
#include "System/Platform/MessageBox.h"
#include "System/StringUtil.h"

@@ -36,10 +36,12 @@ CONFIG(int, MSAALevel).defaultValue(0).minimumValue(0).maximumValue(32).descript
CONFIG(int, ForceDisableClipCtrl).defaultValue(0).minimumValue(0).maximumValue(1);
CONFIG(int, ForceCoreContext).defaultValue(1).minimumValue(0).maximumValue(1);
CONFIG(int, ForceSwapBuffers).defaultValue(1).minimumValue(0).maximumValue(1);
CONFIG(int, AtiHacks).defaultValue(-1).headlessValue(0).minimumValue(-1).maximumValue(1).description("Enables graphics drivers workarounds for users with ATI video cards.\n -1:=runtime detect, 0:=off, 1:=on");

// enabled in safemode, far more likely the gpu runs out of memory than this extension causes crashes!
// (otherwise defaults to off because it reduces mipmap quality, smallest compressed level is bigger)
// apply runtime texture compression for glBuildMipmaps?
// glCompressedTex*Image* must additionally be supported
// for DDS (SMF DXT1, etc)
// this defaults to off because it reduces mipmap quality
// the smallest compressed mip-level is necessarily bigger
CONFIG(bool, CompressTextures).defaultValue(false).safemodeValue(true).description("Runtime compress most textures to save VideoRAM.");
CONFIG(bool, DualScreenMode).defaultValue(false).description("Sets whether to split the screen in half, with one half for minimap and one for main screen. Right side is for minimap unless DualScreenMiniMapOnLeft is set.");
CONFIG(bool, DualScreenMiniMapOnLeft).defaultValue(false).description("When set, will make the left half of the screen the minimap when DualScreenMode is set.");
@@ -73,7 +75,8 @@ GlobalRenderingInfo globalRenderingInfo;
CR_BIND(CGlobalRendering, )

CR_REG_METADATA(CGlobalRendering, (
CR_MEMBER(teamNanospray),
CR_MEMBER(active),

CR_MEMBER(drawSky),
CR_MEMBER(drawWater),
CR_MEMBER(drawGround),
@@ -116,15 +119,14 @@ CR_REG_METADATA(CGlobalRendering, (
CR_IGNORED(maxTextureSize),
CR_IGNORED(maxTexAnisoLvl),

CR_IGNORED(active),
CR_MEMBER(teamNanospray),
CR_IGNORED(compressTextures),

CR_IGNORED(haveATI),
CR_IGNORED(haveMesa),
CR_IGNORED(haveIntel),
CR_IGNORED(haveNvidia),

CR_IGNORED(atiHacks),
CR_IGNORED(supportNonPowerOfTwoTex),
CR_IGNORED(supportTextureQueryLOD),
CR_IGNORED(support24bitDepthBuffer),
@@ -195,6 +197,7 @@ CGlobalRendering::CGlobalRendering()
, maxTextureSize(2048)
, maxTexAnisoLvl(0.0f)

, active(true)
, drawSky(true)
, drawWater(true)
, drawGround(true)
@@ -208,14 +211,12 @@ CGlobalRendering::CGlobalRendering()
, glDebugErrors(false)

, teamNanospray(configHandler->GetBool("TeamNanoSpray"))
, active(true)
, compressTextures(false)
, compressTextures(configHandler->GetBool("CompressTextures"))

, haveATI(false)
, haveMesa(false)
, haveIntel(false)
, haveNvidia(false)
, atiHacks(false)

, supportNonPowerOfTwoTex(false)
, supportTextureQueryLOD(false)
@@ -752,20 +753,6 @@ void CGlobalRendering::SetGLSupportFlags()
}


{
// use some ATI bugfixes?
const int atiHacksCfg = configHandler->GetInt("AtiHacks");
atiHacks = haveATI;
atiHacks &= (atiHacksCfg < 0); // runtime detect
atiHacks |= (atiHacksCfg > 0); // user override
}

// apply runtime texture compression for glBuildMipmaps?
// glCompressedTex*Image* must additionally be supported
// for DDS (SMF DXT1, etc)
compressTextures = configHandler->GetBool("CompressTextures");


#ifdef GLEW_NV_primitive_restart
// not defined for headless builds
supportRestartPrimitive = GLEW_NV_primitive_restart;
@@ -783,21 +770,21 @@ void CGlobalRendering::SetGLSupportFlags()
supportFragDepthLayout = (globalRenderingInfo.glContextVersion.x >= 4 && globalRenderingInfo.glContextVersion.y >= 2);


// detect if GL_DEPTH_COMPONENT24 is supported (many ATIs don't;
// they seem to support GL_DEPTH_COMPONENT24 for static textures
// but those can't be rendered to)
// detect if GL_DEPTH_COMPONENT24 is supported for render targets
// many ATIs historically did not; they only seemed to support it
// for static textures
{
#if 0
GLint state = 0;
glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 16, 16, 0, GL_RED, GL_FLOAT, nullptr);
glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &state);
support24bitDepthBuffer = (state > 0);
#else
if (!atiHacks) {
{
FBO fbo;
fbo.Bind();
fbo.CreateRenderBuffer(GL_COLOR_ATTACHMENT0, GL_RGBA8, 16, 16);
fbo.CreateRenderBuffer(GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT24, 16, 16);
fbo.CreateRenderBuffer(GL_DEPTH_ATTACHMENT , GL_DEPTH_COMPONENT24, 16, 16);
support24bitDepthBuffer = (fbo.GetStatus() == GL_FRAMEBUFFER_COMPLETE);
fbo.Unbind();
}
@@ -904,8 +891,7 @@ void CGlobalRendering::LogGLSupportInfo() const
LOG("\tmax. uniform buffer-bindings : %i", glslMaxUniformBufferBindings);
LOG("\tmax. uniform block-size : %iKB", glslMaxUniformBufferSize / 1024);
LOG("\t");
LOG("\tenable ATI-hacks : %i", atiHacks);
LOG("\tcompress MIP-maps: %i", compressTextures);
LOG("\trun-time texture compression: %i", compressTextures);
LOG("\t");
}

@@ -195,6 +195,13 @@ class CGlobalRendering {
float maxTexAnisoLvl;


/**
* @brief active video
*
* Whether the graphics need to be drawn
*/
bool active;

bool drawSky;
bool drawWater;
bool drawGround;
@@ -217,14 +224,6 @@ class CGlobalRendering {
*/
bool teamNanospray;


/**
* @brief active video
*
* Whether the graphics need to be drawn
*/
bool active;

/**
* @brief compressTextures
*
@@ -244,13 +243,6 @@ class CGlobalRendering {
bool haveNvidia;


/**
* @brief collection of some ATI bugfixes
*
* enables some ATI bugfixes
*/
bool atiHacks;

/**
* @brief if the GPU (drivers) support NonPowerOfTwoTextures
*

0 comments on commit 3f54ff4

Please sign in to comment.
You can’t perform that action at this time.