mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
don't use optional for debugName
This commit is contained in:
@@ -90,7 +90,7 @@ public:
|
||||
BufferUsageFlags usageFlags;
|
||||
BufferDataUsage dataUsage;
|
||||
bool zeroInitialize;
|
||||
Optional<std::string> debugName;
|
||||
std::string debugName;
|
||||
|
||||
Settings(uint32 usageflags, BufferDataUsage dataUsage)
|
||||
: usageFlags((BufferUsageFlags)usageflags)
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
const DataMember &getDataMember(int index) const { return dataMembers[index]; }
|
||||
size_t getMemberOffset(int index) const { return dataMembers[index].offset; }
|
||||
int getDataMemberIndex(const std::string &name) const;
|
||||
const Optional<std::string> &getDebugName() const { return debugName; }
|
||||
const std::string &getDebugName() const { return debugName; }
|
||||
|
||||
void setImmutable(bool immutable) { this->immutable = immutable; };
|
||||
bool isImmutable() const { return immutable; }
|
||||
@@ -188,7 +188,7 @@ protected:
|
||||
// Usage hint. GL_[DYNAMIC, STATIC, STREAM]_DRAW.
|
||||
BufferDataUsage dataUsage;
|
||||
|
||||
Optional<std::string> debugName;
|
||||
std::string debugName;
|
||||
|
||||
bool mapped;
|
||||
MapType mappedType;
|
||||
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
bool renderTarget = false;
|
||||
bool computeWrite = false;
|
||||
OptionalBool readable;
|
||||
Optional<std::string> debugName;
|
||||
std::string debugName;
|
||||
};
|
||||
|
||||
struct Slices
|
||||
@@ -290,7 +290,7 @@ public:
|
||||
|
||||
Quad *getQuad() const;
|
||||
|
||||
const Optional<std::string> &getDebugName() const { return debugName; }
|
||||
const std::string &getDebugName() const { return debugName; }
|
||||
|
||||
static int getTotalMipmapCount(int w, int h);
|
||||
static int getTotalMipmapCount(int w, int h, int d);
|
||||
@@ -347,7 +347,7 @@ protected:
|
||||
|
||||
int64 graphicsMemorySize;
|
||||
|
||||
Optional<std::string> debugName;
|
||||
std::string debugName;
|
||||
|
||||
}; // Texture
|
||||
|
||||
|
||||
@@ -164,8 +164,8 @@ bool Buffer::load(const void *initialdata)
|
||||
glTexBuffer(target, glformat, buffer);
|
||||
}
|
||||
|
||||
if (debugName.hasValue)
|
||||
glObjectLabel(GL_BUFFER, buffer, -1, debugName.value.c_str());
|
||||
if (!debugName.empty())
|
||||
glObjectLabel(GL_BUFFER, buffer, -1, debugName.c_str());
|
||||
|
||||
return (glGetError() == GL_NO_ERROR);
|
||||
}
|
||||
|
||||
@@ -422,12 +422,12 @@ bool Texture::loadVolatile()
|
||||
|
||||
setGraphicsMemorySize(memsize);
|
||||
|
||||
if (debugName.hasValue)
|
||||
if (!debugName.empty())
|
||||
{
|
||||
if (texture)
|
||||
glObjectLabel(GL_TEXTURE, texture, -1, debugName.value.c_str());
|
||||
glObjectLabel(GL_TEXTURE, texture, -1, debugName.c_str());
|
||||
else
|
||||
glObjectLabel(GL_FRAMEBUFFER, renderbuffer, -1, debugName.value.c_str());
|
||||
glObjectLabel(GL_FRAMEBUFFER, renderbuffer, -1, debugName.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -108,7 +108,7 @@ bool Buffer::loadVolatile()
|
||||
else
|
||||
coherent = false;
|
||||
|
||||
if (debugName.hasValue && vgfx->getEnabledOptionalInstanceExtensions().debugInfo)
|
||||
if (!debugName.empty() && vgfx->getEnabledOptionalInstanceExtensions().debugInfo)
|
||||
{
|
||||
auto device = vgfx->getDevice();
|
||||
|
||||
@@ -116,7 +116,7 @@ bool Buffer::loadVolatile()
|
||||
nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
|
||||
nameInfo.objectType = VK_OBJECT_TYPE_BUFFER;
|
||||
nameInfo.objectHandle = (uint64_t)buffer;
|
||||
nameInfo.pObjectName = debugName.value.c_str();
|
||||
nameInfo.pObjectName = debugName.c_str();
|
||||
vkSetDebugUtilsObjectNameEXT(device, &nameInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ bool Texture::loadVolatile()
|
||||
|
||||
setGraphicsMemorySize(memsize);
|
||||
|
||||
if (debugName.hasValue)
|
||||
if (!debugName.empty())
|
||||
{
|
||||
if (vgfx->getEnabledOptionalInstanceExtensions().debugInfo)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ bool Texture::loadVolatile()
|
||||
nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
|
||||
nameInfo.objectType = VK_OBJECT_TYPE_IMAGE;
|
||||
nameInfo.objectHandle = (uint64_t)textureImage;
|
||||
nameInfo.pObjectName = debugName.value.c_str();
|
||||
nameInfo.pObjectName = debugName.c_str();
|
||||
vkSetDebugUtilsObjectNameEXT(device, &nameInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,11 +416,11 @@ static int w_Buffer_isBufferType(lua_State *L)
|
||||
static int w_Buffer_getDebugName(lua_State *L)
|
||||
{
|
||||
Buffer *t = luax_checkbuffer(L, 1);
|
||||
const Optional<std::string> &debugName = t->getDebugName();
|
||||
if (debugName.hasValue)
|
||||
luax_pushstring(L, debugName.value);
|
||||
else
|
||||
const std::string &debugName = t->getDebugName();
|
||||
if (debugName.empty())
|
||||
lua_pushnil(L);
|
||||
else
|
||||
luax_pushstring(L, debugName);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -741,7 +741,7 @@ static void luax_checktexturesettings(lua_State *L, int idx, bool opt, bool chec
|
||||
lua_getfield(L, idx, Texture::getConstant(Texture::SETTING_DEBUGNAME));
|
||||
if (!lua_isnoneornil(L, -1))
|
||||
{
|
||||
s.debugName.set(luaL_checkstring(L, -1));
|
||||
s.debugName = luaL_checkstring(L, -1);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
|
||||
@@ -477,11 +477,11 @@ int w_Texture_renderTo(lua_State *L)
|
||||
static int w_Texture_getDebugName(lua_State *L)
|
||||
{
|
||||
Texture *t = luax_checktexture(L, 1);
|
||||
const Optional<std::string> &debugName = t->getDebugName();
|
||||
if (debugName.hasValue)
|
||||
luax_pushstring(L, debugName.value);
|
||||
else
|
||||
const std::string &debugName = t->getDebugName();
|
||||
if (debugName.empty())
|
||||
lua_pushnil(L);
|
||||
else
|
||||
luax_pushstring(L, debugName);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user