blob: ae08bc1426d674570dfe8e317d33ac3195a440c0 (
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
|
#pragma once
#include "base/assert.hpp"
#include <cstdint>
namespace dp
{
enum class TextureFormat : uint8_t
{
RGBA8,
Alpha,
RedGreen,
DepthStencil,
Depth,
Unspecified
};
enum class TextureFilter : uint8_t
{
Nearest,
Linear
};
enum class TextureWrapping : uint8_t
{
ClampToEdge,
Repeat
};
inline uint8_t GetBytesPerPixel(TextureFormat format)
{
uint8_t result = 0;
switch (format)
{
case TextureFormat::RGBA8: result = 4; break;
case TextureFormat::Alpha: result = 1; break;
case TextureFormat::RedGreen: result = 2; break;
case TextureFormat::DepthStencil: result = 4; break;
case TextureFormat::Depth: result = 4; break;
default: ASSERT(false, ()); break;
}
return result;
}
} // namespace dp
|