mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 20:37:18 +12:00
Shader recompiler: Add UBO
This commit is contained in:
parent
fe4bbea2ef
commit
c8eb1c1128
6 changed files with 105 additions and 22 deletions
|
@ -23,13 +23,11 @@ namespace PICA {
|
|||
u32 texUnitConfig;
|
||||
u32 texEnvUpdateBuffer;
|
||||
|
||||
// TODO: This should probably be a uniform
|
||||
u32 texEnvBufferColor;
|
||||
|
||||
// There's 6 TEV stages, and each one is configured via 5 word-sized registers
|
||||
std::array<u32, 5 * 6> tevConfigs;
|
||||
};
|
||||
|
||||
// Config used for identifying unique fragment pipeline configurations
|
||||
struct FragmentConfig {
|
||||
OutputConfig outConfig;
|
||||
TextureConfig texConfig;
|
||||
|
|
18
include/PICA/pica_frag_uniforms.hpp
Normal file
18
include/PICA/pica_frag_uniforms.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include <type_traits>
|
||||
|
||||
#include "helpers.hpp"
|
||||
|
||||
namespace PICA {
|
||||
struct FragmentUniforms {
|
||||
using vec3 = std::array<float, 3>;
|
||||
using vec4 = std::array<float, 4>;
|
||||
static constexpr usize tevStageCount = 6;
|
||||
|
||||
s32 alphaReference;
|
||||
|
||||
alignas(16) vec4 constantColors[tevStageCount];
|
||||
alignas(16) vec4 tevBufferColor;
|
||||
};
|
||||
} // namespace PICA
|
|
@ -67,7 +67,12 @@ class RendererGL final : public Renderer {
|
|||
OpenGL::Framebuffer screenFramebuffer;
|
||||
OpenGL::Texture blankTexture;
|
||||
|
||||
std::unordered_map<PICA::FragmentConfig, OpenGL::Program> shaderCache;
|
||||
// Cached recompiled fragment shader
|
||||
struct CachedProgram {
|
||||
OpenGL::Program program;
|
||||
uint uboBinding;
|
||||
};
|
||||
std::unordered_map<PICA::FragmentConfig, CachedProgram> shaderCache;
|
||||
|
||||
OpenGL::Framebuffer getColourFBO();
|
||||
OpenGL::Texture getTexture(Texture& tex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue