mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-19 20:19:13 +12:00
Start work on GL state manager object
This commit is contained in:
parent
ee49f89779
commit
b403e9a66e
8 changed files with 95 additions and 11 deletions
|
@ -10,8 +10,9 @@
|
|||
|
||||
using namespace Floats;
|
||||
|
||||
|
||||
GPU::GPU(Memory& mem) : mem(mem), renderer(*this, regs) {
|
||||
// Note: For when we have multiple backends, the GL state manager can stay here and have the constructor for the Vulkan-or-whatever renderer ignore it
|
||||
// Thus, our GLStateManager being here does not negatively impact renderer-agnosticness
|
||||
GPU::GPU(Memory& mem, GLStateManager& gl) : mem(mem), renderer(*this, gl, regs) {
|
||||
vram = new u8[vramSize];
|
||||
mem.setVRAM(vram); // Give the bus a pointer to our VRAM
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "emulator.hpp"
|
||||
|
||||
Emulator::Emulator() : kernel(cpu, memory, gpu), cpu(memory, kernel), gpu(memory), memory(cpu.getTicksRef()) {
|
||||
Emulator::Emulator() : kernel(cpu, memory, gpu), cpu(memory, kernel), gpu(memory, gl), memory(cpu.getTicksRef()) {
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0) {
|
||||
Helpers::panic("Failed to initialize SDL2");
|
||||
}
|
||||
|
@ -326,3 +326,9 @@ bool Emulator::loadELF(std::ifstream& file) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reset our graphics context and initialize the GPU's graphics context
|
||||
void Emulator::initGraphicsContext() {
|
||||
gl.reset(); // TODO (For when we have multiple backends): Only do this if we are using OpenGL
|
||||
gpu.initGraphicsContext();
|
||||
}
|
16
src/gl_state.cpp
Normal file
16
src/gl_state.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include "gl_state.hpp"
|
||||
|
||||
void GLStateManager::resetBlend() {
|
||||
blendEnabled = false;
|
||||
OpenGL::disableBlend();
|
||||
}
|
||||
|
||||
void GLStateManager::resetDepth() {
|
||||
depthEnabled = false;
|
||||
OpenGL::disableDepth();
|
||||
}
|
||||
|
||||
void GLStateManager::reset() {
|
||||
resetBlend();
|
||||
resetDepth();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue