Skip to content

Commit

Permalink
Fix some compile warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Jul 15, 2024
1 parent 72af731 commit 35e4435
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/modules/graphics/GraphicsReadback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.");

Expand Down
10 changes: 3 additions & 7 deletions src/modules/graphics/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,11 @@ Mesh::Mesh(const std::vector<Mesh::BufferAttribute> &attributes, PrimitiveType d
attachedAttributes = attributes;
vertexCount = attachedAttributes.size() > 0 ? LOVE_UINT32_MAX : 0;

auto gfx = Module::getInstance<Graphics>(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)
Expand Down Expand Up @@ -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.");
Expand Down Expand Up @@ -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<Graphics>(Module::M_GRAPHICS);

BufferAttribute oldattrib = {};
BufferAttribute newattrib = {};

Expand All @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/modules/graphics/Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/modules/graphics/ShaderStage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/graphics/wrap_Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 35e4435

Please sign in to comment.