rasterizer_cache_gl: Notify on framebuffer change
This commit is contained in:
parent
45b6d2d349
commit
d583fc1e97
|
@ -968,18 +968,27 @@ Surface RasterizerCacheOpenGL::GetColorBufferSurface(std::size_t index, bool pre
|
||||||
gpu.dirty_flags.color_buffer.reset(index);
|
gpu.dirty_flags.color_buffer.reset(index);
|
||||||
|
|
||||||
ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets);
|
ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets);
|
||||||
|
auto Notify = [&]() {
|
||||||
|
if (last_color_buffers[index] != current_color_buffers[index]) {
|
||||||
|
NotifyFrameBufferChange(current_color_buffers[index]);
|
||||||
|
}
|
||||||
|
last_color_buffers[index] = current_color_buffers[index];
|
||||||
|
};
|
||||||
|
|
||||||
if (index >= regs.rt_control.count) {
|
if (index >= regs.rt_control.count) {
|
||||||
return last_color_buffers[index] = {};
|
Notify();
|
||||||
|
return current_color_buffers[index] = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (regs.rt[index].Address() == 0 || regs.rt[index].format == Tegra::RenderTargetFormat::NONE) {
|
if (regs.rt[index].Address() == 0 || regs.rt[index].format == Tegra::RenderTargetFormat::NONE) {
|
||||||
return last_color_buffers[index] = {};
|
Notify();
|
||||||
|
return current_color_buffers[index] = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const SurfaceParams color_params{SurfaceParams::CreateForFramebuffer(index)};
|
const SurfaceParams color_params{SurfaceParams::CreateForFramebuffer(index)};
|
||||||
|
|
||||||
return last_color_buffers[index] = GetSurface(color_params, preserve_contents);
|
Notify();
|
||||||
|
return current_color_buffers[index] = GetSurface(color_params, preserve_contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerCacheOpenGL::LoadSurface(const Surface& surface) {
|
void RasterizerCacheOpenGL::LoadSurface(const Surface& surface) {
|
||||||
|
@ -1290,4 +1299,9 @@ Surface RasterizerCacheOpenGL::TryGetReservedSurface(const SurfaceParams& params
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RasterizerCacheOpenGL::NotifyFrameBufferChange(Surface triggering_surface) {
|
||||||
|
if (triggering_surface == nullptr)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace OpenGL
|
} // namespace OpenGL
|
||||||
|
|
|
@ -34,6 +34,7 @@ using SurfaceTarget = VideoCore::Surface::SurfaceTarget;
|
||||||
using SurfaceType = VideoCore::Surface::SurfaceType;
|
using SurfaceType = VideoCore::Surface::SurfaceType;
|
||||||
using PixelFormat = VideoCore::Surface::PixelFormat;
|
using PixelFormat = VideoCore::Surface::PixelFormat;
|
||||||
using ComponentType = VideoCore::Surface::ComponentType;
|
using ComponentType = VideoCore::Surface::ComponentType;
|
||||||
|
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
||||||
|
|
||||||
struct SurfaceParams {
|
struct SurfaceParams {
|
||||||
enum class SurfaceClass {
|
enum class SurfaceClass {
|
||||||
|
@ -449,6 +450,9 @@ private:
|
||||||
/// Tries to get a reserved surface for the specified parameters
|
/// Tries to get a reserved surface for the specified parameters
|
||||||
Surface TryGetReservedSurface(const SurfaceParams& params);
|
Surface TryGetReservedSurface(const SurfaceParams& params);
|
||||||
|
|
||||||
|
/// When a render target is changed, this method is called with the previous render target
|
||||||
|
void NotifyFrameBufferChange(Surface triggering_surface);
|
||||||
|
|
||||||
/// Performs a slow but accurate surface copy, flushing to RAM and reinterpreting the data
|
/// Performs a slow but accurate surface copy, flushing to RAM and reinterpreting the data
|
||||||
void AccurateCopySurface(const Surface& src_surface, const Surface& dst_surface);
|
void AccurateCopySurface(const Surface& src_surface, const Surface& dst_surface);
|
||||||
void FastLayeredCopySurface(const Surface& src_surface, const Surface& dst_surface);
|
void FastLayeredCopySurface(const Surface& src_surface, const Surface& dst_surface);
|
||||||
|
@ -469,7 +473,8 @@ private:
|
||||||
/// using the new format.
|
/// using the new format.
|
||||||
OGLBuffer copy_pbo;
|
OGLBuffer copy_pbo;
|
||||||
|
|
||||||
std::array<Surface, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets> last_color_buffers;
|
std::array<Surface, Maxwell::NumRenderTargets> last_color_buffers;
|
||||||
|
std::array<Surface, Maxwell::NumRenderTargets> current_color_buffers;
|
||||||
Surface last_depth_buffer;
|
Surface last_depth_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue