mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 20:49:12 +12:00
Format stuff
This commit is contained in:
parent
a4fcb1c4dc
commit
2849cc3798
12 changed files with 145 additions and 177 deletions
|
@ -3,52 +3,48 @@
|
|||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
#include "opengl.hpp"
|
||||
#include "renderer_gl/renderer_gl.hpp"
|
||||
#include "PICA/pica_frag_config.hpp"
|
||||
#include "lockfree/spsc/queue.hpp"
|
||||
#include "opengl.hpp"
|
||||
#include "renderer_gl/renderer_gl.hpp"
|
||||
|
||||
namespace PICA::ShaderGen
|
||||
{
|
||||
class FragmentGenerator;
|
||||
namespace PICA::ShaderGen {
|
||||
class FragmentGenerator;
|
||||
}
|
||||
|
||||
namespace AsyncCompiler
|
||||
{
|
||||
void* createContext(void* userdata);
|
||||
void makeCurrent(void* userdata, void* context);
|
||||
void destroyContext(void* context);
|
||||
}
|
||||
namespace AsyncCompiler {
|
||||
void* createContext(void* userdata);
|
||||
void makeCurrent(void* userdata, void* context);
|
||||
void destroyContext(void* context);
|
||||
} // namespace AsyncCompiler
|
||||
|
||||
struct CompilingProgram
|
||||
{
|
||||
CachedProgram* program;
|
||||
PICA::FragmentConfig* config;
|
||||
struct CompilingProgram {
|
||||
CachedProgram* program;
|
||||
PICA::FragmentConfig* config;
|
||||
};
|
||||
|
||||
struct AsyncCompilerThread
|
||||
{
|
||||
explicit AsyncCompilerThread(PICA::ShaderGen::FragmentGenerator& fragShaderGen, void* userdata);
|
||||
~AsyncCompilerThread();
|
||||
struct AsyncCompilerThread {
|
||||
explicit AsyncCompilerThread(PICA::ShaderGen::FragmentGenerator& fragShaderGen, void* userdata);
|
||||
~AsyncCompilerThread();
|
||||
|
||||
// Called from the emulator thread to queue a fragment configuration for compilation
|
||||
// Returns false if the queue is full, true otherwise
|
||||
void PushFragmentConfig(const PICA::FragmentConfig& config, CachedProgram* cachedProgram);
|
||||
// Called from the emulator thread to queue a fragment configuration for compilation
|
||||
// Returns false if the queue is full, true otherwise
|
||||
void PushFragmentConfig(const PICA::FragmentConfig& config, CachedProgram* cachedProgram);
|
||||
|
||||
// Wait for all queued fragment configurations to be compiled
|
||||
void Finish();
|
||||
// Wait for all queued fragment configurations to be compiled
|
||||
void Finish();
|
||||
|
||||
private:
|
||||
PICA::ShaderGen::FragmentGenerator& fragShaderGen;
|
||||
OpenGL::Shader defaultShadergenVs;
|
||||
private:
|
||||
PICA::ShaderGen::FragmentGenerator& fragShaderGen;
|
||||
OpenGL::Shader defaultShadergenVs;
|
||||
|
||||
// Our lockfree queue only allows for trivial types, so we preallocate enough structs
|
||||
// to avoid dynamic allocation on each push
|
||||
int preallocatedProgramsIndex;
|
||||
static constexpr int preallocatedProgramsSize = 256;
|
||||
std::array<CompilingProgram*, preallocatedProgramsSize> preallocatedPrograms;
|
||||
lockfree::spsc::Queue<CompilingProgram*, preallocatedProgramsSize - 1> programQueue;
|
||||
std::atomic_bool running;
|
||||
std::atomic_flag hasWork = ATOMIC_FLAG_INIT;
|
||||
std::thread thread;
|
||||
// Our lockfree queue only allows for trivial types, so we preallocate enough structs
|
||||
// to avoid dynamic allocation on each push
|
||||
int preallocatedProgramsIndex;
|
||||
static constexpr int preallocatedProgramsSize = 256;
|
||||
std::array<CompilingProgram*, preallocatedProgramsSize> preallocatedPrograms;
|
||||
lockfree::spsc::Queue<CompilingProgram*, preallocatedProgramsSize - 1> programQueue;
|
||||
std::atomic_bool running;
|
||||
std::atomic_flag hasWork = ATOMIC_FLAG_INIT;
|
||||
std::thread thread;
|
||||
};
|
|
@ -6,13 +6,13 @@
|
|||
#include <span>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "config.hpp"
|
||||
#include "PICA/float_types.hpp"
|
||||
#include "PICA/pica_frag_config.hpp"
|
||||
#include "PICA/pica_hash.hpp"
|
||||
#include "PICA/pica_vertex.hpp"
|
||||
#include "PICA/regs.hpp"
|
||||
#include "PICA/shader_gen.hpp"
|
||||
#include "config.hpp"
|
||||
#include "gl_state.hpp"
|
||||
#include "helpers.hpp"
|
||||
#include "logger.hpp"
|
||||
|
@ -42,7 +42,7 @@ class RendererGL final : public Renderer {
|
|||
OpenGL::VertexBuffer vbo;
|
||||
ShaderMode shaderMode = EmulatorConfig::defaultShaderMode;
|
||||
|
||||
// Data
|
||||
// Data
|
||||
struct {
|
||||
// TEV configuration uniform locations
|
||||
GLint textureEnvSourceLoc = -1;
|
||||
|
@ -112,7 +112,7 @@ class RendererGL final : public Renderer {
|
|||
void clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control) override; // Clear a GPU buffer in VRAM
|
||||
void displayTransfer(u32 inputAddr, u32 outputAddr, u32 inputSize, u32 outputSize, u32 flags) override; // Perform display transfer
|
||||
void textureCopy(u32 inputAddr, u32 outputAddr, u32 totalBytes, u32 inputSize, u32 outputSize, u32 flags) override;
|
||||
void drawVertices(PICA::PrimType primType, std::span<const PICA::Vertex> vertices) override; // Draw the given vertices
|
||||
void drawVertices(PICA::PrimType primType, std::span<const PICA::Vertex> vertices) override; // Draw the given vertices
|
||||
void deinitGraphicsContext() override;
|
||||
|
||||
virtual bool supportsShaderReload() override { return true; }
|
||||
|
@ -120,7 +120,7 @@ class RendererGL final : public Renderer {
|
|||
virtual void setUbershader(const std::string& shader) override;
|
||||
|
||||
virtual void setShaderMode(ShaderMode mode) override { shaderMode = mode; }
|
||||
|
||||
|
||||
std::optional<ColourBuffer> getColourBuffer(u32 addr, PICA::ColorFmt format, u32 width, u32 height, bool createIfnotFound = true);
|
||||
|
||||
// Note: The caller is responsible for deleting the currently bound FBO before calling this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue