Fix build on MIPS

On MIPS toolchains, the 'mips' keyword is a macro defined to 1.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
This commit is contained in:
Paul Cercueil
2019-12-19 11:30:38 +01:00
parent 6a552d5a6f
commit 0bac89e00f
3 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -555,12 +555,12 @@ size_t Parser::parseImageSize(DXGIFormat fmt, int width, int height) const
return bytes;
}
bool Parser::parseTexData(const uint8_t *data, size_t dataSize, DXGIFormat fmt, int w, int h, int mips)
bool Parser::parseTexData(const uint8_t *data, size_t dataSize, DXGIFormat fmt, int w, int h, int nb_mips)
{
size_t offset = 0;
std::vector<Image> newTexData;
for (int i = 0; i < mips; i++)
for (int i = 0; i < nb_mips; i++)
{
Image img;
img.width = w;
@@ -631,9 +631,9 @@ bool Parser::parseData(const void *data, size_t dataSize)
int w = header->width;
int h = header->height;
int mips = std::max((int) header->mipMapCount, 1);
int nb_mips = std::max((int) header->mipMapCount, 1);
return parseTexData(&readData[offset], dataSize - offset, format, w, h, mips);
return parseTexData(&readData[offset], dataSize - offset, format, w, h, nb_mips);
}
} // dds
+1 -1
View File
@@ -105,7 +105,7 @@ public:
private:
size_t parseImageSize(dxinfo::DXGIFormat fmt, int width, int height) const;
bool parseTexData(const uint8_t *data, size_t dataSize, dxinfo::DXGIFormat fmt, int w, int h, int mips);
bool parseTexData(const uint8_t *data, size_t dataSize, dxinfo::DXGIFormat fmt, int w, int h, int nb_mips);
bool parseData(const void *data, size_t dataSize);
std::vector<Image> texData;
+2 -2
View File
@@ -31,7 +31,7 @@ namespace graphics
namespace opengl
{
static GLenum createFBO(GLuint &framebuffer, TextureType texType, PixelFormat format, GLuint texture, int layers, int mips)
static GLenum createFBO(GLuint &framebuffer, TextureType texType, PixelFormat format, GLuint texture, int layers, int nb_mips)
{
// get currently bound fbo to reset to it later
GLuint current_fbo = gl.getFramebuffer(OpenGL::FRAMEBUFFER_ALL);
@@ -60,7 +60,7 @@ static GLenum createFBO(GLuint &framebuffer, TextureType texType, PixelFormat fo
// Make sure all faces and layers of the texture are initialized to
// transparent black. This is unfortunately probably pretty slow for
// 2D-array and 3D textures with a lot of layers...
for (int mip = mips - 1; mip >= 0; mip--)
for (int mip = nb_mips - 1; mip >= 0; mip--)
{
int nlayers = layers;
if (texType == TEXTURE_VOLUME)