chore: make yuzu REUSE compliant
[REUSE] is a specification that aims at making file copyright
information consistent, so that it can be both human and machine
readable. It basically requires that all files have a header containing
copyright and licensing information. When this isn't possible, like
when dealing with binary assets, generated files or embedded third-party
dependencies, it is permitted to insert copyright information in the
`.reuse/dep5` file.
Oh, and it also requires that all the licenses used in the project are
present in the `LICENSES` folder, that's why the diff is so huge.
This can be done automatically with `reuse download --all`.
The `reuse` tool also contains a handy subcommand that analyzes the
project and tells whether or not the project is (still) compliant,
`reuse lint`.
Following REUSE has a few advantages over the current approach:
- Copyright information is easy to access for users / downstream
- Files like `dist/license.md` do not need to exist anymore, as
`.reuse/dep5` is used instead
- `reuse lint` makes it easy to ensure that copyright information of
files like binary assets / images is always accurate and up to date
To add copyright information of files that didn't have it I looked up
who committed what and when, for each file. As yuzu contributors do not
have to sign a CLA or similar I couldn't assume that copyright ownership
was of the "yuzu Emulator Project", so I used the name and/or email of
the commit author instead.
[REUSE]: https://reuse.software
Follow-up to 01cf05bc75b1e47beb08937439f3ed9339e7b254
2022-05-15 00:06:02 +00:00
|
|
|
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-10-29 01:14:25 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <climits>
|
|
|
|
#include <utility>
|
|
|
|
#include "common/assert.h"
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "common/logging/log.h"
|
|
|
|
#include "video_core/gpu.h"
|
|
|
|
#include "video_core/textures/texture.h"
|
|
|
|
|
|
|
|
namespace VideoCore::Surface {
|
|
|
|
|
|
|
|
enum class PixelFormat {
|
2020-07-01 05:28:53 +00:00
|
|
|
A8B8G8R8_UNORM,
|
|
|
|
A8B8G8R8_SNORM,
|
|
|
|
A8B8G8R8_SINT,
|
|
|
|
A8B8G8R8_UINT,
|
|
|
|
R5G6B5_UNORM,
|
|
|
|
B5G6R5_UNORM,
|
|
|
|
A1R5G5B5_UNORM,
|
|
|
|
A2B10G10R10_UNORM,
|
|
|
|
A2B10G10R10_UINT,
|
|
|
|
A1B5G5R5_UNORM,
|
2022-04-13 15:01:57 +00:00
|
|
|
A5B5G5R1_UNORM,
|
2020-07-01 05:28:53 +00:00
|
|
|
R8_UNORM,
|
|
|
|
R8_SNORM,
|
|
|
|
R8_SINT,
|
|
|
|
R8_UINT,
|
|
|
|
R16G16B16A16_FLOAT,
|
|
|
|
R16G16B16A16_UNORM,
|
|
|
|
R16G16B16A16_SNORM,
|
|
|
|
R16G16B16A16_SINT,
|
|
|
|
R16G16B16A16_UINT,
|
|
|
|
B10G11R11_FLOAT,
|
|
|
|
R32G32B32A32_UINT,
|
|
|
|
BC1_RGBA_UNORM,
|
|
|
|
BC2_UNORM,
|
|
|
|
BC3_UNORM,
|
|
|
|
BC4_UNORM,
|
|
|
|
BC4_SNORM,
|
|
|
|
BC5_UNORM,
|
|
|
|
BC5_SNORM,
|
|
|
|
BC7_UNORM,
|
|
|
|
BC6H_UFLOAT,
|
|
|
|
BC6H_SFLOAT,
|
|
|
|
ASTC_2D_4X4_UNORM,
|
|
|
|
B8G8R8A8_UNORM,
|
|
|
|
R32G32B32A32_FLOAT,
|
|
|
|
R32G32B32A32_SINT,
|
|
|
|
R32G32_FLOAT,
|
|
|
|
R32G32_SINT,
|
|
|
|
R32_FLOAT,
|
|
|
|
R16_FLOAT,
|
|
|
|
R16_UNORM,
|
|
|
|
R16_SNORM,
|
|
|
|
R16_UINT,
|
|
|
|
R16_SINT,
|
|
|
|
R16G16_UNORM,
|
|
|
|
R16G16_FLOAT,
|
|
|
|
R16G16_UINT,
|
|
|
|
R16G16_SINT,
|
|
|
|
R16G16_SNORM,
|
|
|
|
R32G32B32_FLOAT,
|
|
|
|
A8B8G8R8_SRGB,
|
|
|
|
R8G8_UNORM,
|
|
|
|
R8G8_SNORM,
|
|
|
|
R8G8_SINT,
|
|
|
|
R8G8_UINT,
|
|
|
|
R32G32_UINT,
|
|
|
|
R16G16B16X16_FLOAT,
|
|
|
|
R32_UINT,
|
|
|
|
R32_SINT,
|
|
|
|
ASTC_2D_8X8_UNORM,
|
|
|
|
ASTC_2D_8X5_UNORM,
|
|
|
|
ASTC_2D_5X4_UNORM,
|
|
|
|
B8G8R8A8_SRGB,
|
|
|
|
BC1_RGBA_SRGB,
|
|
|
|
BC2_SRGB,
|
|
|
|
BC3_SRGB,
|
|
|
|
BC7_SRGB,
|
|
|
|
A4B4G4R4_UNORM,
|
2022-04-13 15:01:57 +00:00
|
|
|
R4G4_UNORM,
|
2020-06-30 06:41:38 +00:00
|
|
|
ASTC_2D_4X4_SRGB,
|
|
|
|
ASTC_2D_8X8_SRGB,
|
|
|
|
ASTC_2D_8X5_SRGB,
|
|
|
|
ASTC_2D_5X4_SRGB,
|
2020-07-01 05:28:53 +00:00
|
|
|
ASTC_2D_5X5_UNORM,
|
2020-06-30 06:41:38 +00:00
|
|
|
ASTC_2D_5X5_SRGB,
|
2020-07-01 05:28:53 +00:00
|
|
|
ASTC_2D_10X8_UNORM,
|
2020-06-30 06:41:38 +00:00
|
|
|
ASTC_2D_10X8_SRGB,
|
2020-07-01 05:28:53 +00:00
|
|
|
ASTC_2D_6X6_UNORM,
|
2020-06-30 06:41:38 +00:00
|
|
|
ASTC_2D_6X6_SRGB,
|
2022-07-01 02:04:23 +00:00
|
|
|
ASTC_2D_10X6_UNORM,
|
2022-10-06 14:45:40 +00:00
|
|
|
ASTC_2D_10X5_UNORM,
|
|
|
|
ASTC_2D_10X5_SRGB,
|
2020-07-01 05:28:53 +00:00
|
|
|
ASTC_2D_10X10_UNORM,
|
2020-06-30 06:41:38 +00:00
|
|
|
ASTC_2D_10X10_SRGB,
|
2020-07-01 05:28:53 +00:00
|
|
|
ASTC_2D_12X12_UNORM,
|
2020-06-30 06:41:38 +00:00
|
|
|
ASTC_2D_12X12_SRGB,
|
2020-07-01 05:28:53 +00:00
|
|
|
ASTC_2D_8X6_UNORM,
|
2020-06-30 06:41:38 +00:00
|
|
|
ASTC_2D_8X6_SRGB,
|
2020-07-01 05:28:53 +00:00
|
|
|
ASTC_2D_6X5_UNORM,
|
2020-06-30 06:41:38 +00:00
|
|
|
ASTC_2D_6X5_SRGB,
|
2020-07-01 05:28:53 +00:00
|
|
|
E5B9G9R9_FLOAT,
|
2018-10-29 01:14:25 +00:00
|
|
|
|
|
|
|
MaxColorFormat,
|
|
|
|
|
|
|
|
// Depth formats
|
2020-07-01 05:28:53 +00:00
|
|
|
D32_FLOAT = MaxColorFormat,
|
|
|
|
D16_UNORM,
|
2018-10-29 01:14:25 +00:00
|
|
|
|
|
|
|
MaxDepthFormat,
|
|
|
|
|
2021-11-17 20:04:38 +00:00
|
|
|
// Stencil formats
|
|
|
|
S8_UINT = MaxDepthFormat,
|
|
|
|
MaxStencilFormat,
|
|
|
|
|
2018-10-29 01:14:25 +00:00
|
|
|
// DepthStencil formats
|
2021-11-17 20:04:38 +00:00
|
|
|
D24_UNORM_S8_UINT = MaxStencilFormat,
|
2020-07-01 05:28:53 +00:00
|
|
|
S8_UINT_D24_UNORM,
|
|
|
|
D32_FLOAT_S8_UINT,
|
2018-10-29 01:14:25 +00:00
|
|
|
|
|
|
|
MaxDepthStencilFormat,
|
|
|
|
|
|
|
|
Max = MaxDepthStencilFormat,
|
|
|
|
Invalid = 255,
|
|
|
|
};
|
2020-12-30 05:25:23 +00:00
|
|
|
constexpr std::size_t MaxPixelFormat = static_cast<std::size_t>(PixelFormat::Max);
|
2018-10-29 01:14:25 +00:00
|
|
|
|
|
|
|
enum class SurfaceType {
|
|
|
|
ColorTexture = 0,
|
|
|
|
Depth = 1,
|
2021-11-17 20:04:38 +00:00
|
|
|
Stencil = 2,
|
|
|
|
DepthStencil = 3,
|
|
|
|
Invalid = 4,
|
2018-10-29 01:14:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class SurfaceTarget {
|
|
|
|
Texture1D,
|
2019-04-28 21:03:41 +00:00
|
|
|
TextureBuffer,
|
2018-10-29 01:14:25 +00:00
|
|
|
Texture2D,
|
|
|
|
Texture3D,
|
|
|
|
Texture1DArray,
|
|
|
|
Texture2DArray,
|
|
|
|
TextureCubemap,
|
2018-10-19 00:04:43 +00:00
|
|
|
TextureCubeArray,
|
2018-10-29 01:14:25 +00:00
|
|
|
};
|
|
|
|
|
2022-05-13 04:40:12 +00:00
|
|
|
constexpr std::array<u8, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{
|
2020-07-01 05:28:53 +00:00
|
|
|
1, // A8B8G8R8_UNORM
|
|
|
|
1, // A8B8G8R8_SNORM
|
|
|
|
1, // A8B8G8R8_SINT
|
|
|
|
1, // A8B8G8R8_UINT
|
|
|
|
1, // R5G6B5_UNORM
|
|
|
|
1, // B5G6R5_UNORM
|
|
|
|
1, // A1R5G5B5_UNORM
|
|
|
|
1, // A2B10G10R10_UNORM
|
|
|
|
1, // A2B10G10R10_UINT
|
|
|
|
1, // A1B5G5R5_UNORM
|
2022-04-13 15:01:57 +00:00
|
|
|
1, // A5B5G5R1_UNORM
|
2020-07-01 05:28:53 +00:00
|
|
|
1, // R8_UNORM
|
|
|
|
1, // R8_SNORM
|
|
|
|
1, // R8_SINT
|
|
|
|
1, // R8_UINT
|
|
|
|
1, // R16G16B16A16_FLOAT
|
|
|
|
1, // R16G16B16A16_UNORM
|
|
|
|
1, // R16G16B16A16_SNORM
|
|
|
|
1, // R16G16B16A16_SINT
|
|
|
|
1, // R16G16B16A16_UINT
|
|
|
|
1, // B10G11R11_FLOAT
|
|
|
|
1, // R32G32B32A32_UINT
|
|
|
|
4, // BC1_RGBA_UNORM
|
|
|
|
4, // BC2_UNORM
|
|
|
|
4, // BC3_UNORM
|
|
|
|
4, // BC4_UNORM
|
|
|
|
4, // BC4_SNORM
|
|
|
|
4, // BC5_UNORM
|
|
|
|
4, // BC5_SNORM
|
|
|
|
4, // BC7_UNORM
|
|
|
|
4, // BC6H_UFLOAT
|
|
|
|
4, // BC6H_SFLOAT
|
|
|
|
4, // ASTC_2D_4X4_UNORM
|
|
|
|
1, // B8G8R8A8_UNORM
|
|
|
|
1, // R32G32B32A32_FLOAT
|
|
|
|
1, // R32G32B32A32_SINT
|
|
|
|
1, // R32G32_FLOAT
|
|
|
|
1, // R32G32_SINT
|
|
|
|
1, // R32_FLOAT
|
|
|
|
1, // R16_FLOAT
|
|
|
|
1, // R16_UNORM
|
|
|
|
1, // R16_SNORM
|
|
|
|
1, // R16_UINT
|
|
|
|
1, // R16_SINT
|
|
|
|
1, // R16G16_UNORM
|
|
|
|
1, // R16G16_FLOAT
|
|
|
|
1, // R16G16_UINT
|
|
|
|
1, // R16G16_SINT
|
|
|
|
1, // R16G16_SNORM
|
|
|
|
1, // R32G32B32_FLOAT
|
|
|
|
1, // A8B8G8R8_SRGB
|
|
|
|
1, // R8G8_UNORM
|
|
|
|
1, // R8G8_SNORM
|
|
|
|
1, // R8G8_SINT
|
|
|
|
1, // R8G8_UINT
|
|
|
|
1, // R32G32_UINT
|
|
|
|
1, // R16G16B16X16_FLOAT
|
|
|
|
1, // R32_UINT
|
|
|
|
1, // R32_SINT
|
|
|
|
8, // ASTC_2D_8X8_UNORM
|
|
|
|
8, // ASTC_2D_8X5_UNORM
|
|
|
|
5, // ASTC_2D_5X4_UNORM
|
|
|
|
1, // B8G8R8A8_SRGB
|
|
|
|
4, // BC1_RGBA_SRGB
|
|
|
|
4, // BC2_SRGB
|
|
|
|
4, // BC3_SRGB
|
|
|
|
4, // BC7_SRGB
|
|
|
|
1, // A4B4G4R4_UNORM
|
2022-04-13 15:01:57 +00:00
|
|
|
1, // R4G4_UNORM
|
2018-12-04 18:32:00 +00:00
|
|
|
4, // ASTC_2D_4X4_SRGB
|
|
|
|
8, // ASTC_2D_8X8_SRGB
|
|
|
|
8, // ASTC_2D_8X5_SRGB
|
|
|
|
5, // ASTC_2D_5X4_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
5, // ASTC_2D_5X5_UNORM
|
2018-12-04 18:32:00 +00:00
|
|
|
5, // ASTC_2D_5X5_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
10, // ASTC_2D_10X8_UNORM
|
2018-12-04 18:32:00 +00:00
|
|
|
10, // ASTC_2D_10X8_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
6, // ASTC_2D_6X6_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
6, // ASTC_2D_6X6_SRGB
|
2022-07-01 02:04:23 +00:00
|
|
|
10, // ASTC_2D_10X6_UNORM
|
2022-10-06 14:45:40 +00:00
|
|
|
10, // ASTC_2D_10X5_UNORM
|
|
|
|
10, // ASTC_2D_10X5_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
10, // ASTC_2D_10X10_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
10, // ASTC_2D_10X10_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
12, // ASTC_2D_12X12_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
12, // ASTC_2D_12X12_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
8, // ASTC_2D_8X6_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
8, // ASTC_2D_8X6_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
6, // ASTC_2D_6X5_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
6, // ASTC_2D_6X5_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
1, // E5B9G9R9_FLOAT
|
|
|
|
1, // D32_FLOAT
|
|
|
|
1, // D16_UNORM
|
2021-11-17 20:04:38 +00:00
|
|
|
1, // S8_UINT
|
2020-07-01 05:28:53 +00:00
|
|
|
1, // D24_UNORM_S8_UINT
|
|
|
|
1, // S8_UINT_D24_UNORM
|
|
|
|
1, // D32_FLOAT_S8_UINT
|
2018-12-04 18:32:00 +00:00
|
|
|
}};
|
|
|
|
|
2020-12-30 05:25:23 +00:00
|
|
|
constexpr u32 DefaultBlockWidth(PixelFormat format) {
|
|
|
|
ASSERT(static_cast<std::size_t>(format) < BLOCK_WIDTH_TABLE.size());
|
|
|
|
return BLOCK_WIDTH_TABLE[static_cast<std::size_t>(format)];
|
2018-10-30 02:46:09 +00:00
|
|
|
}
|
|
|
|
|
2022-05-13 04:40:12 +00:00
|
|
|
constexpr std::array<u8, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{
|
2020-07-01 05:28:53 +00:00
|
|
|
1, // A8B8G8R8_UNORM
|
|
|
|
1, // A8B8G8R8_SNORM
|
|
|
|
1, // A8B8G8R8_SINT
|
|
|
|
1, // A8B8G8R8_UINT
|
|
|
|
1, // R5G6B5_UNORM
|
|
|
|
1, // B5G6R5_UNORM
|
|
|
|
1, // A1R5G5B5_UNORM
|
|
|
|
1, // A2B10G10R10_UNORM
|
|
|
|
1, // A2B10G10R10_UINT
|
|
|
|
1, // A1B5G5R5_UNORM
|
2022-04-13 15:01:57 +00:00
|
|
|
1, // A5B5G5R1_UNORM
|
2020-07-01 05:28:53 +00:00
|
|
|
1, // R8_UNORM
|
|
|
|
1, // R8_SNORM
|
|
|
|
1, // R8_SINT
|
|
|
|
1, // R8_UINT
|
|
|
|
1, // R16G16B16A16_FLOAT
|
|
|
|
1, // R16G16B16A16_UNORM
|
|
|
|
1, // R16G16B16A16_SNORM
|
|
|
|
1, // R16G16B16A16_SINT
|
|
|
|
1, // R16G16B16A16_UINT
|
|
|
|
1, // B10G11R11_FLOAT
|
|
|
|
1, // R32G32B32A32_UINT
|
|
|
|
4, // BC1_RGBA_UNORM
|
|
|
|
4, // BC2_UNORM
|
|
|
|
4, // BC3_UNORM
|
|
|
|
4, // BC4_UNORM
|
|
|
|
4, // BC4_SNORM
|
|
|
|
4, // BC5_UNORM
|
|
|
|
4, // BC5_SNORM
|
|
|
|
4, // BC7_UNORM
|
|
|
|
4, // BC6H_UFLOAT
|
|
|
|
4, // BC6H_SFLOAT
|
|
|
|
4, // ASTC_2D_4X4_UNORM
|
|
|
|
1, // B8G8R8A8_UNORM
|
|
|
|
1, // R32G32B32A32_FLOAT
|
|
|
|
1, // R32G32B32A32_SINT
|
|
|
|
1, // R32G32_FLOAT
|
|
|
|
1, // R32G32_SINT
|
|
|
|
1, // R32_FLOAT
|
|
|
|
1, // R16_FLOAT
|
|
|
|
1, // R16_UNORM
|
|
|
|
1, // R16_SNORM
|
|
|
|
1, // R16_UINT
|
|
|
|
1, // R16_SINT
|
|
|
|
1, // R16G16_UNORM
|
|
|
|
1, // R16G16_FLOAT
|
|
|
|
1, // R16G16_UINT
|
|
|
|
1, // R16G16_SINT
|
|
|
|
1, // R16G16_SNORM
|
|
|
|
1, // R32G32B32_FLOAT
|
|
|
|
1, // A8B8G8R8_SRGB
|
|
|
|
1, // R8G8_UNORM
|
|
|
|
1, // R8G8_SNORM
|
|
|
|
1, // R8G8_SINT
|
|
|
|
1, // R8G8_UINT
|
|
|
|
1, // R32G32_UINT
|
|
|
|
1, // R16G16B16X16_FLOAT
|
|
|
|
1, // R32_UINT
|
|
|
|
1, // R32_SINT
|
|
|
|
8, // ASTC_2D_8X8_UNORM
|
|
|
|
5, // ASTC_2D_8X5_UNORM
|
|
|
|
4, // ASTC_2D_5X4_UNORM
|
|
|
|
1, // B8G8R8A8_SRGB
|
|
|
|
4, // BC1_RGBA_SRGB
|
|
|
|
4, // BC2_SRGB
|
|
|
|
4, // BC3_SRGB
|
|
|
|
4, // BC7_SRGB
|
|
|
|
1, // A4B4G4R4_UNORM
|
2022-04-13 15:01:57 +00:00
|
|
|
1, // R4G4_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
4, // ASTC_2D_4X4_SRGB
|
|
|
|
8, // ASTC_2D_8X8_SRGB
|
|
|
|
5, // ASTC_2D_8X5_SRGB
|
|
|
|
4, // ASTC_2D_5X4_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
5, // ASTC_2D_5X5_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
5, // ASTC_2D_5X5_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
8, // ASTC_2D_10X8_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
8, // ASTC_2D_10X8_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
6, // ASTC_2D_6X6_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
6, // ASTC_2D_6X6_SRGB
|
2022-07-01 02:04:23 +00:00
|
|
|
6, // ASTC_2D_10X6_UNORM
|
2022-10-06 14:45:40 +00:00
|
|
|
5, // ASTC_2D_10X5_UNORM
|
|
|
|
5, // ASTC_2D_10X5_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
10, // ASTC_2D_10X10_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
10, // ASTC_2D_10X10_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
12, // ASTC_2D_12X12_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
12, // ASTC_2D_12X12_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
6, // ASTC_2D_8X6_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
6, // ASTC_2D_8X6_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
5, // ASTC_2D_6X5_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
5, // ASTC_2D_6X5_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
1, // E5B9G9R9_FLOAT
|
|
|
|
1, // D32_FLOAT
|
|
|
|
1, // D16_UNORM
|
2021-11-17 20:04:38 +00:00
|
|
|
1, // S8_UINT
|
2020-07-01 05:28:53 +00:00
|
|
|
1, // D24_UNORM_S8_UINT
|
|
|
|
1, // S8_UINT_D24_UNORM
|
|
|
|
1, // D32_FLOAT_S8_UINT
|
2018-12-04 18:32:00 +00:00
|
|
|
}};
|
|
|
|
|
2020-12-30 05:25:23 +00:00
|
|
|
constexpr u32 DefaultBlockHeight(PixelFormat format) {
|
|
|
|
ASSERT(static_cast<std::size_t>(format) < BLOCK_HEIGHT_TABLE.size());
|
|
|
|
return BLOCK_HEIGHT_TABLE[static_cast<std::size_t>(format)];
|
2018-10-29 01:14:25 +00:00
|
|
|
}
|
|
|
|
|
2022-05-13 04:40:12 +00:00
|
|
|
constexpr std::array<u8, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{
|
2020-07-01 05:28:53 +00:00
|
|
|
32, // A8B8G8R8_UNORM
|
|
|
|
32, // A8B8G8R8_SNORM
|
|
|
|
32, // A8B8G8R8_SINT
|
|
|
|
32, // A8B8G8R8_UINT
|
|
|
|
16, // R5G6B5_UNORM
|
|
|
|
16, // B5G6R5_UNORM
|
|
|
|
16, // A1R5G5B5_UNORM
|
|
|
|
32, // A2B10G10R10_UNORM
|
|
|
|
32, // A2B10G10R10_UINT
|
|
|
|
16, // A1B5G5R5_UNORM
|
2022-04-13 15:01:57 +00:00
|
|
|
16, // A5B5G5R1_UNORM
|
2020-07-01 05:28:53 +00:00
|
|
|
8, // R8_UNORM
|
|
|
|
8, // R8_SNORM
|
|
|
|
8, // R8_SINT
|
|
|
|
8, // R8_UINT
|
|
|
|
64, // R16G16B16A16_FLOAT
|
|
|
|
64, // R16G16B16A16_UNORM
|
|
|
|
64, // R16G16B16A16_SNORM
|
|
|
|
64, // R16G16B16A16_SINT
|
|
|
|
64, // R16G16B16A16_UINT
|
|
|
|
32, // B10G11R11_FLOAT
|
|
|
|
128, // R32G32B32A32_UINT
|
|
|
|
64, // BC1_RGBA_UNORM
|
|
|
|
128, // BC2_UNORM
|
|
|
|
128, // BC3_UNORM
|
|
|
|
64, // BC4_UNORM
|
|
|
|
64, // BC4_SNORM
|
|
|
|
128, // BC5_UNORM
|
|
|
|
128, // BC5_SNORM
|
|
|
|
128, // BC7_UNORM
|
|
|
|
128, // BC6H_UFLOAT
|
|
|
|
128, // BC6H_SFLOAT
|
|
|
|
128, // ASTC_2D_4X4_UNORM
|
|
|
|
32, // B8G8R8A8_UNORM
|
|
|
|
128, // R32G32B32A32_FLOAT
|
|
|
|
128, // R32G32B32A32_SINT
|
|
|
|
64, // R32G32_FLOAT
|
|
|
|
64, // R32G32_SINT
|
|
|
|
32, // R32_FLOAT
|
|
|
|
16, // R16_FLOAT
|
|
|
|
16, // R16_UNORM
|
|
|
|
16, // R16_SNORM
|
|
|
|
16, // R16_UINT
|
|
|
|
16, // R16_SINT
|
|
|
|
32, // R16G16_UNORM
|
|
|
|
32, // R16G16_FLOAT
|
|
|
|
32, // R16G16_UINT
|
|
|
|
32, // R16G16_SINT
|
|
|
|
32, // R16G16_SNORM
|
|
|
|
96, // R32G32B32_FLOAT
|
|
|
|
32, // A8B8G8R8_SRGB
|
|
|
|
16, // R8G8_UNORM
|
|
|
|
16, // R8G8_SNORM
|
|
|
|
16, // R8G8_SINT
|
|
|
|
16, // R8G8_UINT
|
|
|
|
64, // R32G32_UINT
|
|
|
|
64, // R16G16B16X16_FLOAT
|
|
|
|
32, // R32_UINT
|
|
|
|
32, // R32_SINT
|
|
|
|
128, // ASTC_2D_8X8_UNORM
|
|
|
|
128, // ASTC_2D_8X5_UNORM
|
|
|
|
128, // ASTC_2D_5X4_UNORM
|
|
|
|
32, // B8G8R8A8_SRGB
|
|
|
|
64, // BC1_RGBA_SRGB
|
|
|
|
128, // BC2_SRGB
|
|
|
|
128, // BC3_SRGB
|
|
|
|
128, // BC7_UNORM
|
|
|
|
16, // A4B4G4R4_UNORM
|
2022-04-13 15:01:57 +00:00
|
|
|
8, // R4G4_UNORM
|
2018-12-04 18:32:00 +00:00
|
|
|
128, // ASTC_2D_4X4_SRGB
|
|
|
|
128, // ASTC_2D_8X8_SRGB
|
|
|
|
128, // ASTC_2D_8X5_SRGB
|
|
|
|
128, // ASTC_2D_5X4_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
128, // ASTC_2D_5X5_UNORM
|
2018-12-04 18:32:00 +00:00
|
|
|
128, // ASTC_2D_5X5_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
128, // ASTC_2D_10X8_UNORM
|
2018-12-04 18:32:00 +00:00
|
|
|
128, // ASTC_2D_10X8_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
128, // ASTC_2D_6X6_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
128, // ASTC_2D_6X6_SRGB
|
2022-07-01 02:04:23 +00:00
|
|
|
128, // ASTC_2D_10X6_UNORM
|
2022-10-06 14:45:40 +00:00
|
|
|
128, // ASTC_2D_10X5_UNORM
|
|
|
|
128, // ASTC_2D_10X5_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
128, // ASTC_2D_10X10_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
128, // ASTC_2D_10X10_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
128, // ASTC_2D_12X12_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
128, // ASTC_2D_12X12_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
128, // ASTC_2D_8X6_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
128, // ASTC_2D_8X6_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
128, // ASTC_2D_6X5_UNORM
|
2019-10-02 23:00:16 +00:00
|
|
|
128, // ASTC_2D_6X5_SRGB
|
2020-07-01 05:28:53 +00:00
|
|
|
32, // E5B9G9R9_FLOAT
|
|
|
|
32, // D32_FLOAT
|
|
|
|
16, // D16_UNORM
|
2021-11-17 20:04:38 +00:00
|
|
|
8, // S8_UINT
|
2020-07-01 05:28:53 +00:00
|
|
|
32, // D24_UNORM_S8_UINT
|
|
|
|
32, // S8_UINT_D24_UNORM
|
|
|
|
64, // D32_FLOAT_S8_UINT
|
2018-12-04 18:32:00 +00:00
|
|
|
}};
|
|
|
|
|
2020-12-30 05:25:23 +00:00
|
|
|
constexpr u32 BitsPerBlock(PixelFormat format) {
|
|
|
|
ASSERT(static_cast<std::size_t>(format) < BITS_PER_BLOCK_TABLE.size());
|
|
|
|
return BITS_PER_BLOCK_TABLE[static_cast<std::size_t>(format)];
|
2018-10-29 01:14:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns the sizer in bytes of the specified pixel format
|
2020-12-30 05:25:23 +00:00
|
|
|
constexpr u32 BytesPerBlock(PixelFormat pixel_format) {
|
|
|
|
return BitsPerBlock(pixel_format) / CHAR_BIT;
|
2018-10-29 01:14:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SurfaceTarget SurfaceTargetFromTextureType(Tegra::Texture::TextureType texture_type);
|
|
|
|
|
|
|
|
bool SurfaceTargetIsLayered(SurfaceTarget target);
|
2019-01-29 23:33:56 +00:00
|
|
|
|
|
|
|
bool SurfaceTargetIsArray(SurfaceTarget target);
|
2018-10-29 01:14:25 +00:00
|
|
|
|
|
|
|
PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format);
|
|
|
|
|
|
|
|
PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format);
|
|
|
|
|
2022-03-20 04:51:16 +00:00
|
|
|
PixelFormat PixelFormatFromGPUPixelFormat(Service::android::PixelFormat format);
|
2018-10-29 01:14:25 +00:00
|
|
|
|
|
|
|
SurfaceType GetFormatType(PixelFormat pixel_format);
|
|
|
|
|
|
|
|
bool IsPixelFormatASTC(PixelFormat format);
|
|
|
|
|
2019-09-13 03:17:26 +00:00
|
|
|
bool IsPixelFormatSRGB(PixelFormat format);
|
|
|
|
|
2021-09-19 00:50:00 +00:00
|
|
|
bool IsPixelFormatInteger(PixelFormat format);
|
|
|
|
|
2021-10-19 17:41:57 +00:00
|
|
|
bool IsPixelFormatSignedInteger(PixelFormat format);
|
|
|
|
|
|
|
|
size_t PixelComponentSizeBitsInteger(PixelFormat format);
|
|
|
|
|
2018-10-29 01:14:25 +00:00
|
|
|
std::pair<u32, u32> GetASTCBlockSize(PixelFormat format);
|
|
|
|
|
2021-06-14 11:42:22 +00:00
|
|
|
u64 EstimatedDecompressedSize(u64 base_size, PixelFormat format);
|
|
|
|
|
2018-10-29 01:14:25 +00:00
|
|
|
} // namespace VideoCore::Surface
|