summaryrefslogtreecommitdiff
path: root/src/video_core/gpu_synch.cpp
diff options
context:
space:
mode:
authorGravatar James Rowe2020-03-24 20:58:49 -0600
committerGravatar James Rowe2020-03-24 21:03:42 -0600
commit282adfc70b5d7d958d564bfda0227bb3fbd8d110 (patch)
tree2a98e3bedec2e7fdb33478814a73be664661aecc /src/video_core/gpu_synch.cpp
parentUse the correct directory for Qt Plugins (diff)
downloadyuzu-282adfc70b5d7d958d564bfda0227bb3fbd8d110.tar.gz
yuzu-282adfc70b5d7d958d564bfda0227bb3fbd8d110.tar.xz
yuzu-282adfc70b5d7d958d564bfda0227bb3fbd8d110.zip
Frontend/GPU: Refactor context management
Changes the GraphicsContext to be managed by the GPU core. This eliminates the need for the frontends to fool around with tricky MakeCurrent/DoneCurrent calls that are dependent on the settings (such as async gpu option). This also refactors out the need to use QWidget::fromWindowContainer as that caused issues with focus and input handling. Now we use a regular QWidget and just access the native windowHandle() directly. Another change is removing the debug tool setting in FrameMailbox. Instead of trying to block the frontend until a new frame is ready, the core will now take over presentation and draw directly to the window if the renderer detects that its hooked by NSight or RenderDoc Lastly, since it was in the way, I removed ScopeAcquireWindowContext and replaced it with a simple subclass in GraphicsContext that achieves the same result
Diffstat (limited to 'src/video_core/gpu_synch.cpp')
-rw-r--r--src/video_core/gpu_synch.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/video_core/gpu_synch.cpp b/src/video_core/gpu_synch.cpp
index d48221077..bd5278a5c 100644
--- a/src/video_core/gpu_synch.cpp
+++ b/src/video_core/gpu_synch.cpp
@@ -7,12 +7,15 @@
7 7
8namespace VideoCommon { 8namespace VideoCommon {
9 9
10GPUSynch::GPUSynch(Core::System& system, VideoCore::RendererBase& renderer) 10GPUSynch::GPUSynch(Core::System& system, std::unique_ptr<VideoCore::RendererBase>&& renderer,
11 : GPU(system, renderer, false) {} 11 std::unique_ptr<Core::Frontend::GraphicsContext>&& context)
12 : GPU(system, std::move(renderer), false), context{std::move(context)} {}
12 13
13GPUSynch::~GPUSynch() = default; 14GPUSynch::~GPUSynch() = default;
14 15
15void GPUSynch::Start() {} 16void GPUSynch::Start() {
17 context->MakeCurrent();
18}
16 19
17void GPUSynch::PushGPUEntries(Tegra::CommandList&& entries) { 20void GPUSynch::PushGPUEntries(Tegra::CommandList&& entries) {
18 dma_pusher->Push(std::move(entries)); 21 dma_pusher->Push(std::move(entries));
@@ -20,19 +23,19 @@ void GPUSynch::PushGPUEntries(Tegra::CommandList&& entries) {
20} 23}
21 24
22void GPUSynch::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { 25void GPUSynch::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
23 renderer.SwapBuffers(framebuffer); 26 renderer->SwapBuffers(framebuffer);
24} 27}
25 28
26void GPUSynch::FlushRegion(CacheAddr addr, u64 size) { 29void GPUSynch::FlushRegion(CacheAddr addr, u64 size) {
27 renderer.Rasterizer().FlushRegion(addr, size); 30 renderer->Rasterizer().FlushRegion(addr, size);
28} 31}
29 32
30void GPUSynch::InvalidateRegion(CacheAddr addr, u64 size) { 33void GPUSynch::InvalidateRegion(CacheAddr addr, u64 size) {
31 renderer.Rasterizer().InvalidateRegion(addr, size); 34 renderer->Rasterizer().InvalidateRegion(addr, size);
32} 35}
33 36
34void GPUSynch::FlushAndInvalidateRegion(CacheAddr addr, u64 size) { 37void GPUSynch::FlushAndInvalidateRegion(CacheAddr addr, u64 size) {
35 renderer.Rasterizer().FlushAndInvalidateRegion(addr, size); 38 renderer->Rasterizer().FlushAndInvalidateRegion(addr, size);
36} 39}
37 40
38} // namespace VideoCommon 41} // namespace VideoCommon