Photon Editor Library
2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ghi_enums.ipp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
RenderCore/ghi_enums.h
"
4
5
#include <Common/assertion.h>
6
7
#include <type_traits>
8
9
namespace
ph::editor::ghi
10
{
11
12
inline
std::size_t
num_bytes
(
ESizedPixelFormat
sizedFormat)
13
{
14
switch
(sizedFormat)
15
{
16
case
ESizedPixelFormat::Empty
:
return
0;
17
case
ESizedPixelFormat::RGB_8
:
return
3 * 1;
18
case
ESizedPixelFormat::RGBA_8
:
return
4 * 1;
19
case
ESizedPixelFormat::RGB_16F
:
return
3 * 2;
20
case
ESizedPixelFormat::RGBA_16F
:
return
4 * 2;
21
case
ESizedPixelFormat::RGB_32F
:
return
3 * 4;
22
case
ESizedPixelFormat::RGBA_32F
:
return
4 * 4;
23
case
ESizedPixelFormat::Depth_24_Stencil_8
:
return
3 + 1;
24
default
: PH_ASSERT_UNREACHABLE_SECTION();
return
0;
25
}
26
}
27
28
inline
std::size_t
num_bytes
(
EPixelComponent
component)
29
{
30
switch
(component)
31
{
32
case
EPixelComponent::Empty
:
return
0;
33
case
EPixelComponent::Int8
:
return
1;
34
case
EPixelComponent::UInt8
:
return
1;
35
case
EPixelComponent::Int16
:
return
2;
36
case
EPixelComponent::UInt16
:
return
2;
37
case
EPixelComponent::Int32
:
return
4;
38
case
EPixelComponent::UInt32
:
return
4;
39
case
EPixelComponent::Int64
:
return
8;
40
case
EPixelComponent::UInt64
:
return
8;
41
case
EPixelComponent::Float16
:
return
2;
42
case
EPixelComponent::Float32
:
return
4;
43
case
EPixelComponent::Float64
:
return
8;
44
default
: PH_ASSERT_UNREACHABLE_SECTION();
return
0;
45
}
46
}
47
48
inline
std::size_t
num_bytes
(
EStorageElement
element)
49
{
50
switch
(element)
51
{
52
case
EStorageElement::Empty
:
return
0;
53
case
EStorageElement::Int8
:
return
1;
54
case
EStorageElement::UInt8
:
return
1;
55
case
EStorageElement::Int16
:
return
2;
56
case
EStorageElement::UInt16
:
return
2;
57
case
EStorageElement::Int32
:
return
4;
58
case
EStorageElement::UInt32
:
return
4;
59
case
EStorageElement::Int64
:
return
8;
60
case
EStorageElement::UInt64
:
return
8;
61
case
EStorageElement::Float16
:
return
2;
62
case
EStorageElement::Float32
:
return
4;
63
case
EStorageElement::Float64
:
return
8;
64
default
: PH_ASSERT_UNREACHABLE_SECTION();
return
0;
65
}
66
}
67
68
template
<CEnum DstEnumType>
69
DstEnumType
translate_to
(EPicturePixelComponent pictureComponent)
70
{
71
if
constexpr
(std::is_same_v<DstEnumType, EPixelComponent>)
72
{
73
switch
(pictureComponent)
74
{
75
case
EPicturePixelComponent::Empty:
return
EPixelComponent::Empty
;
76
case
EPicturePixelComponent::Int8:
return
EPixelComponent::Int8
;
77
case
EPicturePixelComponent::UInt8:
return
EPixelComponent::UInt8
;
78
case
EPicturePixelComponent::Int16:
return
EPixelComponent::Int16
;
79
case
EPicturePixelComponent::UInt16:
return
EPixelComponent::UInt16
;
80
case
EPicturePixelComponent::Int32:
return
EPixelComponent::Int32
;
81
case
EPicturePixelComponent::UInt32:
return
EPixelComponent::UInt32
;
82
case
EPicturePixelComponent::Int64:
return
EPixelComponent::Int64
;
83
case
EPicturePixelComponent::UInt64:
return
EPixelComponent::UInt64
;
84
case
EPicturePixelComponent::Float16:
return
EPixelComponent::Float16
;
85
case
EPicturePixelComponent::Float32:
return
EPixelComponent::Float32
;
86
case
EPicturePixelComponent::Float64:
return
EPixelComponent::Float64
;
87
default
: PH_ASSERT_UNREACHABLE_SECTION();
return
EPixelComponent::Empty
;
88
}
89
}
90
else
91
{
92
PH_ASSERT_UNREACHABLE_SECTION();
93
return
static_cast<
DstEnumType
>
(0);
94
}
95
}
96
97
}
// end namespace ph::editor::ghi
ghi_enums.h
ph::editor::ghi
Definition
PlatformDisplay.h:13
ph::editor::ghi::ESizedPixelFormat
ESizedPixelFormat
Combined pixel layout and component type information. Unless stated explicitly, the characters RGB do...
Definition
ghi_enums.h:19
ph::editor::ghi::ESizedPixelFormat::RGB_32F
@ RGB_32F
ph::editor::ghi::ESizedPixelFormat::RGBA_16F
@ RGBA_16F
ph::editor::ghi::ESizedPixelFormat::RGBA_32F
@ RGBA_32F
ph::editor::ghi::ESizedPixelFormat::Depth_24_Stencil_8
@ Depth_24_Stencil_8
ph::editor::ghi::ESizedPixelFormat::RGB_8
@ RGB_8
ph::editor::ghi::ESizedPixelFormat::RGBA_8
@ RGBA_8
ph::editor::ghi::ESizedPixelFormat::Empty
@ Empty
ph::editor::ghi::ESizedPixelFormat::RGB_16F
@ RGB_16F
ph::editor::ghi::EStorageElement
EStorageElement
Definition
ghi_enums.h:70
ph::editor::ghi::EStorageElement::Float32
@ Float32
ph::editor::ghi::EStorageElement::Float16
@ Float16
ph::editor::ghi::EStorageElement::Int16
@ Int16
ph::editor::ghi::EStorageElement::Int8
@ Int8
ph::editor::ghi::EStorageElement::UInt16
@ UInt16
ph::editor::ghi::EStorageElement::UInt64
@ UInt64
ph::editor::ghi::EStorageElement::UInt8
@ UInt8
ph::editor::ghi::EStorageElement::Int32
@ Int32
ph::editor::ghi::EStorageElement::Empty
@ Empty
ph::editor::ghi::EStorageElement::Float64
@ Float64
ph::editor::ghi::EStorageElement::UInt32
@ UInt32
ph::editor::ghi::EStorageElement::Int64
@ Int64
ph::editor::ghi::translate_to
DstEnumType translate_to(EPicturePixelComponent pictureComponent)
Definition
ghi_enums.ipp:69
ph::editor::ghi::EPixelComponent
EPixelComponent
Definition
ghi_enums.h:42
ph::editor::ghi::EPixelComponent::Float32
@ Float32
ph::editor::ghi::EPixelComponent::Float16
@ Float16
ph::editor::ghi::EPixelComponent::Int16
@ Int16
ph::editor::ghi::EPixelComponent::Int8
@ Int8
ph::editor::ghi::EPixelComponent::UInt16
@ UInt16
ph::editor::ghi::EPixelComponent::UInt64
@ UInt64
ph::editor::ghi::EPixelComponent::UInt8
@ UInt8
ph::editor::ghi::EPixelComponent::Int32
@ Int32
ph::editor::ghi::EPixelComponent::Empty
@ Empty
ph::editor::ghi::EPixelComponent::Float64
@ Float64
ph::editor::ghi::EPixelComponent::UInt32
@ UInt32
ph::editor::ghi::EPixelComponent::Int64
@ Int64
ph::editor::ghi::num_bytes
std::size_t num_bytes(ESizedPixelFormat sizedFormat)
Definition
ghi_enums.ipp:12
Source
RenderCore
ghi_enums.ipp
Generated by
1.11.0