Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
DescriptorSets.h
Go to the documentation of this file.
1/*
2Copyright (c) 2018 DIVIDE-Studio
3Copyright (c) 2009 Ionut Cava
4
5This file is part of DIVIDE Framework.
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software
9and associated documentation files (the "Software"), to deal in the Software
10without restriction,
11including without limitation the rights to use, copy, modify, merge, publish,
12distribute, sublicense,
13and/or sell copies of the Software, and to permit persons to whom the
14Software is furnished to do so,
15subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in
18all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED,
22INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23PARTICULAR PURPOSE AND NONINFRINGEMENT.
24IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25DAMAGES OR OTHER LIABILITY,
26WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27IN CONNECTION WITH THE SOFTWARE
28OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30*/
31
32#pragma once
33#ifndef DVD_DESCRIPTOR_SETS_H_
34#define DVD_DESCRIPTOR_SETS_H_
35
36#include "DescriptorSetsFwd.h"
39
40namespace Divide
41{
42 // SubRange instead of vec2<U16> to keep things trivial
43 struct SubRange
44 {
47
48 bool operator==( const SubRange& ) const = default;
49 };
50
52 {
55
56 bool operator==( const ImageSubRange& ) const = default;
57 };
58
60 {
65
66 bool operator==( const ImageViewDescriptor& ) const = default;
67 };
68
69 struct ImageView
70 {
71 static constexpr size_t INVALID_VIEW_HASH = std::numeric_limits<size_t>::max();
72
74 const Texture* _srcTexture{ nullptr };
76
78
79 bool operator==( const ImageView& other ) const noexcept;
80 bool operator!=( const ImageView& other ) const noexcept;
81 };
82
83 [[nodiscard]] TextureType TargetType(const ImageView& imageView) noexcept;
84
86 {
89
92
93 bool operator==(const DescriptorCombinedImageSampler&) const noexcept = default;
94 };
95
97 {
100
101 bool operator==( const DescriptorImageView& ) const noexcept = default;
102 };
103
105 {
109 };
110
112 {
113 union
114 {
118 };
119
121
122 bool operator==( const DescriptorSetBindingData& rhs ) const noexcept;
123 bool operator!=( const DescriptorSetBindingData& rhs ) const noexcept;
124 };
125
127 {
130 U8 _slot{ 0u };
131
132 bool operator==( const DescriptorSetBinding& ) const = default;
133 };
134
136 {
137 std::array<DescriptorSetBinding, MAX_BINDINGS_PER_DESCRIPTOR_SET> _bindings;
139
140 bool operator==( const DescriptorSet& ) const = default;
141 };
142
143 void Set( DescriptorSetBindingData& dataInOut, ShaderBuffer* buffer, BufferRange range ) noexcept;
144 void Set( DescriptorSetBindingData& dataInOut, const DescriptorImageView& view ) noexcept;
145 void Set( DescriptorSetBindingData& dataInOut, const ImageView& view, ImageUsage usage) noexcept;
146 void Set( DescriptorSetBindingData& dataInOut, const ImageView& view, SamplerDescriptor sampler ) noexcept;
147
148 [[nodiscard]] DescriptorSetBinding& AddBinding(DescriptorSet& setInOut, U8 slot, U16 stageVisibilityMask);
149 [[nodiscard]] DescriptorSetBinding& AddBinding(DescriptorSet& setInOut, U8 slot, ShaderStageVisibility stageVisibility);
150
151 bool operator==( const ShaderBufferEntry& lhs, const ShaderBufferEntry& rhs ) noexcept;
152 bool operator!=( const ShaderBufferEntry& lhs, const ShaderBufferEntry& rhs ) noexcept;
153
154 [[nodiscard]] bool IsSet( const DescriptorSetBindingData& data ) noexcept;
155
156 template<typename T>
157 [[nodiscard]] T& As( DescriptorSetBindingData& data ) noexcept;
158 template<typename T>
159 [[nodiscard]] const T& As( const DescriptorSetBindingData& data ) noexcept;
160
161 [[nodiscard]] size_t GetHash( const ImageViewDescriptor& descriptor ) noexcept;
162 [[nodiscard]] size_t GetHash( const ImageView& imageView ) noexcept;
163
164}; //namespace Divide
165
166#endif //DVD_DESCRIPTOR_SETS_H_
167
168#include "DescriptorSets.inl"
An API-independent representation of a texture.
Definition: Texture.h:83
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
TextureType TargetType(const ImageView &imageView) noexcept
int32_t I32
uint8_t U8
size_t GetHash(const PropertyDescriptor< T > &descriptor) noexcept
Definition: Resource.inl:40
bool IsSet(const SwitchSceneTarget &target) noexcept
DescriptorSetBindingType
constexpr U16 U16_MAX
uint16_t U16
void Set(DescriptorSetBindingData &dataInOut, ShaderBuffer *buffer, const BufferRange range) noexcept
DescriptorSetBinding & AddBinding(DescriptorSet &setInOut, U8 slot, U16 stageVisibilityMask)
ShaderStageVisibility
bool operator==(const DisplayManager::OutputDisplayProperties &lhs, const DisplayManager::OutputDisplayProperties &rhs) noexcept
Definition: Application.inl:37
T & As(DescriptorSetBindingData &data) noexcept
constexpr auto to_base(const Type value) -> Type
bool operator==(const DescriptorCombinedImageSampler &) const noexcept=default
bool operator==(const DescriptorImageView &) const noexcept=default
DescriptorSetBindingType _type
bool operator!=(const DescriptorSetBindingData &rhs) const noexcept
DescriptorCombinedImageSampler _sampledImage
bool operator==(const DescriptorSetBindingData &rhs) const noexcept
bool operator==(const DescriptorSetBinding &) const =default
DescriptorSetBindingData _data
bool operator==(const DescriptorSet &) const =default
std::array< DescriptorSetBinding, MAX_BINDINGS_PER_DESCRIPTOR_SET > _bindings
bool operator==(const ImageSubRange &) const =default
bool operator==(const ImageViewDescriptor &) const =default
bool operator==(const ImageView &other) const noexcept
static constexpr size_t INVALID_VIEW_HASH
ImageViewDescriptor _descriptor
TextureType _targetType
ImageSubRange _subRange
const Texture * _srcTexture
bool operator!=(const ImageView &other) const noexcept
static constexpr size_t INVALID_SAMPLER_HASH
BufferRange _range
I32 _queueReadIndex
ShaderBuffer * _buffer
bool operator==(const SubRange &) const =default