8 changed files with 162 additions and 65 deletions
-
9src/core/core.cpp
-
4src/video_core/CMakeLists.txt
-
48src/video_core/gpu.cpp
-
26src/video_core/gpu.h
-
37src/video_core/gpu_asynch.cpp
-
37src/video_core/gpu_asynch.h
-
37src/video_core/gpu_synch.cpp
-
29src/video_core/gpu_synch.h
@ -0,0 +1,37 @@ |
|||
// Copyright 2019 yuzu Emulator Project
|
|||
// Licensed under GPLv2 or any later version
|
|||
// Refer to the license.txt file included.
|
|||
|
|||
#include "video_core/gpu_asynch.h"
|
|||
#include "video_core/gpu_thread.h"
|
|||
#include "video_core/renderer_base.h"
|
|||
|
|||
namespace VideoCommon { |
|||
|
|||
GPUAsynch::GPUAsynch(Core::System& system, VideoCore::RendererBase& renderer) |
|||
: Tegra::GPU(system, renderer), gpu_thread{renderer, *dma_pusher} {} |
|||
|
|||
GPUAsynch::~GPUAsynch() = default; |
|||
|
|||
void GPUAsynch::PushGPUEntries(Tegra::CommandList&& entries) { |
|||
gpu_thread.SubmitList(std::move(entries)); |
|||
} |
|||
|
|||
void GPUAsynch::SwapBuffers( |
|||
std::optional<std::reference_wrapper<const Tegra::FramebufferConfig>> framebuffer) { |
|||
gpu_thread.SwapBuffers(std::move(framebuffer)); |
|||
} |
|||
|
|||
void GPUAsynch::FlushRegion(VAddr addr, u64 size) { |
|||
gpu_thread.FlushRegion(addr, size); |
|||
} |
|||
|
|||
void GPUAsynch::InvalidateRegion(VAddr addr, u64 size) { |
|||
gpu_thread.InvalidateRegion(addr, size); |
|||
} |
|||
|
|||
void GPUAsynch::FlushAndInvalidateRegion(VAddr addr, u64 size) { |
|||
gpu_thread.FlushAndInvalidateRegion(addr, size); |
|||
} |
|||
|
|||
} // namespace VideoCommon
|
|||
@ -0,0 +1,37 @@ |
|||
// Copyright 2019 yuzu Emulator Project |
|||
// Licensed under GPLv2 or any later version |
|||
// Refer to the license.txt file included. |
|||
|
|||
#pragma once |
|||
|
|||
#include "video_core/gpu.h" |
|||
#include "video_core/gpu_thread.h" |
|||
|
|||
namespace VideoCore { |
|||
class RendererBase; |
|||
} // namespace VideoCore |
|||
|
|||
namespace VideoCommon { |
|||
|
|||
namespace GPUThread { |
|||
class ThreadManager; |
|||
} // namespace GPUThread |
|||
|
|||
/// Implementation of GPU interface that runs the GPU asynchronously |
|||
class GPUAsynch : public Tegra::GPU { |
|||
public: |
|||
explicit GPUAsynch(Core::System& system, VideoCore::RendererBase& renderer); |
|||
~GPUAsynch(); |
|||
|
|||
void PushGPUEntries(Tegra::CommandList&& entries) override; |
|||
void SwapBuffers( |
|||
std::optional<std::reference_wrapper<const Tegra::FramebufferConfig>> framebuffer) override; |
|||
void FlushRegion(VAddr addr, u64 size) override; |
|||
void InvalidateRegion(VAddr addr, u64 size) override; |
|||
void FlushAndInvalidateRegion(VAddr addr, u64 size) override; |
|||
|
|||
private: |
|||
GPUThread::ThreadManager gpu_thread; |
|||
}; |
|||
|
|||
} // namespace VideoCommon |
|||
@ -0,0 +1,37 @@ |
|||
// Copyright 2019 yuzu Emulator Project
|
|||
// Licensed under GPLv2 or any later version
|
|||
// Refer to the license.txt file included.
|
|||
|
|||
#include "video_core/gpu_synch.h"
|
|||
#include "video_core/renderer_base.h"
|
|||
|
|||
namespace VideoCommon { |
|||
|
|||
GPUSynch::GPUSynch(Core::System& system, VideoCore::RendererBase& renderer) |
|||
: Tegra::GPU(system, renderer) {} |
|||
|
|||
GPUSynch::~GPUSynch() = default; |
|||
|
|||
void GPUSynch::PushGPUEntries(Tegra::CommandList&& entries) { |
|||
dma_pusher->Push(std::move(entries)); |
|||
dma_pusher->DispatchCalls(); |
|||
} |
|||
|
|||
void GPUSynch::SwapBuffers( |
|||
std::optional<std::reference_wrapper<const Tegra::FramebufferConfig>> framebuffer) { |
|||
renderer.SwapBuffers(std::move(framebuffer)); |
|||
} |
|||
|
|||
void GPUSynch::FlushRegion(VAddr addr, u64 size) { |
|||
renderer.Rasterizer().FlushRegion(addr, size); |
|||
} |
|||
|
|||
void GPUSynch::InvalidateRegion(VAddr addr, u64 size) { |
|||
renderer.Rasterizer().InvalidateRegion(addr, size); |
|||
} |
|||
|
|||
void GPUSynch::FlushAndInvalidateRegion(VAddr addr, u64 size) { |
|||
renderer.Rasterizer().FlushAndInvalidateRegion(addr, size); |
|||
} |
|||
|
|||
} // namespace VideoCommon
|
|||
@ -0,0 +1,29 @@ |
|||
// Copyright 2019 yuzu Emulator Project |
|||
// Licensed under GPLv2 or any later version |
|||
// Refer to the license.txt file included. |
|||
|
|||
#pragma once |
|||
|
|||
#include "video_core/gpu.h" |
|||
|
|||
namespace VideoCore { |
|||
class RendererBase; |
|||
} // namespace VideoCore |
|||
|
|||
namespace VideoCommon { |
|||
|
|||
/// Implementation of GPU interface that runs the GPU synchronously |
|||
class GPUSynch : public Tegra::GPU { |
|||
public: |
|||
explicit GPUSynch(Core::System& system, VideoCore::RendererBase& renderer); |
|||
~GPUSynch(); |
|||
|
|||
void PushGPUEntries(Tegra::CommandList&& entries) override; |
|||
void SwapBuffers( |
|||
std::optional<std::reference_wrapper<const Tegra::FramebufferConfig>> framebuffer) override; |
|||
void FlushRegion(VAddr addr, u64 size) override; |
|||
void InvalidateRegion(VAddr addr, u64 size) override; |
|||
void FlushAndInvalidateRegion(VAddr addr, u64 size) override; |
|||
}; |
|||
|
|||
} // namespace VideoCommon |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue