1
0
forked from mirrors/0ad

Moves max texture size to backend device capabilities.

This was SVN commit r26409.
This commit is contained in:
vladislavbelov
2022-02-18 23:17:48 +00:00
parent 5eb21cbfbf
commit 36833d1df2
5 changed files with 12 additions and 25 deletions
+1 -14
View File
@@ -20,11 +20,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* OpenGL helper functions.
*/
#include "precompiled.h"
#include "lib/ogl.h"
#include "lib/code_annotation.h"
@@ -416,9 +413,6 @@ bool ogl_SquelchError(GLenum err_to_ignore)
// feature and limit detect
//----------------------------------------------------------------------------
GLint ogl_max_tex_size = -1; // [pixels]
GLint ogl_max_tex_units = -1; // limit on GL_TEXTUREn
#if OS_WIN
bool ogl_Init(void* (load)(const char*), void* hdc)
#elif !CONFIG2_GLES && !OS_MACOSX && !OS_MAC
@@ -484,13 +478,6 @@ bool ogl_Init(void* (load)(const char*))
enableDummyFunctions();
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &ogl_max_tex_size);
#if !CONFIG2_GLES
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &ogl_max_tex_units);
#endif
glEnable(GL_TEXTURE_2D);
return true;
}
+1 -8
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -143,11 +143,4 @@ extern const char* ogl_GetErrorName(GLenum err);
**/
extern bool ogl_SquelchError(GLenum err_to_ignore);
//-----------------------------------------------------------------------------
// implementation limits / feature detect
extern GLint ogl_max_tex_size; /// [pixels]
extern GLint ogl_max_tex_units; /// limit on GL_TEXTUREn
#endif // INCLUDED_OGL
+4 -3
View File
@@ -473,6 +473,8 @@ void ShadowMapInternals::CreateTexture()
Texture.reset();
DummyTexture.reset();
Renderer::Backend::GL::CDevice* backendDevice = g_VideoMode.GetBackendDevice();
CFG_GET_VAL("shadowquality", QualityLevel);
// Get shadow map size as next power of two up from view width/height.
@@ -498,7 +500,8 @@ void ShadowMapInternals::CreateTexture()
}
// Clamp to the maximum texture size.
shadowMapSize = std::min(shadowMapSize, static_cast<int>(ogl_max_tex_size));
shadowMapSize = std::min(
shadowMapSize, static_cast<int>(backendDevice->GetCapabilities().maxTextureSize));
Width = Height = shadowMapSize;
@@ -525,8 +528,6 @@ void ShadowMapInternals::CreateTexture()
LOGMESSAGE("Creating shadow texture (size %dx%d) (format = %s)",
Width, Height, formatName);
Renderer::Backend::GL::CDevice* backendDevice = g_VideoMode.GetBackendDevice();
if (g_RenderingOptions.GetShadowAlphaFix())
{
DummyTexture = backendDevice->CreateTexture2D("ShadowMapDummy",
+5
View File
@@ -287,6 +287,8 @@ std::unique_ptr<CDevice> CDevice::Create(SDL_Window* window, const bool arb)
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glEnable(GL_TEXTURE_2D);
device->m_Backbuffer = CFramebuffer::CreateBackbuffer(device.get());
Capabilities& capabilities = device->m_Capabilities;
@@ -324,6 +326,9 @@ std::unique_ptr<CDevice> CDevice::Create(SDL_Window* window, const bool arb)
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy);
capabilities.maxAnisotropy = maxAnisotropy;
}
GLint maxTextureSize = 1024;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
capabilities.maxTextureSize = maxTextureSize;
#if CONFIG2_GLES
const bool isDebugInCore = ogl_HaveVersion(3, 2);
+1
View File
@@ -56,6 +56,7 @@ public:
bool anisotropicFiltering;
uint32_t maxSampleCount;
float maxAnisotropy;
uint32_t maxTextureSize;
};
~CDevice();