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
10
namespace
gfx
11
{
12
struct
texture_key
13
{
15
std::string
id
;
17
texture_info
info
;
19
std::uint64_t
flags
= BGFX_TEXTURE_NONE;
21
backbuffer_ratio
ratio
= backbuffer_ratio::Count;
22
};
23
24
struct
fbo_key
25
{
27
std::string
id
;
29
std::vector<std::shared_ptr<texture>>
textures
;
30
};
31
32
bool
operator==
(
const
texture_key
& key1,
const
texture_key
& key2);
33
bool
operator==
(
const
fbo_key
& key1,
const
fbo_key
& key2);
34
}
// namespace gfx
35
36
namespace
std
37
{
38
template
<>
39
struct
hash<
gfx
::texture_key>
40
{
41
using
argument_type
=
gfx::texture_key
;
42
using
result_type
= std::size_t;
43
result_type
operator()
(
argument_type
const
& s)
const
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
62
template
<>
63
struct
hash<
gfx
::fbo_key>
64
{
65
using
argument_type
=
gfx::fbo_key
;
66
using
result_type
= std::size_t;
67
result_type
operator()
(
argument_type
const
& s)
const
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
hash.hpp
gfx
Definition
debugdraw.cpp:7
gfx::operator==
bool operator==(const texture_key &key1, const texture_key &key2)
Definition
render_view_keys.cpp:5
gfx::backbuffer_ratio
bgfx::BackbufferRatio::Enum backbuffer_ratio
Definition
graphics.h:22
gfx::texture_info
bgfx::TextureInfo texture_info
Definition
graphics.h:24
std
Definition
render_view_keys.h:37
utils::hash_combine
void hash_combine(std::size_t &seed, const T &v)
Definition
hash.hpp:8
gfx::fbo_key
Definition
render_view_keys.h:25
gfx::fbo_key::id
std::string id
User id.
Definition
render_view_keys.h:27
gfx::fbo_key::textures
std::vector< std::shared_ptr< texture > > textures
Definition
render_view_keys.h:29
gfx::texture_key
Definition
render_view_keys.h:13
gfx::texture_key::id
std::string id
User id.
Definition
render_view_keys.h:15
gfx::texture_key::ratio
backbuffer_ratio ratio
Back buffer ratio if any.
Definition
render_view_keys.h:21
gfx::texture_key::info
texture_info info
Texture detail info.
Definition
render_view_keys.h:17
gfx::texture_key::flags
std::uint64_t flags
Creation flags.
Definition
render_view_keys.h:19
std::hash< gfx::fbo_key >::result_type
std::size_t result_type
Definition
render_view_keys.h:66
std::hash< gfx::fbo_key >::operator()
result_type operator()(argument_type const &s) const
Definition
render_view_keys.h:67
std::hash< gfx::texture_key >::operator()
result_type operator()(argument_type const &s) const
Definition
render_view_keys.h:43
std::hash< gfx::texture_key >::result_type
std::size_t result_type
Definition
render_view_keys.h:42
texture.h
UnravelEngine
UnravelEngine
engine
core
graphics
render_view_keys.h
Generated by
1.12.0