From 35e443545e25f77345693a8a82790aa96977a5c0 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Mon, 15 Jul 2024 17:33:49 -0300 Subject: [PATCH] Fix some compile warnings --- src/modules/graphics/GraphicsReadback.cpp | 4 +--- src/modules/graphics/Mesh.cpp | 10 +++------- src/modules/graphics/Mesh.h | 2 +- src/modules/graphics/ShaderStage.cpp | 2 +- src/modules/graphics/wrap_Graphics.cpp | 2 +- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/modules/graphics/GraphicsReadback.cpp b/src/modules/graphics/GraphicsReadback.cpp index d99a05567..6b7771d84 100644 --- a/src/modules/graphics/GraphicsReadback.cpp +++ b/src/modules/graphics/GraphicsReadback.cpp @@ -33,13 +33,11 @@ namespace graphics love::Type GraphicsReadback::type("GraphicsReadback", &Object::type); -GraphicsReadback::GraphicsReadback(Graphics *gfx, ReadbackMethod method, Buffer *buffer, size_t offset, size_t size, love::data::ByteData *dest, size_t destoffset) +GraphicsReadback::GraphicsReadback(Graphics */*gfx*/, ReadbackMethod method, Buffer *buffer, size_t offset, size_t size, love::data::ByteData *dest, size_t destoffset) : dataType(DATA_BUFFER) , method(method) , bufferData(dest) { - const auto &caps = gfx->getCapabilities(); - if (offset + size > buffer->getSize()) throw love::Exception("Invalid offset or size for the given Buffer."); diff --git a/src/modules/graphics/Mesh.cpp b/src/modules/graphics/Mesh.cpp index b8565b9b0..fcf3ca345 100644 --- a/src/modules/graphics/Mesh.cpp +++ b/src/modules/graphics/Mesh.cpp @@ -109,13 +109,11 @@ Mesh::Mesh(const std::vector &attributes, PrimitiveType d attachedAttributes = attributes; vertexCount = attachedAttributes.size() > 0 ? LOVE_UINT32_MAX : 0; - auto gfx = Module::getInstance(Module::M_GRAPHICS); - for (int i = 0; i < (int) attachedAttributes.size(); i++) { auto &attrib = attachedAttributes[i]; - finalizeAttribute(gfx, attrib); + finalizeAttribute(attrib); int attributeIndex = getAttachedAttributeIndex(attrib.name); if (attributeIndex != i && attributeIndex != -1) @@ -158,7 +156,7 @@ int Mesh::getAttachedAttributeIndex(const std::string &name) const return -1; } -void Mesh::finalizeAttribute(Graphics *gfx, BufferAttribute &attrib) const +void Mesh::finalizeAttribute(BufferAttribute &attrib) const { if ((attrib.buffer->getUsageFlags() & BUFFERUSAGEFLAG_VERTEX) == 0) throw love::Exception("Buffer must be created with vertex buffer support to be used as a Mesh vertex attribute."); @@ -228,8 +226,6 @@ bool Mesh::isAttributeEnabled(const std::string &name) const void Mesh::attachAttribute(const std::string &name, Buffer *buffer, Mesh *mesh, const std::string &attachname, int startindex, AttributeStep step) { - auto gfx = Module::getInstance(Module::M_GRAPHICS); - BufferAttribute oldattrib = {}; BufferAttribute newattrib = {}; @@ -248,7 +244,7 @@ void Mesh::attachAttribute(const std::string &name, Buffer *buffer, Mesh *mesh, newattrib.startArrayIndex = startindex; newattrib.step = step; - finalizeAttribute(gfx, newattrib); + finalizeAttribute(newattrib); if (newattrib.indexInBuffer < 0) throw love::Exception("The specified vertex buffer does not have a vertex attribute named '%s'", attachname.c_str()); diff --git a/src/modules/graphics/Mesh.h b/src/modules/graphics/Mesh.h index f48df211d..f2ee074f3 100644 --- a/src/modules/graphics/Mesh.h +++ b/src/modules/graphics/Mesh.h @@ -187,7 +187,7 @@ class Mesh : public Drawable void setupAttachedAttributes(); int getAttachedAttributeIndex(const std::string &name) const; - void finalizeAttribute(Graphics *gfx, BufferAttribute &attrib) const; + void finalizeAttribute(BufferAttribute &attrib) const; void drawInternal(Graphics *gfx, const Matrix4 &m, int instancecount, Buffer *indirectargs, int argsindex); diff --git a/src/modules/graphics/ShaderStage.cpp b/src/modules/graphics/ShaderStage.cpp index ea628a7c2..566b8b937 100644 --- a/src/modules/graphics/ShaderStage.cpp +++ b/src/modules/graphics/ShaderStage.cpp @@ -30,7 +30,7 @@ namespace love namespace graphics { -ShaderStage::ShaderStage(Graphics *gfx, ShaderStageType stage, const std::string &glsl, bool gles, const std::string &cachekey) +ShaderStage::ShaderStage(Graphics */*gfx*/, ShaderStageType stage, const std::string &glsl, bool gles, const std::string &cachekey) : stageType(stage) , source(glsl) , cacheKey(cachekey) diff --git a/src/modules/graphics/wrap_Graphics.cpp b/src/modules/graphics/wrap_Graphics.cpp index ba8faff05..fac1a339b 100644 --- a/src/modules/graphics/wrap_Graphics.cpp +++ b/src/modules/graphics/wrap_Graphics.cpp @@ -837,7 +837,7 @@ static void luax_checktexturesettings(lua_State *L, int idx, bool opt, bool chec if (lua_type(L, -1) != LUA_TTABLE) luaL_argerror(L, idx, "expected field 'viewformats' to be a table type"); - for (int i = 1; i <= luax_objlen(L, -1); i++) + for (int i = 1; i <= (int)luax_objlen(L, -1); i++) { lua_rawgeti(L, -1, i); const char *str = luaL_checkstring(L, -1);