Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
DescriptorSets.cpp
Go to the documentation of this file.
1
2
4
8
9namespace Divide
10{
11 size_t GetHash( const ImageViewDescriptor& descriptor) noexcept
12 {
13 size_t hash = 1337;
15 descriptor._msaaSamples,
16 descriptor._dataType,
17 descriptor._baseFormat,
18 descriptor._packing);
19 return hash;
20 }
21
22 size_t GetHash( const ImageView& imageView ) noexcept
23 {
24 size_t hash = 1337;
26 GetHash(imageView._descriptor),
27 imageView._srcTexture != nullptr ? imageView._srcTexture->getGUID() : 0,
28 TargetType( imageView ),
29 imageView._subRange._layerRange._offset,
30 imageView._subRange._layerRange._count,
31 imageView._subRange._mipLevels._offset,
32 imageView._subRange._mipLevels._count);
33
34 return hash;
35 }
36
37 TextureType TargetType( const ImageView& imageView ) noexcept
38 {
39 if (imageView._targetType == TextureType::COUNT &&
40 imageView._srcTexture != nullptr)
41 {
42 return imageView._srcTexture->descriptor()._texType;
43 }
44
45 return imageView._targetType;
46 }
47
48 bool operator==(const ShaderBufferEntry& lhs, const ShaderBufferEntry& rhs) noexcept
49 {
50 return lhs._range == rhs._range &&
51 lhs._queueReadIndex == rhs._queueReadIndex &&
52 Compare(lhs._buffer, rhs._buffer);
53 }
54
55 bool operator!=(const ShaderBufferEntry& lhs, const ShaderBufferEntry& rhs) noexcept
56 {
57 return lhs._range != rhs._range ||
58 lhs._queueReadIndex != rhs._queueReadIndex ||
59 !Compare(lhs._buffer, rhs._buffer);
60 }
61
62 void Set( DescriptorSetBindingData& dataInOut, ShaderBuffer* buffer, const BufferRange range ) noexcept
63 {
64 assert( buffer != nullptr );
65 dataInOut._buffer = { buffer, range, buffer->queueReadIndex() };
68 }
69
70 void Set( DescriptorSetBindingData& dataInOut, const Handle<Texture> defaultTextureView, const SamplerDescriptor sampler ) noexcept
71 {
72 Set( dataInOut, Get( defaultTextureView )->getView(), sampler );
73 }
74
75} //namespace Divide
void Hash_combine(size_t &seed, const T &v, const Rest &... rest) noexcept
a la Boost
Definition: MathHelper.inl:799
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
FORCE_INLINE bool operator!=(const GUIDWrapper &lhs, const GUIDWrapper &rhs) noexcept
Definition: GUIDWrapper.h:67
FORCE_INLINE bool Compare(const GUIDWrapper *const lhs, const GUIDWrapper *const rhs) noexcept
Definition: GUIDWrapper.h:73
TextureType TargetType(const ImageView &imageView) noexcept
size_t GetHash(const PropertyDescriptor< T > &descriptor) noexcept
Definition: Resource.inl:40
void Set(DescriptorSetBindingData &dataInOut, ShaderBuffer *buffer, const BufferRange range) noexcept
bool operator==(const DisplayManager::OutputDisplayProperties &lhs, const DisplayManager::OutputDisplayProperties &rhs) noexcept
Definition: Application.inl:37
FORCE_INLINE T * Get(const Handle< T > handle)