summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-11-18 05:49:44 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-11-18 05:49:44 +0100
commitf7e155d8b90f9466a766160560addeca69888fd2 (patch)
tree133351708fffc900625b046f0a48755187a43926
parenttexture_cache: Use pixel format conversion when supported by the runtime (diff)
downloadyuzu-f7e155d8b90f9466a766160560addeca69888fd2.tar
yuzu-f7e155d8b90f9466a766160560addeca69888fd2.tar.gz
yuzu-f7e155d8b90f9466a766160560addeca69888fd2.tar.bz2
yuzu-f7e155d8b90f9466a766160560addeca69888fd2.tar.lz
yuzu-f7e155d8b90f9466a766160560addeca69888fd2.tar.xz
yuzu-f7e155d8b90f9466a766160560addeca69888fd2.tar.zst
yuzu-f7e155d8b90f9466a766160560addeca69888fd2.zip
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index e560111c3..6956535e5 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -396,6 +396,10 @@ OGLTexture MakeImage(const VideoCommon::ImageInfo& info, GLenum gl_internal_form
UNREACHABLE_MSG("Invalid image format={}", format);
return GL_R32UI;
}
+
+[[nodiscard]] u32 NextPow2(u32 value) {
+ return 1U << (32U - std::countl_zero(value - 1U));
+}
} // Anonymous namespace
ImageBufferMap::~ImageBufferMap() {
@@ -1304,7 +1308,7 @@ void FormatConversionPass::ConvertImage(Image& dst_image, Image& src_image,
const u32 copy_size = region.width * region.height * region.depth * img_bpp;
if (pbo_size < copy_size) {
intermediate_pbo.Create();
- pbo_size = copy_size;
+ pbo_size = NextPow2(copy_size);
glNamedBufferData(intermediate_pbo.handle, pbo_size, nullptr, GL_STREAM_COPY);
}
// Copy from source to PBO