diff options
| author | iwubcode <iwubcode@users.noreply.github.com> | 2025-11-17 18:32:47 -0600 |
|---|---|---|
| committer | iwubcode <iwubcode@users.noreply.github.com> | 2026-03-26 20:13:16 -0500 |
| commit | 2d8f9558515df4f5fccee9be9e659e40b710e164 (patch) | |
| tree | ee1a567a9fde92f10749435d05c9a39d4d1c30b3 /Source/Core/VideoCommon/Resources/CustomResourceManager.cpp | |
| parent | 6ba2d2e081c991835892acd912c00c5ea39902a0 (diff) | |
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.
Diffstat (limited to 'Source/Core/VideoCommon/Resources/CustomResourceManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Resources/CustomResourceManager.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/Resources/CustomResourceManager.cpp b/Source/Core/VideoCommon/Resources/CustomResourceManager.cpp index ffb16b055a..29e215b8ea 100644 --- a/Source/Core/VideoCommon/Resources/CustomResourceManager.cpp +++ b/Source/Core/VideoCommon/Resources/CustomResourceManager.cpp @@ -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) |
