mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
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:
@@ -555,12 +555,12 @@ size_t Parser::parseImageSize(DXGIFormat fmt, int width, int height) const
|
|||||||
return bytes;
|
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;
|
size_t offset = 0;
|
||||||
std::vector<Image> newTexData;
|
std::vector<Image> newTexData;
|
||||||
|
|
||||||
for (int i = 0; i < mips; i++)
|
for (int i = 0; i < nb_mips; i++)
|
||||||
{
|
{
|
||||||
Image img;
|
Image img;
|
||||||
img.width = w;
|
img.width = w;
|
||||||
@@ -631,9 +631,9 @@ bool Parser::parseData(const void *data, size_t dataSize)
|
|||||||
int w = header->width;
|
int w = header->width;
|
||||||
int h = header->height;
|
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
|
} // dds
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
size_t parseImageSize(dxinfo::DXGIFormat fmt, int width, int height) const;
|
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);
|
bool parseData(const void *data, size_t dataSize);
|
||||||
|
|
||||||
std::vector<Image> texData;
|
std::vector<Image> texData;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace graphics
|
|||||||
namespace opengl
|
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
|
// get currently bound fbo to reset to it later
|
||||||
GLuint current_fbo = gl.getFramebuffer(OpenGL::FRAMEBUFFER_ALL);
|
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
|
// Make sure all faces and layers of the texture are initialized to
|
||||||
// transparent black. This is unfortunately probably pretty slow for
|
// transparent black. This is unfortunately probably pretty slow for
|
||||||
// 2D-array and 3D textures with a lot of layers...
|
// 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;
|
int nlayers = layers;
|
||||||
if (texType == TEXTURE_VOLUME)
|
if (texType == TEXTURE_VOLUME)
|
||||||
|
|||||||
Reference in New Issue
Block a user