mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-05-06 12:02:54 -04:00
VideoCommon: enhance 'CustomResourceManager' for post processing
This expands the interface of 'CustomResourceManager' to get a Material for post processing a frame buffer (currently EFB). The flow is similar to the normal draw material but distinguishes itself by not needing a UID. The full shader is much simpler than the draw shader and is currently put inline with the shader resource.
This commit is contained in:
@@ -43,7 +43,8 @@ void CustomResourceManager::Shutdown()
|
||||
|
||||
void CustomResourceManager::Reset()
|
||||
{
|
||||
m_material_resources.clear();
|
||||
m_draw_material_resources.clear();
|
||||
m_postprocessing_material_resources.clear();
|
||||
m_shader_resources.clear();
|
||||
m_texture_data_resources.clear();
|
||||
m_texture_sampler_resources.clear();
|
||||
@@ -102,11 +103,11 @@ TextureDataResource* CustomResourceManager::GetTextureDataFromAsset(
|
||||
return resource.get();
|
||||
}
|
||||
|
||||
MaterialResource* CustomResourceManager::GetMaterialFromAsset(
|
||||
MaterialResource* CustomResourceManager::GetDrawMaterialFromAsset(
|
||||
const CustomAssetLibrary::AssetID& asset_id, const GXPipelineUid& pipeline_uid,
|
||||
std::shared_ptr<VideoCommon::CustomAssetLibrary> library)
|
||||
{
|
||||
auto& resource = m_material_resources[asset_id][PipelineToHash(pipeline_uid)];
|
||||
auto& resource = m_draw_material_resources[asset_id][PipelineToHash(pipeline_uid)];
|
||||
if (resource == nullptr)
|
||||
{
|
||||
resource = std::make_unique<MaterialResource>(
|
||||
@@ -116,11 +117,24 @@ MaterialResource* CustomResourceManager::GetMaterialFromAsset(
|
||||
return resource.get();
|
||||
}
|
||||
|
||||
ShaderResource*
|
||||
CustomResourceManager::GetShaderFromAsset(const CustomAssetLibrary::AssetID& asset_id,
|
||||
std::size_t shader_key, const GXPipelineUid& pipeline_uid,
|
||||
const std::string& preprocessor_settings,
|
||||
std::shared_ptr<VideoCommon::CustomAssetLibrary> library)
|
||||
MaterialResource* CustomResourceManager::GetPostProcessingMaterialFromAsset(
|
||||
const CustomAssetLibrary::AssetID& asset_id,
|
||||
std::shared_ptr<VideoCommon::CustomAssetLibrary> library)
|
||||
{
|
||||
auto& resource = m_postprocessing_material_resources[asset_id];
|
||||
if (resource == nullptr)
|
||||
{
|
||||
resource =
|
||||
std::make_unique<MaterialResource>(CreateResourceContext(asset_id, std::move(library)));
|
||||
}
|
||||
resource->Process();
|
||||
return resource.get();
|
||||
}
|
||||
|
||||
ShaderResource* CustomResourceManager::GetShaderFromAsset(
|
||||
const CustomAssetLibrary::AssetID& asset_id, std::size_t shader_key,
|
||||
const std::optional<GXPipelineUid>& pipeline_uid, const std::string& preprocessor_settings,
|
||||
std::shared_ptr<VideoCommon::CustomAssetLibrary> library)
|
||||
{
|
||||
auto& resource = m_shader_resources[asset_id][shader_key];
|
||||
if (resource == nullptr)
|
||||
|
||||
Reference in New Issue
Block a user