mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Remove unused LoadTextureRawSub
and CMD_TEXTURE_UPDATE
The `IGraphics::LoadTextureRawSub` function and the respective `CMD_TEXTURE_UPDATE` command are unused. Only text textures are updated after having been uploaded, but there is a separate `CMD_TEXT_TEXTURE_UPDATE` for that.
This commit is contained in:
parent
9110d393dd
commit
da8ec6bed9
|
@ -656,11 +656,6 @@ void CCommandProcessorFragment_OpenGL::TextureUpdate(int Slot, int X, int Y, int
|
|||
free(pTexData);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL::Cmd_Texture_Update(const CCommandBuffer::SCommand_Texture_Update *pCommand)
|
||||
{
|
||||
TextureUpdate(pCommand->m_Slot, pCommand->m_X, pCommand->m_Y, pCommand->m_Width, pCommand->m_Height, GL_RGBA, pCommand->m_pData);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL::DestroyTexture(int Slot)
|
||||
{
|
||||
m_pTextureMemoryUsage->store(m_pTextureMemoryUsage->load(std::memory_order_relaxed) - m_vTextures[Slot].m_MemSize, std::memory_order_relaxed);
|
||||
|
@ -1057,9 +1052,6 @@ ERunCommandReturnTypes CCommandProcessorFragment_OpenGL::RunCommand(const CComma
|
|||
case CCommandBuffer::CMD_TEXTURE_DESTROY:
|
||||
Cmd_Texture_Destroy(static_cast<const CCommandBuffer::SCommand_Texture_Destroy *>(pBaseCommand));
|
||||
break;
|
||||
case CCommandBuffer::CMD_TEXTURE_UPDATE:
|
||||
Cmd_Texture_Update(static_cast<const CCommandBuffer::SCommand_Texture_Update *>(pBaseCommand));
|
||||
break;
|
||||
case CCommandBuffer::CMD_TEXT_TEXTURES_CREATE:
|
||||
Cmd_TextTextures_Create(static_cast<const CCommandBuffer::SCommand_TextTextures_Create *>(pBaseCommand));
|
||||
break;
|
||||
|
|
|
@ -89,7 +89,6 @@ protected:
|
|||
|
||||
virtual bool Cmd_Init(const SCommand_Init *pCommand);
|
||||
virtual void Cmd_Shutdown(const SCommand_Shutdown *pCommand) {}
|
||||
virtual void Cmd_Texture_Update(const CCommandBuffer::SCommand_Texture_Update *pCommand);
|
||||
virtual void Cmd_Texture_Destroy(const CCommandBuffer::SCommand_Texture_Destroy *pCommand);
|
||||
virtual void Cmd_Texture_Create(const CCommandBuffer::SCommand_Texture_Create *pCommand);
|
||||
virtual void Cmd_TextTexture_Update(const CCommandBuffer::SCommand_TextTexture_Update *pCommand);
|
||||
|
|
|
@ -505,11 +505,6 @@ void CCommandProcessorFragment_OpenGL3_3::TextureUpdate(int Slot, int X, int Y,
|
|||
free(pTexData);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL3_3::Cmd_Texture_Update(const CCommandBuffer::SCommand_Texture_Update *pCommand)
|
||||
{
|
||||
TextureUpdate(pCommand->m_Slot, pCommand->m_X, pCommand->m_Y, pCommand->m_Width, pCommand->m_Height, GL_RGBA, pCommand->m_pData);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL3_3::Cmd_Texture_Destroy(const CCommandBuffer::SCommand_Texture_Destroy *pCommand)
|
||||
{
|
||||
int Slot = 0;
|
||||
|
|
|
@ -82,7 +82,6 @@ protected:
|
|||
|
||||
bool Cmd_Init(const SCommand_Init *pCommand) override;
|
||||
void Cmd_Shutdown(const SCommand_Shutdown *pCommand) override;
|
||||
void Cmd_Texture_Update(const CCommandBuffer::SCommand_Texture_Update *pCommand) override;
|
||||
void Cmd_Texture_Destroy(const CCommandBuffer::SCommand_Texture_Destroy *pCommand) override;
|
||||
void Cmd_Texture_Create(const CCommandBuffer::SCommand_Texture_Create *pCommand) override;
|
||||
void Cmd_TextTexture_Update(const CCommandBuffer::SCommand_TextTexture_Update *pCommand) override;
|
||||
|
|
|
@ -1263,7 +1263,6 @@ protected:
|
|||
{
|
||||
m_aCommandCallbacks[CommandBufferCMDOff(CCommandBuffer::CMD_TEXTURE_CREATE)] = {false, [](SRenderCommandExecuteBuffer &ExecBuffer, const CCommandBuffer::SCommand *pBaseCommand) {}, [this](const CCommandBuffer::SCommand *pBaseCommand, SRenderCommandExecuteBuffer &ExecBuffer) { return Cmd_Texture_Create(static_cast<const CCommandBuffer::SCommand_Texture_Create *>(pBaseCommand)); }};
|
||||
m_aCommandCallbacks[CommandBufferCMDOff(CCommandBuffer::CMD_TEXTURE_DESTROY)] = {false, [](SRenderCommandExecuteBuffer &ExecBuffer, const CCommandBuffer::SCommand *pBaseCommand) {}, [this](const CCommandBuffer::SCommand *pBaseCommand, SRenderCommandExecuteBuffer &ExecBuffer) { return Cmd_Texture_Destroy(static_cast<const CCommandBuffer::SCommand_Texture_Destroy *>(pBaseCommand)); }};
|
||||
m_aCommandCallbacks[CommandBufferCMDOff(CCommandBuffer::CMD_TEXTURE_UPDATE)] = {false, [](SRenderCommandExecuteBuffer &ExecBuffer, const CCommandBuffer::SCommand *pBaseCommand) {}, [this](const CCommandBuffer::SCommand *pBaseCommand, SRenderCommandExecuteBuffer &ExecBuffer) { return Cmd_Texture_Update(static_cast<const CCommandBuffer::SCommand_Texture_Update *>(pBaseCommand)); }};
|
||||
m_aCommandCallbacks[CommandBufferCMDOff(CCommandBuffer::CMD_TEXT_TEXTURES_CREATE)] = {false, [](SRenderCommandExecuteBuffer &ExecBuffer, const CCommandBuffer::SCommand *pBaseCommand) {}, [this](const CCommandBuffer::SCommand *pBaseCommand, SRenderCommandExecuteBuffer &ExecBuffer) { return Cmd_TextTextures_Create(static_cast<const CCommandBuffer::SCommand_TextTextures_Create *>(pBaseCommand)); }};
|
||||
m_aCommandCallbacks[CommandBufferCMDOff(CCommandBuffer::CMD_TEXT_TEXTURES_DESTROY)] = {false, [](SRenderCommandExecuteBuffer &ExecBuffer, const CCommandBuffer::SCommand *pBaseCommand) {}, [this](const CCommandBuffer::SCommand *pBaseCommand, SRenderCommandExecuteBuffer &ExecBuffer) { return Cmd_TextTextures_Destroy(static_cast<const CCommandBuffer::SCommand_TextTextures_Destroy *>(pBaseCommand)); }};
|
||||
m_aCommandCallbacks[CommandBufferCMDOff(CCommandBuffer::CMD_TEXT_TEXTURE_UPDATE)] = {false, [](SRenderCommandExecuteBuffer &ExecBuffer, const CCommandBuffer::SCommand *pBaseCommand) {}, [this](const CCommandBuffer::SCommand *pBaseCommand, SRenderCommandExecuteBuffer &ExecBuffer) { return Cmd_TextTexture_Update(static_cast<const CCommandBuffer::SCommand_TextTexture_Update *>(pBaseCommand)); }};
|
||||
|
@ -6631,19 +6630,6 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool Cmd_Texture_Update(const CCommandBuffer::SCommand_Texture_Update *pCommand)
|
||||
{
|
||||
size_t IndexTex = pCommand->m_Slot;
|
||||
uint8_t *pData = pCommand->m_pData;
|
||||
|
||||
if(!UpdateTexture(IndexTex, VK_FORMAT_B8G8R8A8_UNORM, pData, pCommand->m_X, pCommand->m_Y, pCommand->m_Width, pCommand->m_Height))
|
||||
return false;
|
||||
|
||||
free(pData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool Cmd_Texture_Destroy(const CCommandBuffer::SCommand_Texture_Destroy *pCommand)
|
||||
{
|
||||
size_t ImageIndex = (size_t)pCommand->m_Slot;
|
||||
|
|
|
@ -337,25 +337,6 @@ static bool ConvertToRGBA(uint8_t *pDest, const CImageInfo &SrcImage)
|
|||
}
|
||||
}
|
||||
|
||||
int CGraphics_Threaded::LoadTextureRawSub(CTextureHandle TextureId, int x, int y, const CImageInfo &Image)
|
||||
{
|
||||
dbg_assert(TextureId.IsValid(), "Invalid texture handle used with LoadTextureRawSub.");
|
||||
|
||||
CCommandBuffer::SCommand_Texture_Update Cmd;
|
||||
Cmd.m_Slot = TextureId.Id();
|
||||
Cmd.m_X = x;
|
||||
Cmd.m_Y = y;
|
||||
Cmd.m_Width = Image.m_Width;
|
||||
Cmd.m_Height = Image.m_Height;
|
||||
|
||||
uint8_t *pTmpData = static_cast<uint8_t *>(malloc(Image.m_Width * Image.m_Height * CImageInfo::PixelSize(CImageInfo::FORMAT_RGBA)));
|
||||
ConvertToRGBA(pTmpData, Image);
|
||||
Cmd.m_pData = pTmpData;
|
||||
AddCmd(Cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
IGraphics::CTextureHandle CGraphics_Threaded::LoadSpriteTextureImpl(const CImageInfo &FromImageInfo, int x, int y, size_t w, size_t h, const char *pName)
|
||||
{
|
||||
m_vSpriteHelper.resize(w * h * FromImageInfo.PixelSize());
|
||||
|
|
|
@ -93,7 +93,6 @@ public:
|
|||
// texture commands
|
||||
CMD_TEXTURE_CREATE,
|
||||
CMD_TEXTURE_DESTROY,
|
||||
CMD_TEXTURE_UPDATE,
|
||||
CMD_TEXT_TEXTURES_CREATE,
|
||||
CMD_TEXT_TEXTURES_DESTROY,
|
||||
CMD_TEXT_TEXTURE_UPDATE,
|
||||
|
@ -532,22 +531,6 @@ public:
|
|||
uint8_t *m_pData; // will be freed by the command processor
|
||||
};
|
||||
|
||||
struct SCommand_Texture_Update : public SCommand
|
||||
{
|
||||
SCommand_Texture_Update() :
|
||||
SCommand(CMD_TEXTURE_UPDATE) {}
|
||||
|
||||
// texture information
|
||||
int m_Slot;
|
||||
|
||||
int m_X;
|
||||
int m_Y;
|
||||
size_t m_Width;
|
||||
size_t m_Height;
|
||||
// data must be in RGBA format
|
||||
uint8_t *m_pData; // will be freed by the command processor
|
||||
};
|
||||
|
||||
struct SCommand_Texture_Destroy : public SCommand
|
||||
{
|
||||
SCommand_Texture_Destroy() :
|
||||
|
@ -966,7 +949,6 @@ public:
|
|||
int UnloadTexture(IGraphics::CTextureHandle *pIndex) override;
|
||||
IGraphics::CTextureHandle LoadTextureRaw(const CImageInfo &Image, int Flags, const char *pTexName = nullptr) override;
|
||||
IGraphics::CTextureHandle LoadTextureRawMove(CImageInfo &Image, int Flags, const char *pTexName = nullptr) override;
|
||||
int LoadTextureRawSub(IGraphics::CTextureHandle TextureId, int x, int y, const CImageInfo &Image) override;
|
||||
|
||||
bool LoadTextTextures(size_t Width, size_t Height, CTextureHandle &TextTexture, CTextureHandle &TextOutlineTexture, uint8_t *pTextData, uint8_t *pTextOutlineData) override;
|
||||
bool UnloadTextTextures(CTextureHandle &TextTexture, CTextureHandle &TextOutlineTexture) override;
|
||||
|
|
|
@ -343,7 +343,6 @@ public:
|
|||
virtual int UnloadTexture(CTextureHandle *pIndex) = 0;
|
||||
virtual CTextureHandle LoadTextureRaw(const CImageInfo &Image, int Flags, const char *pTexName = nullptr) = 0;
|
||||
virtual CTextureHandle LoadTextureRawMove(CImageInfo &Image, int Flags, const char *pTexName = nullptr) = 0;
|
||||
virtual int LoadTextureRawSub(CTextureHandle TextureId, int x, int y, const CImageInfo &Image) = 0;
|
||||
virtual CTextureHandle LoadTexture(const char *pFilename, int StorageType, int Flags = 0) = 0;
|
||||
virtual void TextureSet(CTextureHandle Texture) = 0;
|
||||
void TextureClear() { TextureSet(CTextureHandle()); }
|
||||
|
|
Loading…
Reference in a new issue