summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2025-11-17 18:35:55 -0600
committeriwubcode <iwubcode@users.noreply.github.com>2026-03-26 20:13:16 -0500
commit7bfd43eb1aed359222a2ba0dde8c191dc8bce245 (patch)
tree3cc641fa715335aa17072276f60ae358ed590dcb /Source/Core
parent2d8f9558515df4f5fccee9be9e659e40b710e164 (diff)
VideoCommon: update CustomPipelineAction to get a Material when an EFB is received
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.cpp78
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h13
2 files changed, 29 insertions, 62 deletions
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.cpp
index 4e22d5b3f8..35c8ce0a25 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.cpp
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.cpp
@@ -3,7 +3,11 @@
#include "VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h"
+#include "Common/JsonUtil.h"
#include "Common/Logging/Log.h"
+#include "Core/System.h"
+
+#include "VideoCommon/Resources/CustomResourceManager.h"
std::unique_ptr<CustomPipelineAction>
CustomPipelineAction::Create(std::shared_ptr<VideoCommon::CustomAssetLibrary> library)
@@ -15,58 +19,16 @@ std::unique_ptr<CustomPipelineAction>
CustomPipelineAction::Create(const picojson::value& json_data,
std::shared_ptr<VideoCommon::CustomAssetLibrary> library)
{
- std::vector<CustomPipelineAction::PipelinePassPassDescription> pipeline_passes;
-
- const auto& passes_json = json_data.get("passes");
- if (passes_json.is<picojson::array>())
- {
- for (const auto& passes_json_val : passes_json.get<picojson::array>())
- {
- CustomPipelineAction::PipelinePassPassDescription pipeline_pass;
- if (!passes_json_val.is<picojson::object>())
- {
- ERROR_LOG_FMT(VIDEO,
- "Failed to load custom pipeline action, 'passes' has an array value that "
- "is not an object!");
- return nullptr;
- }
-
- auto pass = passes_json_val.get<picojson::object>();
- if (!pass.contains("pixel_material_asset"))
- {
- ERROR_LOG_FMT(VIDEO,
- "Failed to load custom pipeline action, 'passes' value missing required "
- "field 'pixel_material_asset'");
- return nullptr;
- }
+ auto material_asset = ReadStringFromJson(json_data.get<picojson::object>(), "material_asset");
- auto pixel_material_asset_json = pass["pixel_material_asset"];
- if (!pixel_material_asset_json.is<std::string>())
- {
- ERROR_LOG_FMT(VIDEO, "Failed to load custom pipeline action, 'passes' field "
- "'pixel_material_asset' is not a string!");
- return nullptr;
- }
- pipeline_pass.m_pixel_material_asset = pixel_material_asset_json.to_str();
- pipeline_passes.push_back(std::move(pipeline_pass));
- }
- }
-
- if (pipeline_passes.empty())
+ if (!material_asset)
{
- ERROR_LOG_FMT(VIDEO, "Failed to load custom pipeline action, must specify at least one pass");
+ ERROR_LOG_FMT(VIDEO,
+ "Failed to load custom pipeline action, 'material_asset' does not have a value");
return nullptr;
}
- if (pipeline_passes.size() > 1)
- {
- ERROR_LOG_FMT(
- VIDEO,
- "Failed to load custom pipeline action, multiple passes are not currently supported");
- return nullptr;
- }
-
- return std::make_unique<CustomPipelineAction>(std::move(library), std::move(pipeline_passes));
+ return std::make_unique<CustomPipelineAction>(std::move(library), std::move(*material_asset));
}
CustomPipelineAction::CustomPipelineAction(std::shared_ptr<VideoCommon::CustomAssetLibrary> library)
@@ -74,14 +36,26 @@ CustomPipelineAction::CustomPipelineAction(std::shared_ptr<VideoCommon::CustomAs
{
}
-CustomPipelineAction::CustomPipelineAction(
- std::shared_ptr<VideoCommon::CustomAssetLibrary> library,
- std::vector<PipelinePassPassDescription> pass_descriptions)
- : m_library(std::move(library)), m_passes_config(std::move(pass_descriptions))
+CustomPipelineAction::CustomPipelineAction(std::shared_ptr<VideoCommon::CustomAssetLibrary> library,
+ std::string material_asset)
+ : m_library(std::move(library)), m_material_asset(std::move(material_asset))
{
- m_pipeline_passes.resize(m_passes_config.size());
}
void CustomPipelineAction::OnDrawStarted(GraphicsModActionData::DrawStarted*)
{
+ // TODO
+}
+
+void CustomPipelineAction::AfterEFB(GraphicsModActionData::PostEFB* post_efb)
+{
+ if (!post_efb) [[unlikely]]
+ return;
+
+ if (m_material_asset.empty())
+ return;
+
+ auto& resource_manager = Core::System::GetInstance().GetCustomResourceManager();
+ post_efb->material =
+ resource_manager.GetPostProcessingMaterialFromAsset(m_material_asset, m_library);
}
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h
index 99026b99ce..d03ccd4a6e 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h
@@ -6,22 +6,15 @@
#include <memory>
#include <string>
#include <string_view>
-#include <vector>
#include <picojson.h>
#include "VideoCommon/Assets/CustomAssetLibrary.h"
-#include "VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.h"
#include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModAction.h"
class CustomPipelineAction final : public GraphicsModAction
{
public:
- struct PipelinePassPassDescription
- {
- std::string m_pixel_material_asset;
- };
-
static constexpr std::string_view factory_name = "custom_pipeline";
static std::unique_ptr<CustomPipelineAction>
Create(const picojson::value& json_data,
@@ -30,11 +23,11 @@ public:
Create(std::shared_ptr<VideoCommon::CustomAssetLibrary> library);
explicit CustomPipelineAction(std::shared_ptr<VideoCommon::CustomAssetLibrary> library);
CustomPipelineAction(std::shared_ptr<VideoCommon::CustomAssetLibrary> library,
- std::vector<PipelinePassPassDescription> pass_descriptions);
+ std::string material_asset);
void OnDrawStarted(GraphicsModActionData::DrawStarted*) override;
+ void AfterEFB(GraphicsModActionData::PostEFB*) override;
private:
std::shared_ptr<VideoCommon::CustomAssetLibrary> m_library;
- std::vector<PipelinePassPassDescription> m_passes_config;
- std::vector<CustomPipeline> m_pipeline_passes;
+ std::string m_material_asset;
};