Go to the documentation of this file.
84 Uint32 _ArraySize) noexcept :
94 VERIFY(_ArraySize >= 1,
"Array size must be greater than 1");
102 NamesPool.CopyString(Attribs.Name),
104 Attribs.ResourceType,
133 GLuint _UBIndex)noexcept :
147 static_assert((
sizeof(
UniformBufferInfo) %
sizeof(
void*)) == 0,
"sizeof(UniformBufferInfo) must be multiple of sizeof(void*)");
164 bool _IsMultisample) noexcept :
184 static_assert((
sizeof(
TextureInfo) %
sizeof(
void*)) == 0,
"sizeof(TextureInfo) must be multiple of sizeof(void*)");
201 bool _IsMultisample) noexcept :
221 static_assert((
sizeof(
ImageInfo) %
sizeof(
void*)) == 0,
"sizeof(ImageInfo) must be multiple of sizeof(void*)");
236 GLint _SBIndex)noexcept :
250 static_assert((
sizeof(
StorageBlockInfo) %
sizeof(
void*)) == 0,
"sizeof(StorageBlockInfo) must be multiple of sizeof(void*)");
262 VERIFY(Index < m_NumUniformBuffers,
"Uniform buffer index (", Index,
") is out of range");
263 return m_UniformBuffers[Index];
268 VERIFY(Index < m_NumTextures,
"Texture index (", Index,
") is out of range");
269 return m_Textures[Index];
274 VERIFY(Index < m_NumImages,
"Image index (", Index,
") is out of range");
275 return m_Images[Index];
280 VERIFY(Index < m_NumStorageBlocks,
"Storage block index (", Index,
") is out of range");
281 return m_StorageBlocks[Index];
287 VERIFY(Index < m_NumUniformBuffers,
"Uniform buffer index (", Index,
") is out of range");
288 return m_UniformBuffers[Index];
293 VERIFY(Index < m_NumTextures,
"Texture index (", Index,
") is out of range");
294 return m_Textures[Index];
299 VERIFY(Index < m_NumImages,
"Image index (", Index,
") is out of range");
300 return m_Images[Index];
305 VERIFY(Index < m_NumStorageBlocks,
"Storage block index (", Index,
") is out of range");
306 return m_StorageBlocks[Index];
311 return m_NumUniformBuffers + m_NumTextures + m_NumImages + m_NumStorageBlocks;
318 template <
typename THandleUB,
319 typename THandleTexture,
323 THandleTexture HandleTexture,
324 THandleImg HandleImg,
328 Uint32 NumAllowedTypes = 0)
const
332 auto CheckResourceType = [&](
const char* Name)
334 if (pResourceLayout ==
nullptr)
343 for (
Uint32 ub = 0; ub < m_NumUniformBuffers; ++ub)
346 if (CheckResourceType(UB.Name))
350 for (
Uint32 s = 0; s < m_NumTextures; ++s)
353 if (CheckResourceType(Sam.Name))
357 for (
Uint32 img = 0; img < m_NumImages; ++img)
360 if (CheckResourceType(Img.Name))
364 for (
Uint32 sb = 0; sb < m_NumStorageBlocks; ++sb)
367 if (CheckResourceType(SB.Name))
372 template <
typename THandleUB,
373 typename THandleTexture,
377 THandleTexture HandleTexture,
378 THandleImg HandleImg,
381 for (
Uint32 ub = 0; ub < m_NumUniformBuffers; ++ub)
384 for (
Uint32 s = 0; s < m_NumTextures; ++s)
387 for (
Uint32 img = 0; img < m_NumImages; ++img)
390 for (
Uint32 sb = 0; sb < m_NumStorageBlocks; ++sb)
395 void AllocateResources(std::vector<UniformBufferInfo>& UniformBlocks,
396 std::vector<TextureInfo>& Textures,
397 std::vector<ImageInfo>& Images,
398 std::vector<StorageBlockInfo>& StorageBlocks);
409 UniformBufferInfo* m_UniformBuffers =
nullptr;
410 TextureInfo* m_Textures =
nullptr;
411 ImageInfo* m_Images =
nullptr;
412 StorageBlockInfo* m_StorageBlocks =
nullptr;
414 Uint32 m_NumUniformBuffers = 0;
417 Uint32 m_NumStorageBlocks = 0;
TextureInfo & operator=(const TextureInfo &)=delete
SHADER_RESOURCE_TYPE Type
Shader resource type, see Diligent::SHADER_RESOURCE_TYPE.
Definition: Shader.h:410
Definition: ShaderResourcesGL.hpp:70
char Char
Definition: BasicTypes.h:64
Uint32 GetNumStorageBlocks() const
Definition: ShaderResourcesGL.hpp:257
const bool IsMultisample
Definition: ShaderResourcesGL.hpp:219
const SHADER_RESOURCE_TYPE ResourceType
Definition: ShaderResourcesGL.hpp:75
Uint32 ArraySize
Array size. For non-array resource this value is 1.
Definition: Shader.h:413
SHADER_TYPE
Describes the shader type.
Definition: GraphicsTypes.h:65
SHADER_RESOURCE_TYPE
Describes shader resource type.
Definition: Shader.h:356
const GLint SBIndex
Definition: ShaderResourcesGL.hpp:248
bool IsAllowedType(SHADER_RESOURCE_VARIABLE_TYPE VarType, Uint32 AllowedTypeBits) noexcept
Definition: ShaderResourceVariableBase.hpp:102
Uint32 GetAllowedTypeBits(const SHADER_RESOURCE_VARIABLE_TYPE *AllowedVarTypes, Uint32 NumAllowedTypes) noexcept
Definition: ShaderResourceVariableBase.hpp:112
void LoadUniforms(SHADER_TYPE ShaderStages, const GLObjectWrappers::GLProgramObj &GLProgram, class GLContextState &State)
Loads program uniforms and assigns bindings.
Definition: ShaderResourcesGL.cpp:209
ImageInfo & GetImage(Uint32 Index)
Definition: ShaderResourcesGL.hpp:272
const SHADER_TYPE ShaderStages
Definition: ShaderResourcesGL.hpp:74
const TextureInfo & GetTexture(Uint32 Index) const
Definition: ShaderResourcesGL.hpp:291
Uint32 GetVariableCount() const
Definition: ShaderResourcesGL.hpp:309
TextureInfo(const TextureInfo &)=delete
StorageBlockInfo & operator=(const StorageBlockInfo &)=delete
GLResourceAttribs(const Char *_Name, SHADER_TYPE _ShaderStages, SHADER_RESOURCE_TYPE _ResourceType, Uint32 _ArraySize) noexcept
Definition: ShaderResourcesGL.hpp:81
Uint32 ArraySize
Definition: ShaderResourcesGL.hpp:76
StorageBlockInfo(const Char *_Name, SHADER_TYPE _ShaderStages, SHADER_RESOURCE_TYPE _ResourceType, Uint32 _ArraySize, GLint _SBIndex) noexcept
Definition: ShaderResourcesGL.hpp:232
const bool IsMultisample
Definition: ShaderResourcesGL.hpp:182
Uint32 GetNumImages() const
Definition: ShaderResourcesGL.hpp:256
ImageInfo(const Char *_Name, SHADER_TYPE _ShaderStages, SHADER_RESOURCE_TYPE _ResourceType, Uint32 _ArraySize, GLenum _ImageType, RESOURCE_DIMENSION _ResourceDim, bool _IsMultisample) noexcept
Definition: ShaderResourcesGL.hpp:195
StorageBlockInfo(const StorageBlockInfo &)=delete
ShaderResourceDesc GetResourceDesc() const
Definition: ShaderResourcesGL.hpp:111
ImageInfo & operator=(const ImageInfo &)=delete
Uint32 GetNumUniformBuffers() const
Definition: ShaderResourcesGL.hpp:254
const UniformBufferInfo & GetUniformBuffer(Uint32 Index) const
Definition: ShaderResourcesGL.hpp:285
ImageInfo(const ImageInfo &Img, StringPool &NamesPool) noexcept
Definition: ShaderResourcesGL.hpp:208
Definition: ShaderResourcesGL.hpp:187
const GLenum TextureType
Definition: ShaderResourcesGL.hpp:180
~ShaderResourcesGL()
Definition: ShaderResourcesGL.cpp:177
const char * Name
Shader resource name.
Definition: Shader.h:407
const StorageBlockInfo & GetStorageBlock(Uint32 Index) const
Definition: ShaderResourcesGL.hpp:303
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
const RESOURCE_DIMENSION ResourceDim
Definition: ShaderResourcesGL.hpp:218
@ SHADER_TYPE_UNKNOWN
Unknown shader type.
Definition: GraphicsTypes.h:67
GLResourceAttribs(const GLResourceAttribs &Attribs, StringPool &NamesPool) noexcept
Definition: ShaderResourcesGL.hpp:97
SHADER_TYPE GetShaderStages() const
Definition: ShaderResourcesGL.hpp:316
Definition: ShaderResourcesGL.hpp:150
const ImageInfo & GetImage(Uint32 Index) const
Definition: ShaderResourcesGL.hpp:297
TextureInfo(const TextureInfo &Tex, StringPool &NamesPool) noexcept
Definition: ShaderResourcesGL.hpp:171
const Char * Name
Definition: ShaderResourcesGL.hpp:73
SHADER_RESOURCE_VARIABLE_TYPE GetShaderVariableType(SHADER_TYPE ShaderStage, SHADER_RESOURCE_VARIABLE_TYPE DefaultVariableType, const ShaderResourceVariableDesc *Variables, Uint32 NumVars, TNameCompare NameCompare)
Definition: ShaderResourceVariableBase.hpp:45
Uint32 GetNumTextures() const
Definition: ShaderResourcesGL.hpp:255
Shader resource description.
Definition: Shader.h:390
Definition: GLObjectWrapper.hpp:36
Definition: ShaderResourcesGL.hpp:224
Definition: GLContextState.hpp:39
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
StorageBlockInfo & GetStorageBlock(Uint32 Index)
Definition: ShaderResourcesGL.hpp:278
ShaderResourceDesc GetResourceDesc(Uint32 Index) const
Definition: ShaderResourcesGL.cpp:552
Implementation of a simple fixed-size string pool.
Definition: StringPool.hpp:42
TextureInfo & GetTexture(Uint32 Index)
Definition: ShaderResourcesGL.hpp:266
void ProcessConstResources(THandleUB HandleUB, THandleTexture HandleTexture, THandleImg HandleImg, THandleSB HandleSB, const PipelineResourceLayoutDesc *pResourceLayout=nullptr, const SHADER_RESOURCE_VARIABLE_TYPE *AllowedVarTypes=nullptr, Uint32 NumAllowedTypes=0) const
Definition: ShaderResourcesGL.hpp:322
RESOURCE_DIMENSION
Describes resource dimension.
Definition: GraphicsTypes.h:256
ImageInfo(const ImageInfo &)=delete
ShaderResourcesGL & operator=(const ShaderResourcesGL &)=delete
void ProcessResources(THandleUB HandleUB, THandleTexture HandleTexture, THandleImg HandleImg, THandleSB HandleSB)
Definition: ShaderResourcesGL.hpp:376
Definition: ShaderResourcesGL.hpp:52
UniformBufferInfo & GetUniformBuffer(Uint32 Index)
Definition: ShaderResourcesGL.hpp:260
@ SHADER_RESOURCE_TYPE_UNKNOWN
Shader resource type is unknown.
Definition: Shader.h:359
Pipeline layout description.
Definition: PipelineState.h:103
const RESOURCE_DIMENSION ResourceDim
Definition: ShaderResourcesGL.hpp:181
const GLenum ImageType
Definition: ShaderResourcesGL.hpp:217
StorageBlockInfo(const StorageBlockInfo &SB, StringPool &NamesPool) noexcept
Definition: ShaderResourcesGL.hpp:241
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
TextureInfo(const Char *_Name, SHADER_TYPE _ShaderStages, SHADER_RESOURCE_TYPE _ResourceType, Uint32 _ArraySize, GLenum _TextureType, RESOURCE_DIMENSION _ResourceDim, bool _IsMultisample) noexcept
Definition: ShaderResourcesGL.hpp:158
SHADER_RESOURCE_VARIABLE_TYPE
Describes the type of the shader resource variable.
Definition: ShaderResourceVariable.h:48
ShaderResourcesGL()
Definition: ShaderResourcesGL.hpp:55