mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
[GPU] Start implementing commands
This commit is contained in:
parent
fef585ebb3
commit
8692e7fc6b
11 changed files with 132 additions and 21 deletions
|
@ -4,7 +4,8 @@
|
|||
#include <fstream>
|
||||
|
||||
#include "cpu.hpp"
|
||||
#include "helpers.hpp"
|
||||
#include "gpu.hpp"
|
||||
#include "memory.hpp"
|
||||
#include "opengl.hpp"
|
||||
#include "SFML/Window.hpp"
|
||||
#include "SFML/Graphics.hpp"
|
||||
|
@ -15,6 +16,7 @@ enum class ROMType {
|
|||
|
||||
class Emulator {
|
||||
CPU cpu;
|
||||
GPU gpu;
|
||||
Memory memory;
|
||||
Kernel kernel;
|
||||
|
||||
|
@ -28,7 +30,7 @@ class Emulator {
|
|||
|
||||
public:
|
||||
Emulator() : window(sf::VideoMode(width, height), "Alber", sf::Style::Default, sf::ContextSettings(0, 0, 0, 4, 3)),
|
||||
kernel(cpu, memory), cpu(memory, kernel) {
|
||||
kernel(cpu, memory, gpu), cpu(memory, kernel) {
|
||||
reset();
|
||||
window.setActive(true);
|
||||
}
|
||||
|
|
10
include/gpu.hpp
Normal file
10
include/gpu.hpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
#include "helpers.hpp"
|
||||
|
||||
class GPU {
|
||||
|
||||
public:
|
||||
GPU() {}
|
||||
void clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control);
|
||||
void reset();
|
||||
};
|
|
@ -100,7 +100,7 @@ class Kernel {
|
|||
void waitSynchronization1();
|
||||
|
||||
public:
|
||||
Kernel(CPU& cpu, Memory& mem);
|
||||
Kernel(CPU& cpu, Memory& mem, GPU& gpu);
|
||||
void serviceSVC(u32 svc);
|
||||
void reset();
|
||||
};
|
|
@ -1,8 +1,9 @@
|
|||
#pragma once
|
||||
#include <cstring>
|
||||
#include "gpu.hpp"
|
||||
#include "helpers.hpp"
|
||||
#include "kernel_types.hpp"
|
||||
#include "memory.hpp"
|
||||
#include <cstring>
|
||||
|
||||
enum class GPUInterrupt : u8 {
|
||||
PSC0 = 0, // Memory fill completed
|
||||
|
@ -17,6 +18,7 @@ enum class GPUInterrupt : u8 {
|
|||
class GPUService {
|
||||
Handle handle = KernelHandles::GPU;
|
||||
Memory& mem;
|
||||
GPU& gpu;
|
||||
u32& currentPID; // Process ID of the current process
|
||||
u8* sharedMem; // Pointer to GSP shared memory
|
||||
|
||||
|
@ -24,16 +26,22 @@ class GPUService {
|
|||
// This is the PID of that process
|
||||
u32 privilegedProcess;
|
||||
|
||||
void processCommands();
|
||||
|
||||
// Service commands
|
||||
void acquireRight(u32 messagePointer);
|
||||
void flushDataCache(u32 messagePointer);
|
||||
void registerInterruptRelayQueue(u32 messagePointer);
|
||||
void setLCDForceBlack(u32 messagePointer);
|
||||
void triggerCmdReqQueue(u32 messagePointer);
|
||||
void writeHwRegs(u32 messagePointer);
|
||||
void writeHwRegsWithMask(u32 messagePointer);
|
||||
|
||||
// GPU commands processed via TriggerCmdReqQueue
|
||||
void memoryFill(u32* cmd);
|
||||
|
||||
public:
|
||||
GPUService(Memory& mem, u32& currentPID) : mem(mem), currentPID(currentPID) {}
|
||||
GPUService(Memory& mem, GPU& gpu, u32& currentPID) : mem(mem), gpu(gpu), currentPID(currentPID) {}
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
void requestInterrupt(GPUInterrupt type);
|
||||
|
|
|
@ -23,7 +23,7 @@ class ServiceManager {
|
|||
void registerClient(u32 messagePointer);
|
||||
|
||||
public:
|
||||
ServiceManager(std::array<u32, 16>& regs, Memory& mem, u32& currentPID);
|
||||
ServiceManager(std::array<u32, 16>& regs, Memory& mem, GPU& gpu, u32& currentPID);
|
||||
void reset();
|
||||
void handleSyncRequest(u32 messagePointer);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue