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