mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-27 04:36:18 +00:00
CustomShaderCache temporary (?) changes to support mesh shaders that are completely custom; have some ideas on a more optimal solution but this was faster as a POC
This commit is contained in:
parent
ecae0239ce
commit
9d0b3d8827
2 changed files with 33 additions and 0 deletions
|
@ -19,6 +19,8 @@ CustomShaderCache::CustomShaderCache()
|
||||||
|
|
||||||
m_frame_end_handler = AfterFrameEvent::Register([this](Core::System&) { RetrieveAsyncShaders(); },
|
m_frame_end_handler = AfterFrameEvent::Register([this](Core::System&) { RetrieveAsyncShaders(); },
|
||||||
"RetrieveAsyncShaders");
|
"RetrieveAsyncShaders");
|
||||||
|
|
||||||
|
m_mesh_cache.Initialize(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomShaderCache::~CustomShaderCache()
|
CustomShaderCache::~CustomShaderCache()
|
||||||
|
@ -28,12 +30,16 @@ CustomShaderCache::~CustomShaderCache()
|
||||||
|
|
||||||
if (m_async_uber_shader_compiler)
|
if (m_async_uber_shader_compiler)
|
||||||
m_async_uber_shader_compiler->StopWorkerThreads();
|
m_async_uber_shader_compiler->StopWorkerThreads();
|
||||||
|
|
||||||
|
m_mesh_cache.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomShaderCache::RetrieveAsyncShaders()
|
void CustomShaderCache::RetrieveAsyncShaders()
|
||||||
{
|
{
|
||||||
m_async_shader_compiler->RetrieveWorkItems();
|
m_async_shader_compiler->RetrieveWorkItems();
|
||||||
m_async_uber_shader_compiler->RetrieveWorkItems();
|
m_async_uber_shader_compiler->RetrieveWorkItems();
|
||||||
|
|
||||||
|
m_mesh_cache.RetrieveAsyncShaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomShaderCache::Reload()
|
void CustomShaderCache::Reload()
|
||||||
|
@ -53,6 +59,8 @@ void CustomShaderCache::Reload()
|
||||||
m_uber_ps_cache = {};
|
m_uber_ps_cache = {};
|
||||||
m_pipeline_cache = {};
|
m_pipeline_cache = {};
|
||||||
m_uber_pipeline_cache = {};
|
m_uber_pipeline_cache = {};
|
||||||
|
|
||||||
|
m_mesh_cache.Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<const AbstractPipeline*>
|
std::optional<const AbstractPipeline*>
|
||||||
|
@ -85,6 +93,23 @@ CustomShaderCache::GetPipelineAsync(const VideoCommon::GXUberPipelineUid& uid,
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const AbstractPipeline* CustomShaderCache::GetPipelineForUid(const VideoCommon::GXPipelineUid& uid)
|
||||||
|
{
|
||||||
|
return m_mesh_cache.GetPipelineForUid(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
const AbstractPipeline*
|
||||||
|
CustomShaderCache::GetUberPipelineForUid(const VideoCommon::GXUberPipelineUid& uid)
|
||||||
|
{
|
||||||
|
return m_mesh_cache.GetUberPipelineForUid(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<const AbstractPipeline*>
|
||||||
|
CustomShaderCache::GetPipelineForUidAsync(const VideoCommon::GXPipelineUid& uid)
|
||||||
|
{
|
||||||
|
return m_mesh_cache.GetPipelineForUidAsync(uid);
|
||||||
|
}
|
||||||
|
|
||||||
void CustomShaderCache::AsyncCreatePipeline(const VideoCommon::GXPipelineUid& uid,
|
void CustomShaderCache::AsyncCreatePipeline(const VideoCommon::GXPipelineUid& uid,
|
||||||
|
|
||||||
const CustomShaderInstance& custom_shaders,
|
const CustomShaderInstance& custom_shaders,
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "VideoCommon/AsyncShaderCompiler.h"
|
#include "VideoCommon/AsyncShaderCompiler.h"
|
||||||
#include "VideoCommon/GXPipelineTypes.h"
|
#include "VideoCommon/GXPipelineTypes.h"
|
||||||
#include "VideoCommon/PixelShaderGen.h"
|
#include "VideoCommon/PixelShaderGen.h"
|
||||||
|
#include "VideoCommon/ShaderCache.h"
|
||||||
#include "VideoCommon/ShaderGenCommon.h"
|
#include "VideoCommon/ShaderGenCommon.h"
|
||||||
#include "VideoCommon/UberShaderPixel.h"
|
#include "VideoCommon/UberShaderPixel.h"
|
||||||
#include "VideoCommon/VideoEvents.h"
|
#include "VideoCommon/VideoEvents.h"
|
||||||
|
@ -56,6 +57,11 @@ public:
|
||||||
const CustomShaderInstance& custom_shaders,
|
const CustomShaderInstance& custom_shaders,
|
||||||
const AbstractPipelineConfig& pipeline_config);
|
const AbstractPipelineConfig& pipeline_config);
|
||||||
|
|
||||||
|
const AbstractPipeline* GetPipelineForUid(const VideoCommon::GXPipelineUid& uid);
|
||||||
|
const AbstractPipeline* GetUberPipelineForUid(const VideoCommon::GXUberPipelineUid& uid);
|
||||||
|
std::optional<const AbstractPipeline*>
|
||||||
|
GetPipelineForUidAsync(const VideoCommon::GXPipelineUid& uid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Configuration bits.
|
// Configuration bits.
|
||||||
APIType m_api_type = APIType::Nothing;
|
APIType m_api_type = APIType::Nothing;
|
||||||
|
@ -141,4 +147,6 @@ private:
|
||||||
const CustomShaderInstance& custom_shaders);
|
const CustomShaderInstance& custom_shaders);
|
||||||
|
|
||||||
Common::EventHook m_frame_end_handler;
|
Common::EventHook m_frame_end_handler;
|
||||||
|
|
||||||
|
VideoCommon::ShaderCache m_mesh_cache;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue