CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
GPUFormat.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
12
14
16
17#include <cstdint>
18#include <tuple>
19
20namespace CeresEngine {
21
24 Uint8,
25
27 Float16,
28
31 };
32
33 // /// The image format
34 // class Format {
35 // public:
36 // /// The image format type
37 // enum class Type {
38 // /// A undefined format type
39 // undefined,
40 //
41 // /// A image that has a color buffer with up to 4 color
42 // channels.
43 // color,
44 //
45 // /// A image that has a depth buffer attached to it.
46 // depth
47 // };
48 //
49 // Type type = Type::undefined;
50 // Precision precision = Precision::uint8;
51 // int channels = 4;
52 //
53 // public:
54 // Format() = default;
55 // Format(const Format&) = default;
56 //
57 // explicit Format(Type type = Type::color,
58 // Precision precision = Precision::uint8,
59 // int channels = 4)
60 // : type(type),
61 // precision(precision),
62 // channels(channels) {}
63 //
64 // public:
65 // /// A image that has a color buffer with up to 4 color channels.
66 // static Format undefined() {
67 // return Format(Type::undefined);
68 // }
69 //
70 // /// A image that has a color buffer with up to 4 color channels.
71 // static Format color8(int channels = 4) {
72 // return Format{Type::color, Precision::uint8, channels};
73 // }
74 //
75 // /// A image that has a color buffer with up to 4 color channels.
76 // static Format colorFloat16(int channels = 4) {
77 // return Format{Type::color, Precision::float16, channels};
78 // }
79 //
80 // /// A image that has a color buffer with up to 4 color channels.
81 // static Format colorFloat32(int channels = 4) {
82 // return Format{Type::color, Precision::float32, channels};
83 // }
84 //
85 // /// A image that has a color buffer with up to 4 color channels.
86 // static Format color(Precision precision = Precision::uint8, int
87 // channels = 4) {
88 // return Format{Type::color, precision, channels};
89 // }
90 //
91 // /// A image that has a depth buffer attached to it.
92 // static Format depthFloat16() {
93 // return Format{Type::depth, Precision::float16, 1};
94 // }
95 //
96 // /// A image that has a depth buffer attached to it.
97 // static Format depthFloat32() {
98 // return Format{Type::depth, Precision::float32, 1};
99 // }
100 //
101 // /// A image that has a depth buffer attached to it.
102 // static Format depth(Precision precision = Precision::float16) {
103 // return Format{Type::depth, precision, 1};
104 // }
105 //
106 // };
107
110 Int8,
111 UInt8,
112
113 Int16,
114 UInt16,
115
116 Int32,
117 UInt32,
118
119 Float16,
120 Float32,
121 Float64,
122 };
123
129 [[nodiscard]] UInt32 formatBitSize(Format format) noexcept;
130
134
138 [[nodiscard]] bool isCompressedFormat(Format format) noexcept;
139
143 [[nodiscard]] bool isDepthStencilFormat(Format format) noexcept;
144
148 [[nodiscard]] bool isDepthFormat(Format format) noexcept;
149
153 [[nodiscard]] bool isStencilFormat(Format format) noexcept;
154
159 [[nodiscard]] bool isNormalizedFormat(Format format) noexcept;
160
164 [[nodiscard]] bool isIntegralFormat(Format format) noexcept;
165
170 [[nodiscard]] bool isFloatFormat(Format format) noexcept;
171
173 [[nodiscard]] UInt32 dataTypeSize(DataType dataType) noexcept;
174
178 [[nodiscard]] bool isIntDataType(DataType dataType) noexcept;
179
184 [[nodiscard]] bool isUIntDataType(DataType dataType) noexcept;
185
189 [[nodiscard]] bool isFloatDataType(DataType dataType) noexcept;
190
191} // namespace CeresEngine
#define CE_SCRIPT_EXPORT(...)
The CE_SCRIPT_EXPORT macro marks a class or method as exportable and available in scripting environme...
Definition Macros.hpp:247
Tuple is a fixed-size collection of heterogeneous values.
Definition Tuple.hpp:15
Definition Application.hpp:19
bool isNormalizedFormat(Format format) noexcept
Returns true if the specified hardware format is a normalized format (like Format::RGBA8UNorm,...
bool isStencilFormat(Format format) noexcept
Returns true if the specified hardware format is a stencil format, i.e.
Precision
Definition GPUFormat.hpp:22
@ Float32
A image that represents each channel using 32 bit floats.
@ Float16
A image that represents each channel using 16 bit floats.
@ Uint8
A image that represents each channel using 8 bits.
UInt32 dataTypeSize(DataType dataType) noexcept
Returns the size (in bytes) of the specified data type.
bool isIntDataType(DataType dataType) noexcept
Determines if the argument refers to a signed integer data type.
bool isFloatDataType(DataType dataType) noexcept
Determines if the argument refers to a floating-pointer data type.
bool isDepthStencilFormat(Format format) noexcept
Returns true if the specified hardware format is a depth or depth-stencil format, i....
Format
Definition TextureFormat.hpp:54
UInt32 formatBitSize(Format format) noexcept
Returns the bit size of the specified hardware format.
std::int32_t Int32
Definition DataTypes.hpp:21
std::uint16_t UInt16
Definition DataTypes.hpp:20
std::uint8_t UInt8
Definition DataTypes.hpp:17
bool isIntegralFormat(Format format) noexcept
Returns true if the specified hardware format is an integral format (like Format::RGBA8UInt,...
bool isFloatFormat(Format format) noexcept
Returns true if the specified hardware format is a floating-point format (like Format::RGBA32Float,...
DataType
Renderer data types enumeration.
Definition GPUFormat.hpp:109
@ Float64
64-bit real type (double).
Tuple< DataType, UInt32 > splitFormat(Format format) noexcept
Splits the specified hardware format into a data type and the number of components.
std::uint32_t UInt32
Definition DataTypes.hpp:23
bool isUIntDataType(DataType dataType) noexcept
Determines if the argument refers to an unsigned integer data type.
std::int8_t Int8
Definition DataTypes.hpp:15
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
bool isCompressedFormat(Format format) noexcept
Returns true if the specified hardware format is a compressed format, i.e.
std::int16_t Int16
Definition DataTypes.hpp:18
bool isDepthFormat(Format format) noexcept
Returns true if the specified hardware format is a depth format, i.e.