mirror of
https://github.com/love2d/love.git
synced 2026-08-19 12:14:20 +02:00
Fix some compile warnings
This commit is contained in:
@@ -106,7 +106,7 @@ Buffer::Buffer(Graphics *gfx, const Settings &settings, const std::vector<DataDe
|
|||||||
if (info.baseType == DATA_BASETYPE_BOOL)
|
if (info.baseType == DATA_BASETYPE_BOOL)
|
||||||
throw love::Exception("Bool types are not supported in vertex buffers.");
|
throw love::Exception("Bool types are not supported in vertex buffers.");
|
||||||
|
|
||||||
if (decl.bindingLocation < 0 || decl.bindingLocation >= VertexAttributes::MAX)
|
if (decl.bindingLocation < 0 || decl.bindingLocation >= (int) VertexAttributes::MAX)
|
||||||
{
|
{
|
||||||
if (decl.bindingLocation == -1 && !decl.name.empty())
|
if (decl.bindingLocation == -1 && !decl.name.empty())
|
||||||
legacyVertexBindings = true;
|
legacyVertexBindings = true;
|
||||||
@@ -344,6 +344,8 @@ std::vector<Buffer::DataDeclaration> Buffer::getCommonFormatDeclaration(CommonFo
|
|||||||
{ getConstant(ATTRIB_TEXCOORD), DATAFORMAT_FLOAT_VEC2, 0, ATTRIB_TEXCOORD },
|
{ getConstant(ATTRIB_TEXCOORD), DATAFORMAT_FLOAT_VEC2, 0, ATTRIB_TEXCOORD },
|
||||||
{ getConstant(ATTRIB_COLOR), DATAFORMAT_UNORM8_VEC4, 0, ATTRIB_COLOR },
|
{ getConstant(ATTRIB_COLOR), DATAFORMAT_UNORM8_VEC4, 0, ATTRIB_COLOR },
|
||||||
};
|
};
|
||||||
|
case CommonFormat::COUNT:
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ void Mesh::finalizeAttribute(BufferAttribute &attrib) const
|
|||||||
attrib.bindingLocation = (int)builtinattrib;
|
attrib.bindingLocation = (int)builtinattrib;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attrib.bindingLocation >= VertexAttributes::MAX || (attrib.bindingLocation < 0 && attrib.name.empty()))
|
if (attrib.bindingLocation >= (int) VertexAttributes::MAX || (attrib.bindingLocation < 0 && attrib.name.empty()))
|
||||||
throw love::Exception("Vertex attributes must have a valid binding location value within [0, %d).", VertexAttributes::MAX);
|
throw love::Exception("Vertex attributes must have a valid binding location value within [0, %d).", VertexAttributes::MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1232,7 +1232,7 @@ static bool AddFieldsToFormat(std::vector<Buffer::DataDeclaration> &format, int
|
|||||||
DataFormat dataformat = getDataFormat(type->getBasicType(), type->getVectorSize(), type->getMatrixRows(), type->getMatrixCols(), type->isMatrix());
|
DataFormat dataformat = getDataFormat(type->getBasicType(), type->getVectorSize(), type->getMatrixRows(), type->getMatrixCols(), type->isMatrix());
|
||||||
if (dataformat == DATAFORMAT_MAX_ENUM)
|
if (dataformat == DATAFORMAT_MAX_ENUM)
|
||||||
{
|
{
|
||||||
err = "Shader validation error:\nUnhandled data format for type " + (int)type->getBasicType() + std::string(" with name ") + basename;
|
err = "Shader validation error:\nUnhandled data format for type " + std::to_string((int)type->getBasicType()) + std::string(" with name ") + basename;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ size_t getFormatStride(CommonFormat format)
|
|||||||
case CommonFormat::XYf_STf_RGBAub: return sizeof(XYf_STf_RGBAub);
|
case CommonFormat::XYf_STf_RGBAub: return sizeof(XYf_STf_RGBAub);
|
||||||
case CommonFormat::XYf_STus_RGBAub: return sizeof(XYf_STus_RGBAub);
|
case CommonFormat::XYf_STus_RGBAub: return sizeof(XYf_STus_RGBAub);
|
||||||
case CommonFormat::XYf_STPf_RGBAub: return sizeof(XYf_STPf_RGBAub);
|
case CommonFormat::XYf_STPf_RGBAub: return sizeof(XYf_STPf_RGBAub);
|
||||||
|
case CommonFormat::COUNT: return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -77,6 +78,8 @@ uint32 getFormatFlags(CommonFormat format)
|
|||||||
case CommonFormat::XYf_STus_RGBAub:
|
case CommonFormat::XYf_STus_RGBAub:
|
||||||
case CommonFormat::XYf_STPf_RGBAub:
|
case CommonFormat::XYf_STPf_RGBAub:
|
||||||
return ATTRIBFLAG_POS | ATTRIBFLAG_TEXCOORD | ATTRIBFLAG_COLOR;
|
return ATTRIBFLAG_POS | ATTRIBFLAG_TEXCOORD | ATTRIBFLAG_COLOR;
|
||||||
|
case CommonFormat::COUNT:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -99,6 +102,8 @@ int getFormatPositionComponents(CommonFormat format)
|
|||||||
return 2;
|
return 2;
|
||||||
case CommonFormat::XYZf:
|
case CommonFormat::XYZf:
|
||||||
return 3;
|
return 3;
|
||||||
|
case CommonFormat::COUNT:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -321,6 +326,8 @@ void VertexAttributes::setCommonFormat(CommonFormat format, uint8 bufferindex)
|
|||||||
set(ATTRIB_TEXCOORD, DATAFORMAT_FLOAT_VEC3, uint16(sizeof(float) * 2), bufferindex);
|
set(ATTRIB_TEXCOORD, DATAFORMAT_FLOAT_VEC3, uint16(sizeof(float) * 2), bufferindex);
|
||||||
set(ATTRIB_COLOR, DATAFORMAT_UNORM8_VEC4, uint16(sizeof(float) * 5), bufferindex);
|
set(ATTRIB_COLOR, DATAFORMAT_UNORM8_VEC4, uint16(sizeof(float) * 5), bufferindex);
|
||||||
break;
|
break;
|
||||||
|
case CommonFormat::COUNT:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,9 +126,8 @@ bool World::ContactFilter::process(Shape *a, Shape *b)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
World::QueryCallback::QueryCallback(World *world, lua_State *L, int idx)
|
World::QueryCallback::QueryCallback(lua_State *L, int idx)
|
||||||
: world(world)
|
: L(L)
|
||||||
, L(L)
|
|
||||||
, funcidx(idx)
|
, funcidx(idx)
|
||||||
{
|
{
|
||||||
luaL_checktype(L, funcidx, LUA_TFUNCTION);
|
luaL_checktype(L, funcidx, LUA_TFUNCTION);
|
||||||
@@ -159,9 +158,8 @@ bool World::QueryCallback::ReportFixture(b2Fixture *fixture)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
World::CollectCallback::CollectCallback(World *world, uint16 categoryMask, lua_State *L)
|
World::CollectCallback::CollectCallback(uint16 categoryMask, lua_State *L)
|
||||||
: world(world)
|
: categoryMask(categoryMask)
|
||||||
, categoryMask(categoryMask)
|
|
||||||
, L(L)
|
, L(L)
|
||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
@@ -185,9 +183,8 @@ bool World::CollectCallback::ReportFixture(b2Fixture *f)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
World::RayCastCallback::RayCastCallback(World *world, lua_State *L, int idx)
|
World::RayCastCallback::RayCastCallback(lua_State *L, int idx)
|
||||||
: world(world)
|
: L(L)
|
||||||
, L(L)
|
|
||||||
, funcidx(idx)
|
, funcidx(idx)
|
||||||
{
|
{
|
||||||
luaL_checktype(L, funcidx, LUA_TFUNCTION);
|
luaL_checktype(L, funcidx, LUA_TFUNCTION);
|
||||||
@@ -605,7 +602,7 @@ int World::queryShapesInArea(lua_State *L)
|
|||||||
box.lowerBound = Physics::scaleDown(b2Vec2(lx, ly));
|
box.lowerBound = Physics::scaleDown(b2Vec2(lx, ly));
|
||||||
box.upperBound = Physics::scaleDown(b2Vec2(ux, uy));
|
box.upperBound = Physics::scaleDown(b2Vec2(ux, uy));
|
||||||
luaL_checktype(L, 5, LUA_TFUNCTION);
|
luaL_checktype(L, 5, LUA_TFUNCTION);
|
||||||
QueryCallback query(this, L, 5);
|
QueryCallback query(L, 5);
|
||||||
world->QueryAABB(&query, box);
|
world->QueryAABB(&query, box);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -620,7 +617,7 @@ int World::getShapesInArea(lua_State *L)
|
|||||||
b2AABB box;
|
b2AABB box;
|
||||||
box.lowerBound = Physics::scaleDown(b2Vec2(lx, ly));
|
box.lowerBound = Physics::scaleDown(b2Vec2(lx, ly));
|
||||||
box.upperBound = Physics::scaleDown(b2Vec2(ux, uy));
|
box.upperBound = Physics::scaleDown(b2Vec2(ux, uy));
|
||||||
CollectCallback query(this, categoryMaskBits, L);
|
CollectCallback query(categoryMaskBits, L);
|
||||||
world->QueryAABB(&query, box);
|
world->QueryAABB(&query, box);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -634,7 +631,7 @@ int World::rayCast(lua_State *L)
|
|||||||
b2Vec2 v1 = Physics::scaleDown(b2Vec2(x1, y1));
|
b2Vec2 v1 = Physics::scaleDown(b2Vec2(x1, y1));
|
||||||
b2Vec2 v2 = Physics::scaleDown(b2Vec2(x2, y2));
|
b2Vec2 v2 = Physics::scaleDown(b2Vec2(x2, y2));
|
||||||
luaL_checktype(L, 5, LUA_TFUNCTION);
|
luaL_checktype(L, 5, LUA_TFUNCTION);
|
||||||
RayCastCallback raycast(this, L, 5);
|
RayCastCallback raycast(L, 5);
|
||||||
world->RayCast(&raycast, v1, v2);
|
world->RayCast(&raycast, v1, v2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,11 +93,10 @@ public:
|
|||||||
class QueryCallback : public b2QueryCallback
|
class QueryCallback : public b2QueryCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QueryCallback(World *world, lua_State *L, int idx);
|
QueryCallback(lua_State *L, int idx);
|
||||||
virtual ~QueryCallback();
|
virtual ~QueryCallback();
|
||||||
bool ReportFixture(b2Fixture *fixture) override;
|
bool ReportFixture(b2Fixture *fixture) override;
|
||||||
private:
|
private:
|
||||||
World *world;
|
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
int funcidx;
|
int funcidx;
|
||||||
int userargs;
|
int userargs;
|
||||||
@@ -106,11 +105,10 @@ public:
|
|||||||
class CollectCallback : public b2QueryCallback
|
class CollectCallback : public b2QueryCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CollectCallback(World *world, uint16 categoryMask, lua_State *L);
|
CollectCallback(uint16 categoryMask, lua_State *L);
|
||||||
virtual ~CollectCallback();
|
virtual ~CollectCallback();
|
||||||
bool ReportFixture(b2Fixture *fixture) override;
|
bool ReportFixture(b2Fixture *fixture) override;
|
||||||
private:
|
private:
|
||||||
World *world;
|
|
||||||
uint16 categoryMask;
|
uint16 categoryMask;
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
@@ -119,11 +117,10 @@ public:
|
|||||||
class RayCastCallback : public b2RayCastCallback
|
class RayCastCallback : public b2RayCastCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RayCastCallback(World *world, lua_State *L, int idx);
|
RayCastCallback(lua_State *L, int idx);
|
||||||
virtual ~RayCastCallback();
|
virtual ~RayCastCallback();
|
||||||
float ReportFixture(b2Fixture *fixture, const b2Vec2 &point, const b2Vec2 &normal, float fraction) override;
|
float ReportFixture(b2Fixture *fixture, const b2Vec2 &point, const b2Vec2 &normal, float fraction) override;
|
||||||
private:
|
private:
|
||||||
World *world;
|
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
int funcidx;
|
int funcidx;
|
||||||
int userargs;
|
int userargs;
|
||||||
|
|||||||
Reference in New Issue
Block a user