summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.h
blob: 83bc9f84e1a188377bb130c976cdc5608da462c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2024 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <memory>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <vector>

#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/Assets/CustomAssetLibrary.h"
#include "VideoCommon/Assets/MaterialAsset.h"
#include "VideoCommon/Assets/ShaderAsset.h"
#include "VideoCommon/Assets/TextureAsset.h"
#include "VideoCommon/ShaderGenCommon.h"

namespace VideoCommon
{
class CustomAssetLoader;
}

struct CustomPipeline
{
  void UpdatePixelData(VideoCommon::CustomAssetLoader& loader,
                       std::shared_ptr<VideoCommon::CustomAssetLibrary> library,
                       std::span<const u32> texture_units,
                       const VideoCommon::CustomAssetLibrary::AssetID& material_to_load);

  VideoCommon::CachedAsset<VideoCommon::MaterialAsset> m_pixel_material;
  VideoCommon::CachedAsset<VideoCommon::PixelShaderAsset> m_pixel_shader;

  struct CachedTextureAsset
  {
    VideoCommon::CachedAsset<VideoCommon::GameTextureAsset> m_cached_asset;
    std::unique_ptr<AbstractTexture> m_texture;
    std::string m_sampler_code;
    std::string m_define_code;
  };
  std::vector<std::optional<CachedTextureAsset>> m_game_textures;

  ShaderCode m_last_generated_shader_code;
  ShaderCode m_last_generated_material_code;

  std::vector<u8> m_material_data;
};