mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Fix some compile warnings
This commit is contained in:
@@ -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.");
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -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<Graphics>(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());
|
||||
|
||||
@@ -187,7 +187,7 @@ private:
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user