mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-24 21:55:42 +00:00
Removed textureMemoryMultiplier again; a bit more debug output for differing texture sizes
This commit is contained in:
parent
0ea9ba0770
commit
b719b8fd60
5 changed files with 14 additions and 34 deletions
|
@ -2028,8 +2028,9 @@ void Game::fillGridFromQuad(Quad *q, ObsType obsType, bool trim)
|
|||
|
||||
if (trim)
|
||||
{
|
||||
std::vector<TileVector> obsCopy = obs;
|
||||
obs.clear();
|
||||
std::vector<TileVector> obsCopy;
|
||||
obsCopy.swap(obs);
|
||||
// obs now empty
|
||||
|
||||
int sides = 0;
|
||||
for (int i = 0; i < obsCopy.size(); i++)
|
||||
|
|
|
@ -274,12 +274,6 @@ void UserSettings::save()
|
|||
}
|
||||
doc.InsertEndChild(xml_net);
|
||||
|
||||
TiXmlElement xml_debug("Debug");
|
||||
{
|
||||
xml_debug.SetAttribute("textureMemoryMultiplier", debug.textureMemoryMultiplier);
|
||||
}
|
||||
doc.InsertEndChild(xml_debug);
|
||||
|
||||
}
|
||||
|
||||
#if defined(BBGE_BUILD_UNIX)
|
||||
|
@ -566,12 +560,6 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
|
|||
network.masterServer = serv;
|
||||
}
|
||||
|
||||
TiXmlElement *xml_debug = doc.FirstChildElement("Debug");
|
||||
if (xml_debug)
|
||||
{
|
||||
xml_debug->Attribute("textureMemoryMultiplier", &debug.textureMemoryMultiplier);
|
||||
}
|
||||
|
||||
if (system.locale.empty())
|
||||
getSystemLocale();
|
||||
else
|
||||
|
@ -618,9 +606,6 @@ void UserSettings::apply()
|
|||
|
||||
core->settings.prebufferSounds = audio.prebuffer;
|
||||
|
||||
if (debug.textureMemoryMultiplier >= 1)
|
||||
Texture::textureMemoryMultiplier = debug.textureMemoryMultiplier;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -178,12 +178,6 @@ public:
|
|||
std::string masterServer;
|
||||
} network;
|
||||
|
||||
struct Debug
|
||||
{
|
||||
Debug() { textureMemoryMultiplier = 1; }
|
||||
int textureMemoryMultiplier;
|
||||
} debug;
|
||||
|
||||
void loadDefaults(bool doApply=true);
|
||||
void load(bool doApply=true, const std::string &overrideFile="");
|
||||
void save();
|
||||
|
|
|
@ -56,8 +56,6 @@ bool Texture::useMipMaps = true;
|
|||
|
||||
TexErr Texture::textureError = TEXERR_OK;
|
||||
|
||||
int Texture::textureMemoryMultiplier = 1;
|
||||
|
||||
Texture::Texture() : Resource()
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
|
@ -821,7 +819,7 @@ static unsigned int clp2(unsigned int x)
|
|||
unsigned char * Texture::getBufferAndSize(int *wparam, int *hparam, unsigned int *sizeparam)
|
||||
{
|
||||
unsigned char *data = NULL;
|
||||
unsigned int size = 0, allocsize = 0;
|
||||
unsigned int size = 0;
|
||||
int tw = 0, th = 0;
|
||||
int w = 0, h = 0;
|
||||
|
||||
|
@ -836,13 +834,18 @@ unsigned char * Texture::getBufferAndSize(int *wparam, int *hparam, unsigned int
|
|||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
|
||||
|
||||
// As we know it - but round to nearest power of 2 OpenGL does this internally anyways.
|
||||
// As we know it - but round to nearest power of 2 - OpenGL does this internally anyways.
|
||||
tw = clp2(width); // known to be > 0.
|
||||
th = clp2(height);
|
||||
|
||||
if (w != tw || h != th)
|
||||
{
|
||||
debugLog("Texture::getBufferAndSize() WARNING: width/height disagree");
|
||||
std::ostringstream os;
|
||||
os << "Texture::getBufferAndSize() WARNING: width/height disagree: ";
|
||||
os << "Driver says (" << w << ", " << h << "); ";
|
||||
os << "Texture says (" << width << ", " << height << "); ";
|
||||
os << "Rounded to (" << tw << ", " << th << ")";
|
||||
debugLog(os.str());
|
||||
// choose max. for size calculation
|
||||
w = w > tw ? w : tw;
|
||||
h = h > th ? h : th;
|
||||
|
@ -852,9 +855,7 @@ unsigned char * Texture::getBufferAndSize(int *wparam, int *hparam, unsigned int
|
|||
if (!size)
|
||||
goto fail;
|
||||
|
||||
allocsize = size * textureMemoryMultiplier;
|
||||
|
||||
data = (unsigned char*)malloc(allocsize + 32);
|
||||
data = (unsigned char*)malloc(size + 32);
|
||||
if (!data)
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
@ -862,12 +863,12 @@ unsigned char * Texture::getBufferAndSize(int *wparam, int *hparam, unsigned int
|
|||
errorLog(os.str());
|
||||
goto fail;
|
||||
}
|
||||
memcpy(data + allocsize, "SAFE", 5);
|
||||
memcpy(data + size, "SAFE", 5);
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
// Not sure but this might be the case with nouveau drivers on linux... still investigating. -- fg
|
||||
if(memcmp(data + allocsize, "SAFE", 5))
|
||||
if(memcmp(data + size, "SAFE", 5))
|
||||
{
|
||||
errorLog("Texture::getBufferAndSize(): Broken graphics driver! Wrote past end of buffer!");
|
||||
free(data); // in case we are here, this will most likely cause a crash.
|
||||
|
|
|
@ -82,7 +82,6 @@ public:
|
|||
void read(int tx, int ty, int w, int h, unsigned char *pixels);
|
||||
|
||||
unsigned char *getBufferAndSize(int *w, int *h, unsigned int *size); // returned memory must be free()'d
|
||||
static int textureMemoryMultiplier; // 1. More for buggy drivers.
|
||||
|
||||
protected:
|
||||
std::string loadName;
|
||||
|
|
Loading…
Reference in a new issue