2023-06-02 19:43:28 +00:00
|
|
|
// Copyright 2023 Dolphin Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-08-24 05:35:31 +00:00
|
|
|
#include <picojson.h>
|
|
|
|
|
2023-06-02 19:43:28 +00:00
|
|
|
#include "VideoCommon/Assets/CustomAsset.h"
|
|
|
|
#include "VideoCommon/Assets/CustomTextureData.h"
|
2023-08-24 05:35:31 +00:00
|
|
|
#include "VideoCommon/RenderState.h"
|
2023-06-02 19:43:28 +00:00
|
|
|
|
|
|
|
namespace VideoCommon
|
|
|
|
{
|
|
|
|
class RawTextureAsset final : public CustomLoadableAsset<CustomTextureData>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using CustomLoadableAsset::CustomLoadableAsset;
|
|
|
|
|
|
|
|
private:
|
|
|
|
CustomAssetLibrary::LoadInfo LoadImpl(const CustomAssetLibrary::AssetID& asset_id) override;
|
|
|
|
};
|
|
|
|
|
2023-08-24 05:35:31 +00:00
|
|
|
struct TextureData
|
|
|
|
{
|
|
|
|
static bool FromJson(const CustomAssetLibrary::AssetID& asset_id, const picojson::object& json,
|
|
|
|
TextureData* data);
|
|
|
|
enum class Type
|
|
|
|
{
|
|
|
|
Type_Undefined,
|
|
|
|
Type_Texture2D,
|
2023-09-06 02:11:19 +00:00
|
|
|
Type_TextureCube,
|
|
|
|
Type_Max = Type_TextureCube
|
2023-08-24 05:35:31 +00:00
|
|
|
};
|
|
|
|
Type m_type;
|
|
|
|
CustomTextureData m_data;
|
|
|
|
SamplerState m_sampler;
|
|
|
|
};
|
|
|
|
|
2023-06-02 19:43:28 +00:00
|
|
|
class GameTextureAsset final : public CustomLoadableAsset<CustomTextureData>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using CustomLoadableAsset::CustomLoadableAsset;
|
|
|
|
|
|
|
|
// Validates that the game texture matches the native dimensions provided
|
|
|
|
// Callees are expected to call this once the data is loaded
|
|
|
|
bool Validate(u32 native_width, u32 native_height) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
CustomAssetLibrary::LoadInfo LoadImpl(const CustomAssetLibrary::AssetID& asset_id) override;
|
|
|
|
};
|
|
|
|
} // namespace VideoCommon
|