mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
VideoCommon: rename GameTextureAsset into TextureAsset and make it only contain CustomTextureData. Move validation and load logic to individual functions
This commit is contained in:
@ -13,11 +13,11 @@
|
||||
|
||||
namespace VideoCommon
|
||||
{
|
||||
struct TextureData
|
||||
struct TextureAndSamplerData
|
||||
{
|
||||
static bool FromJson(const CustomAssetLibrary::AssetID& asset_id, const picojson::object& json,
|
||||
TextureData* data);
|
||||
static void ToJson(picojson::object* obj, const TextureData& data);
|
||||
TextureAndSamplerData* data);
|
||||
static void ToJson(picojson::object* obj, const TextureAndSamplerData& data);
|
||||
enum class Type
|
||||
{
|
||||
Type_Undefined,
|
||||
@ -30,23 +30,19 @@ struct TextureData
|
||||
SamplerState m_sampler;
|
||||
};
|
||||
|
||||
class GameTextureAsset final : public CustomLoadableAsset<TextureData>
|
||||
class TextureAsset 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
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<VideoCommon::TextureData::Type>
|
||||
: EnumFormatter<VideoCommon::TextureData::Type::Type_Max>
|
||||
struct fmt::formatter<VideoCommon::TextureAndSamplerData::Type>
|
||||
: EnumFormatter<VideoCommon::TextureAndSamplerData::Type::Type_Max>
|
||||
{
|
||||
constexpr formatter() : EnumFormatter({"Undefined", "Texture2D", "TextureCube"}) {}
|
||||
};
|
||||
|
Reference in New Issue
Block a user