mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 12:39:13 +12:00
Format stuff
This commit is contained in:
parent
a4fcb1c4dc
commit
2849cc3798
12 changed files with 145 additions and 177 deletions
|
@ -115,7 +115,7 @@ namespace PICA {
|
|||
bumpSelector = Helpers::getBits<22, 2>(config0);
|
||||
clampHighlights = Helpers::getBit<27>(config0);
|
||||
bumpMode = Helpers::getBits<28, 2>(config0);
|
||||
bumpRenorm = Helpers::getBit<30>(config0) ^ 1; // 0 = enable so flip it with xor
|
||||
bumpRenorm = Helpers::getBit<30>(config0) ^ 1; // 0 = enable so flip it with xor
|
||||
|
||||
for (int i = 0; i < totalLightCount; i++) {
|
||||
auto& light = lights[i];
|
||||
|
@ -220,7 +220,10 @@ namespace PICA {
|
|||
}
|
||||
|
||||
// If this fails you probably added a new field to the struct and forgot to update the copy constructor
|
||||
static_assert(sizeof(FragmentConfig) == sizeof(outConfig.raw) + sizeof(texConfig) + sizeof(fogConfig.raw) + sizeof(lighting.raw) + 7 * sizeof(LightingLUTConfig) + 8 * sizeof(Light));
|
||||
static_assert(
|
||||
sizeof(FragmentConfig) == sizeof(outConfig.raw) + sizeof(texConfig) + sizeof(fogConfig.raw) + sizeof(lighting.raw) +
|
||||
7 * sizeof(LightingLUTConfig) + 8 * sizeof(Light)
|
||||
);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class Emulator {
|
|||
static constexpr u32 width = 400;
|
||||
static constexpr u32 height = 240 * 2; // * 2 because 2 screens
|
||||
ROMType romType = ROMType::None;
|
||||
bool running = false; // Is the emulator running a game?
|
||||
bool running = false; // Is the emulator running a game?
|
||||
|
||||
private:
|
||||
#ifdef PANDA3DS_ENABLE_HTTP_SERVER
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
#include "PICA/pica_vertex.hpp"
|
||||
#include "PICA/regs.hpp"
|
||||
|
|
|
@ -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