mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-14 05:55:13 +01:00
renderer_base: Don't directly expose the rasterizer unique_ptr
There's no reason to allow direct access to the unique_ptr instance. Only its contained pointer.
This commit is contained in:
parent
58c336b671
commit
bf76afc68d
@ -275,7 +275,7 @@ static void FlushDataCache(Service::Interface* self) {
|
|||||||
u32 size = cmd_buff[2];
|
u32 size = cmd_buff[2];
|
||||||
u32 process = cmd_buff[4];
|
u32 process = cmd_buff[4];
|
||||||
|
|
||||||
VideoCore::g_renderer->rasterizer->InvalidateRegion(Memory::VirtualToPhysicalAddress(address), size);
|
VideoCore::g_renderer->Rasterizer()->InvalidateRegion(Memory::VirtualToPhysicalAddress(address), size);
|
||||||
|
|
||||||
// TODO(purpasmart96): Verify return header on HW
|
// TODO(purpasmart96): Verify return header on HW
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
|
|||||||
|
|
||||||
// GX request DMA - typically used for copying memory from GSP heap to VRAM
|
// GX request DMA - typically used for copying memory from GSP heap to VRAM
|
||||||
case CommandId::REQUEST_DMA:
|
case CommandId::REQUEST_DMA:
|
||||||
VideoCore::g_renderer->rasterizer->FlushRegion(Memory::VirtualToPhysicalAddress(command.dma_request.source_address),
|
VideoCore::g_renderer->Rasterizer()->FlushRegion(Memory::VirtualToPhysicalAddress(command.dma_request.source_address),
|
||||||
command.dma_request.size);
|
command.dma_request.size);
|
||||||
|
|
||||||
memcpy(Memory::GetPointer(command.dma_request.dest_address),
|
memcpy(Memory::GetPointer(command.dma_request.dest_address),
|
||||||
@ -373,7 +373,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
|
|||||||
command.dma_request.size);
|
command.dma_request.size);
|
||||||
SignalInterrupt(InterruptId::DMA);
|
SignalInterrupt(InterruptId::DMA);
|
||||||
|
|
||||||
VideoCore::g_renderer->rasterizer->InvalidateRegion(Memory::VirtualToPhysicalAddress(command.dma_request.dest_address),
|
VideoCore::g_renderer->Rasterizer()->InvalidateRegion(Memory::VirtualToPhysicalAddress(command.dma_request.dest_address),
|
||||||
command.dma_request.size);
|
command.dma_request.size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -467,7 +467,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
|
|||||||
if (region.size == 0)
|
if (region.size == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
VideoCore::g_renderer->rasterizer->InvalidateRegion(
|
VideoCore::g_renderer->Rasterizer()->InvalidateRegion(
|
||||||
Memory::VirtualToPhysicalAddress(region.address), region.size);
|
Memory::VirtualToPhysicalAddress(region.address), region.size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -267,7 +267,7 @@ static void StartConversion(Service::Interface* self) {
|
|||||||
// dst_image_size would seem to be perfect for this, but it doesn't include the gap :(
|
// dst_image_size would seem to be perfect for this, but it doesn't include the gap :(
|
||||||
u32 total_output_size = conversion.input_lines *
|
u32 total_output_size = conversion.input_lines *
|
||||||
(conversion.dst.transfer_unit + conversion.dst.gap);
|
(conversion.dst.transfer_unit + conversion.dst.gap);
|
||||||
VideoCore::g_renderer->rasterizer->InvalidateRegion(
|
VideoCore::g_renderer->Rasterizer()->InvalidateRegion(
|
||||||
Memory::VirtualToPhysicalAddress(conversion.dst.address), total_output_size);
|
Memory::VirtualToPhysicalAddress(conversion.dst.address), total_output_size);
|
||||||
|
|
||||||
LOG_DEBUG(Service_Y2R, "called");
|
LOG_DEBUG(Service_Y2R, "called");
|
||||||
|
@ -140,7 +140,7 @@ inline void Write(u32 addr, const T data) {
|
|||||||
GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PSC1);
|
GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PSC1);
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoCore::g_renderer->rasterizer->InvalidateRegion(config.GetStartAddress(), config.GetEndAddress() - config.GetStartAddress());
|
VideoCore::g_renderer->Rasterizer()->InvalidateRegion(config.GetStartAddress(), config.GetEndAddress() - config.GetStartAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset "trigger" flag and set the "finish" flag
|
// Reset "trigger" flag and set the "finish" flag
|
||||||
@ -171,7 +171,7 @@ inline void Write(u32 addr, const T data) {
|
|||||||
u32 output_gap = config.texture_copy.output_gap * 16;
|
u32 output_gap = config.texture_copy.output_gap * 16;
|
||||||
|
|
||||||
size_t contiguous_input_size = config.texture_copy.size / input_width * (input_width + input_gap);
|
size_t contiguous_input_size = config.texture_copy.size / input_width * (input_width + input_gap);
|
||||||
VideoCore::g_renderer->rasterizer->FlushRegion(config.GetPhysicalInputAddress(), contiguous_input_size);
|
VideoCore::g_renderer->Rasterizer()->FlushRegion(config.GetPhysicalInputAddress(), contiguous_input_size);
|
||||||
|
|
||||||
u32 remaining_size = config.texture_copy.size;
|
u32 remaining_size = config.texture_copy.size;
|
||||||
u32 remaining_input = input_width;
|
u32 remaining_input = input_width;
|
||||||
@ -204,7 +204,7 @@ inline void Write(u32 addr, const T data) {
|
|||||||
config.flags);
|
config.flags);
|
||||||
|
|
||||||
size_t contiguous_output_size = config.texture_copy.size / output_width * (output_width + output_gap);
|
size_t contiguous_output_size = config.texture_copy.size / output_width * (output_width + output_gap);
|
||||||
VideoCore::g_renderer->rasterizer->InvalidateRegion(config.GetPhysicalOutputAddress(), contiguous_output_size);
|
VideoCore::g_renderer->Rasterizer()->InvalidateRegion(config.GetPhysicalOutputAddress(), contiguous_output_size);
|
||||||
|
|
||||||
GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF);
|
GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF);
|
||||||
break;
|
break;
|
||||||
@ -231,7 +231,7 @@ inline void Write(u32 addr, const T data) {
|
|||||||
u32 input_size = config.input_width * config.input_height * GPU::Regs::BytesPerPixel(config.input_format);
|
u32 input_size = config.input_width * config.input_height * GPU::Regs::BytesPerPixel(config.input_format);
|
||||||
u32 output_size = output_width * output_height * GPU::Regs::BytesPerPixel(config.output_format);
|
u32 output_size = output_width * output_height * GPU::Regs::BytesPerPixel(config.output_format);
|
||||||
|
|
||||||
VideoCore::g_renderer->rasterizer->FlushRegion(config.GetPhysicalInputAddress(), input_size);
|
VideoCore::g_renderer->Rasterizer()->FlushRegion(config.GetPhysicalInputAddress(), input_size);
|
||||||
|
|
||||||
for (u32 y = 0; y < output_height; ++y) {
|
for (u32 y = 0; y < output_height; ++y) {
|
||||||
for (u32 x = 0; x < output_width; ++x) {
|
for (u32 x = 0; x < output_width; ++x) {
|
||||||
@ -338,7 +338,7 @@ inline void Write(u32 addr, const T data) {
|
|||||||
g_regs.display_transfer_config.trigger = 0;
|
g_regs.display_transfer_config.trigger = 0;
|
||||||
GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF);
|
GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PPF);
|
||||||
|
|
||||||
VideoCore::g_renderer->rasterizer->InvalidateRegion(config.GetPhysicalOutputAddress(), output_size);
|
VideoCore::g_renderer->Rasterizer()->InvalidateRegion(config.GetPhysicalOutputAddress(), output_size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
|
|||||||
// Send to renderer
|
// Send to renderer
|
||||||
using Pica::Shader::OutputVertex;
|
using Pica::Shader::OutputVertex;
|
||||||
auto AddTriangle = [](const OutputVertex& v0, const OutputVertex& v1, const OutputVertex& v2) {
|
auto AddTriangle = [](const OutputVertex& v0, const OutputVertex& v1, const OutputVertex& v2) {
|
||||||
VideoCore::g_renderer->rasterizer->AddTriangle(v0, v1, v2);
|
VideoCore::g_renderer->Rasterizer()->AddTriangle(v0, v1, v2);
|
||||||
};
|
};
|
||||||
|
|
||||||
g_state.immediate.primitive_assembler.SubmitVertex(output, AddTriangle);
|
g_state.immediate.primitive_assembler.SubmitVertex(output, AddTriangle);
|
||||||
@ -155,7 +155,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
|
|||||||
case PICA_REG_INDEX(gpu_mode):
|
case PICA_REG_INDEX(gpu_mode):
|
||||||
if (regs.gpu_mode == Regs::GPUMode::Configuring && regs.vs_default_attributes_setup.index == 15) {
|
if (regs.gpu_mode == Regs::GPUMode::Configuring && regs.vs_default_attributes_setup.index == 15) {
|
||||||
// Draw immediate mode triangles when GPU Mode is set to GPUMode::Configuring
|
// Draw immediate mode triangles when GPU Mode is set to GPUMode::Configuring
|
||||||
VideoCore::g_renderer->rasterizer->DrawTriangles();
|
VideoCore::g_renderer->Rasterizer()->DrawTriangles();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
|
|||||||
using Pica::Shader::OutputVertex;
|
using Pica::Shader::OutputVertex;
|
||||||
auto AddTriangle = [](
|
auto AddTriangle = [](
|
||||||
const OutputVertex& v0, const OutputVertex& v1, const OutputVertex& v2) {
|
const OutputVertex& v0, const OutputVertex& v1, const OutputVertex& v2) {
|
||||||
VideoCore::g_renderer->rasterizer->AddTriangle(v0, v1, v2);
|
VideoCore::g_renderer->Rasterizer()->AddTriangle(v0, v1, v2);
|
||||||
};
|
};
|
||||||
|
|
||||||
primitive_assembler.SubmitVertex(output, AddTriangle);
|
primitive_assembler.SubmitVertex(output, AddTriangle);
|
||||||
@ -407,7 +407,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
|
|||||||
range.second, range.first);
|
range.second, range.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoCore::g_renderer->rasterizer->DrawTriangles();
|
VideoCore::g_renderer->Rasterizer()->DrawTriangles();
|
||||||
|
|
||||||
#if PICA_DUMP_GEOMETRY
|
#if PICA_DUMP_GEOMETRY
|
||||||
geometry_dumper.Dump();
|
geometry_dumper.Dump();
|
||||||
@ -542,7 +542,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoCore::g_renderer->rasterizer->NotifyPicaRegisterChanged(id);
|
VideoCore::g_renderer->Rasterizer()->NotifyPicaRegisterChanged(id);
|
||||||
|
|
||||||
if (g_debug_context)
|
if (g_debug_context)
|
||||||
g_debug_context->OnEvent(DebugContext::Event::PicaCommandProcessed, reinterpret_cast<void*>(&id));
|
g_debug_context->OnEvent(DebugContext::Event::PicaCommandProcessed, reinterpret_cast<void*>(&id));
|
||||||
|
@ -48,7 +48,7 @@ void DebugContext::OnEvent(Event event, void* data) {
|
|||||||
std::unique_lock<std::mutex> lock(breakpoint_mutex);
|
std::unique_lock<std::mutex> lock(breakpoint_mutex);
|
||||||
|
|
||||||
// Commit the hardware renderer's framebuffer so it will show on debug widgets
|
// Commit the hardware renderer's framebuffer so it will show on debug widgets
|
||||||
VideoCore::g_renderer->rasterizer->FlushFramebuffer();
|
VideoCore::g_renderer->Rasterizer()->FlushFramebuffer();
|
||||||
|
|
||||||
// TODO: Should stop the CPU thread here once we multithread emulation.
|
// TODO: Should stop the CPU thread here once we multithread emulation.
|
||||||
|
|
||||||
|
@ -54,11 +54,14 @@ public:
|
|||||||
return m_current_frame;
|
return m_current_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VideoCore::RasterizerInterface* Rasterizer() const {
|
||||||
|
return rasterizer.get();
|
||||||
|
}
|
||||||
|
|
||||||
void RefreshRasterizerSetting();
|
void RefreshRasterizerSetting();
|
||||||
|
|
||||||
std::unique_ptr<VideoCore::RasterizerInterface> rasterizer;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
std::unique_ptr<VideoCore::RasterizerInterface> rasterizer;
|
||||||
f32 m_current_fps; ///< Current framerate, should be set by the renderer
|
f32 m_current_fps; ///< Current framerate, should be set by the renderer
|
||||||
int m_current_frame; ///< Current frame, should be set by the renderer
|
int m_current_frame; ///< Current frame, should be set by the renderer
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user