Use a separate max texture size for SP
This commit is contained in:
parent
ddbe42680d
commit
546cd94f39
@ -934,6 +934,7 @@ void IrrDriver::applyResolutionSettings()
|
||||
// initDevice will drop the current device.
|
||||
delete m_renderer;
|
||||
SharedGPUObjects::reset();
|
||||
SP::setMaxTextureSize();
|
||||
initDevice();
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
|
@ -97,6 +97,8 @@ std::array<GLuint, ST_COUNT> g_samplers;
|
||||
// Check sp_shader.cpp for the name
|
||||
std::array<GLuint, 1> sp_prefilled_tex;
|
||||
// ----------------------------------------------------------------------------
|
||||
std::atomic<uint32_t> sp_max_texture_size(2048);
|
||||
// ----------------------------------------------------------------------------
|
||||
std::vector<float> g_bounding_boxes;
|
||||
// ----------------------------------------------------------------------------
|
||||
std::vector<std::shared_ptr<SPDynamicDrawCall> > g_dy_dc;
|
||||
@ -1435,6 +1437,15 @@ void uploadSPM(irr::scene::IMesh* mesh)
|
||||
}
|
||||
} // uploadSPM
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void setMaxTextureSize()
|
||||
{
|
||||
const unsigned max =
|
||||
(UserConfigParams::m_high_definition_textures & 0x01) == 0 ?
|
||||
UserConfigParams::m_max_texture_size : 2048;
|
||||
sp_max_texture_size.store(max);
|
||||
} // setMaxTextureSize
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "vector3d.h"
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <cmath>
|
||||
#include <functional>
|
||||
#include <ostream>
|
||||
@ -88,6 +89,7 @@ class SPMeshBuffer;
|
||||
extern GLuint sp_mat_ubo[MAX_PLAYER_COUNT][3];
|
||||
extern GLuint sp_fog_ubo;
|
||||
extern std::array<GLuint, 1> sp_prefilled_tex;
|
||||
extern std::atomic<uint32_t> sp_max_texture_size;
|
||||
extern unsigned sp_solid_poly_count;
|
||||
extern unsigned sp_shadow_poly_count;
|
||||
extern int sp_cur_shadow_cascade;
|
||||
@ -139,6 +141,14 @@ SPMesh* convertEVTStandard(irr::scene::IMesh* mesh,
|
||||
// ----------------------------------------------------------------------------
|
||||
void uploadSPM(irr::scene::IMesh* mesh);
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifdef SERVER_ONLY
|
||||
inline void setMaxTextureSize() {}
|
||||
#else
|
||||
void setMaxTextureSize();
|
||||
#endif
|
||||
// ----------------------------------------------------------------------------
|
||||
inline void unsetMaxTextureSize() { sp_max_texture_size.store(2048); }
|
||||
// ----------------------------------------------------------------------------
|
||||
inline uint8_t srgbToLinear(float color_srgb)
|
||||
{
|
||||
int ret;
|
||||
|
@ -167,8 +167,8 @@ std::shared_ptr<video::IImage> SPTexture::getTextureImage() const
|
||||
core::dimension2du img_size = image->getDimension();
|
||||
core::dimension2du tex_size = img_size.getOptimalSize
|
||||
(true/*requirePowerOfTwo*/, false/*requireSquare*/, false/*larger*/);
|
||||
const core::dimension2du& max_size = irr_driver->getVideoDriver()
|
||||
->getDriverAttributes().getAttributeAsDimension2d("MAX_TEXTURE_SIZE");
|
||||
unsigned max = sp_max_texture_size.load();
|
||||
core::dimension2du max_size = core::dimension2du(max, max);
|
||||
|
||||
if (tex_size.Width > max_size.Width)
|
||||
{
|
||||
|
@ -1654,14 +1654,14 @@ void initUserConfig()
|
||||
//=============================================================================
|
||||
void initRest()
|
||||
{
|
||||
|
||||
SP::setMaxTextureSize();
|
||||
irr_driver = new IrrDriver();
|
||||
|
||||
|
||||
if (irr_driver->getDevice() == NULL)
|
||||
{
|
||||
Log::fatal("main", "Couldn't initialise irrlicht device. Quitting.\n");
|
||||
}
|
||||
|
||||
|
||||
StkTime::init(); // grabs the timer object from the irrlicht device
|
||||
|
||||
// Now create the actual non-null device in the irrlicht driver
|
||||
|
Loading…
x
Reference in New Issue
Block a user