diff options
| author | Scott Mansell <phiren@gmail.com> | 2023-02-01 00:03:59 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-01 00:03:59 +1300 |
| commit | e98ab0784dd823bb974cc2f6fbed697accc76f57 (patch) | |
| tree | 25e7c1f52f2be320829fc58f65cf04a59b5a892c /Source/Core/VideoBackends/OGL | |
| parent | ed3ad9458d6825917f09c3ccf93a20c5fb363078 (diff) | |
| parent | 7bea39b39e9978ca8461adf68a2c28535719c48e (diff) | |
Merge pull request #11501 from iwubcode/abstract_texture_load_specify_layer
VideoBackends: add a way to load data into a specific level AND layer
Diffstat (limited to 'Source/Core/VideoBackends/OGL')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/OGLTexture.cpp | 9 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/OGL/OGLTexture.h | 4 |
2 files changed, 8 insertions, 5 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 { diff --git a/Source/Core/VideoBackends/OGL/OGLTexture.h b/Source/Core/VideoBackends/OGL/OGLTexture.h index 4900801523..9d1c119505 100644 --- a/Source/Core/VideoBackends/OGL/OGLTexture.h +++ b/Source/Core/VideoBackends/OGL/OGLTexture.h @@ -28,8 +28,8 @@ public: u32 dst_layer, u32 dst_level) override; void ResolveFromTexture(const AbstractTexture* src, const MathUtil::Rectangle<int>& rect, u32 layer, u32 level) override; - void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer, - size_t buffer_size) override; + void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer, size_t buffer_size, + u32 layer) override; GLuint GetGLTextureId() const { return m_texId; } GLenum GetGLTarget() const |
