mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 20:49:12 +12:00
Boops
This commit is contained in:
parent
78ac8d2c0d
commit
ab4c9b2ae5
7 changed files with 100 additions and 65 deletions
|
@ -40,7 +40,8 @@ namespace PICA
|
|||
struct AsyncCompilerState
|
||||
{
|
||||
// The constructor will start the thread that will compile the shaders and create an OpenGL context
|
||||
explicit AsyncCompilerState(PICA::ShaderGen::FragmentGenerator& fragShaderGen);
|
||||
// contextCreationUserdata is frontend specific, for example for SDL it's an SDL_Window*
|
||||
explicit AsyncCompilerState(PICA::ShaderGen::FragmentGenerator& fragShaderGen, void* contextCreationUserdata);
|
||||
|
||||
// The destructor will first set the stop flag and join the thread (which will wait until it exits)
|
||||
// and then clean up the queues
|
||||
|
@ -60,9 +61,6 @@ struct AsyncCompilerState
|
|||
// Manually stops the thread
|
||||
void Stop();
|
||||
private:
|
||||
void createGLContext();
|
||||
void destroyGLContext();
|
||||
|
||||
PICA::ShaderGen::FragmentGenerator& fragShaderGen;
|
||||
|
||||
OpenGL::Shader defaultShadergenVs;
|
||||
|
@ -72,4 +70,6 @@ private:
|
|||
lockfree::spsc::Queue<CompiledProgram*, maxInFlightShaderCount> compiledQueue;
|
||||
std::atomic_bool running = false;
|
||||
std::thread shaderCompilationThread;
|
||||
|
||||
void* contextCreationUserdata;
|
||||
};
|
|
@ -26,7 +26,7 @@ class GPU;
|
|||
// Cached recompiled fragment shader
|
||||
struct CachedProgram {
|
||||
OpenGL::Program program;
|
||||
uint uboBinding;
|
||||
GLuint uboBinding = 0;
|
||||
bool ready = false;
|
||||
};
|
||||
|
||||
|
@ -79,10 +79,7 @@ class RendererGL final : public Renderer {
|
|||
OpenGL::Shader defaultShadergenVs;
|
||||
GLuint shadergenFragmentUBO;
|
||||
|
||||
// Cached recompiled fragment shader
|
||||
struct CachedProgram {
|
||||
OpenGL::Program program;
|
||||
};
|
||||
void* contextCreationUserdata = nullptr;
|
||||
std::unordered_map<PICA::FragmentConfig, CachedProgram> shaderCache;
|
||||
std::unique_ptr<AsyncCompilerState> asyncCompiler;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue