Frontend PR fixes (#6378)
* citra_qt: Check if renderer is null * core: Fix dynarmic use-after-free error * bootmanager: Add current context check in DoneCurrent * Loading a save state would destroy the frame dumper class, which contains a shared context. That context would call DoneCurrent without checking if it was actually bound or not, resulting in crashes when calling opengl functions * externals: Correct glad readme * common: Log renderer debug setting * citra: Make lambda lower case * Consistency with review comments on the PR * video_core: Kill more global state * GetResolutionScaleFactor would be called somewhere in the renderer constructor chain but it relies on the yet unitialized g_renderer, resulting in crashes when the resolution scale is set to auto. Rather than adding a workaround, let's kill this global state to fix this for good
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "common/microprofile.h"
|
||||
#include "video_core/pica_state.h"
|
||||
#include "video_core/rasterizer_cache/rasterizer_cache.h"
|
||||
#include "video_core/renderer_base.h"
|
||||
#include "video_core/renderer_opengl/gl_format_reinterpreter.h"
|
||||
#include "video_core/renderer_opengl/texture_downloader_es.h"
|
||||
#include "video_core/renderer_opengl/texture_filters/texture_filterer.h"
|
||||
@@ -239,8 +240,9 @@ static Surface FindMatch(const SurfaceCache& surface_cache, const SurfaceParams&
|
||||
return match_surface;
|
||||
}
|
||||
|
||||
RasterizerCacheOpenGL::RasterizerCacheOpenGL() {
|
||||
resolution_scale_factor = VideoCore::GetResolutionScaleFactor();
|
||||
RasterizerCacheOpenGL::RasterizerCacheOpenGL(VideoCore::RendererBase& renderer_)
|
||||
: renderer{renderer_} {
|
||||
resolution_scale_factor = renderer.GetResolutionScaleFactor();
|
||||
texture_filterer = std::make_unique<TextureFilterer>(
|
||||
Settings::values.texture_filter_name.GetValue(), resolution_scale_factor);
|
||||
format_reinterpreter = std::make_unique<FormatReinterpreterOpenGL>();
|
||||
@@ -588,15 +590,14 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces(
|
||||
const auto& config = regs.framebuffer.framebuffer;
|
||||
|
||||
// Update resolution_scale_factor and reset cache if changed
|
||||
const bool resolution_scale_changed =
|
||||
resolution_scale_factor != VideoCore::GetResolutionScaleFactor();
|
||||
const u32 scale_factor = renderer.GetResolutionScaleFactor();
|
||||
const bool resolution_scale_changed = resolution_scale_factor != scale_factor;
|
||||
const bool texture_filter_changed =
|
||||
VideoCore::g_texture_filter_update_requested.exchange(false) &&
|
||||
texture_filterer->Reset(Settings::values.texture_filter_name.GetValue(),
|
||||
VideoCore::GetResolutionScaleFactor());
|
||||
renderer.Settings().texture_filter_update_requested.exchange(false) &&
|
||||
texture_filterer->Reset(Settings::values.texture_filter_name.GetValue(), scale_factor);
|
||||
|
||||
if (resolution_scale_changed || texture_filter_changed) {
|
||||
resolution_scale_factor = VideoCore::GetResolutionScaleFactor();
|
||||
resolution_scale_factor = scale_factor;
|
||||
FlushAll();
|
||||
while (!surface_cache.empty())
|
||||
UnregisterSurface(*surface_cache.begin()->second.begin());
|
||||
|
@@ -9,6 +9,10 @@
|
||||
#include "video_core/rasterizer_cache/surface_params.h"
|
||||
#include "video_core/texture/texture_decode.h"
|
||||
|
||||
namespace VideoCore {
|
||||
class RendererBase;
|
||||
}
|
||||
|
||||
namespace OpenGL {
|
||||
|
||||
enum class ScaleMatch {
|
||||
@@ -23,7 +27,7 @@ class FormatReinterpreterOpenGL;
|
||||
|
||||
class RasterizerCacheOpenGL : NonCopyable {
|
||||
public:
|
||||
RasterizerCacheOpenGL();
|
||||
RasterizerCacheOpenGL(VideoCore::RendererBase& renderer);
|
||||
~RasterizerCacheOpenGL();
|
||||
|
||||
/// Blit one surface's texture to another
|
||||
@@ -108,6 +112,7 @@ private:
|
||||
/// Increase/decrease the number of surface in pages touching the specified region
|
||||
void UpdatePagesCachedCount(PAddr addr, u32 size, int delta);
|
||||
|
||||
VideoCore::RendererBase& renderer;
|
||||
TextureRuntime runtime;
|
||||
SurfaceCache surface_cache;
|
||||
PageMap cached_pages;
|
||||
|
Reference in New Issue
Block a user