summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/OGLTexture.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-12-02 20:45:27 +0100
committerGitHub <noreply@github.com>2020-12-02 20:45:27 +0100
commitb148b56fba41e2beb81c61e4d84bbecad0f33a53 (patch)
tree9588abb91d50ca660e9f832eb8d751be73a8413d /Source/Core/VideoBackends/OGL/OGLTexture.cpp
parent00f2e0e494f644d0a559dc92f9eb94be0fab6913 (diff)
parent139d4fc76e4ddf45179ca5ec5e42c52ef513ea4d (diff)
Merge pull request #9304 from lioncash/panic
General: Convert PanicAlerts over to fmt equivalent
Diffstat (limited to 'Source/Core/VideoBackends/OGL/OGLTexture.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/OGLTexture.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/Source/Core/VideoBackends/OGL/OGLTexture.cpp b/Source/Core/VideoBackends/OGL/OGLTexture.cpp
index 3cdbaca301..6a378f6b86 100644
--- a/Source/Core/VideoBackends/OGL/OGLTexture.cpp
+++ b/Source/Core/VideoBackends/OGL/OGLTexture.cpp
@@ -42,7 +42,7 @@ GLenum GetGLInternalFormatForTextureFormat(AbstractTextureFormat format, bool st
case AbstractTextureFormat::D32F_S8:
return GL_DEPTH32F_STENCIL8;
default:
- PanicAlert("Unhandled texture format.");
+ PanicAlertFmt("Unhandled texture format.");
return storage ? GL_RGBA8 : GL_RGBA;
}
}
@@ -216,12 +216,15 @@ void OGLTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8
size_t buffer_size)
{
if (level >= m_config.levels)
- PanicAlert("Texture only has %d levels, can't update level %d", m_config.levels, level);
- if (width != std::max(1u, m_config.width >> level) ||
- height != std::max(1u, m_config.height >> level))
- PanicAlert("size of level %d must be %dx%d, but %dx%d requested", level,
- std::max(1u, m_config.width >> level), std::max(1u, m_config.height >> level), width,
- height);
+ PanicAlertFmt("Texture only has {} levels, can't update level {}", m_config.levels, level);
+
+ const auto expected_width = std::max(1U, m_config.width >> level);
+ const auto expected_height = std::max(1U, m_config.height >> level);
+ if (width != expected_width || height != expected_height)
+ {
+ PanicAlertFmt("Size of level {} must be {}x{}, but {}x{} requested", level, expected_width,
+ expected_height, width, height);
+ }
const GLenum target = GetGLTarget();
glActiveTexture(GL_MUTABLE_TEXTURE_INDEX);