GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
Texture.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Ivar Härnqvist
2// SPDX-License-Identifier: MIT
3
4#ifndef GREM_GRAPHICS_TEXTURE_HPP
5#define GREM_GRAPHICS_TEXTURE_HPP
6
8
16#include <GREM/core/extents.hpp>
18#include <GREM/core/math.hpp>
22
23#include <utility> // std::move
24
25namespace grem::graphics {
26
27class Texture; // Forward declaration.
28class Swapchain; // Forward declaration, to avoid a circular include of Swapchain.hpp.
29class Device; // Forward declaration, to avoid a circular include of Device.hpp.
30struct DeviceImplementation; // Forward declaration, to avoid a circular include of Device.hpp.
31
32struct TextureImplementation;
33
46
50enum class TextureAspect : uint8_t { // NOLINT(performance-enum-size)
51 COLOR = 1 << 0,
52 DEPTH = 1 << 1,
53 STENCIL = 1 << 2,
54};
55
60public:
64 static const TextureAspects ALL;
65
70
75
79 constexpr TextureAspects() noexcept = default;
80
89 constexpr TextureAspects(TextureAspect aspect)
90 : bits(static_cast<uint8_t>(aspect)) {}
91
99 [[nodiscard]] constexpr bool operator==(const TextureAspects& other) const noexcept = default;
100
106 [[nodiscard]] constexpr bool empty() const noexcept {
107 return bits == 0;
108 }
109
117 [[nodiscard]] constexpr bool contains(TextureAspect aspect) const noexcept {
118 return (bits & TextureAspects{aspect}.bits) != 0;
119 }
120
129 [[nodiscard]] constexpr bool containsAnyOf(TextureAspects aspects) const noexcept {
130 return (bits & aspects.bits) != 0;
131 }
132
141 [[nodiscard]] constexpr bool containsAllOf(TextureAspects aspects) const noexcept {
142 return static_cast<uint8_t>(bits & aspects.bits) == aspects.bits;
143 }
144
153 [[nodiscard]] friend constexpr TextureAspects operator~(TextureAspects a) noexcept {
154 return TextureAspects{static_cast<uint8_t>(~a.bits)};
155 }
156
165 [[nodiscard]] friend constexpr TextureAspects operator&(TextureAspects a, TextureAspects b) noexcept {
166 return TextureAspects{static_cast<uint8_t>(a.bits & b.bits)};
167 }
168
177 [[nodiscard]] friend constexpr TextureAspects operator|(TextureAspects a, TextureAspects b) noexcept {
178 return TextureAspects{static_cast<uint8_t>(a.bits | b.bits)};
179 }
180
190 [[nodiscard]] friend constexpr TextureAspects operator^(TextureAspects a, TextureAspects b) noexcept {
191 return TextureAspects{static_cast<uint8_t>(a.bits ^ b.bits)};
192 }
193
202 friend constexpr TextureAspects& operator&=(TextureAspects& a, TextureAspects b) noexcept {
203 return a = a & b;
204 }
205
214 friend constexpr TextureAspects& operator|=(TextureAspects& a, TextureAspects b) noexcept {
215 return a = a | b;
216 }
217
226 friend constexpr TextureAspects& operator^=(TextureAspects& a, TextureAspects b) noexcept {
227 return a = a ^ b;
228 }
229
230private:
231 constexpr explicit TextureAspects(uint8_t bits) noexcept
232 : bits(bits) {}
233
234 uint8_t bits{};
235};
236
245 return ~TextureAspects{a};
246}
247
257 return TextureAspects{a} | TextureAspects{b};
258}
259
260inline constexpr TextureAspects TextureAspects::ALL = ~TextureAspects{};
263
312
318 uint32_t layer = 0;
319 uint32_t mipLevel = 0;
320
328 [[nodiscard]] constexpr bool operator==(const TextureSubresource& other) const = default;
329};
330
336 Offset3D offset{.x = 0, .y = 0, .z = 0};
338 uint32_t mipLevel = 0;
339
347 [[nodiscard]] constexpr bool operator==(const TextureRegion2D& other) const = default;
348};
349
355 Offset3D offset{.x = 0, .y = 0, .z = 0};
357 uint32_t mipLevel = 0;
358
366 [[nodiscard]] constexpr bool operator==(const TextureRegion3D& other) const = default;
367};
368
376
384
392
400
408
416
421struct RetainValues {};
422
432
439
444struct ClearMode : Variant<RetainValues, ClearValues, UndefinedClearValues> {
445 using Variant::Variant;
446};
447
455
461
466struct ResolveMode : Variant<StoreIntermediateValues, DiscardIntermediateValues> {
467 using Variant::Variant;
468};
469
473enum class TextureFilter : uint8_t {
476};
477
481enum class TextureMipmapMode : uint8_t {
485};
486
495
546
586
596
603
611 [[nodiscard]] constexpr bool operator==(const TextureImageDownloadOptions& other) const = default;
612};
613
685
687 .minificationFilter = TextureFilter::NEAREST,
688 .magnificationFilter = TextureFilter::NEAREST,
689 .mipmapMode = TextureMipmapMode::NONE,
690 .horizontalWrappingMode = TextureWrappingMode::REPEAT,
691 .verticalWrappingMode = TextureWrappingMode::REPEAT,
692 .maxAnisotropy = 1.0f,
693};
694
700class Texture {
701public:
711 [[nodiscard]] static constexpr TextureAspects getFormatAspects(TextureFormat internalFormat) {
712 switch (internalFormat) {
713 case TextureFormat::UNKNOWN: throw graphics::Error{"Invalid texture format."};
714 case TextureFormat::R8_UNORM: [[fallthrough]];
715 case TextureFormat::R16_FLOAT: [[fallthrough]];
716 case TextureFormat::R32_FLOAT: [[fallthrough]];
717 case TextureFormat::R8G8_UNORM: [[fallthrough]];
718 case TextureFormat::R16G16_FLOAT: [[fallthrough]];
719 case TextureFormat::R32G32_FLOAT: [[fallthrough]];
720 case TextureFormat::R8G8B8A8_UNORM: [[fallthrough]];
721 case TextureFormat::R8G8B8A8_SRGB: [[fallthrough]];
722 case TextureFormat::B8G8R8A8_UNORM: [[fallthrough]];
723 case TextureFormat::B8G8R8A8_SRGB: [[fallthrough]];
724 case TextureFormat::R16G16B16A16_FLOAT: [[fallthrough]];
725 case TextureFormat::R32G32B32A32_FLOAT: [[fallthrough]];
726 case TextureFormat::R5G6B5_UNORM_PACK16: [[fallthrough]];
727 case TextureFormat::A1R5G5B5_UNORM_PACK16: [[fallthrough]];
728 case TextureFormat::B10G11R11_UFLOAT_PACK32: [[fallthrough]];
729 case TextureFormat::A2B10G10R10_UNORM_PACK32: [[fallthrough]];
730 case TextureFormat::ASTC_4x4_RGBA_UNORM_BLOCK: [[fallthrough]];
731 case TextureFormat::ASTC_4x4_RGBA_SRGB_BLOCK: [[fallthrough]];
732 case TextureFormat::BC1_RGB_UNORM_BLOCK: [[fallthrough]];
733 case TextureFormat::BC1_RGB_SRGB_BLOCK: [[fallthrough]];
734 case TextureFormat::BC3_RGBA_UNORM_BLOCK: [[fallthrough]];
735 case TextureFormat::BC3_RGBA_SRGB_BLOCK: [[fallthrough]];
736 case TextureFormat::BC4_R_UNORM_BLOCK: [[fallthrough]];
737 case TextureFormat::BC5_RG_UNORM_BLOCK: [[fallthrough]];
738 case TextureFormat::BC6H_RGB_UFLOAT_BLOCK: [[fallthrough]];
739 case TextureFormat::BC6H_RGB_FLOAT_BLOCK: [[fallthrough]];
740 case TextureFormat::BC7_RGBA_UNORM_BLOCK: [[fallthrough]];
741 case TextureFormat::BC7_RGBA_SRGB_BLOCK: [[fallthrough]];
742 case TextureFormat::ETC2_R8G8B8_UNORM_BLOCK: [[fallthrough]];
743 case TextureFormat::ETC2_R8G8B8_SRGB_BLOCK: [[fallthrough]];
744 case TextureFormat::ETC2_R8G8B8A8_UNORM_BLOCK: [[fallthrough]];
745 case TextureFormat::ETC2_R8G8B8A8_SRGB_BLOCK: [[fallthrough]];
746 case TextureFormat::EAC_R11_UNORM_BLOCK: [[fallthrough]];
747 case TextureFormat::EAC_R11G11_UNORM_BLOCK: [[fallthrough]];
750 case TextureFormat::D16_UNORM: [[fallthrough]];
752 case TextureFormat::D24_UNORM_S8_UINT: [[fallthrough]];
754 }
755 unreachable();
756 }
757
780
791 [[nodiscard]] static constexpr resource::ImageFormat getImageFormat(TextureFormat internalFormat) {
792 switch (internalFormat) {
793 case TextureFormat::UNKNOWN: [[fallthrough]];
794 case TextureFormat::B8G8R8A8_UNORM: [[fallthrough]];
795 case TextureFormat::B8G8R8A8_SRGB: [[fallthrough]];
796 case TextureFormat::D16_UNORM: [[fallthrough]];
797 case TextureFormat::D32_FLOAT: [[fallthrough]];
798 case TextureFormat::D24_UNORM_S8_UINT: [[fallthrough]];
799 case TextureFormat::D32_FLOAT_S8_UINT: throw graphics::Error{"Invalid texture format."};
806 case TextureFormat::R8G8B8A8_UNORM: [[fallthrough]];
834 }
835 unreachable();
836 }
837
855
869 [[nodiscard]] static constexpr bool hasInternalSRGBFormat(resource::ImageFormat format) noexcept {
870 switch (format) {
871 case resource::ImageFormat::UNKNOWN: [[fallthrough]];
872 case resource::ImageFormat::R8G8B8_UINT: [[fallthrough]];
873 case resource::ImageFormat::R16G16B16_FLOAT: [[fallthrough]];
874 case resource::ImageFormat::R32G32B32_FLOAT: [[fallthrough]];
883 case resource::ImageFormat::R8_UINT: [[fallthrough]];
884 case resource::ImageFormat::R16_FLOAT: [[fallthrough]];
885 case resource::ImageFormat::R32_FLOAT: [[fallthrough]];
886 case resource::ImageFormat::R8G8_UINT: [[fallthrough]];
887 case resource::ImageFormat::R16G16_FLOAT: [[fallthrough]];
888 case resource::ImageFormat::R32G32_FLOAT: [[fallthrough]];
889 case resource::ImageFormat::R16G16B16A16_FLOAT: [[fallthrough]];
890 case resource::ImageFormat::R32G32B32A32_FLOAT: [[fallthrough]];
891 case resource::ImageFormat::R5G6B5_UINT_PACK16: [[fallthrough]];
895 case resource::ImageFormat::BC4_R_UINT_BLOCK: [[fallthrough]];
896 case resource::ImageFormat::BC5_RG_UINT_BLOCK: [[fallthrough]];
899 case resource::ImageFormat::EAC_R11_UINT_BLOCK: [[fallthrough]];
901 case resource::ImageFormat::R8G8B8A8_UINT: [[fallthrough]];
903 case resource::ImageFormat::BC1_RGB_UINT_BLOCK: [[fallthrough]];
904 case resource::ImageFormat::BC3_RGBA_UINT_BLOCK: [[fallthrough]];
905 case resource::ImageFormat::BC7_RGBA_UINT_BLOCK: [[fallthrough]];
909 }
910 unreachable();
911 }
912
922 [[nodiscard]] static constexpr Color::TransferFunction getTransferFunction(TextureFormat internalFormat) noexcept {
923 switch (internalFormat) {
924 case TextureFormat::UNKNOWN: [[fallthrough]];
925 case TextureFormat::R8_UNORM: [[fallthrough]];
926 case TextureFormat::R16_FLOAT: [[fallthrough]];
927 case TextureFormat::R32_FLOAT: [[fallthrough]];
928 case TextureFormat::R8G8_UNORM: [[fallthrough]];
929 case TextureFormat::R16G16_FLOAT: [[fallthrough]];
930 case TextureFormat::R32G32_FLOAT: [[fallthrough]];
931 case TextureFormat::R8G8B8A8_UNORM: [[fallthrough]];
932 case TextureFormat::B8G8R8A8_UNORM: [[fallthrough]];
933 case TextureFormat::R16G16B16A16_FLOAT: [[fallthrough]];
934 case TextureFormat::R32G32B32A32_FLOAT: [[fallthrough]];
935 case TextureFormat::D16_UNORM: [[fallthrough]];
936 case TextureFormat::D32_FLOAT: [[fallthrough]];
937 case TextureFormat::D24_UNORM_S8_UINT: [[fallthrough]];
938 case TextureFormat::D32_FLOAT_S8_UINT: [[fallthrough]];
939 case TextureFormat::R5G6B5_UNORM_PACK16: [[fallthrough]];
940 case TextureFormat::A1R5G5B5_UNORM_PACK16: [[fallthrough]];
941 case TextureFormat::B10G11R11_UFLOAT_PACK32: [[fallthrough]];
942 case TextureFormat::A2B10G10R10_UNORM_PACK32: [[fallthrough]];
943 case TextureFormat::ASTC_4x4_RGBA_UNORM_BLOCK: [[fallthrough]];
944 case TextureFormat::BC1_RGB_UNORM_BLOCK: [[fallthrough]];
945 case TextureFormat::BC3_RGBA_UNORM_BLOCK: [[fallthrough]];
946 case TextureFormat::BC4_R_UNORM_BLOCK: [[fallthrough]];
947 case TextureFormat::BC5_RG_UNORM_BLOCK: [[fallthrough]];
948 case TextureFormat::BC6H_RGB_UFLOAT_BLOCK: [[fallthrough]];
949 case TextureFormat::BC6H_RGB_FLOAT_BLOCK: [[fallthrough]];
950 case TextureFormat::BC7_RGBA_UNORM_BLOCK: [[fallthrough]];
951 case TextureFormat::ETC2_R8G8B8_UNORM_BLOCK: [[fallthrough]];
952 case TextureFormat::ETC2_R8G8B8A8_UNORM_BLOCK: [[fallthrough]];
953 case TextureFormat::EAC_R11_UNORM_BLOCK: [[fallthrough]];
954 case TextureFormat::EAC_R11G11_UNORM_BLOCK: [[fallthrough]];
956 case TextureFormat::R8G8B8A8_SRGB: [[fallthrough]];
957 case TextureFormat::B8G8R8A8_SRGB: [[fallthrough]];
958 case TextureFormat::ASTC_4x4_RGBA_SRGB_BLOCK: [[fallthrough]];
959 case TextureFormat::BC1_RGB_SRGB_BLOCK: [[fallthrough]];
960 case TextureFormat::BC3_RGBA_SRGB_BLOCK: [[fallthrough]];
961 case TextureFormat::BC7_RGBA_SRGB_BLOCK: [[fallthrough]];
962 case TextureFormat::ETC2_R8G8B8_SRGB_BLOCK: [[fallthrough]];
963 case TextureFormat::ETC2_R8G8B8A8_SRGB_BLOCK: [[fallthrough]];
965 }
966 unreachable();
967 }
968
983 [[nodiscard]] static constexpr TextureFormat getInternalFormat(resource::ImageFormat format, Color::TransferFunction transferFunction) noexcept {
984 switch (format) {
985 case resource::ImageFormat::UNKNOWN: [[fallthrough]];
986 case resource::ImageFormat::R8G8B8_UINT: [[fallthrough]];
987 case resource::ImageFormat::R16G16B16_FLOAT: [[fallthrough]];
988 case resource::ImageFormat::R32G32B32_FLOAT: [[fallthrough]];
1030 }
1031 unreachable();
1032 }
1033
1042 [[nodiscard]] static constexpr TextureFormat getRawFormat(TextureFormat internalFormat) noexcept {
1043 switch (internalFormat) {
1085 }
1086 unreachable();
1087 }
1088
1101 [[nodiscard]] static constexpr TextureFormat getUncompressedFormat(TextureFormat internalFormat) noexcept {
1102 switch (internalFormat) {
1144 }
1145 unreachable();
1146 }
1147
1158 [[nodiscard]] static constexpr bool isCompatibleFormat(TextureFormat internalFormat, resource::ImageFormat format) noexcept {
1159 switch (internalFormat) {
1160 case TextureFormat::UNKNOWN: [[fallthrough]];
1161 case TextureFormat::B8G8R8A8_UNORM: [[fallthrough]];
1162 case TextureFormat::B8G8R8A8_SRGB: [[fallthrough]];
1163 case TextureFormat::D16_UNORM: [[fallthrough]];
1164 case TextureFormat::D32_FLOAT: [[fallthrough]];
1165 case TextureFormat::D24_UNORM_S8_UINT: [[fallthrough]];
1166 case TextureFormat::D32_FLOAT_S8_UINT: return false;
1173 case TextureFormat::R8G8B8A8_UNORM: [[fallthrough]];
1181 case TextureFormat::ASTC_4x4_RGBA_UNORM_BLOCK: [[fallthrough]];
1183 case TextureFormat::BC1_RGB_UNORM_BLOCK: [[fallthrough]];
1185 case TextureFormat::BC3_RGBA_UNORM_BLOCK: [[fallthrough]];
1191 case TextureFormat::BC7_RGBA_UNORM_BLOCK: [[fallthrough]];
1193 case TextureFormat::ETC2_R8G8B8_UNORM_BLOCK: [[fallthrough]];
1195 case TextureFormat::ETC2_R8G8B8A8_UNORM_BLOCK: [[fallthrough]];
1199 case TextureFormat::PVRTC1_4BPP_RGBA_UNORM_BLOCK: [[fallthrough]];
1201 }
1202 unreachable();
1203 }
1204
1214 [[nodiscard]] static constexpr bool isRGBAColorFormat(TextureFormat internalFormat) noexcept {
1215 switch (internalFormat) {
1216 case TextureFormat::UNKNOWN: [[fallthrough]];
1217 case TextureFormat::R8_UNORM: [[fallthrough]];
1218 case TextureFormat::R16_FLOAT: [[fallthrough]];
1219 case TextureFormat::R32_FLOAT: [[fallthrough]];
1220 case TextureFormat::R8G8_UNORM: [[fallthrough]];
1221 case TextureFormat::R16G16_FLOAT: [[fallthrough]];
1222 case TextureFormat::R32G32_FLOAT: [[fallthrough]];
1223 case TextureFormat::D16_UNORM: [[fallthrough]];
1224 case TextureFormat::D32_FLOAT: [[fallthrough]];
1225 case TextureFormat::D24_UNORM_S8_UINT: [[fallthrough]];
1226 case TextureFormat::D32_FLOAT_S8_UINT: [[fallthrough]];
1227 case TextureFormat::R5G6B5_UNORM_PACK16: [[fallthrough]];
1228 case TextureFormat::A1R5G5B5_UNORM_PACK16: [[fallthrough]];
1229 case TextureFormat::B10G11R11_UFLOAT_PACK32: [[fallthrough]];
1230 case TextureFormat::BC1_RGB_UNORM_BLOCK: [[fallthrough]];
1231 case TextureFormat::BC1_RGB_SRGB_BLOCK: [[fallthrough]];
1232 case TextureFormat::BC4_R_UNORM_BLOCK: [[fallthrough]];
1233 case TextureFormat::BC5_RG_UNORM_BLOCK: [[fallthrough]];
1234 case TextureFormat::BC6H_RGB_UFLOAT_BLOCK: [[fallthrough]];
1235 case TextureFormat::BC6H_RGB_FLOAT_BLOCK: [[fallthrough]];
1236 case TextureFormat::ETC2_R8G8B8_UNORM_BLOCK: [[fallthrough]];
1237 case TextureFormat::ETC2_R8G8B8_SRGB_BLOCK: [[fallthrough]];
1238 case TextureFormat::EAC_R11_UNORM_BLOCK: [[fallthrough]];
1239 case TextureFormat::EAC_R11G11_UNORM_BLOCK: return false;
1240 case TextureFormat::B8G8R8A8_UNORM: [[fallthrough]];
1241 case TextureFormat::B8G8R8A8_SRGB: [[fallthrough]];
1242 case TextureFormat::R8G8B8A8_UNORM: [[fallthrough]];
1243 case TextureFormat::R8G8B8A8_SRGB: [[fallthrough]];
1244 case TextureFormat::R16G16B16A16_FLOAT: [[fallthrough]];
1245 case TextureFormat::R32G32B32A32_FLOAT: [[fallthrough]];
1246 case TextureFormat::A2B10G10R10_UNORM_PACK32: [[fallthrough]];
1247 case TextureFormat::ASTC_4x4_RGBA_UNORM_BLOCK: [[fallthrough]];
1248 case TextureFormat::ASTC_4x4_RGBA_SRGB_BLOCK: [[fallthrough]];
1249 case TextureFormat::BC3_RGBA_UNORM_BLOCK: [[fallthrough]];
1250 case TextureFormat::BC3_RGBA_SRGB_BLOCK: [[fallthrough]];
1251 case TextureFormat::BC7_RGBA_UNORM_BLOCK: [[fallthrough]];
1252 case TextureFormat::BC7_RGBA_SRGB_BLOCK: [[fallthrough]];
1253 case TextureFormat::ETC2_R8G8B8A8_UNORM_BLOCK: [[fallthrough]];
1254 case TextureFormat::ETC2_R8G8B8A8_SRGB_BLOCK: [[fallthrough]];
1255 case TextureFormat::PVRTC1_4BPP_RGBA_UNORM_BLOCK: [[fallthrough]];
1257 }
1258 unreachable();
1259 }
1260
1268 [[nodiscard]] static constexpr bool isRawFormat(TextureFormat internalFormat) noexcept {
1269 switch (internalFormat) {
1270 case TextureFormat::UNKNOWN: [[fallthrough]];
1271 case TextureFormat::R5G6B5_UNORM_PACK16: [[fallthrough]];
1272 case TextureFormat::A1R5G5B5_UNORM_PACK16: [[fallthrough]];
1273 case TextureFormat::B10G11R11_UFLOAT_PACK32: [[fallthrough]];
1274 case TextureFormat::A2B10G10R10_UNORM_PACK32: [[fallthrough]];
1275 case TextureFormat::ASTC_4x4_RGBA_UNORM_BLOCK: [[fallthrough]];
1276 case TextureFormat::ASTC_4x4_RGBA_SRGB_BLOCK: [[fallthrough]];
1277 case TextureFormat::BC1_RGB_UNORM_BLOCK: [[fallthrough]];
1278 case TextureFormat::BC1_RGB_SRGB_BLOCK: [[fallthrough]];
1279 case TextureFormat::BC3_RGBA_UNORM_BLOCK: [[fallthrough]];
1280 case TextureFormat::BC3_RGBA_SRGB_BLOCK: [[fallthrough]];
1281 case TextureFormat::BC4_R_UNORM_BLOCK: [[fallthrough]];
1282 case TextureFormat::BC5_RG_UNORM_BLOCK: [[fallthrough]];
1283 case TextureFormat::BC6H_RGB_UFLOAT_BLOCK: [[fallthrough]];
1284 case TextureFormat::BC6H_RGB_FLOAT_BLOCK: [[fallthrough]];
1285 case TextureFormat::BC7_RGBA_UNORM_BLOCK: [[fallthrough]];
1286 case TextureFormat::BC7_RGBA_SRGB_BLOCK: [[fallthrough]];
1287 case TextureFormat::ETC2_R8G8B8_UNORM_BLOCK: [[fallthrough]];
1288 case TextureFormat::ETC2_R8G8B8_SRGB_BLOCK: [[fallthrough]];
1289 case TextureFormat::ETC2_R8G8B8A8_UNORM_BLOCK: [[fallthrough]];
1290 case TextureFormat::ETC2_R8G8B8A8_SRGB_BLOCK: [[fallthrough]];
1291 case TextureFormat::EAC_R11_UNORM_BLOCK: [[fallthrough]];
1292 case TextureFormat::EAC_R11G11_UNORM_BLOCK: [[fallthrough]];
1293 case TextureFormat::PVRTC1_4BPP_RGBA_UNORM_BLOCK: [[fallthrough]];
1295 case TextureFormat::R8_UNORM: [[fallthrough]];
1296 case TextureFormat::R16_FLOAT: [[fallthrough]];
1297 case TextureFormat::R32_FLOAT: [[fallthrough]];
1298 case TextureFormat::R8G8_UNORM: [[fallthrough]];
1299 case TextureFormat::R16G16_FLOAT: [[fallthrough]];
1300 case TextureFormat::R32G32_FLOAT: [[fallthrough]];
1301 case TextureFormat::R8G8B8A8_UNORM: [[fallthrough]];
1302 case TextureFormat::R8G8B8A8_SRGB: [[fallthrough]];
1303 case TextureFormat::B8G8R8A8_UNORM: [[fallthrough]];
1304 case TextureFormat::B8G8R8A8_SRGB: [[fallthrough]];
1305 case TextureFormat::R16G16B16A16_FLOAT: [[fallthrough]];
1306 case TextureFormat::R32G32B32A32_FLOAT: [[fallthrough]];
1307 case TextureFormat::D16_UNORM: [[fallthrough]];
1308 case TextureFormat::D32_FLOAT: [[fallthrough]];
1309 case TextureFormat::D24_UNORM_S8_UINT: [[fallthrough]];
1310 case TextureFormat::D32_FLOAT_S8_UINT: return true;
1311 }
1312 unreachable();
1313 }
1314
1325 [[nodiscard]] static constexpr bool isPackedFormat(TextureFormat internalFormat) noexcept {
1326 switch (internalFormat) {
1327 case TextureFormat::UNKNOWN: [[fallthrough]];
1328 case TextureFormat::R8_UNORM: [[fallthrough]];
1329 case TextureFormat::R16_FLOAT: [[fallthrough]];
1330 case TextureFormat::R32_FLOAT: [[fallthrough]];
1331 case TextureFormat::R8G8_UNORM: [[fallthrough]];
1332 case TextureFormat::R16G16_FLOAT: [[fallthrough]];
1333 case TextureFormat::R32G32_FLOAT: [[fallthrough]];
1334 case TextureFormat::R8G8B8A8_UNORM: [[fallthrough]];
1335 case TextureFormat::R8G8B8A8_SRGB: [[fallthrough]];
1336 case TextureFormat::B8G8R8A8_UNORM: [[fallthrough]];
1337 case TextureFormat::B8G8R8A8_SRGB: [[fallthrough]];
1338 case TextureFormat::R16G16B16A16_FLOAT: [[fallthrough]];
1339 case TextureFormat::R32G32B32A32_FLOAT: [[fallthrough]];
1340 case TextureFormat::D16_UNORM: [[fallthrough]];
1341 case TextureFormat::D32_FLOAT: [[fallthrough]];
1342 case TextureFormat::D24_UNORM_S8_UINT: [[fallthrough]];
1343 case TextureFormat::D32_FLOAT_S8_UINT: [[fallthrough]];
1344 case TextureFormat::ASTC_4x4_RGBA_UNORM_BLOCK: [[fallthrough]];
1345 case TextureFormat::ASTC_4x4_RGBA_SRGB_BLOCK: [[fallthrough]];
1346 case TextureFormat::BC1_RGB_UNORM_BLOCK: [[fallthrough]];
1347 case TextureFormat::BC1_RGB_SRGB_BLOCK: [[fallthrough]];
1348 case TextureFormat::BC3_RGBA_UNORM_BLOCK: [[fallthrough]];
1349 case TextureFormat::BC3_RGBA_SRGB_BLOCK: [[fallthrough]];
1350 case TextureFormat::BC4_R_UNORM_BLOCK: [[fallthrough]];
1351 case TextureFormat::BC5_RG_UNORM_BLOCK: [[fallthrough]];
1352 case TextureFormat::BC6H_RGB_UFLOAT_BLOCK: [[fallthrough]];
1353 case TextureFormat::BC6H_RGB_FLOAT_BLOCK: [[fallthrough]];
1354 case TextureFormat::BC7_RGBA_UNORM_BLOCK: [[fallthrough]];
1355 case TextureFormat::BC7_RGBA_SRGB_BLOCK: [[fallthrough]];
1356 case TextureFormat::ETC2_R8G8B8_UNORM_BLOCK: [[fallthrough]];
1357 case TextureFormat::ETC2_R8G8B8_SRGB_BLOCK: [[fallthrough]];
1358 case TextureFormat::ETC2_R8G8B8A8_UNORM_BLOCK: [[fallthrough]];
1359 case TextureFormat::ETC2_R8G8B8A8_SRGB_BLOCK: [[fallthrough]];
1360 case TextureFormat::EAC_R11_UNORM_BLOCK: [[fallthrough]];
1361 case TextureFormat::EAC_R11G11_UNORM_BLOCK: [[fallthrough]];
1362 case TextureFormat::PVRTC1_4BPP_RGBA_UNORM_BLOCK: [[fallthrough]];
1364 case TextureFormat::R5G6B5_UNORM_PACK16: [[fallthrough]];
1365 case TextureFormat::A1R5G5B5_UNORM_PACK16: [[fallthrough]];
1366 case TextureFormat::B10G11R11_UFLOAT_PACK32: [[fallthrough]];
1368 }
1369 unreachable();
1370 }
1371
1383 [[nodiscard]] static constexpr bool isCompressedFormat(TextureFormat internalFormat) noexcept {
1384 switch (internalFormat) {
1385 case TextureFormat::UNKNOWN: [[fallthrough]];
1386 case TextureFormat::R8_UNORM: [[fallthrough]];
1387 case TextureFormat::R16_FLOAT: [[fallthrough]];
1388 case TextureFormat::R32_FLOAT: [[fallthrough]];
1389 case TextureFormat::R8G8_UNORM: [[fallthrough]];
1390 case TextureFormat::R16G16_FLOAT: [[fallthrough]];
1391 case TextureFormat::R32G32_FLOAT: [[fallthrough]];
1392 case TextureFormat::R8G8B8A8_UNORM: [[fallthrough]];
1393 case TextureFormat::R8G8B8A8_SRGB: [[fallthrough]];
1394 case TextureFormat::B8G8R8A8_UNORM: [[fallthrough]];
1395 case TextureFormat::B8G8R8A8_SRGB: [[fallthrough]];
1396 case TextureFormat::R16G16B16A16_FLOAT: [[fallthrough]];
1397 case TextureFormat::R32G32B32A32_FLOAT: [[fallthrough]];
1398 case TextureFormat::D16_UNORM: [[fallthrough]];
1399 case TextureFormat::D32_FLOAT: [[fallthrough]];
1400 case TextureFormat::D24_UNORM_S8_UINT: [[fallthrough]];
1401 case TextureFormat::D32_FLOAT_S8_UINT: [[fallthrough]];
1402 case TextureFormat::R5G6B5_UNORM_PACK16: [[fallthrough]];
1403 case TextureFormat::A1R5G5B5_UNORM_PACK16: [[fallthrough]];
1404 case TextureFormat::B10G11R11_UFLOAT_PACK32: [[fallthrough]];
1405 case TextureFormat::A2B10G10R10_UNORM_PACK32: return false;
1406 case TextureFormat::ASTC_4x4_RGBA_UNORM_BLOCK: [[fallthrough]];
1407 case TextureFormat::ASTC_4x4_RGBA_SRGB_BLOCK: [[fallthrough]];
1408 case TextureFormat::BC1_RGB_UNORM_BLOCK: [[fallthrough]];
1409 case TextureFormat::BC1_RGB_SRGB_BLOCK: [[fallthrough]];
1410 case TextureFormat::BC3_RGBA_UNORM_BLOCK: [[fallthrough]];
1411 case TextureFormat::BC3_RGBA_SRGB_BLOCK: [[fallthrough]];
1412 case TextureFormat::BC4_R_UNORM_BLOCK: [[fallthrough]];
1413 case TextureFormat::BC5_RG_UNORM_BLOCK: [[fallthrough]];
1414 case TextureFormat::BC6H_RGB_UFLOAT_BLOCK: [[fallthrough]];
1415 case TextureFormat::BC6H_RGB_FLOAT_BLOCK: [[fallthrough]];
1416 case TextureFormat::BC7_RGBA_UNORM_BLOCK: [[fallthrough]];
1417 case TextureFormat::BC7_RGBA_SRGB_BLOCK: [[fallthrough]];
1418 case TextureFormat::ETC2_R8G8B8_UNORM_BLOCK: [[fallthrough]];
1419 case TextureFormat::ETC2_R8G8B8_SRGB_BLOCK: [[fallthrough]];
1420 case TextureFormat::ETC2_R8G8B8A8_UNORM_BLOCK: [[fallthrough]];
1421 case TextureFormat::ETC2_R8G8B8A8_SRGB_BLOCK: [[fallthrough]];
1422 case TextureFormat::EAC_R11_UNORM_BLOCK: [[fallthrough]];
1423 case TextureFormat::EAC_R11G11_UNORM_BLOCK: [[fallthrough]];
1424 case TextureFormat::PVRTC1_4BPP_RGBA_UNORM_BLOCK: [[fallthrough]];
1426 }
1427 unreachable();
1428 }
1429
1441 [[nodiscard]] static constexpr bool isFramebufferCompatibleFormat(TextureFormat internalFormat) noexcept {
1442 switch (internalFormat) {
1443 case TextureFormat::UNKNOWN: [[fallthrough]];
1444 case TextureFormat::ASTC_4x4_RGBA_UNORM_BLOCK: [[fallthrough]];
1445 case TextureFormat::ASTC_4x4_RGBA_SRGB_BLOCK: [[fallthrough]];
1446 case TextureFormat::BC1_RGB_UNORM_BLOCK: [[fallthrough]];
1447 case TextureFormat::BC1_RGB_SRGB_BLOCK: [[fallthrough]];
1448 case TextureFormat::BC3_RGBA_UNORM_BLOCK: [[fallthrough]];
1449 case TextureFormat::BC3_RGBA_SRGB_BLOCK: [[fallthrough]];
1450 case TextureFormat::BC4_R_UNORM_BLOCK: [[fallthrough]];
1451 case TextureFormat::BC5_RG_UNORM_BLOCK: [[fallthrough]];
1452 case TextureFormat::BC6H_RGB_UFLOAT_BLOCK: [[fallthrough]];
1453 case TextureFormat::BC6H_RGB_FLOAT_BLOCK: [[fallthrough]];
1454 case TextureFormat::BC7_RGBA_UNORM_BLOCK: [[fallthrough]];
1455 case TextureFormat::BC7_RGBA_SRGB_BLOCK: [[fallthrough]];
1456 case TextureFormat::ETC2_R8G8B8_UNORM_BLOCK: [[fallthrough]];
1457 case TextureFormat::ETC2_R8G8B8_SRGB_BLOCK: [[fallthrough]];
1458 case TextureFormat::ETC2_R8G8B8A8_UNORM_BLOCK: [[fallthrough]];
1459 case TextureFormat::ETC2_R8G8B8A8_SRGB_BLOCK: [[fallthrough]];
1460 case TextureFormat::EAC_R11_UNORM_BLOCK: [[fallthrough]];
1461 case TextureFormat::EAC_R11G11_UNORM_BLOCK: [[fallthrough]];
1462 case TextureFormat::PVRTC1_4BPP_RGBA_UNORM_BLOCK: [[fallthrough]];
1464 case TextureFormat::R8_UNORM: [[fallthrough]];
1465 case TextureFormat::R16_FLOAT: [[fallthrough]];
1466 case TextureFormat::R32_FLOAT: [[fallthrough]];
1467 case TextureFormat::R8G8_UNORM: [[fallthrough]];
1468 case TextureFormat::R16G16_FLOAT: [[fallthrough]];
1469 case TextureFormat::R32G32_FLOAT: [[fallthrough]];
1470 case TextureFormat::R8G8B8A8_UNORM: [[fallthrough]];
1471 case TextureFormat::R8G8B8A8_SRGB: [[fallthrough]];
1472 case TextureFormat::B8G8R8A8_UNORM: [[fallthrough]];
1473 case TextureFormat::B8G8R8A8_SRGB: [[fallthrough]];
1474 case TextureFormat::R16G16B16A16_FLOAT: [[fallthrough]];
1475 case TextureFormat::R32G32B32A32_FLOAT: [[fallthrough]];
1476 case TextureFormat::D16_UNORM: [[fallthrough]];
1477 case TextureFormat::D32_FLOAT: [[fallthrough]];
1478 case TextureFormat::D24_UNORM_S8_UINT: [[fallthrough]];
1479 case TextureFormat::D32_FLOAT_S8_UINT: [[fallthrough]];
1480 case TextureFormat::R5G6B5_UNORM_PACK16: [[fallthrough]];
1481 case TextureFormat::A1R5G5B5_UNORM_PACK16: [[fallthrough]];
1482 case TextureFormat::B10G11R11_UFLOAT_PACK32: [[fallthrough]];
1484 }
1485 unreachable();
1486 }
1487
1520 [[nodiscard]] GREM_API(graphics) static Texture create(Device& device, TextureType type, TextureFormat internalFormat, Extent3D size, uint32_t mipLevelCount,
1521 const void* pixels, Optional<TextureSamplerOptions> samplerOptions = TextureSamplerOptions{});
1522
1549 [[nodiscard]] static Texture create(Device& device, TextureType type, TextureFormat internalFormat, Extent3D size, uint32_t mipLevelCount, const UndefinedClearValues& values,
1551 (void)values;
1552 return create(device, type, internalFormat, size, mipLevelCount, nullptr, samplerOptions);
1553 }
1554
1581 [[nodiscard]] static Texture create(Device& device, TextureType type, TextureFormat internalFormat, Extent3D size, uint32_t mipLevelCount, const ClearValues& values,
1583 Texture result = create(device, type, internalFormat, size, mipLevelCount, UndefinedClearValues{}, samplerOptions);
1584 result.fill(values);
1585 return result;
1586 }
1587
1613 [[nodiscard]] GREM_API(graphics) static Texture
1614 createRenderbuffer(Device& device, TextureFormat internalFormat, Extent2D size, uint32_t maxMultisampleCount, const UndefinedClearValues& values);
1615
1641 [[nodiscard]] static Texture createRenderbuffer(Device& device, TextureFormat internalFormat, Extent2D size, uint32_t maxMultisampleCount, const ClearValues& values) {
1642 Texture result = createRenderbuffer(device, internalFormat, size, maxMultisampleCount, UndefinedClearValues{});
1643 result.fill(values);
1644 return result;
1645 }
1646
1650 Texture() noexcept = default;
1651
1678 GREM_API(graphics)
1679 Texture(Device& device, const resource::ImageView& image, const TextureImageUploadOptions& options = {},
1681
1687 explicit operator bool() const noexcept {
1688 return static_cast<bool>(implementation);
1689 }
1690
1720 GREM_API(graphics) void pasteImage(Extent3D imageSize, const void* pixels, Offset3D destinationOffset, Region3D sourceRegion);
1721
1751 void pasteImage(Extent3D imageSize, const void* pixels, Offset3D destinationOffset = {.x = 0, .y = 0, .z = 0}, Offset3D sourceOffset = {.x = 0, .y = 0, .z = 0}) {
1752 pasteImage(imageSize, pixels, destinationOffset, Region3D{.offset = sourceOffset, .size = imageSize});
1753 }
1754
1780 GREM_API(graphics) void pasteTexture(const Texture& texture, Offset3D destinationOffset, Region3D sourceRegion);
1781
1807 void pasteTexture(const Texture& texture, Offset3D destinationOffset = {.x = 0, .y = 0, .z = 0}, Offset3D sourceOffset = {.x = 0, .y = 0, .z = 0}) {
1808 pasteTexture(texture, destinationOffset, Region3D{.offset = sourceOffset, .size = texture.getSize3D()});
1809 }
1810
1824 GREM_API(graphics) void fill(const ClearValues& values = {});
1825
1841 GREM_API(graphics) void fill(TextureSubresource subresource, const ClearValues& values = {});
1842
1857 GREM_API(graphics) void generateMipmap();
1858
1876 [[nodiscard]] GREM_API(graphics) Texture copy() const;
1877
1897 [[nodiscard]] GREM_API(graphics) Texture copyWithSamplerOptions(Optional<TextureSamplerOptions> newSamplerOptions) const;
1898
1920 [[nodiscard]] GREM_API(graphics) resource::Image downloadImage(const TextureImageDownloadOptions& downloadOptions = {}) const;
1921
1927 operator TextureSubresourceReference() noexcept {
1928 return {.texture = this, .subresource{}};
1929 }
1930
1936 operator TextureSubresourceConstReference() const noexcept {
1937 return {.texture = this, .subresource{}};
1938 }
1939
1949 return {.texture = this, .subresource = subresource};
1950 }
1951
1960 [[nodiscard]] TextureSubresourceConstReference getSubresource(TextureSubresource subresource) const noexcept {
1961 return {.texture = this, .subresource = subresource};
1962 }
1963
1969 operator TextureRegion2DReference() noexcept {
1970 return {.texture = this, .region{.size = getSize2D()}};
1971 }
1972
1979 operator TextureRegion2DConstReference() const noexcept {
1980 return {.texture = this, .region{.size = getSize2D()}};
1981 }
1982
1992 return {.texture = this, .region = region};
1993 }
1994
2003 [[nodiscard]] TextureRegion2DConstReference getRegion2D(TextureRegion2D region) const noexcept {
2004 return {.texture = this, .region = region};
2005 }
2006
2016 return {.texture = this, .region = region};
2017 }
2018
2027 [[nodiscard]] TextureRegion3DConstReference getRegion3D(TextureRegion3D region) const noexcept {
2028 return {.texture = this, .region = region};
2029 }
2030
2036 [[nodiscard]] GREM_API(graphics) TextureType getType() const noexcept;
2037
2044 [[nodiscard]] GREM_API(graphics) TextureFormat getInternalFormat() const noexcept;
2045
2061 [[nodiscard]] Extent2D getSize2D() const noexcept {
2062 const Extent3D size = getSize3D();
2063 return Extent2D{.width = size.width, .height = size.height};
2064 }
2065
2078 [[nodiscard]] GREM_API(graphics) Extent3D getSize3D() const noexcept;
2079
2096 [[nodiscard]] uint32_t getWidth() const noexcept {
2097 return getSize3D().width;
2098 }
2099
2116 [[nodiscard]] uint32_t getHeight() const noexcept {
2117 return getSize3D().height;
2118 }
2119
2136 [[nodiscard]] uint32_t getDepth() const noexcept {
2137 return getSize3D().depth;
2138 }
2139
2146 [[nodiscard]] GREM_API(graphics) uint32_t getMipLevelCount() const noexcept;
2147
2155 [[nodiscard]] GREM_API(graphics) uint32_t getMaxMultisampleCount() const noexcept;
2156
2163 [[nodiscard]] GREM_API(graphics) Optional<TextureSamplerOptions> getSamplerOptions() const noexcept;
2164
2173 [[nodiscard]] SharedPointer<TextureImplementation> lock() const noexcept {
2174 return implementation;
2175 }
2176
2185 [[nodiscard]] TextureImplementation* get() noexcept { // NOLINT(readability-make-member-function-const)
2186 return implementation.get();
2187 }
2188
2197 [[nodiscard]] const TextureImplementation* get() const noexcept {
2198 return implementation.get();
2199 }
2200
2201private:
2202 friend Device;
2203 friend DeviceImplementation;
2204 friend Swapchain;
2205 friend TextureImplementation;
2206
2207 explicit Texture(SharedPointer<TextureImplementation> handle) noexcept
2208 : implementation(std::move(handle)) {}
2209
2210 SharedPointer<TextureImplementation> implementation{};
2211};
2212
2213} // namespace grem::graphics
2214
2215#endif
Floating-point linear RGBA color in the Rec.
Definition Color.hpp:60
TransferFunction
Color transfer function.
Definition Color.hpp:65
@ SRGB
sRGB transfer function.
Definition Color.hpp:67
@ LINEAR
Linear transfer function.
Definition Color.hpp:66
static const Color INVISIBLE
Definition Color.hpp:70
Optional value type that holds either a value or no value.
Definition Optional.hpp:58
Definition SharedPointer.hpp:65
friend class Variant
JSON value type using the default allocator.
Definition Variant.hpp:1402
Persistent system managing the rendering context of a Window.
Definition Device.hpp:68
Render target texture holding a chain of images leading to a window to be presented to.
Definition Swapchain.hpp:61
Set of aspects of a texture format.
Definition Texture.hpp:59
constexpr bool containsAnyOf(TextureAspects aspects) const noexcept
Check if the aspect set contains at least one of the given aspects.
Definition Texture.hpp:129
friend constexpr TextureAspects & operator^=(TextureAspects &a, TextureAspects b) noexcept
Assign the symmetric difference of two aspect sets to the first set.
Definition Texture.hpp:226
static const TextureAspects DEPTH_STENCIL
Set containing both the depth and stencil texture aspects.
Definition Texture.hpp:69
friend constexpr TextureAspects & operator|=(TextureAspects &a, TextureAspects b) noexcept
Assign the union of two aspect sets to the first set.
Definition Texture.hpp:214
friend constexpr TextureAspects operator|(TextureAspects a, TextureAspects b) noexcept
Get the union of two aspect sets.
Definition Texture.hpp:177
constexpr bool containsAllOf(TextureAspects aspects) const noexcept
Check if the aspect set contains all of the given aspects.
Definition Texture.hpp:141
friend constexpr TextureAspects & operator&=(TextureAspects &a, TextureAspects b) noexcept
Assign the intersection of two aspect sets to the first set.
Definition Texture.hpp:202
friend constexpr TextureAspects operator&(TextureAspects a, TextureAspects b) noexcept
Get the intersection of two aspect sets.
Definition Texture.hpp:165
constexpr bool contains(TextureAspect aspect) const noexcept
Check if the aspect set contains the given aspect.
Definition Texture.hpp:117
constexpr bool operator==(const TextureAspects &other) const noexcept=default
Compare this aspect set to another for equality.
friend constexpr TextureAspects operator~(TextureAspects a) noexcept
Get the complement of an aspect set.
Definition Texture.hpp:153
static const TextureAspects COLOR_DEPTH_STENCIL
Set containing the color, depth and stencil texture aspects.
Definition Texture.hpp:74
constexpr TextureAspects() noexcept=default
Construct an empty aspect set.
friend constexpr TextureAspects operator^(TextureAspects a, TextureAspects b) noexcept
Get the symmetric difference of two aspect sets.
Definition Texture.hpp:190
static const TextureAspects ALL
Set containing all possible texture aspects.
Definition Texture.hpp:64
constexpr bool empty() const noexcept
Check if the aspect set is empty.
Definition Texture.hpp:106
Storage for multidimensional data, such as 2D images, on the GPU, combined with a sampler configurati...
Definition Texture.hpp:700
Optional< TextureSamplerOptions > getSamplerOptions() const noexcept
Get the configuration options of this texture's associated sampler.
static constexpr bool isRGBAColorFormat(TextureFormat internalFormat) noexcept
Check if a specific internal texture format is an RGBA color format with an alpha channel.
Definition Texture.hpp:1214
static constexpr bool isRawFormat(TextureFormat internalFormat) noexcept
Check if a specific internal texture format is a raw format.
Definition Texture.hpp:1268
resource::Image downloadImage(const TextureImageDownloadOptions &downloadOptions={}) const
Download a copy of all or part of the image stored in the texture.
static Texture create(Device &device, TextureType type, TextureFormat internalFormat, Extent3D size, uint32_t mipLevelCount, const ClearValues &values, Optional< TextureSamplerOptions > samplerOptions=TextureSamplerOptions{})
Create a new texture object and allocate GPU memory for storing image data, initialized to specific v...
Definition Texture.hpp:1581
static constexpr resource::ImageType getImageType(TextureType type)
Get the image type corresponding to a texture type.
Definition Texture.hpp:768
static Texture createRenderbuffer(Device &device, TextureFormat internalFormat, Extent2D size, uint32_t maxMultisampleCount, const ClearValues &values)
Create a new unsampled texture object and allocate GPU memory for storing potentially multisampled 2D...
Definition Texture.hpp:1641
void generateMipmap()
Generate a mipmap, with the maximum possible number of mip levels, for the texture based on the highe...
TextureRegion2DConstReference getRegion2D(TextureRegion2D region) const noexcept
Get a read-only reference to a 2D region of the texture.
Definition Texture.hpp:2003
void pasteTexture(const Texture &texture, Offset3D destinationOffset={.x=0,.y=0,.z=0}, Offset3D sourceOffset={.x=0,.y=0,.z=0})
Copy all of the image data of another 2D or 2D array texture into the texture at a specific position.
Definition Texture.hpp:1807
uint32_t getHeight() const noexcept
Get the height, in texels, of the image data stored in this texture.
Definition Texture.hpp:2116
TextureRegion3DReference getRegion3D(TextureRegion3D region) noexcept
Get a reference to a 3D region of the texture.
Definition Texture.hpp:2015
void pasteImage(Extent3D imageSize, const void *pixels, Offset3D destinationOffset={.x=0,.y=0,.z=0}, Offset3D sourceOffset={.x=0,.y=0,.z=0})
Copy all of an array of layers of 2D image data into the texture at a specific position.
Definition Texture.hpp:1751
static constexpr bool hasInternalSRGBFormat(resource::ImageFormat format) noexcept
Check if an image format has a corresponding internal texture format that uses the sRGB transfer func...
Definition Texture.hpp:869
static constexpr Color::TransferFunction getTransferFunction(TextureFormat internalFormat) noexcept
Get the transfer function of an internal texture format.
Definition Texture.hpp:922
Texture copy() const
Create a new texture object, allocate GPU memory and copy the image data of this texture onto it.
TextureSubresourceConstReference getSubresource(TextureSubresource subresource) const noexcept
Get a read-only reference to a subresource of the texture.
Definition Texture.hpp:1960
static constexpr TextureType getType(resource::ImageType type) noexcept
Get the texture type corresponding to an image type.
Definition Texture.hpp:845
uint32_t getWidth() const noexcept
Get the width, in texels, of the image data stored in this texture.
Definition Texture.hpp:2096
void pasteTexture(const Texture &texture, Offset3D destinationOffset, Region3D sourceRegion)
Copy all or part of the image data of another 2D or 2D array texture into the texture at a specific p...
void fill(TextureSubresource subresource, const ClearValues &values={})
Fill a subresource of the texture with specific values.
static constexpr bool isCompatibleFormat(TextureFormat internalFormat, resource::ImageFormat format) noexcept
Check if a specific image format is directly compatible with an internal texture format.
Definition Texture.hpp:1158
static constexpr TextureFormat getInternalFormat(resource::ImageFormat format, Color::TransferFunction transferFunction) noexcept
Get the internal texture format corresponding to an image format.
Definition Texture.hpp:983
static constexpr TextureAspects getFormatAspects(TextureFormat internalFormat)
Get the set of texture aspects of an internal texture format.
Definition Texture.hpp:711
Extent3D getSize3D() const noexcept
Get the size, in texels, and the depth, in layers, of the 3D image data stored in this texture.
static Texture create(Device &device, TextureType type, TextureFormat internalFormat, Extent3D size, uint32_t mipLevelCount, const UndefinedClearValues &values, Optional< TextureSamplerOptions > samplerOptions=TextureSamplerOptions{})
Create a new texture object and allocate uninitialized GPU memory for storing image data.
Definition Texture.hpp:1549
static constexpr bool isPackedFormat(TextureFormat internalFormat) noexcept
Check if a specific internal texture format is a bit-packed format.
Definition Texture.hpp:1325
TextureSubresourceReference getSubresource(TextureSubresource subresource) noexcept
Get a reference to a subresource of the texture.
Definition Texture.hpp:1948
const TextureImplementation * get() const noexcept
Get a pointer to the underlying resource implementation.
Definition Texture.hpp:2197
static constexpr resource::ImageFormat getImageFormat(TextureFormat internalFormat)
Get the image format corresponding to an internal texture format.
Definition Texture.hpp:791
static constexpr TextureFormat getUncompressedFormat(TextureFormat internalFormat) noexcept
Get the uncompressed format corresponding to a specific internal texture format.
Definition Texture.hpp:1101
uint32_t getMaxMultisampleCount() const noexcept
Get the maximum multisample count of the texture.
uint32_t getDepth() const noexcept
Get the depth, in layers, of the image data stored in this texture.
Definition Texture.hpp:2136
static constexpr TextureFormat getRawFormat(TextureFormat internalFormat) noexcept
Get the raw format corresponding to a specific internal texture format.
Definition Texture.hpp:1042
TextureType getType() const noexcept
Get the type of the texture.
SharedPointer< TextureImplementation > lock() const noexcept
Get a lock for the underlying resource implementation.
Definition Texture.hpp:2173
static constexpr bool isFramebufferCompatibleFormat(TextureFormat internalFormat) noexcept
Check if a specific internal texture format is framebuffer-compatible.
Definition Texture.hpp:1441
void pasteImage(Extent3D imageSize, const void *pixels, Offset3D destinationOffset, Region3D sourceRegion)
Copy all or part of an array of layers of 2D image data into the texture at a specific position.
TextureImplementation * get() noexcept
Get a pointer to the underlying resource implementation.
Definition Texture.hpp:2185
static Texture create(Device &device, TextureType type, TextureFormat internalFormat, Extent3D size, uint32_t mipLevelCount, const void *pixels, Optional< TextureSamplerOptions > samplerOptions=TextureSamplerOptions{})
Create a new texture object and allocate GPU memory for storing image data.
uint32_t getMipLevelCount() const noexcept
Get the number of mip levels of the texture.
static constexpr bool isCompressedFormat(TextureFormat internalFormat) noexcept
Check if a specific internal texture format is a compressed format.
Definition Texture.hpp:1383
Extent2D getSize2D() const noexcept
Get the size, in texels, of the 2D image data stored in this texture.
Definition Texture.hpp:2061
TextureRegion2DReference getRegion2D(TextureRegion2D region) noexcept
Get a reference to a 2D region of the texture.
Definition Texture.hpp:1991
Texture() noexcept=default
Construct an empty texture without a value.
TextureRegion3DConstReference getRegion3D(TextureRegion3D region) const noexcept
Get a read-only reference to a 3D region of the texture.
Definition Texture.hpp:2027
static Texture createRenderbuffer(Device &device, TextureFormat internalFormat, Extent2D size, uint32_t maxMultisampleCount, const UndefinedClearValues &values)
Create a new unsampled texture object and allocate uninitialized GPU memory for storing potentially m...
void fill(const ClearValues &values={})
Fill all allocated texture data with specific values.
Texture copyWithSamplerOptions(Optional< TextureSamplerOptions > newSamplerOptions) const
Create a new texture object with new sampler options, allocate GPU memory and copy the image data of ...
Container for a 2D image.
Definition Image.hpp:951
Definition buffer_layouts.hpp:20
TextureDepthComparisonMode
Depth comparison mode for the sampler of a Texture.
Definition Texture.hpp:499
TextureWrappingMode
Wrapping mode of the sampler of a Texture.
Definition Texture.hpp:490
@ REPEAT
Wrap the texture coordinates around the 0-1 range.
Definition Texture.hpp:491
@ CLAMP_TO_EDGE
Clamp to the edge of the texture when sampling outside the 0-1 range.
Definition Texture.hpp:492
@ MIRRORED_REPEAT
Mirror the texture coordinates in the 0-1 range.
Definition Texture.hpp:493
TextureFormat
Description of the internal format of a Texture.
Definition Texture.hpp:267
@ R32G32_FLOAT
Raw bitmap where each texel comprises 2 32-bit floating-point components: red, green.
Definition Texture.hpp:274
@ D16_UNORM
Raw bitmap where each texel comprises 1 normalized 16-bit unsigned integer component: depth.
Definition Texture.hpp:282
@ BC4_R_UNORM_BLOCK
S3TC BC4 (RGTC1) block-compressed single-channel texture using 64 bits per 4x4 block.
Definition Texture.hpp:297
@ D32_FLOAT
Raw bitmap where each texel comprises 1 32-bit floating-point component: depth.
Definition Texture.hpp:284
@ B8G8R8A8_UNORM
Raw bitmap where each texel comprises 4 normalized 8-bit unsigned integer components: blue,...
Definition Texture.hpp:278
@ B10G11R11_UFLOAT_PACK32
Packed bitmap with the following 32-bit unsigned floating-point RGB texel format: BBBBBBBBBBGGGGGGGGG...
Definition Texture.hpp:289
@ ETC2_R8G8B8A8_UNORM_BLOCK
ETC2 block-compressed RGBA texture using 128 bits per 4x4 block.
Definition Texture.hpp:305
@ R16_FLOAT
Raw bitmap where each texel comprises 1 16-bit floating-point component: red.
Definition Texture.hpp:270
@ R32_FLOAT
Raw bitmap where each texel comprises 1 32-bit floating-point component: red.
Definition Texture.hpp:271
@ PVRTC1_4BPP_RGBA_SRGB_BLOCK
PVRTC1 block-compressed sRGBA texture using 64 bits per 4x4 block.
Definition Texture.hpp:310
@ ETC2_R8G8B8A8_SRGB_BLOCK
ETC2 block-compressed sRGBA texture using 128 bits per 4x4 block.
Definition Texture.hpp:306
@ BC7_RGBA_SRGB_BLOCK
S3TC BC7 (BPTC) block-compressed sRGBA texture using 128 bits per 4x4 block.
Definition Texture.hpp:302
@ R16G16_FLOAT
Raw bitmap where each texel comprises 2 16-bit floating-point components: red, green.
Definition Texture.hpp:273
@ BC1_RGB_UNORM_BLOCK
S3TC BC1 (DXT1) block-compressed RGB texture using 64 bits per 4x4 block.
Definition Texture.hpp:293
@ EAC_R11G11_UNORM_BLOCK
ETC2 EAC block-compressed double-channel texture using 128 bits per 4x4 block.
Definition Texture.hpp:308
@ BC7_RGBA_UNORM_BLOCK
S3TC BC7 (BPTC) block-compressed RGBA texture using 128 bits per 4x4 block.
Definition Texture.hpp:301
@ BC6H_RGB_UFLOAT_BLOCK
S3TC BC6H (BPTC) block-compressed unsigned floating-point RGB texture using 128 bits per 4x4 block.
Definition Texture.hpp:299
@ EAC_R11_UNORM_BLOCK
ETC2 EAC block-compressed single-channel texture using 64 bits per 4x4 block.
Definition Texture.hpp:307
@ R8G8B8A8_SRGB
Raw bitmap where each texel comprises 3 sRGB-encoded and 1 normalized 8-bit unsigned integer componen...
Definition Texture.hpp:277
@ UNKNOWN
Unknown texture format.
Definition Texture.hpp:268
@ A1R5G5B5_UNORM_PACK16
Packed bitmap with the following 16-bit unsigned integer RGBA texel format: ARRRRRGGGGGBBBBB.
Definition Texture.hpp:288
@ A2B10G10R10_UNORM_PACK32
Packed bitmap with the following 32-bit unsigned integer RGBA texel format: AABBBBBBBBBBGGGGGGGGGGRRR...
Definition Texture.hpp:290
@ R8_UNORM
Raw bitmap where each texel comprises 1 normalized 8-bit unsigned integer component: red.
Definition Texture.hpp:269
@ BC3_RGBA_SRGB_BLOCK
S3TC BC3 (DXT5) block-compressed sRGBA texture using 128 bits per 4x4 block.
Definition Texture.hpp:296
@ PVRTC1_4BPP_RGBA_UNORM_BLOCK
PVRTC1 block-compressed RGBA texture using 64 bits per 4x4 block.
Definition Texture.hpp:309
@ R8G8_UNORM
Raw bitmap where each texel comprises 2 normalized 8-bit unsigned integer components: red,...
Definition Texture.hpp:272
@ R5G6B5_UNORM_PACK16
Packed bitmap with the following 16-bit unsigned integer RGB texel format: RRRRRGGGGGGBBBBB.
Definition Texture.hpp:287
@ BC6H_RGB_FLOAT_BLOCK
S3TC BC6H (BPTC) block-compressed signed floating-point RGB texture using 128 bits per 4x4 block.
Definition Texture.hpp:300
@ R32G32B32A32_FLOAT
Raw bitmap where each texel comprises 4 32-bit floating-point components: red, green,...
Definition Texture.hpp:281
@ R16G16B16A16_FLOAT
Raw bitmap where each texel comprises 4 16-bit floating-point components: red, green,...
Definition Texture.hpp:280
@ BC3_RGBA_UNORM_BLOCK
S3TC BC3 (DXT5) block-compressed RGBA texture using 128 bits per 4x4 block.
Definition Texture.hpp:295
@ D32_FLOAT_S8_UINT
Raw bitmap where each texel comprises 1 32-bit floating-point depth component and 1 8-bit unsigned in...
Definition Texture.hpp:286
@ D24_UNORM_S8_UINT
Raw bitmap where each texel comprises 1 normalized 24-bit unsigned integer depth component and 1 8-bi...
Definition Texture.hpp:285
@ ASTC_4x4_RGBA_SRGB_BLOCK
ASTC block-compressed RGBA texture using 128 bits per 4x4 block.
Definition Texture.hpp:292
@ ASTC_4x4_RGBA_UNORM_BLOCK
ASTC block-compressed RGBA texture using 128 bits per 4x4 block.
Definition Texture.hpp:291
@ BC5_RG_UNORM_BLOCK
S3TC BC5 (RGTC2) block-compressed double-channel texture using 128 bits per 4x4 block.
Definition Texture.hpp:298
@ ETC2_R8G8B8_UNORM_BLOCK
ETC2 block-compressed RGB texture using 64 bits per 4x4 block.
Definition Texture.hpp:303
@ BC1_RGB_SRGB_BLOCK
S3TC BC1 (DXT1) block-compressed sRGB texture using 64 bits per 4x4 block.
Definition Texture.hpp:294
@ ETC2_R8G8B8_SRGB_BLOCK
ETC2 block-compressed sRGB texture using 64 bits per 4x4 block.
Definition Texture.hpp:304
@ R8G8B8A8_UNORM
Raw bitmap where each texel comprises 4 normalized 8-bit unsigned integer components: red,...
Definition Texture.hpp:276
@ B8G8R8A8_SRGB
Raw bitmap where each texel comprises 3 sRGB-encoded and 1 normalized 8-bit unsigned integer componen...
Definition Texture.hpp:279
constexpr TextureAspects operator|(TextureAspect a, TextureAspect b) noexcept
Get the union of two texture aspects.
Definition Texture.hpp:256
@ NONE
Ignore the depth buffer.
Definition shaders.hpp:59
TextureAspect
Aspect of a texture format.
Definition Texture.hpp:50
@ COLOR
Color buffer.
Definition Texture.hpp:51
@ STENCIL
Stencil buffer.
Definition Texture.hpp:53
@ DEPTH
Depth buffer.
Definition Texture.hpp:52
constexpr TextureAspects operator~(TextureAspect a) noexcept
Get the complement of a texture aspect.
Definition Texture.hpp:244
TextureMipmapMode
Mipmap mode for the sampler of a Texture.
Definition Texture.hpp:481
@ LINEAR
Interpolate between the two nearest mip levels to the displayed size.
Definition Texture.hpp:484
@ NONE
Always use the most detailed mip level (level 0).
Definition Texture.hpp:482
TextureFilter
Filtering mode for the sampler of a Texture.
Definition Texture.hpp:473
@ LINEAR
Interpolate between texels for a smoother appearance.
Definition Texture.hpp:475
@ NEAREST
Use the nearest neighbor to the sampled texel, which results in a blocky appearance.
Definition Texture.hpp:474
@ ALWAYS_PASS
The depth test always passes.
Definition shaders.hpp:137
@ LESS
The depth test passes if and only if the new depth value is less than the old depth value.
Definition shaders.hpp:102
@ NOT_EQUAL
The depth test passes if and only if the new depth value is not equal to the old depth value.
Definition shaders.hpp:132
@ NEVER_PASS
The depth test always fails.
Definition shaders.hpp:96
@ LESS_OR_EQUAL
The depth test passes if and only if the new depth value is less than or equal to the old depth value...
Definition shaders.hpp:108
@ EQUAL
The depth test passes if and only if the new depth value is equal to the old depth value.
Definition shaders.hpp:126
@ GREATER_OR_EQUAL
The depth test passes if and only if the new depth value is greater than or equal to the old depth va...
Definition shaders.hpp:120
@ GREATER
The depth test passes if and only if the new depth value is greater than the old depth value.
Definition shaders.hpp:114
TextureType
Backend-specific implementation of Texture.
Definition Texture.hpp:37
@ TEXTURE_2D_ARRAY
Texture set up to store an array of 2D images.
Definition Texture.hpp:40
@ SWAPCHAIN
Unsampled texture representing a presentation swapchain.
Definition Texture.hpp:44
@ TEXTURE_CUBE
Texture set up to store a cube of 6 sides of square 2D images.
Definition Texture.hpp:41
@ RENDERBUFFER
Unsampled texture set up to store a potentially multisampled 2D image.
Definition Texture.hpp:43
@ TEXTURE_CUBE_ARRAY
Texture set up to store an array of cubes of 6 sides of square 2D images.
Definition Texture.hpp:42
@ EMPTY
Empty texture without a value.
Definition Texture.hpp:38
@ TEXTURE_2D
Texture set up to store a single 2D image.
Definition Texture.hpp:39
Definition Window.hpp:15
ImageFormat
Description of the format of an Image, including the number of component channels,...
Definition Image.hpp:53
@ R32G32_FLOAT
Raw bitmap where each pixel comprises 2 32-bit floating-point components: red, green.
Definition Image.hpp:60
@ A1R5G5B5_UINT_PACK16
Packed bitmap with the following 16-bit unsigned integer RGBA pixel format: ARRRRRGGGGGBBBBB.
Definition Image.hpp:68
@ BC4_R_UINT_BLOCK
S3TC BC4 (RGTC1) block-compressed single-channel image using 64 bits per 4x4 block.
Definition Image.hpp:74
@ B10G11R11_UFLOAT_PACK32
Packed bitmap with the following 32-bit unsigned floating-point RGB pixel format: BBBBBBBBBBGGGGGGGGG...
Definition Image.hpp:69
@ R16_FLOAT
Raw bitmap where each pixel comprises 1 16-bit floating-point component: red.
Definition Image.hpp:56
@ KTX2_ETC1S_RGBA_UINT_BLOCK
KTX2 container of an ETC1-compressed ETC1S-encoded image with 2 DFD channels: RGB and AAA.
Definition Image.hpp:87
@ R32_FLOAT
Raw bitmap where each pixel comprises 1 32-bit floating-point component: red.
Definition Image.hpp:57
@ R8G8B8_UINT
Raw bitmap where each pixel comprises 3 8-bit unsigned integer components: red, green,...
Definition Image.hpp:61
@ R16G16B16_FLOAT
Raw bitmap where each pixel comprises 3 16-bit floating-point components: red, green,...
Definition Image.hpp:62
@ EAC_R11G11_UINT_BLOCK
ETC2 EAC block-compressed double-channel image using 128 bits per 4x4 block.
Definition Image.hpp:82
@ R16G16_FLOAT
Raw bitmap where each pixel comprises 2 16-bit floating-point components: red, green.
Definition Image.hpp:59
@ KTX2_ETC1S_R_UINT_BLOCK
KTX2 container of an ETC1-compressed ETC1S-encoded image with 1 DFD channel: RRR.
Definition Image.hpp:84
@ BC6H_RGB_UFLOAT_BLOCK
S3TC BC6H (BPTC) block-compressed unsigned floating-point RGB image using 128 bits per 4x4 block.
Definition Image.hpp:76
@ ETC2_R8G8B8A8_UINT_BLOCK
ETC2 block-compressed RGBA image using 128 bits per 4x4 block.
Definition Image.hpp:80
@ BC5_RG_UINT_BLOCK
S3TC BC5 (RGTC2) block-compressed double-channel image using 128 bits per 4x4 block.
Definition Image.hpp:75
@ R8G8B8A8_UINT
Raw bitmap where each pixel comprises 4 8-bit unsigned integer components: red, green,...
Definition Image.hpp:64
@ R8G8_UINT
Raw bitmap where each pixel comprises 2 8-bit unsigned integer components: red, green.
Definition Image.hpp:58
@ UNKNOWN
Unknown image format.
Definition Image.hpp:54
@ KTX2_UASTC_R_UINT_BLOCK
KTX2 container of an ASTC 4x4-compressed UASTC LDR-encoded image with 1 DFD channel: RRR.
Definition Image.hpp:88
@ ETC2_R8G8B8_UINT_BLOCK
ETC2 block-compressed RGB image using 64 bits per 4x4 block.
Definition Image.hpp:79
@ BC6H_RGB_FLOAT_BLOCK
S3TC BC6H (BPTC) block-compressed signed floating-point RGB image using 128 bits per 4x4 block.
Definition Image.hpp:77
@ R32G32B32A32_FLOAT
Raw bitmap where each pixel comprises 4 32-bit floating-point components: red, green,...
Definition Image.hpp:66
@ R16G16B16A16_FLOAT
Raw bitmap where each pixel comprises 4 16-bit floating-point components: red, green,...
Definition Image.hpp:65
@ ASTC_4x4_RGBA_UINT_BLOCK
ASTC block-compressed RGBA image using 128 bits per 4x4 block.
Definition Image.hpp:71
@ KTX2_UASTC_RGB_UINT_BLOCK
KTX2 container of an ASTC 4x4-compressed UASTC LDR-encoded image with 1 DFD channel: RGB.
Definition Image.hpp:90
@ R5G6B5_UINT_PACK16
Packed bitmap with the following 16-bit unsigned integer RGB pixel format: RRRRRGGGGGGBBBBB.
Definition Image.hpp:67
@ EAC_R11_UINT_BLOCK
ETC2 EAC block-compressed single-channel image using 64 bits per 4x4 block.
Definition Image.hpp:81
@ BC3_RGBA_UINT_BLOCK
S3TC BC3 (DXT5) block-compressed RGBA image using 128 bits per 4x4 block.
Definition Image.hpp:73
@ R8_UINT
Raw bitmap where each pixel comprises 1 8-bit unsigned integer component: red.
Definition Image.hpp:55
@ BC1_RGB_UINT_BLOCK
S3TC BC1 (DXT1) block-compressed RGB image using 64 bits per 4x4 block.
Definition Image.hpp:72
@ KTX2_ETC1S_RGB_UINT_BLOCK
KTX2 container of an ETC1-compressed ETC1S-encoded image with 1 DFD channel: RGB.
Definition Image.hpp:86
@ A2B10G10R10_UINT_PACK32
Packed bitmap with the following 32-bit unsigned integer RGBA pixel format: AABBBBBBBBBBGGGGGGGGGGRRR...
Definition Image.hpp:70
@ KTX2_UASTC_RG_UINT_BLOCK
KTX2 container of an ASTC 4x4-compressed UASTC LDR-encoded image with 1 DFD channel: RG.
Definition Image.hpp:89
@ KTX2_ETC1S_RG_UINT_BLOCK
KTX2 container of an ETC1-compressed ETC1S-encoded image with 2 DFD channels: RRR and GGG.
Definition Image.hpp:85
@ PVRTC1_4BPP_RGBA_UINT_BLOCK
PVRTC1 block-compressed RGBA image using 64 bits per 4x4 block.
Definition Image.hpp:83
@ R32G32B32_FLOAT
Raw bitmap where each pixel comprises 3 32-bit floating-point components: red, green,...
Definition Image.hpp:63
@ BC7_RGBA_UINT_BLOCK
S3TC BC7 (BPTC) block-compressed RGBA image using 128 bits per 4x4 block.
Definition Image.hpp:78
@ KTX2_UASTC_RGBA_UINT_BLOCK
KTX2 container of an ASTC 4x4-compressed UASTC LDR-encoded image with 1 DFD channel: RGBA.
Definition Image.hpp:91
ImageType
Type of an Image.
Definition Image.hpp:41
@ IMAGE_CUBE
A cube of 6 sides of square 2D images.
Definition Image.hpp:45
@ IMAGE_CUBE_ARRAY
An array of cubes of 6 sides of square 2D images.
Definition Image.hpp:46
@ EMPTY
Empty image without a value.
Definition Image.hpp:42
@ IMAGE_2D_ARRAY
An array of 2D images.
Definition Image.hpp:44
@ IMAGE_2D
A single 2D image.
Definition Image.hpp:43
Region< 3 > Region3D
Rectangular region of 3D data.
Definition extents.hpp:820
Extent< 2 > Extent2D
Size of a 2D data region.
Definition extents.hpp:31
void unreachable()
Definition assertions.hpp:125
Offset< 3 > Offset3D
Offset in a 3D data region.
Definition extents.hpp:22
Extent< 3 > Extent3D
Size of a 3D data region.
Definition extents.hpp:32
uint32_t height
Vertical extent.
Definition extents.hpp:239
uint32_t width
Horizontal extent.
Definition extents.hpp:238
uint32_t depth
Number of layers.
Definition extents.hpp:240
Specification of how a texture should either be left untouched, be cleared to specific values or be c...
Definition Texture.hpp:444
constexpr Variant() noexcept(std::is_nothrow_default_constructible_v< variant_alternative_t< 0, Variant > >)
Default-construct a variant with the first variant alternative, if it is default-constructible.
Definition Variant.hpp:351
Specification of values that a texture should be cleared to.
Definition Texture.hpp:426
uint8_t stencil
Stencil value to clear the stencil aspect to.
Definition Texture.hpp:430
TextureAspects aspects
Which texture aspects to clear.
Definition Texture.hpp:427
float depth
Depth value to clear the depth aspect to.
Definition Texture.hpp:429
Color color
Color value to clear the color aspect to.
Definition Texture.hpp:428
Specification that an intermediate render texture may have its intermediate values discarded after be...
Definition Texture.hpp:460
Exception type for domain-specific errors originating from the grem::graphics module.
Definition Error.hpp:17
Specification of how an intermediate render texture should either store or discard its values after b...
Definition Texture.hpp:466
constexpr Variant() noexcept(std::is_nothrow_default_constructible_v< variant_alternative_t< 0, Variant > >)
Default-construct a variant with the first variant alternative, if it is default-constructible.
Definition Variant.hpp:351
Specification that a texture should leave its values untouched rather than clearing them.
Definition Texture.hpp:421
Specification that an intermediate render texture should store its intermediate values after being re...
Definition Texture.hpp:452
TextureAspects aspects
Which texture aspects to store.
Definition Texture.hpp:453
Configuration options for a texture image download.
Definition Texture.hpp:590
bool convertFromPremultipliedAlpha
Convert the downloaded image from pre-multiplied to straight alpha.
Definition Texture.hpp:602
constexpr bool operator==(const TextureImageDownloadOptions &other) const =default
Compare these options to another set of options for equality.
Optional< TextureSubresource > subresource
Texture subresource to download.
Definition Texture.hpp:595
Configuration options for a texture image upload.
Definition Texture.hpp:550
bool generateMipmap
Generate a new mip chain with the maximum number of mip levels for the texture based on mip level 0 o...
Definition Texture.hpp:575
bool convertToPremultipliedAlpha
Convert the uploaded image from straight to pre-multiplied alpha.
Definition Texture.hpp:565
constexpr bool operator==(const TextureImageUploadOptions &other) const =default
Compare these options to another set of options for equality.
Color::TransferFunction transferFunction
Preferred transfer function to use when choosing the internal texture format.
Definition Texture.hpp:558
Read-only reference to a 2D region of a texture.
Definition Texture.hpp:396
const Texture * texture
Read-only non-null pointer to the texture.
Definition Texture.hpp:397
TextureRegion2D region
Referenced texture region.
Definition Texture.hpp:398
Reference to a 2D region of a texture.
Definition Texture.hpp:388
Texture * texture
Non-null pointer to the texture.
Definition Texture.hpp:389
TextureRegion2D region
Referenced texture region.
Definition Texture.hpp:390
Two-dimensional region of a texture.
Definition Texture.hpp:334
uint32_t mipLevel
Mip level index in the texture.
Definition Texture.hpp:338
Extent2D size
Size of the region, in texels.
Definition Texture.hpp:337
Offset3D offset
Offset from the bottom left of the first layer in the texture, in texels.
Definition Texture.hpp:336
constexpr bool operator==(const TextureRegion2D &other) const =default
Compare this region to another for equality.
TextureAspects aspects
Set of texture aspects.
Definition Texture.hpp:335
Read-only reference to a 3D region of a texture.
Definition Texture.hpp:412
TextureRegion3D region
Referenced texture region.
Definition Texture.hpp:414
const Texture * texture
Read-only non-null pointer to the texture.
Definition Texture.hpp:413
Reference to a 3D region of a texture.
Definition Texture.hpp:404
TextureRegion3D region
Referenced texture region.
Definition Texture.hpp:406
Texture * texture
Non-null pointer to the texture.
Definition Texture.hpp:405
Three-dimensional region of a texture.
Definition Texture.hpp:353
Offset3D offset
Offset from the bottom left of the first layer in the texture, in texels.
Definition Texture.hpp:355
TextureAspects aspects
Set of texture aspects.
Definition Texture.hpp:354
uint32_t mipLevel
Mip level index in the texture.
Definition Texture.hpp:357
constexpr bool operator==(const TextureRegion3D &other) const =default
Compare this region to another for equality.
Extent3D size
Size of the region, in texels/layers.
Definition Texture.hpp:356
Configuration options for the sampler of a Texture.
Definition Texture.hpp:617
constexpr bool operator==(const TextureSamplerOptions &other) const =default
Compare this configuration to another for equality.
TextureWrappingMode horizontalWrappingMode
How to address the texture when the horizontal component of the texture coordinates is outside the 0-...
Definition Texture.hpp:654
float maxAnisotropy
Maximum level of anisotropic filtering to use.
Definition Texture.hpp:667
TextureWrappingMode verticalWrappingMode
How to address the texture when the vertical component of the texture coordinates is outside the 0-1 ...
Definition Texture.hpp:660
TextureFilter magnificationFilter
Filtering mode to use when the texture is rendered larger than its original size.
Definition Texture.hpp:634
Optional< TextureDepthComparisonMode > depthComparisonMode
Depth comparison mode to use when sampling the texture.
Definition Texture.hpp:674
TextureMipmapMode mipmapMode
Mipmap mode to use when determining which mip detail level to sample depending on the texture's size ...
Definition Texture.hpp:648
static const TextureSamplerOptions UNFILTERED
A texture sampler configuration that ensures that the texture is sampled as directly as possible,...
Definition Texture.hpp:622
TextureFilter minificationFilter
Filtering mode to use when the texture is rendered smaller than its original size.
Definition Texture.hpp:628
Read-only reference to a subresource of a texture.
Definition Texture.hpp:380
TextureSubresource subresource
Referenced texture subresource.
Definition Texture.hpp:382
const Texture * texture
Read-only non-null pointer to the texture.
Definition Texture.hpp:381
Reference to a subresource of a texture.
Definition Texture.hpp:372
TextureSubresource subresource
Referenced texture subresource.
Definition Texture.hpp:374
Texture * texture
Non-null pointer to the texture.
Definition Texture.hpp:373
Subresource selection of a texture.
Definition Texture.hpp:316
constexpr bool operator==(const TextureSubresource &other) const =default
Compare this subresource selection to another for equality.
uint32_t layer
Layer index in the texture.
Definition Texture.hpp:318
uint32_t mipLevel
Mip level index in the texture.
Definition Texture.hpp:319
TextureAspects aspects
Set of texture aspects.
Definition Texture.hpp:317
Specification that a texture may be cleared to undefined values.
Definition Texture.hpp:436
TextureAspects aspects
Which texture aspects to clear.
Definition Texture.hpp:437