summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/OGLTexture.cpp
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2023-01-27 18:46:53 -0600
committeriwubcode <iwubcode@users.noreply.github.com>2023-01-27 18:46:53 -0600
commit7bea39b39e9978ca8461adf68a2c28535719c48e (patch)
tree7329c4aab053fada727c88bf996050f04e2bdb4f /Source/Core/VideoBackends/OGL/OGLTexture.cpp
parent41272dc5f1b62f4a5a0562cc29eb3e83367d0f14 (diff)
VideoBackends: add a way to load data into a specific level AND layer, default to layer 0
Diffstat (limited to 'Source/Core/VideoBackends/OGL/OGLTexture.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/OGLTexture.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/Core/VideoBackends/OGL/OGLTexture.cpp b/Source/Core/VideoBackends/OGL/OGLTexture.cpp
index 8c1b14cd08..68d9009ac6 100644
--- a/Source/Core/VideoBackends/OGL/OGLTexture.cpp
+++ b/Source/Core/VideoBackends/OGL/OGLTexture.cpp
@@ -221,11 +221,14 @@ void OGLTexture::ResolveFromTexture(const AbstractTexture* src,
}
void OGLTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
- size_t buffer_size)
+ size_t buffer_size, u32 layer)
{
if (level >= m_config.levels)
PanicAlertFmt("Texture only has {} levels, can't update level {}", m_config.levels, level);
+ if (layer >= m_config.layers)
+ PanicAlertFmt("Texture only has {} layer, can't update layer {}", m_config.layers, layer);
+
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)
@@ -246,7 +249,7 @@ void OGLTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8
{
if (g_ogl_config.bSupportsTextureStorage)
{
- glCompressedTexSubImage3D(target, level, 0, 0, 0, width, height, 1, gl_internal_format,
+ glCompressedTexSubImage3D(target, level, 0, 0, layer, width, height, 1, gl_internal_format,
static_cast<GLsizei>(buffer_size), buffer);
}
else
@@ -261,7 +264,7 @@ void OGLTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8
GLenum gl_type = GetGLTypeForTextureFormat(m_config.format);
if (g_ogl_config.bSupportsTextureStorage)
{
- glTexSubImage3D(target, level, 0, 0, 0, width, height, 1, gl_format, gl_type, buffer);
+ glTexSubImage3D(target, level, 0, 0, layer, width, height, 1, gl_format, gl_type, buffer);
}
else
{