add texture:getDebugName and buffer:getDebugName

This commit is contained in:
niki
2023-12-14 00:09:08 +01:00
parent 834398335d
commit 7a25dfa7fc
15 changed files with 47 additions and 25 deletions
+12
View File
@@ -474,6 +474,17 @@ int w_Texture_renderTo(lua_State *L)
return 0;
}
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
lua_pushnil(L);
return 1;
}
const luaL_Reg w_Texture_functions[] =
{
{ "getTextureType", w_Texture_getTextureType },
@@ -506,6 +517,7 @@ const luaL_Reg w_Texture_functions[] =
{ "generateMipmaps", w_Texture_generateMipmaps },
{ "replacePixels", w_Texture_replacePixels },
{ "renderTo", w_Texture_renderTo },
{ "getDebugName", w_Texture_getDebugName },
// Deprecated
{ "newImageData", w_Texture_newImageData },