mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-24 19:27:27 +00:00
VideoCommon: add logic to generate render targets using a render target template and some other metadata
This commit is contained in:
parent
97a016a3df
commit
e56e694cd8
2 changed files with 46 additions and 0 deletions
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2025 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "VideoCommon/GraphicsModEditor/RenderTargetGeneration.h"
|
||||
|
||||
#include "Common/JsonUtil.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "VideoCommon/GraphicsModEditor/EditorState.h"
|
||||
|
||||
namespace GraphicsModEditor
|
||||
{
|
||||
EditorAsset* GenerateRenderTarget(const std::filesystem::path& output_path,
|
||||
const VideoCommon::RenderTargetData& data,
|
||||
GraphicsModEditor::EditorAssetSource* source)
|
||||
{
|
||||
picojson::object obj;
|
||||
VideoCommon::RenderTargetData::ToJson(&obj, data);
|
||||
|
||||
const auto metadata_path = output_path / "metadata.rendertarget";
|
||||
if (!JsonToFile(PathToString(metadata_path), picojson::value{obj}, true))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
source->AddAsset(metadata_path);
|
||||
return source->GetAssetFromPath(metadata_path);
|
||||
}
|
||||
} // namespace GraphicsModEditor
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2025 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include "VideoCommon/Assets/RenderTargetAsset.h"
|
||||
|
||||
namespace GraphicsModEditor
|
||||
{
|
||||
struct EditorAsset;
|
||||
class EditorAssetSource;
|
||||
EditorAsset* GenerateRenderTarget(const std::filesystem::path& output_path,
|
||||
const VideoCommon::RenderTargetData& data,
|
||||
GraphicsModEditor::EditorAssetSource* source);
|
||||
} // namespace GraphicsModEditor
|
Loading…
Add table
Add a link
Reference in a new issue