mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-08 05:19:59 +00:00
gl_rasterizer: Skip framebuffer configuration if rendertargets have not been changed
This commit is contained in:
parent
b683e41fca
commit
19cf995225
2 changed files with 31 additions and 1 deletions
|
@ -488,7 +488,19 @@ void RasterizerOpenGL::ConfigureFramebuffers(OpenGLState& current_state, bool us
|
||||||
bool using_depth_fb, bool preserve_contents,
|
bool using_depth_fb, bool preserve_contents,
|
||||||
std::optional<std::size_t> single_color_target) {
|
std::optional<std::size_t> single_color_target) {
|
||||||
MICROPROFILE_SCOPE(OpenGL_Framebuffer);
|
MICROPROFILE_SCOPE(OpenGL_Framebuffer);
|
||||||
const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
|
const auto& gpu = Core::System::GetInstance().GPU().Maxwell3D();
|
||||||
|
const auto& regs = gpu.regs;
|
||||||
|
|
||||||
|
const FramebufferConfigState fb_config_state{using_color_fb, using_depth_fb, preserve_contents,
|
||||||
|
single_color_target};
|
||||||
|
if (fb_config_state == current_framebuffer_config_state && gpu.dirty_flags.color_buffer == 0 &&
|
||||||
|
!gpu.dirty_flags.zeta_buffer) {
|
||||||
|
// Only skip if the previous ConfigureFramebuffers call was from the same kind (multiple or
|
||||||
|
// single color targets). This is done because the guest registers may not change but the
|
||||||
|
// host framebuffer may contain different attachments
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
current_framebuffer_config_state = fb_config_state;
|
||||||
|
|
||||||
Surface depth_surface;
|
Surface depth_surface;
|
||||||
if (using_depth_fb) {
|
if (using_depth_fb) {
|
||||||
|
|
|
@ -94,6 +94,23 @@ private:
|
||||||
float max_anisotropic = 1.0f;
|
float max_anisotropic = 1.0f;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct FramebufferConfigState {
|
||||||
|
bool using_color_fb{};
|
||||||
|
bool using_depth_fb{};
|
||||||
|
bool preserve_contents{};
|
||||||
|
std::optional<std::size_t> single_color_target;
|
||||||
|
|
||||||
|
bool operator==(const FramebufferConfigState& rhs) const {
|
||||||
|
return std::tie(using_color_fb, using_depth_fb, preserve_contents,
|
||||||
|
single_color_target) == std::tie(rhs.using_color_fb, rhs.using_depth_fb,
|
||||||
|
rhs.preserve_contents,
|
||||||
|
rhs.single_color_target);
|
||||||
|
}
|
||||||
|
bool operator!=(const FramebufferConfigState& rhs) const {
|
||||||
|
return !operator==(rhs);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the color and depth framebuffer states.
|
* Configures the color and depth framebuffer states.
|
||||||
* @param use_color_fb If true, configure color framebuffers.
|
* @param use_color_fb If true, configure color framebuffers.
|
||||||
|
@ -197,6 +214,7 @@ private:
|
||||||
vertex_array_cache;
|
vertex_array_cache;
|
||||||
|
|
||||||
std::map<FramebufferCacheKey, OGLFramebuffer> framebuffer_cache;
|
std::map<FramebufferCacheKey, OGLFramebuffer> framebuffer_cache;
|
||||||
|
FramebufferConfigState current_framebuffer_config_state;
|
||||||
|
|
||||||
std::array<SamplerInfo, Tegra::Engines::Maxwell3D::Regs::NumTextureSamplers> texture_samplers;
|
std::array<SamplerInfo, Tegra::Engines::Maxwell3D::Regs::NumTextureSamplers> texture_samplers;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue