mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-25 11:46:27 +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(); },
|
||||
"RetrieveAsyncShaders");
|
||||
|
||||
m_mesh_cache.Initialize(true);
|
||||
}
|
||||
|
||||
CustomShaderCache::~CustomShaderCache()
|
||||
|
@ -28,12 +30,16 @@ CustomShaderCache::~CustomShaderCache()
|
|||
|
||||
if (m_async_uber_shader_compiler)
|
||||
m_async_uber_shader_compiler->StopWorkerThreads();
|
||||
|
||||
m_mesh_cache.Shutdown();
|
||||
}
|
||||
|
||||
void CustomShaderCache::RetrieveAsyncShaders()
|
||||
{
|
||||
m_async_shader_compiler->RetrieveWorkItems();
|
||||
m_async_uber_shader_compiler->RetrieveWorkItems();
|
||||
|
||||
m_mesh_cache.RetrieveAsyncShaders();
|
||||
}
|
||||
|
||||
void CustomShaderCache::Reload()
|
||||
|
@ -53,6 +59,8 @@ void CustomShaderCache::Reload()
|
|||
m_uber_ps_cache = {};
|
||||
m_pipeline_cache = {};
|
||||
m_uber_pipeline_cache = {};
|
||||
|
||||
m_mesh_cache.Reload();
|
||||
}
|
||||
|
||||
std::optional<const AbstractPipeline*>
|
||||
|
@ -85,6 +93,23 @@ CustomShaderCache::GetPipelineAsync(const VideoCommon::GXUberPipelineUid& uid,
|
|||
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,
|
||||
|
||||
const CustomShaderInstance& custom_shaders,
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "VideoCommon/AsyncShaderCompiler.h"
|
||||
#include "VideoCommon/GXPipelineTypes.h"
|
||||
#include "VideoCommon/PixelShaderGen.h"
|
||||
#include "VideoCommon/ShaderCache.h"
|
||||
#include "VideoCommon/ShaderGenCommon.h"
|
||||
#include "VideoCommon/UberShaderPixel.h"
|
||||
#include "VideoCommon/VideoEvents.h"
|
||||
|
@ -56,6 +57,11 @@ public:
|
|||
const CustomShaderInstance& custom_shaders,
|
||||
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:
|
||||
// Configuration bits.
|
||||
APIType m_api_type = APIType::Nothing;
|
||||
|
@ -141,4 +147,6 @@ private:
|
|||
const CustomShaderInstance& custom_shaders);
|
||||
|
||||
Common::EventHook m_frame_end_handler;
|
||||
|
||||
VideoCommon::ShaderCache m_mesh_cache;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue