summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Assets/CustomTextureData.h
blob: 048ee9592307758b78c3ad30e5a9398641aad83a (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
// Copyright 2023 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <span>
#include <string>

#include "Common/Buffer.h"
#include "Common/CommonTypes.h"
#include "VideoCommon/TextureConfig.h"

namespace VideoCommon
{
class CustomTextureData
{
public:
  struct ArraySlice
  {
    struct Level
    {
      Common::UniqueBuffer<u8> data;
      AbstractTextureFormat format = AbstractTextureFormat::RGBA8;
      u32 width = 0;
      u32 height = 0;
      u32 row_length = 0;
    };
    std::vector<Level> m_levels;
  };
  std::vector<ArraySlice> m_slices;
};

bool LoadDDSTexture(CustomTextureData* texture, const std::string& filename);
bool LoadDDSTexture(CustomTextureData::ArraySlice::Level* level, const std::string& filename,
                    u32 mip_level);
bool LoadPNGTexture(CustomTextureData::ArraySlice::Level* level, const std::string& filename);
bool LoadPNGTexture(CustomTextureData::ArraySlice::Level* level, std::span<const u8> buffer);
}  // namespace VideoCommon