Diligent Engine  v.2.4.g
SPIRVShaderResources.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 #pragma once
29 
32 
33 // SPIRVShaderResources class uses continuous chunk of memory to store all resources, as follows:
34 //
35 // m_MemoryBuffer m_TotalResources
36 // | | |
37 // | Uniform Buffers | Storage Buffers | Storage Images | Sampled Images | Atomic Counters | Separate Samplers | Separate Images | Stage Inputs | Resource Names |
38 
39 #include <memory>
40 #include <vector>
41 #include <sstream>
42 
43 #include "Shader.h"
44 #include "RenderDevice.h"
45 #include "STDAllocator.hpp"
46 #include "RefCntAutoPtr.hpp"
47 #include "StringPool.hpp"
48 
50 {
51 class Compiler;
52 struct Resource;
53 } // namespace diligent_spirv_cross
54 
55 namespace Diligent
56 {
57 
58 // sizeof(SPIRVShaderResourceAttribs) == 32, msvc x64
60 {
62  {
76  };
77 
79 
80  // clang-format off
81 
82 /* 0 */const char* const Name;
83 /* 8 */const Uint16 ArraySize;
84 /* 10 */const ResourceType Type;
85 /* 11.0*/const Uint8 ResourceDim : 7;
86 /* 11.7*/const Uint8 IsMS : 1;
87 
88  // Offset in SPIRV words (uint32_t) of binding & descriptor set decorations in SPIRV binary
89 /* 12 */const uint32_t BindingDecorationOffset;
90 /* 16 */const uint32_t DescriptorSetDecorationOffset;
91 
92 /* 20 */const Uint32 BufferStaticSize;
93 /* 24 */const Uint32 BufferStride;
94 /* 28 */
95 /* 32 */ // End of structure
96 
97  // clang-format on
98 
99  SPIRVShaderResourceAttribs(const diligent_spirv_cross::Compiler& Compiler,
100  const diligent_spirv_cross::Resource& Res,
101  const char* _Name,
102  ResourceType _Type,
103  Uint32 _BufferStaticSize = 0,
104  Uint32 _BufferStride = 0) noexcept;
105 
107  {
109  }
110 
112  {
113  return static_cast<RESOURCE_DIMENSION>(ResourceDim);
114  }
115 
116  bool IsMultisample() const
117  {
118  return IsMS != 0;
119  }
120 };
121 static_assert(sizeof(SPIRVShaderResourceAttribs) % sizeof(void*) == 0, "Size of SPIRVShaderResourceAttribs struct must be multiple of sizeof(void*)");
122 
123 // sizeof(SPIRVShaderResourceAttribs) == 16, msvc x64
125 {
126  // clang-format off
127  SPIRVShaderStageInputAttribs(const char* _Semantic, uint32_t _LocationDecorationOffset) :
128  Semantic {_Semantic},
129  LocationDecorationOffset {_LocationDecorationOffset}
130  {}
131  // clang-format on
132 
133  const char* const Semantic;
134  const uint32_t LocationDecorationOffset;
135 };
136 static_assert(sizeof(SPIRVShaderStageInputAttribs) % sizeof(void*) == 0, "Size of SPIRVShaderStageInputAttribs struct must be multiple of sizeof(void*)");
137 
140 {
141 public:
143  IRenderDevice* pRenderDevice,
144  std::vector<uint32_t> spirv_binary,
145  const ShaderDesc& shaderDesc,
146  const char* CombinedSamplerSuffix,
147  bool LoadShaderStageInputs,
148  std::string& EntryPoint);
149 
150  // clang-format off
151  SPIRVShaderResources (const SPIRVShaderResources&) = delete;
155  // clang-format on
156 
158 
159  // clang-format off
160 
161  Uint32 GetNumUBs ()const noexcept{ return (m_StorageBufferOffset - 0); }
162  Uint32 GetNumSBs ()const noexcept{ return (m_StorageImageOffset - m_StorageBufferOffset); }
163  Uint32 GetNumImgs ()const noexcept{ return (m_SampledImageOffset - m_StorageImageOffset); }
164  Uint32 GetNumSmpldImgs ()const noexcept{ return (m_AtomicCounterOffset - m_SampledImageOffset); }
165  Uint32 GetNumACs ()const noexcept{ return (m_SeparateSamplerOffset - m_AtomicCounterOffset); }
166  Uint32 GetNumSepSmplrs ()const noexcept{ return (m_SeparateImageOffset - m_SeparateSamplerOffset);}
167  Uint32 GetNumSepImgs ()const noexcept{ return (m_InputAttachmentOffset - m_SeparateImageOffset); }
168  Uint32 GetNumInptAtts ()const noexcept{ return (m_AccelStructOffset - m_InputAttachmentOffset);}
169  Uint32 GetNumAccelStructs()const noexcept{ return (m_TotalResources - m_AccelStructOffset); }
170  Uint32 GetTotalResources () const noexcept { return m_TotalResources; }
171  Uint32 GetNumShaderStageInputs()const noexcept { return m_NumShaderStageInputs; }
172 
173  const SPIRVShaderResourceAttribs& GetUB (Uint32 n)const noexcept{ return GetResAttribs(n, GetNumUBs(), 0 ); }
174  const SPIRVShaderResourceAttribs& GetSB (Uint32 n)const noexcept{ return GetResAttribs(n, GetNumSBs(), m_StorageBufferOffset ); }
175  const SPIRVShaderResourceAttribs& GetImg (Uint32 n)const noexcept{ return GetResAttribs(n, GetNumImgs(), m_StorageImageOffset ); }
176  const SPIRVShaderResourceAttribs& GetSmpldImg (Uint32 n)const noexcept{ return GetResAttribs(n, GetNumSmpldImgs(), m_SampledImageOffset ); }
177  const SPIRVShaderResourceAttribs& GetAC (Uint32 n)const noexcept{ return GetResAttribs(n, GetNumACs(), m_AtomicCounterOffset ); }
178  const SPIRVShaderResourceAttribs& GetSepSmplr (Uint32 n)const noexcept{ return GetResAttribs(n, GetNumSepSmplrs(), m_SeparateSamplerOffset); }
179  const SPIRVShaderResourceAttribs& GetSepImg (Uint32 n)const noexcept{ return GetResAttribs(n, GetNumSepImgs(), m_SeparateImageOffset ); }
180  const SPIRVShaderResourceAttribs& GetInptAtt (Uint32 n)const noexcept{ return GetResAttribs(n, GetNumInptAtts(), m_InputAttachmentOffset); }
181  const SPIRVShaderResourceAttribs& GetAccelStruct(Uint32 n)const noexcept{ return GetResAttribs(n, GetNumAccelStructs(), m_AccelStructOffset ); }
182  const SPIRVShaderResourceAttribs& GetResource (Uint32 n)const noexcept{ return GetResAttribs(n, GetTotalResources(), 0 ); }
183 
184  // clang-format on
185 
187  {
188  VERIFY(n < m_NumShaderStageInputs, "Shader stage input index (", n, ") is out of range. Total input count: ", m_NumShaderStageInputs);
189  auto* ResourceMemoryEnd = reinterpret_cast<const SPIRVShaderResourceAttribs*>(m_MemoryBuffer.get()) + m_TotalResources;
190  return reinterpret_cast<const SPIRVShaderStageInputAttribs*>(ResourceMemoryEnd)[n];
191  }
192 
194  {
204  };
205 
206  SHADER_TYPE GetShaderType() const noexcept { return m_ShaderType; }
207 
208  // Process only resources listed in AllowedVarTypes
209  template <typename THandleUB,
210  typename THandleSB,
211  typename THandleImg,
212  typename THandleSmplImg,
213  typename THandleAC,
214  typename THandleSepSmpl,
215  typename THandleSepImg,
216  typename THandleInptAtt,
217  typename THandleAccelStruct>
218  void ProcessResources(THandleUB HandleUB,
219  THandleSB HandleSB,
220  THandleImg HandleImg,
221  THandleSmplImg HandleSmplImg,
222  THandleAC HandleAC,
223  THandleSepSmpl HandleSepSmpl,
224  THandleSepImg HandleSepImg,
225  THandleInptAtt HandleInptAtt,
226  THandleAccelStruct HandleAccelStruct) const
227  {
228  for (Uint32 n = 0; n < GetNumUBs(); ++n)
229  {
230  const auto& UB = GetUB(n);
231  HandleUB(UB, n);
232  }
233 
234  for (Uint32 n = 0; n < GetNumSBs(); ++n)
235  {
236  const auto& SB = GetSB(n);
237  HandleSB(SB, n);
238  }
239 
240  for (Uint32 n = 0; n < GetNumImgs(); ++n)
241  {
242  const auto& Img = GetImg(n);
243  HandleImg(Img, n);
244  }
245 
246  for (Uint32 n = 0; n < GetNumSmpldImgs(); ++n)
247  {
248  const auto& SmplImg = GetSmpldImg(n);
249  HandleSmplImg(SmplImg, n);
250  }
251 
252  for (Uint32 n = 0; n < GetNumACs(); ++n)
253  {
254  const auto& AC = GetAC(n);
255  HandleAC(AC, n);
256  }
257 
258  for (Uint32 n = 0; n < GetNumSepSmplrs(); ++n)
259  {
260  const auto& SepSmpl = GetSepSmplr(n);
261  HandleSepSmpl(SepSmpl, n);
262  }
263 
264  for (Uint32 n = 0; n < GetNumSepImgs(); ++n)
265  {
266  const auto& SepImg = GetSepImg(n);
267  HandleSepImg(SepImg, n);
268  }
269 
270  for (Uint32 n = 0; n < GetNumInptAtts(); ++n)
271  {
272  const auto& InptAtt = GetInptAtt(n);
273  HandleInptAtt(InptAtt, n);
274  }
275 
276  for (Uint32 n = 0; n < GetNumAccelStructs(); ++n)
277  {
278  const auto& AccelStruct = GetAccelStruct(n);
279  HandleAccelStruct(AccelStruct, n);
280  }
281 
282  static_assert(Uint32{SPIRVShaderResourceAttribs::ResourceType::NumResourceTypes} == 12, "Please handle the new resource type here, if needed");
283  }
284 
285  template <typename THandler>
286  void ProcessResources(THandler Handler) const
287  {
288  for (Uint32 n = 0; n < GetTotalResources(); ++n)
289  {
290  const auto& Res = GetResource(n);
291  Handler(Res, n);
292  }
293  }
294 
295  std::string DumpResources();
296 
297  // clang-format off
298 
299  const char* GetCombinedSamplerSuffix() const { return m_CombinedSamplerSuffix; }
300  const char* GetShaderName() const { return m_ShaderName; }
301  bool IsUsingCombinedSamplers() const { return m_CombinedSamplerSuffix != nullptr; }
302 
303  // clang-format on
304 
305  bool IsHLSLSource() const { return m_IsHLSLSource; }
306 
307 private:
308  void Initialize(IMemoryAllocator& Allocator,
309  const ResourceCounters& Counters,
310  Uint32 NumShaderStageInputs,
311  size_t ResourceNamesPoolSize,
312  StringPool& ResourceNamesPool);
313 
314  SPIRVShaderResourceAttribs& GetResAttribs(Uint32 n, Uint32 NumResources, Uint32 Offset) noexcept
315  {
316  VERIFY(n < NumResources, "Resource index (", n, ") is out of range. Total resource count: ", NumResources);
317  VERIFY_EXPR(Offset + n < m_TotalResources);
318  return reinterpret_cast<SPIRVShaderResourceAttribs*>(m_MemoryBuffer.get())[Offset + n];
319  }
320 
321  const SPIRVShaderResourceAttribs& GetResAttribs(Uint32 n, Uint32 NumResources, Uint32 Offset) const noexcept
322  {
323  VERIFY(n < NumResources, "Resource index (", n, ") is out of range. Total resource count: ", NumResources);
324  VERIFY_EXPR(Offset + n < m_TotalResources);
325  return reinterpret_cast<SPIRVShaderResourceAttribs*>(m_MemoryBuffer.get())[Offset + n];
326  }
327 
328  // clang-format off
329 
330  SPIRVShaderResourceAttribs& GetUB (Uint32 n)noexcept{ return GetResAttribs(n, GetNumUBs(), 0 ); }
331  SPIRVShaderResourceAttribs& GetSB (Uint32 n)noexcept{ return GetResAttribs(n, GetNumSBs(), m_StorageBufferOffset ); }
332  SPIRVShaderResourceAttribs& GetImg (Uint32 n)noexcept{ return GetResAttribs(n, GetNumImgs(), m_StorageImageOffset ); }
333  SPIRVShaderResourceAttribs& GetSmpldImg (Uint32 n)noexcept{ return GetResAttribs(n, GetNumSmpldImgs(), m_SampledImageOffset ); }
334  SPIRVShaderResourceAttribs& GetAC (Uint32 n)noexcept{ return GetResAttribs(n, GetNumACs(), m_AtomicCounterOffset ); }
335  SPIRVShaderResourceAttribs& GetSepSmplr (Uint32 n)noexcept{ return GetResAttribs(n, GetNumSepSmplrs(), m_SeparateSamplerOffset); }
336  SPIRVShaderResourceAttribs& GetSepImg (Uint32 n)noexcept{ return GetResAttribs(n, GetNumSepImgs(), m_SeparateImageOffset ); }
337  SPIRVShaderResourceAttribs& GetInptAtt (Uint32 n)noexcept{ return GetResAttribs(n, GetNumInptAtts(), m_InputAttachmentOffset); }
338  SPIRVShaderResourceAttribs& GetAccelStruct(Uint32 n)noexcept{ return GetResAttribs(n, GetNumAccelStructs(), m_AccelStructOffset ); }
339  SPIRVShaderResourceAttribs& GetResource (Uint32 n)noexcept{ return GetResAttribs(n, GetTotalResources(), 0 ); }
340 
341  // clang-format on
342 
343  SPIRVShaderStageInputAttribs& GetShaderStageInputAttribs(Uint32 n) noexcept
344  {
345  return const_cast<SPIRVShaderStageInputAttribs&>(const_cast<const SPIRVShaderResources*>(this)->GetShaderStageInputAttribs(n));
346  }
347 
348  // Memory buffer that holds all resources as continuous chunk of memory:
349  // | UBs | SBs | StrgImgs | SmplImgs | ACs | SepSamplers | SepImgs | Stage Inputs | Resource Names |
350  std::unique_ptr<void, STDDeleterRawMem<void>> m_MemoryBuffer;
351 
352  const char* m_CombinedSamplerSuffix = nullptr;
353  const char* m_ShaderName = nullptr;
354 
355  using OffsetType = Uint16;
356  OffsetType m_StorageBufferOffset = 0;
357  OffsetType m_StorageImageOffset = 0;
358  OffsetType m_SampledImageOffset = 0;
359  OffsetType m_AtomicCounterOffset = 0;
360  OffsetType m_SeparateSamplerOffset = 0;
361  OffsetType m_SeparateImageOffset = 0;
362  OffsetType m_InputAttachmentOffset = 0;
363  OffsetType m_AccelStructOffset = 0;
364  OffsetType m_TotalResources = 0;
365  OffsetType m_NumShaderStageInputs = 0;
366 
367  SHADER_TYPE m_ShaderType = SHADER_TYPE_UNKNOWN;
368 
369  // Inidicates if the shader was compiled from HLSL source.
370  bool m_IsHLSLSource = false;
371 };
372 
373 } // namespace Diligent
Diligent::SPIRVShaderResources::GetNumSBs
Uint32 GetNumSBs() const noexcept
Definition: SPIRVShaderResources.hpp:162
Diligent::SPIRVShaderResources::DumpResources
std::string DumpResources()
Definition: SPIRVShaderResources.cpp:668
Diligent::SPIRVShaderResourceAttribs::InputAttachment
@ InputAttachment
Definition: SPIRVShaderResources.hpp:73
Diligent::SPIRVShaderResources::~SPIRVShaderResources
~SPIRVShaderResources()
Definition: SPIRVShaderResources.cpp:631
Diligent::SPIRVShaderResourceAttribs::BindingDecorationOffset
const uint32_t BindingDecorationOffset
Definition: SPIRVShaderResources.hpp:89
Diligent::SPIRVShaderResourceAttribs::IsMS
const Uint8 IsMS
Definition: SPIRVShaderResources.hpp:86
Diligent::SPIRVShaderResources::GetNumSmpldImgs
Uint32 GetNumSmpldImgs() const noexcept
Definition: SPIRVShaderResources.hpp:164
Diligent::SPIRVShaderStageInputAttribs::LocationDecorationOffset
const uint32_t LocationDecorationOffset
Definition: SPIRVShaderResources.hpp:134
Diligent::SPIRVShaderResources::ResourceCounters::NumSepSmplrs
Uint32 NumSepSmplrs
Definition: SPIRVShaderResources.hpp:200
Diligent::SPIRVShaderResources::IsUsingCombinedSamplers
bool IsUsingCombinedSamplers() const
Definition: SPIRVShaderResources.hpp:301
Diligent::SHADER_TYPE
SHADER_TYPE
Describes the shader type.
Definition: GraphicsTypes.h:65
Diligent::SHADER_RESOURCE_TYPE
SHADER_RESOURCE_TYPE
Describes shader resource type.
Definition: Shader.h:356
diligent_spirv_cross
Definition: SPIRVShaderResources.hpp:49
Diligent::SPIRVShaderResources::GetNumImgs
Uint32 GetNumImgs() const noexcept
Definition: SPIRVShaderResources.hpp:163
STDAllocator.hpp
Shader.h
Diligent::SPIRVShaderResources::GetNumACs
Uint32 GetNumACs() const noexcept
Definition: SPIRVShaderResources.hpp:165
Diligent::SPIRVShaderResourceAttribs::SeparateImage
@ SeparateImage
Definition: SPIRVShaderResources.hpp:71
Diligent::SPIRVShaderResourceAttribs::AtomicCounter
@ AtomicCounter
Definition: SPIRVShaderResources.hpp:70
Diligent::SPIRVShaderResourceAttribs
Definition: SPIRVShaderResources.hpp:59
Diligent::SPIRVShaderResources::GetAC
const SPIRVShaderResourceAttribs & GetAC(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:177
Diligent::SPIRVShaderResourceAttribs::GetShaderResourceType
static SHADER_RESOURCE_TYPE GetShaderResourceType(ResourceType Type)
Definition: SPIRVShaderResources.cpp:128
Diligent::SPIRVShaderResourceAttribs::SampledImage
@ SampledImage
Definition: SPIRVShaderResources.hpp:69
Diligent::SPIRVShaderStageInputAttribs::SPIRVShaderStageInputAttribs
SPIRVShaderStageInputAttribs(const char *_Semantic, uint32_t _LocationDecorationOffset)
Definition: SPIRVShaderResources.hpp:127
Diligent::SPIRVShaderResources::ResourceCounters
Definition: SPIRVShaderResources.hpp:193
Diligent::SPIRVShaderResources::ResourceCounters::NumACs
Uint32 NumACs
Definition: SPIRVShaderResources.hpp:199
Diligent::SPIRVShaderResources::GetNumSepImgs
Uint32 GetNumSepImgs() const noexcept
Definition: SPIRVShaderResources.hpp:167
Diligent::SPIRVShaderResourceAttribs::BufferStride
const Uint32 BufferStride
Definition: SPIRVShaderResources.hpp:93
Diligent::SPIRVShaderResources::SPIRVShaderResources
SPIRVShaderResources(IMemoryAllocator &Allocator, IRenderDevice *pRenderDevice, std::vector< uint32_t > spirv_binary, const ShaderDesc &shaderDesc, const char *CombinedSamplerSuffix, bool LoadShaderStageInputs, std::string &EntryPoint)
Definition: SPIRVShaderResources.cpp:244
Diligent::SPIRVShaderResources::IsHLSLSource
bool IsHLSLSource() const
Definition: SPIRVShaderResources.hpp:305
Diligent::SPIRVShaderResourceAttribs::SPIRVShaderResourceAttribs
SPIRVShaderResourceAttribs(const diligent_spirv_cross::Compiler &Compiler, const diligent_spirv_cross::Resource &Res, const char *_Name, ResourceType _Type, Uint32 _BufferStaticSize=0, Uint32 _BufferStride=0) noexcept
Definition: SPIRVShaderResources.cpp:108
Diligent::SPIRVShaderResources::GetInptAtt
const SPIRVShaderResourceAttribs & GetInptAtt(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:180
Diligent::SPIRVShaderResources::ResourceCounters::NumSBs
Uint32 NumSBs
Definition: SPIRVShaderResources.hpp:196
RenderDevice.h
Diligent::SPIRVShaderResources::GetShaderType
SHADER_TYPE GetShaderType() const noexcept
Definition: SPIRVShaderResources.hpp:206
Diligent::SPIRVShaderResourceAttribs::ResourceDim
const Uint8 ResourceDim
Definition: SPIRVShaderResources.hpp:85
Diligent::SPIRVShaderResourceAttribs::RWStorageBuffer
@ RWStorageBuffer
Definition: SPIRVShaderResources.hpp:65
Diligent::SPIRVShaderResourceAttribs::ROStorageBuffer
@ ROStorageBuffer
Definition: SPIRVShaderResources.hpp:64
Diligent::SPIRVShaderResources::GetShaderName
const char * GetShaderName() const
Definition: SPIRVShaderResources.hpp:300
Diligent::IRenderDevice
Render device interface.
Definition: RenderDevice.h:75
Diligent::SPIRVShaderResourceAttribs::SeparateSampler
@ SeparateSampler
Definition: SPIRVShaderResources.hpp:72
Diligent::SPIRVShaderResourceAttribs::AccelerationStructure
@ AccelerationStructure
Definition: SPIRVShaderResources.hpp:74
Diligent::SPIRVShaderResourceAttribs::DescriptorSetDecorationOffset
const uint32_t DescriptorSetDecorationOffset
Definition: SPIRVShaderResources.hpp:90
Diligent::SPIRVShaderResources::GetNumAccelStructs
Uint32 GetNumAccelStructs() const noexcept
Definition: SPIRVShaderResources.hpp:169
Diligent::SPIRVShaderResources::GetSmpldImg
const SPIRVShaderResourceAttribs & GetSmpldImg(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:176
Diligent::ShaderDesc
Shader description.
Definition: Shader.h:110
Diligent::SPIRVShaderResources::ResourceCounters::NumSepImgs
Uint32 NumSepImgs
Definition: SPIRVShaderResources.hpp:201
Diligent::SPIRVShaderResourceAttribs::NumResourceTypes
@ NumResourceTypes
Definition: SPIRVShaderResources.hpp:75
Diligent::SPIRVShaderStageInputAttribs::Semantic
const char *const Semantic
Definition: SPIRVShaderResources.hpp:133
Diligent::SPIRVShaderResources::GetTotalResources
Uint32 GetTotalResources() const noexcept
Definition: SPIRVShaderResources.hpp:170
Diligent::SPIRVShaderResources
Diligent::SPIRVShaderResources class.
Definition: SPIRVShaderResources.hpp:139
Diligent::SPIRVShaderResources::ResourceCounters::NumInptAtts
Uint32 NumInptAtts
Definition: SPIRVShaderResources.hpp:202
Diligent::Uint32
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
Diligent::SHADER_TYPE_UNKNOWN
@ SHADER_TYPE_UNKNOWN
Unknown shader type.
Definition: GraphicsTypes.h:67
Diligent::SPIRVShaderResources::ProcessResources
void ProcessResources(THandler Handler) const
Definition: SPIRVShaderResources.hpp:286
Diligent::SPIRVShaderResources::GetAccelStruct
const SPIRVShaderResourceAttribs & GetAccelStruct(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:181
Diligent::SPIRVShaderResourceAttribs::UniformTexelBuffer
@ UniformTexelBuffer
Definition: SPIRVShaderResources.hpp:66
Diligent::SPIRVShaderResources::ResourceCounters::NumSmpldImgs
Uint32 NumSmpldImgs
Definition: SPIRVShaderResources.hpp:198
Diligent::SPIRVShaderResources::GetUB
const SPIRVShaderResourceAttribs & GetUB(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:173
Diligent::SPIRVShaderResources::ResourceCounters::NumUBs
Uint32 NumUBs
Definition: SPIRVShaderResources.hpp:195
Diligent::SPIRVShaderResources::GetShaderStageInputAttribs
const SPIRVShaderStageInputAttribs & GetShaderStageInputAttribs(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:186
Diligent::SPIRVShaderResourceAttribs::GetResourceDesc
ShaderResourceDesc GetResourceDesc() const
Definition: SPIRVShaderResources.hpp:106
Diligent::SPIRVShaderResourceAttribs::Name
const char *const Name
Definition: SPIRVShaderResources.hpp:82
Diligent::IMemoryAllocator
Base interface for a raw memory allocator.
Definition: MemoryAllocator.h:41
Diligent::SPIRVShaderResources::GetNumUBs
Uint32 GetNumUBs() const noexcept
Definition: SPIRVShaderResources.hpp:161
Diligent::SPIRVShaderResourceAttribs::IsMultisample
bool IsMultisample() const
Definition: SPIRVShaderResources.hpp:116
Diligent::SPIRVShaderResources::GetNumSepSmplrs
Uint32 GetNumSepSmplrs() const noexcept
Definition: SPIRVShaderResources.hpp:166
Diligent::SPIRVShaderResourceAttribs::ResourceType
ResourceType
Definition: SPIRVShaderResources.hpp:61
Diligent::SPIRVShaderResourceAttribs::StorageTexelBuffer
@ StorageTexelBuffer
Definition: SPIRVShaderResources.hpp:67
Diligent::Uint16
uint16_t Uint16
16-bit unsigned integer
Definition: BasicTypes.h:52
Diligent::ShaderResourceDesc
Shader resource description.
Definition: Shader.h:390
Diligent::SPIRVShaderResourceAttribs::StorageImage
@ StorageImage
Definition: SPIRVShaderResources.hpp:68
Diligent::Uint8
uint8_t Uint8
8-bit unsigned integer
Definition: BasicTypes.h:53
Diligent::SPIRVShaderResources::GetResource
const SPIRVShaderResourceAttribs & GetResource(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:182
VERIFY_EXPR
#define VERIFY_EXPR(...)
Definition: DebugUtilities.hpp:79
Diligent::SPIRVShaderResourceAttribs::BufferStaticSize
const Uint32 BufferStaticSize
Definition: SPIRVShaderResources.hpp:92
StringPool.hpp
RefCntAutoPtr.hpp
VERIFY
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
Diligent::StringPool
Implementation of a simple fixed-size string pool.
Definition: StringPool.hpp:42
Diligent::SPIRVShaderResourceAttribs::UniformBuffer
@ UniformBuffer
Definition: SPIRVShaderResources.hpp:63
Diligent::SPIRVShaderResources::GetCombinedSamplerSuffix
const char * GetCombinedSamplerSuffix() const
Definition: SPIRVShaderResources.hpp:299
Diligent::SPIRVShaderResourceAttribs::GetResourceDimension
RESOURCE_DIMENSION GetResourceDimension() const
Definition: SPIRVShaderResources.hpp:111
Diligent::SPIRVShaderResourceAttribs::Type
const ResourceType Type
Definition: SPIRVShaderResources.hpp:84
Diligent::SPIRVShaderResources::GetImg
const SPIRVShaderResourceAttribs & GetImg(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:175
Diligent::SPIRVShaderResourceAttribs::ArraySize
const Uint16 ArraySize
Definition: SPIRVShaderResources.hpp:83
Diligent::RESOURCE_DIMENSION
RESOURCE_DIMENSION
Describes resource dimension.
Definition: GraphicsTypes.h:256
Diligent::SPIRVShaderResources::ResourceCounters::NumImgs
Uint32 NumImgs
Definition: SPIRVShaderResources.hpp:197
Diligent::SPIRVShaderResources::GetSepSmplr
const SPIRVShaderResourceAttribs & GetSepSmplr(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:178
Diligent::SPIRVShaderResources::ResourceCounters::NumAccelStructs
Uint32 NumAccelStructs
Definition: SPIRVShaderResources.hpp:203
Diligent::SPIRVShaderResources::GetSepImg
const SPIRVShaderResourceAttribs & GetSepImg(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:179
Diligent::SPIRVShaderResources::GetNumInptAtts
Uint32 GetNumInptAtts() const noexcept
Definition: SPIRVShaderResources.hpp:168
Diligent::SPIRVShaderResources::operator=
SPIRVShaderResources & operator=(const SPIRVShaderResources &)=delete
Diligent::SPIRVShaderResources::GetNumShaderStageInputs
Uint32 GetNumShaderStageInputs() const noexcept
Definition: SPIRVShaderResources.hpp:171
Diligent::SPIRVShaderStageInputAttribs
Definition: SPIRVShaderResources.hpp:124
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
Diligent::SPIRVShaderResources::ProcessResources
void ProcessResources(THandleUB HandleUB, THandleSB HandleSB, THandleImg HandleImg, THandleSmplImg HandleSmplImg, THandleAC HandleAC, THandleSepSmpl HandleSepSmpl, THandleSepImg HandleSepImg, THandleInptAtt HandleInptAtt, THandleAccelStruct HandleAccelStruct) const
Definition: SPIRVShaderResources.hpp:218
Diligent::SPIRVShaderResources::GetSB
const SPIRVShaderResourceAttribs & GetSB(Uint32 n) const noexcept
Definition: SPIRVShaderResources.hpp:174