mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-15 14:09:06 +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)
|
if (trim)
|
||||||
{
|
{
|
||||||
std::vector<TileVector> obsCopy = obs;
|
std::vector<TileVector> obsCopy;
|
||||||
obs.clear();
|
obsCopy.swap(obs);
|
||||||
|
// obs now empty
|
||||||
|
|
||||||
int sides = 0;
|
int sides = 0;
|
||||||
for (int i = 0; i < obsCopy.size(); i++)
|
for (int i = 0; i < obsCopy.size(); i++)
|
||||||
|
|
|
@ -274,12 +274,6 @@ void UserSettings::save()
|
||||||
}
|
}
|
||||||
doc.InsertEndChild(xml_net);
|
doc.InsertEndChild(xml_net);
|
||||||
|
|
||||||
TiXmlElement xml_debug("Debug");
|
|
||||||
{
|
|
||||||
xml_debug.SetAttribute("textureMemoryMultiplier", debug.textureMemoryMultiplier);
|
|
||||||
}
|
|
||||||
doc.InsertEndChild(xml_debug);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(BBGE_BUILD_UNIX)
|
#if defined(BBGE_BUILD_UNIX)
|
||||||
|
@ -566,12 +560,6 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
|
||||||
network.masterServer = serv;
|
network.masterServer = serv;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *xml_debug = doc.FirstChildElement("Debug");
|
|
||||||
if (xml_debug)
|
|
||||||
{
|
|
||||||
xml_debug->Attribute("textureMemoryMultiplier", &debug.textureMemoryMultiplier);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (system.locale.empty())
|
if (system.locale.empty())
|
||||||
getSystemLocale();
|
getSystemLocale();
|
||||||
else
|
else
|
||||||
|
@ -618,9 +606,6 @@ void UserSettings::apply()
|
||||||
|
|
||||||
core->settings.prebufferSounds = audio.prebuffer;
|
core->settings.prebufferSounds = audio.prebuffer;
|
||||||
|
|
||||||
if (debug.textureMemoryMultiplier >= 1)
|
|
||||||
Texture::textureMemoryMultiplier = debug.textureMemoryMultiplier;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,12 +178,6 @@ public:
|
||||||
std::string masterServer;
|
std::string masterServer;
|
||||||
} network;
|
} network;
|
||||||
|
|
||||||
struct Debug
|
|
||||||
{
|
|
||||||
Debug() { textureMemoryMultiplier = 1; }
|
|
||||||
int textureMemoryMultiplier;
|
|
||||||
} debug;
|
|
||||||
|
|
||||||
void loadDefaults(bool doApply=true);
|
void loadDefaults(bool doApply=true);
|
||||||
void load(bool doApply=true, const std::string &overrideFile="");
|
void load(bool doApply=true, const std::string &overrideFile="");
|
||||||
void save();
|
void save();
|
||||||
|
|
|
@ -56,8 +56,6 @@ bool Texture::useMipMaps = true;
|
||||||
|
|
||||||
TexErr Texture::textureError = TEXERR_OK;
|
TexErr Texture::textureError = TEXERR_OK;
|
||||||
|
|
||||||
int Texture::textureMemoryMultiplier = 1;
|
|
||||||
|
|
||||||
Texture::Texture() : Resource()
|
Texture::Texture() : Resource()
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_OPENGL
|
#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 * Texture::getBufferAndSize(int *wparam, int *hparam, unsigned int *sizeparam)
|
||||||
{
|
{
|
||||||
unsigned char *data = NULL;
|
unsigned char *data = NULL;
|
||||||
unsigned int size = 0, allocsize = 0;
|
unsigned int size = 0;
|
||||||
int tw = 0, th = 0;
|
int tw = 0, th = 0;
|
||||||
int w = 0, h = 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_WIDTH, &w);
|
||||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
|
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.
|
tw = clp2(width); // known to be > 0.
|
||||||
th = clp2(height);
|
th = clp2(height);
|
||||||
|
|
||||||
if (w != tw || h != th)
|
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
|
// choose max. for size calculation
|
||||||
w = w > tw ? w : tw;
|
w = w > tw ? w : tw;
|
||||||
h = h > th ? h : th;
|
h = h > th ? h : th;
|
||||||
|
@ -852,9 +855,7 @@ unsigned char * Texture::getBufferAndSize(int *wparam, int *hparam, unsigned int
|
||||||
if (!size)
|
if (!size)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
allocsize = size * textureMemoryMultiplier;
|
data = (unsigned char*)malloc(size + 32);
|
||||||
|
|
||||||
data = (unsigned char*)malloc(allocsize + 32);
|
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
@ -862,12 +863,12 @@ unsigned char * Texture::getBufferAndSize(int *wparam, int *hparam, unsigned int
|
||||||
errorLog(os.str());
|
errorLog(os.str());
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
memcpy(data + allocsize, "SAFE", 5);
|
memcpy(data + size, "SAFE", 5);
|
||||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
// Not sure but this might be the case with nouveau drivers on linux... still investigating. -- fg
|
// 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!");
|
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.
|
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);
|
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
|
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:
|
protected:
|
||||||
std::string loadName;
|
std::string loadName;
|
||||||
|
|
Loading…
Reference in a new issue