Add GSP::GPU::AcquireRight

This commit is contained in:
wheremyfoodat 2022-09-18 17:30:26 +03:00
parent a56b67f3ba
commit 68698ae7a7
6 changed files with 49 additions and 8 deletions

View file

@ -74,7 +74,8 @@ class Kernel {
void outputDebugString();
public:
Kernel(std::array<u32, 16>& regs, Memory& mem) : regs(regs), mem(mem), handleCounter(0), serviceManager(regs, mem) {
Kernel(std::array<u32, 16>& regs, Memory& mem)
: regs(regs), mem(mem), handleCounter(0), serviceManager(regs, mem, currentProcess) {
objects.reserve(512); // Make room for a few objects to avoid further memory allocs later
portHandles.reserve(32);
}

View file

@ -331,6 +331,17 @@ namespace OpenGL {
}
};
enum DepthFunc {
Never = GL_NEVER, // Depth test never passes
Always = GL_ALWAYS, // Depth test always passes
Equal = GL_EQUAL, // Depth test passes if frag z == depth buffer z
NotEqual = GL_NOTEQUAL, // Depth test passes if frag z != depth buffer z
Less = GL_LESS, // Depth test passes if frag z < depth buffer z
Lequal = GL_LEQUAL, // Depth test passes if frag z <= depth buffer z
Greater = GL_GREATER, // Depth test passes if frag z > depth buffer z
Gequal = GL_GEQUAL, // Depth test passes if frag z >= depth buffer z
};
static void setClearColor(float val) { glClearColor(val, val, val, val); }
static void setClearColor(float r, float g, float b, float a) { glClearColor(r, g, b, a); }
static void setClearDepth(float depth) { glClearDepthf(depth); }
@ -359,6 +370,8 @@ namespace OpenGL {
static void enableStencil() { glEnable(GL_STENCIL_TEST); }
static void disableStencil() { glDisable(GL_STENCIL_TEST); }
static void setDepthFunc(DepthFunc func) { glDepthFunc(static_cast<GLenum>(func)); }
enum Primitives {
Triangle = GL_TRIANGLES,
Triangles = Triangle,

View file

@ -6,11 +6,17 @@
class GPUService {
Handle handle = KernelHandles::GPU;
Memory& mem;
u32& currentPID; // Process ID of the current process
// At any point in time only 1 process has privileges to use rendering functions
// This is the PID of that process
u32 privilegedProcess;
// Service commands
void acquireRight(u32 messagePointer);
public:
GPUService(Memory& mem) : mem(mem) {}
GPUService(Memory& mem, u32& currentPID) : mem(mem), currentPID(currentPID) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};

View file

@ -23,7 +23,7 @@ class ServiceManager {
void registerClient(u32 messagePointer);
public:
ServiceManager(std::array<u32, 16>& regs, Memory& mem);
ServiceManager(std::array<u32, 16>& regs, Memory& mem, u32& currentPID);
void reset();
void handleSyncRequest(u32 messagePointer);