RavEngine
Loading...
Searching...
No Matches
SubresourceRange.hpp
1#pragma once
2#include <cstdint>
3#include <limits>
4#include <cmath>
5
6namespace RGL {
7
8 // bitmasks representing the mip levels and array layers that the View represents.
9 // these are combined. So if a texture covers mip 1 and array layers 2 and 3, then mip 1 is covered on both array 2 and 3.
10 // it is not possible to make a view that covers (mip 1, array 2) and (mip 0, array 3) at the same time, for instance
11 using covered_mips_t = uint32_t;
12 using covered_layers_t = uint64_t;
13
14 constexpr covered_mips_t ALL_MIPS = std::numeric_limits<decltype(ALL_MIPS)>::max();
15 constexpr covered_layers_t ALL_LAYERS = std::numeric_limits<decltype(ALL_LAYERS)>::max();
16
17 inline covered_mips_t MakeMipMaskForIndex(covered_mips_t index) {
18 return 1 << index;
19 }
20
21 inline covered_layers_t MakeLayerMaskForIndex(covered_layers_t layer) {
22 return 1 << layer;
23 }
24
28 inline uint32_t MaskToMipLevel(covered_mips_t mipMask) {
29 return std::log2(mipMask);
30 }
31
32 inline uint32_t MaskToLayer(covered_layers_t layerMask) {
33 return std::log2(layerMask);
34 }
35}
uint64 uint64_t
Definition fwd.hpp:145
uint32 uint32_t
Definition fwd.hpp:131