Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
roeas committed Nov 15, 2024
1 parent 61f4c9f commit 1aa70cc
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Engine/Source/Engine/Platform/OpenGL/OpenGLTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ void OpenGLTexture2D::Clear(const void *pClearData) const

void OpenGLTexture2D::Resize(uint32_t width, uint32_t height, const void *pData)
{
#if !defined(SL_FINAL)
if (width <= 0 || height <= 0 || width > RenderCore::GetInfo().m_maxFramebufferSize || height > RenderCore::GetInfo().m_maxFramebufferSize)
{
SL_LOG_ERROR("Invalid texture size!");
SL_LOG_ERROR("Invalid texture size ({}, {})", width, height);
return;
}

if (m_width == width && m_height == height)
{
return;
}
#endif

glDeleteTextures(1, &m_handle);
m_handle = 0;
Expand All @@ -56,12 +54,10 @@ void OpenGLTexture2D::Bind(uint32_t slot) const

void OpenGLTexture2D::Create(const void *pData)
{
#if !defined(SL_FINAL)
if (m_handle)
{
return;
}
#endif

glCreateTextures(GL_TEXTURE_2D, 1, &m_handle);
glTextureStorage2D(m_handle, 1, GLInternalTextureFormat[(size_t)m_format], m_width, m_height);
Expand Down

0 comments on commit 1aa70cc

Please sign in to comment.