From 8b881ac1fcd6bfd9dbd4c64c8398628ce884a8d5 Mon Sep 17 00:00:00 2001 From: Khangaroo Date: Wed, 7 Aug 2019 14:26:25 -0400 Subject: [PATCH] fix preload textures being enabled when it shouldn't address more comments --- .../configuration/configure_graphics.cpp | 2 +- src/core/custom_tex_cache.cpp | 5 ++--- src/core/frontend/image_interface.h | 14 ++++---------- .../renderer_opengl/gl_rasterizer_cache.cpp | 16 ++++++++-------- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/citra_qt/configuration/configure_graphics.cpp b/src/citra_qt/configuration/configure_graphics.cpp index 4b59e05ab..d7bf3f705 100644 --- a/src/citra_qt/configuration/configure_graphics.cpp +++ b/src/citra_qt/configuration/configure_graphics.cpp @@ -23,7 +23,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) ui->hw_renderer_group->setEnabled(checked); ui->toggle_custom_textures->setEnabled(checked); ui->toggle_dump_textures->setEnabled(checked); - ui->toggle_preload_textures->setEnabled(checked); + ui->toggle_preload_textures->setEnabled(false); if (!checked) { ui->toggle_custom_textures->setChecked(false); ui->toggle_dump_textures->setChecked(false); diff --git a/src/core/custom_tex_cache.cpp b/src/core/custom_tex_cache.cpp index 48a2f5578..16250752d 100644 --- a/src/core/custom_tex_cache.cpp +++ b/src/core/custom_tex_cache.cpp @@ -28,8 +28,7 @@ const CustomTexInfo& CustomTexCache::LookupTexture(u64 hash) { return custom_textures.at(hash); } -void CustomTexCache::CacheTexture(u64 hash, const std::vector& tex, u32 width, - u32 height) { +void CustomTexCache::CacheTexture(u64 hash, const std::vector& tex, u32 width, u32 height) { custom_textures[hash] = {width, height, tex}; } -} // namespace Core \ No newline at end of file +} // namespace Core diff --git a/src/core/frontend/image_interface.h b/src/core/frontend/image_interface.h index a7003dfc8..f5ccd1c29 100644 --- a/src/core/frontend/image_interface.h +++ b/src/core/frontend/image_interface.h @@ -13,19 +13,13 @@ namespace Frontend { class ImageInterface { public: - ImageInterface() = default; - ~ImageInterface() = default; + virtual ~ImageInterface() = default; // Error logging should be handled by the frontend - virtual bool DecodePNG(std::vector& dst, u32& width, u32& height, const std::string& path) { - LOG_CRITICAL(Frontend, "Attempted to decode PNG without an image interface!"); - return false; - }; + virtual bool DecodePNG(std::vector& dst, u32& width, u32& height, + const std::string& path) = 0; virtual bool EncodePNG(const std::string& path, const std::vector& src, u32 width, - u32 height) { - LOG_CRITICAL(Frontend, "Attempted to encode PNG without an image interface!"); - return false; - }; + u32 height) = 0; }; } // namespace Frontend \ No newline at end of file diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index d0d53e9a6..165181588 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -997,14 +997,7 @@ void CachedSurface::UploadGLTexture(const Common::Rectangle& rect, GLuint r // Ensure no bad interactions with GL_UNPACK_ALIGNMENT ASSERT(stride * GetGLBytesPerPixel(pixel_format) % 4 == 0); - if (!use_custom_tex) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, static_cast(stride)); - - glActiveTexture(GL_TEXTURE0); - glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, static_cast(rect.GetWidth()), - static_cast(rect.GetHeight()), tuple.format, tuple.type, - &gl_buffer[buffer_offset]); - } else { + if (use_custom_tex) { if (res_scale == 1) { AllocateSurfaceTexture(texture.handle, GetFormatTuple(PixelFormat::RGBA8), custom_tex_info.width, custom_tex_info.height); @@ -1017,6 +1010,13 @@ void CachedSurface::UploadGLTexture(const Common::Rectangle& rect, GLuint r glActiveTexture(GL_TEXTURE0); glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, custom_tex_info.width, custom_tex_info.height, GL_RGBA, GL_UNSIGNED_BYTE, custom_tex_info.tex.data()); + } else { + glPixelStorei(GL_UNPACK_ROW_LENGTH, static_cast(stride)); + + glActiveTexture(GL_TEXTURE0); + glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, static_cast(rect.GetWidth()), + static_cast(rect.GetHeight()), tuple.format, tuple.type, + &gl_buffer[buffer_offset]); } glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);