mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
GPU/OpenGL: Don't keep shader cache open
This commit is contained in:
parent
64e1305087
commit
2df06225ee
|
@ -43,8 +43,6 @@ bool GPU_HW_OpenGL::Initialize(HostDisplay* host_display)
|
||||||
|
|
||||||
SetCapabilities(host_display);
|
SetCapabilities(host_display);
|
||||||
|
|
||||||
m_shader_cache.Open(IsGLES(), g_host_interface->GetShaderCacheBasePath());
|
|
||||||
|
|
||||||
if (!GPU_HW::Initialize(host_display))
|
if (!GPU_HW::Initialize(host_display))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -357,6 +355,9 @@ bool GPU_HW_OpenGL::CreateTextureBuffer()
|
||||||
|
|
||||||
bool GPU_HW_OpenGL::CompilePrograms()
|
bool GPU_HW_OpenGL::CompilePrograms()
|
||||||
{
|
{
|
||||||
|
GL::ShaderCache shader_cache;
|
||||||
|
shader_cache.Open(IsGLES(), g_host_interface->GetShaderCacheBasePath());
|
||||||
|
|
||||||
const bool use_binding_layout = GPU_HW_ShaderGen::UseGLSLBindingLayout();
|
const bool use_binding_layout = GPU_HW_ShaderGen::UseGLSLBindingLayout();
|
||||||
GPU_HW_ShaderGen shadergen(m_host_display->GetRenderAPI(), m_resolution_scale, m_true_color, m_scaled_dithering,
|
GPU_HW_ShaderGen shadergen(m_host_display->GetRenderAPI(), m_resolution_scale, m_true_color, m_scaled_dithering,
|
||||||
m_texture_filtering, m_using_uv_limits, m_supports_dual_source_blend);
|
m_texture_filtering, m_using_uv_limits, m_supports_dual_source_blend);
|
||||||
|
@ -416,7 +417,7 @@ bool GPU_HW_OpenGL::CompilePrograms()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::optional<GL::Program> prog = m_shader_cache.GetProgram(batch_vs, {}, fs, link_callback);
|
std::optional<GL::Program> prog = shader_cache.GetProgram(batch_vs, {}, fs, link_callback);
|
||||||
if (!prog)
|
if (!prog)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -447,7 +448,7 @@ bool GPU_HW_OpenGL::CompilePrograms()
|
||||||
static_cast<InterlacedRenderMode>(interlaced));
|
static_cast<InterlacedRenderMode>(interlaced));
|
||||||
|
|
||||||
std::optional<GL::Program> prog =
|
std::optional<GL::Program> prog =
|
||||||
m_shader_cache.GetProgram(vs, {}, fs, [this, use_binding_layout](GL::Program& prog) {
|
shader_cache.GetProgram(vs, {}, fs, [this, use_binding_layout](GL::Program& prog) {
|
||||||
if (!IsGLES() && !use_binding_layout)
|
if (!IsGLES() && !use_binding_layout)
|
||||||
prog.BindFragData(0, "o_col0");
|
prog.BindFragData(0, "o_col0");
|
||||||
});
|
});
|
||||||
|
@ -465,7 +466,7 @@ bool GPU_HW_OpenGL::CompilePrograms()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<GL::Program> prog = m_shader_cache.GetProgram(shadergen.GenerateScreenQuadVertexShader(), {},
|
std::optional<GL::Program> prog = shader_cache.GetProgram(shadergen.GenerateScreenQuadVertexShader(), {},
|
||||||
shadergen.GenerateInterlacedFillFragmentShader(),
|
shadergen.GenerateInterlacedFillFragmentShader(),
|
||||||
[this, use_binding_layout](GL::Program& prog) {
|
[this, use_binding_layout](GL::Program& prog) {
|
||||||
if (!IsGLES() && !use_binding_layout)
|
if (!IsGLES() && !use_binding_layout)
|
||||||
|
@ -480,8 +481,8 @@ bool GPU_HW_OpenGL::CompilePrograms()
|
||||||
m_vram_interlaced_fill_program = std::move(*prog);
|
m_vram_interlaced_fill_program = std::move(*prog);
|
||||||
UPDATE_PROGRESS();
|
UPDATE_PROGRESS();
|
||||||
|
|
||||||
prog = m_shader_cache.GetProgram(shadergen.GenerateScreenQuadVertexShader(), {},
|
prog =
|
||||||
shadergen.GenerateVRAMReadFragmentShader(),
|
shader_cache.GetProgram(shadergen.GenerateScreenQuadVertexShader(), {}, shadergen.GenerateVRAMReadFragmentShader(),
|
||||||
[this, use_binding_layout](GL::Program& prog) {
|
[this, use_binding_layout](GL::Program& prog) {
|
||||||
if (!IsGLES() && !use_binding_layout)
|
if (!IsGLES() && !use_binding_layout)
|
||||||
prog.BindFragData(0, "o_col0");
|
prog.BindFragData(0, "o_col0");
|
||||||
|
@ -498,8 +499,8 @@ bool GPU_HW_OpenGL::CompilePrograms()
|
||||||
m_vram_read_program = std::move(*prog);
|
m_vram_read_program = std::move(*prog);
|
||||||
UPDATE_PROGRESS();
|
UPDATE_PROGRESS();
|
||||||
|
|
||||||
prog = m_shader_cache.GetProgram(shadergen.GenerateScreenQuadVertexShader(), {},
|
prog =
|
||||||
shadergen.GenerateVRAMCopyFragmentShader(),
|
shader_cache.GetProgram(shadergen.GenerateScreenQuadVertexShader(), {}, shadergen.GenerateVRAMCopyFragmentShader(),
|
||||||
[this, use_binding_layout](GL::Program& prog) {
|
[this, use_binding_layout](GL::Program& prog) {
|
||||||
if (!IsGLES() && !use_binding_layout)
|
if (!IsGLES() && !use_binding_layout)
|
||||||
prog.BindFragData(0, "o_col0");
|
prog.BindFragData(0, "o_col0");
|
||||||
|
@ -516,7 +517,7 @@ bool GPU_HW_OpenGL::CompilePrograms()
|
||||||
m_vram_copy_program = std::move(*prog);
|
m_vram_copy_program = std::move(*prog);
|
||||||
UPDATE_PROGRESS();
|
UPDATE_PROGRESS();
|
||||||
|
|
||||||
prog = m_shader_cache.GetProgram(shadergen.GenerateScreenQuadVertexShader(), {},
|
prog = shader_cache.GetProgram(shadergen.GenerateScreenQuadVertexShader(), {},
|
||||||
shadergen.GenerateVRAMUpdateDepthFragmentShader());
|
shadergen.GenerateVRAMUpdateDepthFragmentShader());
|
||||||
if (!prog)
|
if (!prog)
|
||||||
return false;
|
return false;
|
||||||
|
@ -528,7 +529,7 @@ bool GPU_HW_OpenGL::CompilePrograms()
|
||||||
|
|
||||||
if (m_supports_texture_buffer || m_use_ssbo_for_vram_writes)
|
if (m_supports_texture_buffer || m_use_ssbo_for_vram_writes)
|
||||||
{
|
{
|
||||||
prog = m_shader_cache.GetProgram(shadergen.GenerateScreenQuadVertexShader(), {},
|
prog = shader_cache.GetProgram(shadergen.GenerateScreenQuadVertexShader(), {},
|
||||||
shadergen.GenerateVRAMWriteFragmentShader(m_use_ssbo_for_vram_writes),
|
shadergen.GenerateVRAMWriteFragmentShader(m_use_ssbo_for_vram_writes),
|
||||||
[this, use_binding_layout](GL::Program& prog) {
|
[this, use_binding_layout](GL::Program& prog) {
|
||||||
if (!IsGLES() && !use_binding_layout)
|
if (!IsGLES() && !use_binding_layout)
|
||||||
|
|
|
@ -62,8 +62,6 @@ private:
|
||||||
|
|
||||||
bool CompilePrograms();
|
bool CompilePrograms();
|
||||||
|
|
||||||
GL::ShaderCache m_shader_cache;
|
|
||||||
|
|
||||||
// downsample texture - used for readbacks at >1xIR.
|
// downsample texture - used for readbacks at >1xIR.
|
||||||
GL::Texture m_vram_texture;
|
GL::Texture m_vram_texture;
|
||||||
GL::Texture m_vram_depth_texture;
|
GL::Texture m_vram_depth_texture;
|
||||||
|
|
Loading…
Reference in a new issue