mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 13:26:30 -05:00
renderer_base: Make Rasterizer() return the rasterizer by reference
All calling code assumes that the rasterizer will be in a valid state, which is a totally fine assumption. The only way the rasterizer wouldn't be is if initialization is done incorrectly or fails, which is checked against in System::Init().
This commit is contained in:
parent
6030c5ce41
commit
2665457f4a
5 changed files with 15 additions and 11 deletions
|
@ -187,7 +187,7 @@ System::ResultStatus System::Init(EmuWindow& emu_window) {
|
||||||
return ResultStatus::ErrorVideoCore;
|
return ResultStatus::ErrorVideoCore;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu_core = std::make_unique<Tegra::GPU>(*renderer->Rasterizer());
|
gpu_core = std::make_unique<Tegra::GPU>(renderer->Rasterizer());
|
||||||
|
|
||||||
// Create threads for CPU cores 1-3, and build thread_to_cpu map
|
// Create threads for CPU cores 1-3, and build thread_to_cpu map
|
||||||
// CPU core 0 is run on the main thread
|
// CPU core 0 is run on the main thread
|
||||||
|
|
|
@ -156,8 +156,8 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& ou
|
||||||
auto& system_instance = Core::System::GetInstance();
|
auto& system_instance = Core::System::GetInstance();
|
||||||
|
|
||||||
// Remove this memory region from the rasterizer cache.
|
// Remove this memory region from the rasterizer cache.
|
||||||
system_instance.Renderer().Rasterizer()->FlushAndInvalidateRegion(params.offset,
|
system_instance.Renderer().Rasterizer().FlushAndInvalidateRegion(params.offset,
|
||||||
itr->second.size);
|
itr->second.size);
|
||||||
|
|
||||||
auto& gpu = system_instance.GPU();
|
auto& gpu = system_instance.GPU();
|
||||||
params.offset = gpu.memory_manager->UnmapBuffer(params.offset, itr->second.size);
|
params.offset = gpu.memory_manager->UnmapBuffer(params.offset, itr->second.size);
|
||||||
|
|
|
@ -355,16 +355,16 @@ void RasterizerFlushVirtualRegion(VAddr start, u64 size, FlushMode mode) {
|
||||||
const u64 overlap_size = overlap_end - overlap_start;
|
const u64 overlap_size = overlap_end - overlap_start;
|
||||||
|
|
||||||
for (const auto& gpu_address : gpu_addresses) {
|
for (const auto& gpu_address : gpu_addresses) {
|
||||||
auto* rasterizer = system_instance.Renderer().Rasterizer();
|
auto& rasterizer = system_instance.Renderer().Rasterizer();
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case FlushMode::Flush:
|
case FlushMode::Flush:
|
||||||
rasterizer->FlushRegion(gpu_address, overlap_size);
|
rasterizer.FlushRegion(gpu_address, overlap_size);
|
||||||
break;
|
break;
|
||||||
case FlushMode::Invalidate:
|
case FlushMode::Invalidate:
|
||||||
rasterizer->InvalidateRegion(gpu_address, overlap_size);
|
rasterizer.InvalidateRegion(gpu_address, overlap_size);
|
||||||
break;
|
break;
|
||||||
case FlushMode::FlushAndInvalidate:
|
case FlushMode::FlushAndInvalidate:
|
||||||
rasterizer->FlushAndInvalidateRegion(gpu_address, overlap_size);
|
rasterizer.FlushAndInvalidateRegion(gpu_address, overlap_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,12 @@ public:
|
||||||
return m_current_frame;
|
return m_current_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
RasterizerInterface* Rasterizer() const {
|
RasterizerInterface& Rasterizer() {
|
||||||
return rasterizer.get();
|
return *rasterizer;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RasterizerInterface& Rasterizer() const {
|
||||||
|
return *rasterizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshRasterizerSetting();
|
void RefreshRasterizerSetting();
|
||||||
|
|
|
@ -160,8 +160,8 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf
|
||||||
// only allows rows to have a memory alignement of 4.
|
// only allows rows to have a memory alignement of 4.
|
||||||
ASSERT(framebuffer.stride % 4 == 0);
|
ASSERT(framebuffer.stride % 4 == 0);
|
||||||
|
|
||||||
if (!Rasterizer()->AccelerateDisplay(framebuffer, framebuffer_addr, framebuffer.stride,
|
if (!rasterizer->AccelerateDisplay(framebuffer, framebuffer_addr, framebuffer.stride,
|
||||||
screen_info)) {
|
screen_info)) {
|
||||||
// Reset the screen info's display texture to its own permanent texture
|
// Reset the screen info's display texture to its own permanent texture
|
||||||
screen_info.display_texture = screen_info.texture.resource.handle;
|
screen_info.display_texture = screen_info.texture.resource.handle;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue