Unravel Engine C++ Reference
Loading...
Searching...
No Matches
render_view_keys.h
Go to the documentation of this file.
1#pragma once
2
3#include "texture.h"
4#include <base/hash.hpp>
5#include <cstdint>
6#include <memory>
7#include <string>
8#include <vector>
9
10namespace gfx
11{
13{
15 std::string id;
19 std::uint64_t flags = BGFX_TEXTURE_NONE;
21 backbuffer_ratio ratio = backbuffer_ratio::Count;
22};
23
24struct fbo_key
25{
27 std::string id;
29 std::vector<std::shared_ptr<texture>> textures;
30};
31
32bool operator==(const texture_key& key1, const texture_key& key2);
33bool operator==(const fbo_key& key1, const fbo_key& key2);
34} // namespace gfx
35
36namespace std
37{
38template<>
39struct hash<gfx::texture_key>
40{
42 using result_type = std::size_t;
44 {
45 size_t seed = 0;
46 utils::hash_combine(seed, s.id);
47 utils::hash_combine(seed, static_cast<int>(s.info.format));
48 utils::hash_combine(seed, s.info.storageSize);
49 utils::hash_combine(seed, s.info.width);
50 utils::hash_combine(seed, s.info.height);
51 utils::hash_combine(seed, s.info.depth);
52 utils::hash_combine(seed, s.info.numLayers);
53 utils::hash_combine(seed, s.info.numMips);
54 utils::hash_combine(seed, s.info.bitsPerPixel);
55 utils::hash_combine(seed, s.info.cubeMap);
56 utils::hash_combine(seed, s.flags);
57 utils::hash_combine(seed, static_cast<int>(s.ratio));
58 return seed;
59 }
60};
61
62template<>
63struct hash<gfx::fbo_key>
64{
66 using result_type = std::size_t;
68 {
69 std::size_t seed = 0;
70 utils::hash_combine(seed, s.id);
71 for(auto& tex : s.textures)
72 {
73 utils::hash_combine(seed, tex);
74 }
75
76 return seed;
77 }
78};
79} // namespace std
bool operator==(const texture_key &key1, const texture_key &key2)
bgfx::BackbufferRatio::Enum backbuffer_ratio
Definition graphics.h:22
bgfx::TextureInfo texture_info
Definition graphics.h:24
void hash_combine(std::size_t &seed, const T &v)
Definition hash.hpp:8
std::string id
User id.
std::vector< std::shared_ptr< texture > > textures
std::string id
User id.
backbuffer_ratio ratio
Back buffer ratio if any.
texture_info info
Texture detail info.
std::uint64_t flags
Creation flags.
result_type operator()(argument_type const &s) const
result_type operator()(argument_type const &s) const