mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-20 14:01:44 +12:00
Merge pull request #120 from Wunkolo/renderer-null
Add a `null` rendering backend
This commit is contained in:
commit
5b4f6ef46c
13 changed files with 143 additions and 30 deletions
|
@ -1,10 +1,14 @@
|
|||
#pragma once
|
||||
#include <filesystem>
|
||||
|
||||
#include "renderer.hpp"
|
||||
|
||||
// Remember to initialize every field here to its default value otherwise bad things will happen
|
||||
struct EmulatorConfig {
|
||||
bool shaderJitEnabled = false;
|
||||
RendererType rendererType = RendererType::OpenGL;
|
||||
|
||||
EmulatorConfig(const std::filesystem::path& path);
|
||||
void load(const std::filesystem::path& path);
|
||||
void save(const std::filesystem::path& path);
|
||||
};
|
|
@ -25,13 +25,13 @@ enum class ROMType {
|
|||
};
|
||||
|
||||
class Emulator {
|
||||
EmulatorConfig config;
|
||||
CPU cpu;
|
||||
GPU gpu;
|
||||
Memory memory;
|
||||
Kernel kernel;
|
||||
Crypto::AESEngine aesEngine;
|
||||
|
||||
EmulatorConfig config;
|
||||
SDL_Window* window;
|
||||
|
||||
#ifdef PANDA3DS_ENABLE_OPENGL
|
||||
|
@ -70,8 +70,8 @@ class Emulator {
|
|||
public:
|
||||
// Decides whether to reload or not reload the ROM when resetting. We use enum class over a plain bool for clarity.
|
||||
// If NoReload is selected, the emulator will not reload its selected ROM. This is useful for things like booting up the emulator, or resetting to
|
||||
// change ROMs. If Reload is selected, the emulator will reload its selected ROM. This is useful for eg a "reset" button that keeps the current ROM
|
||||
// and just resets the emu
|
||||
// change ROMs. If Reload is selected, the emulator will reload its selected ROM. This is useful for eg a "reset" button that keeps the current
|
||||
// ROM and just resets the emu
|
||||
enum class ReloadOption { NoReload, Reload };
|
||||
|
||||
Emulator();
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include <span>
|
||||
#include <optional>
|
||||
|
||||
#include "PICA/pica_vertex.hpp"
|
||||
#include "PICA/regs.hpp"
|
||||
#include "helpers.hpp"
|
||||
|
||||
enum class RendererType : s8 {
|
||||
// Todo: Auto = -1,
|
||||
Null = 0,
|
||||
OpenGL = 1,
|
||||
Vulkan = 2,
|
||||
};
|
||||
|
||||
class GPU;
|
||||
|
||||
class Renderer {
|
||||
|
@ -28,6 +36,8 @@ class Renderer {
|
|||
virtual ~Renderer();
|
||||
|
||||
static constexpr u32 vertexBufferSize = 0x10000;
|
||||
static std::optional<RendererType> typeFromString(std::string inString);
|
||||
static const char* typeToString(RendererType rendererType);
|
||||
|
||||
virtual void reset() = 0;
|
||||
virtual void display() = 0; // Display the 3DS screen contents to the window
|
||||
|
|
|
@ -68,6 +68,7 @@ class RendererGL final : public Renderer {
|
|||
|
||||
public:
|
||||
RendererGL(GPU& gpu, const std::array<u32, regNum>& internalRegs) : Renderer(gpu, internalRegs) {}
|
||||
~RendererGL() override;
|
||||
|
||||
void reset() override;
|
||||
void display() override; // Display the 3DS screen contents to the window
|
||||
|
|
17
include/renderer_null/renderer_null.hpp
Normal file
17
include/renderer_null/renderer_null.hpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "renderer.hpp"
|
||||
|
||||
class GPU;
|
||||
|
||||
class RendererNull final : public Renderer {
|
||||
public:
|
||||
RendererNull(GPU& gpu, const std::array<u32, regNum>& internalRegs);
|
||||
~RendererNull() override;
|
||||
|
||||
void reset() override;
|
||||
void display() override;
|
||||
void initGraphicsContext() override;
|
||||
void clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control) override;
|
||||
void displayTransfer(u32 inputAddr, u32 outputAddr, u32 inputSize, u32 outputSize, u32 flags) override;
|
||||
void drawVertices(PICA::PrimType primType, std::span<const PICA::Vertex> vertices) override;
|
||||
void screenshot(const std::string& name) override;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue