Go to the documentation of this file.
64 class PipelineResourceSignatureGLImpl;
72 m_ResourceCache{ResourceCache}
77 void Destroy(IMemoryAllocator& Allocator);
87 void Initialize(
const PipelineResourceSignatureGLImpl& Signature,
88 IMemoryAllocator& Allocator,
104 template <
typename ThisImplType>
204 template <
typename ResourceType>
207 VERIFY(ResIndex < GetNumResources<ResourceType>(),
"Resource index (", ResIndex,
") exceeds max allowed value (", GetNumResources<ResourceType>(),
")");
208 auto Offset = GetResourceOffset<ResourceType>();
209 return reinterpret_cast<const ResourceType*
>(
reinterpret_cast<const Uint8*
>(m_ResourceBuffer) + Offset)[ResIndex];
215 struct ResourceCounters
220 Uint32 NumStorageBlocks = 0;
222 static ResourceCounters CountResources(
const PipelineResourceSignatureGLImpl& Signature,
228 using OffsetType =
Uint16;
230 template <
typename ResourceType> OffsetType GetResourceOffset()
const;
232 template <
typename ResourceType>
233 ResourceType& GetResource(
Uint32 ResIndex)
const
235 VERIFY(ResIndex < GetNumResources<ResourceType>(),
"Resource index (", ResIndex,
") exceeds max allowed value (", GetNumResources<ResourceType>() - 1,
")");
236 auto Offset = GetResourceOffset<ResourceType>();
237 return reinterpret_cast<ResourceType*
>(
reinterpret_cast<Uint8*
>(m_ResourceBuffer) + Offset)[ResIndex];
240 template <
typename ResourceType>
241 IShaderResourceVariable* GetResourceByName(
const Char* Name)
const;
243 template <
typename THandleUB,
244 typename THandleTexture,
245 typename THandleImage,
246 typename THandleStorageBuffer>
247 void HandleResources(THandleUB HandleUB,
248 THandleTexture HandleTexture,
249 THandleImage HandleImage,
250 THandleStorageBuffer HandleStorageBuffer)
252 for (
Uint32 ub = 0; ub < GetNumResources<UniformBuffBindInfo>(); ++ub)
253 HandleUB(GetResource<UniformBuffBindInfo>(ub));
255 for (
Uint32 s = 0; s < GetNumResources<TextureBindInfo>(); ++s)
256 HandleTexture(GetResource<TextureBindInfo>(s));
258 for (
Uint32 i = 0; i < GetNumResources<ImageBindInfo>(); ++i)
259 HandleImage(GetResource<ImageBindInfo>(i));
261 for (
Uint32 s = 0; s < GetNumResources<StorageBufferBindInfo>(); ++s)
262 HandleStorageBuffer(GetResource<StorageBufferBindInfo>(s));
265 template <
typename THandleUB,
266 typename THandleTexture,
267 typename THandleImage,
268 typename THandleStorageBuffer>
269 void HandleConstResources(THandleUB HandleUB,
270 THandleTexture HandleTexture,
271 THandleImage HandleImage,
272 THandleStorageBuffer HandleStorageBuffer)
const
274 for (
Uint32 ub = 0; ub < GetNumResources<UniformBuffBindInfo>(); ++ub)
275 HandleUB(GetConstResource<UniformBuffBindInfo>(ub));
277 for (
Uint32 s = 0; s < GetNumResources<TextureBindInfo>(); ++s)
278 HandleTexture(GetConstResource<TextureBindInfo>(s));
280 for (
Uint32 i = 0; i < GetNumResources<ImageBindInfo>(); ++i)
281 HandleImage(GetConstResource<ImageBindInfo>(i));
283 for (
Uint32 s = 0; s < GetNumResources<StorageBufferBindInfo>(); ++s)
284 HandleStorageBuffer(GetConstResource<StorageBufferBindInfo>(s));
297 void* m_ResourceBuffer =
nullptr;
299 static constexpr OffsetType m_UBOffset = 0;
300 OffsetType m_TextureOffset = 0;
301 OffsetType m_ImageOffset = 0;
302 OffsetType m_StorageBufferOffset = 0;
303 OffsetType m_VariableEndOffset = 0;
305 #ifdef DILIGENT_DEBUG
312 inline Uint32 ShaderVariableManagerGL::GetNumResources<ShaderVariableManagerGL::UniformBuffBindInfo>()
const
318 inline Uint32 ShaderVariableManagerGL::GetNumResources<ShaderVariableManagerGL::TextureBindInfo>()
const
320 return GetNumTextures();
324 inline Uint32 ShaderVariableManagerGL::GetNumResources<ShaderVariableManagerGL::ImageBindInfo>()
const
326 return GetNumImages();
330 inline Uint32 ShaderVariableManagerGL::GetNumResources<ShaderVariableManagerGL::StorageBufferBindInfo>()
const
332 return GetNumStorageBuffers();
338 inline ShaderVariableManagerGL::OffsetType ShaderVariableManagerGL::
339 GetResourceOffset<ShaderVariableManagerGL::UniformBuffBindInfo>()
const
345 inline ShaderVariableManagerGL::OffsetType ShaderVariableManagerGL::
346 GetResourceOffset<ShaderVariableManagerGL::TextureBindInfo>()
const
348 return m_TextureOffset;
352 inline ShaderVariableManagerGL::OffsetType ShaderVariableManagerGL::
353 GetResourceOffset<ShaderVariableManagerGL::ImageBindInfo>()
const
355 return m_ImageOffset;
359 inline ShaderVariableManagerGL::OffsetType ShaderVariableManagerGL::
360 GetResourceOffset<ShaderVariableManagerGL::StorageBufferBindInfo>()
const
362 return m_StorageBufferOffset;
void Initialize(const PipelineResourceSignatureGLImpl &Signature, IMemoryAllocator &Allocator, const SHADER_RESOURCE_VARIABLE_TYPE *AllowedVarTypes, Uint32 NumAllowedTypes, SHADER_TYPE ShaderType)
Definition: ShaderVariableManagerGL.cpp:90
void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex)
Definition: ShaderVariableManagerGL.cpp:233
void Destroy(IMemoryAllocator &Allocator)
Definition: ShaderVariableManagerGL.cpp:182
Implementation of the Diligent::PipelineResourceSignatureGLImpl class.
Definition: PipelineResourceSignatureGLImpl.hpp:63
Uint32 GetNumStorageBuffers() const
Definition: ShaderVariableManagerGL.hpp:199
Base implementation of a shader variable.
Definition: ShaderResourceVariableBase.hpp:524
Shader resource variable.
Definition: ShaderResourceVariable.h:117
char Char
Definition: BasicTypes.h:64
bool IsUBBound(Uint32 CacheOffset) const
Definition: ShaderResourceCacheGL.hpp:160
SHADER_TYPE
Describes the shader type.
Definition: GraphicsTypes.h:65
@ SHADER_RESOURCE_TYPE_TEXTURE_SRV
Shader resource view of a texture (sampled image)
Definition: Shader.h:365
Uint32 Flags
Definition: DXBCUtils.cpp:71
ImageBindInfo(ShaderVariableManagerGL &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerGL.hpp:152
Base interface for all dynamic objects in the engine.
Definition: Object.h:41
Definition: ShaderVariableManagerGL.hpp:105
IObject & GetOwner()
Definition: ShaderVariableManagerGL.hpp:188
Uint32 GetVariableIndex(const IShaderResourceVariable &Var) const
Definition: ShaderVariableManagerGL.cpp:538
Uint32 GetNumResources() const
void BindResources(IResourceMapping *pResourceMapping, Uint32 Flags)
Definition: ShaderVariableManagerGL.cpp:386
Uint32 GetNumUBs() const
Definition: ShaderVariableManagerGL.hpp:196
Uint32 GetVariableCount() const
Definition: ShaderVariableManagerGL.hpp:190
Definition: ShaderVariableManagerGL.hpp:168
The class implements a cache that holds resources bound to a specific GL program.
Definition: ShaderResourceCacheGL.hpp:49
Definition: PipelineResourceAttribsGL.hpp:41
Definition: ShaderVariableManagerD3D11.cpp:627
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:52
Definition: ShaderVariableManagerGL.hpp:150
@ SHADER_RESOURCE_TYPE_INPUT_ATTACHMENT
Input attachment in a render pass.
Definition: Shader.h:380
Definition: ShaderVariableManagerGL.hpp:132
const PipelineResourceDesc & GetDesc() const
Definition: ShaderResourceVariableBase.hpp:626
bool IsImageBound(Uint32 CacheOffset, bool dbgIsTextureView) const
Definition: ShaderResourceCacheGL.hpp:179
const ResourceAttribs & GetAttribs() const
Definition: ShaderVariableManagerGL.hpp:112
Uint32 GetNumImages() const
Definition: ShaderVariableManagerGL.hpp:198
Definition: ShaderVariableManagerD3D11.cpp:548
bool IsTextureBound(Uint32 CacheOffset, bool dbgIsTextureView) const
Definition: ShaderResourceCacheGL.hpp:169
Definition: ShaderVariableManagerGL.hpp:67
virtual bool IsBound(Uint32 ArrayIndex) const override final
Definition: ShaderVariableManagerGL.hpp:176
#define DILIGENT_CALL_TYPE
Definition: CommonDefinitions.h:45
Pipeline resource description.
Definition: PipelineResourceSignature.h:120
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
TextureBindInfo(ShaderVariableManagerGL &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerGL.hpp:134
static size_t GetRequiredMemorySize(const PipelineResourceSignatureGLImpl &Signature, const SHADER_RESOURCE_VARIABLE_TYPE *AllowedVarTypes, Uint32 NumAllowedTypes, SHADER_TYPE ShaderType)
Definition: ShaderVariableManagerGL.cpp:74
@ SHADER_RESOURCE_TYPE_TEXTURE_UAV
Unordered access view of a texture (sotrage image)
Definition: Shader.h:371
void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex)
Definition: ShaderVariableManagerGL.cpp:354
Uint32 GetNumTextures() const
Definition: ShaderVariableManagerGL.hpp:197
virtual bool IsBound(Uint32 ArrayIndex) const override final
Definition: ShaderVariableManagerGL.hpp:158
const ResourceType & GetConstResource(Uint32 ResIndex) const
Definition: ShaderVariableManagerGL.hpp:205
const Uint32 CacheOffset
Definition: PipelineResourceAttribsGL.hpp:52
ShaderVariableManagerGL & operator=(const ShaderVariableManagerGL &)=delete
Base interface for a raw memory allocator.
Definition: MemoryAllocator.h:41
ShaderVariableManagerGL(IObject &Owner, ShaderResourceCacheGL &ResourceCache) noexcept
Definition: ShaderVariableManagerGL.hpp:70
uint16_t Uint16
16-bit unsigned integer
Definition: BasicTypes.h:52
virtual bool IsBound(Uint32 ArrayIndex) const override final
Definition: ShaderVariableManagerGL.hpp:140
bool IsSSBOBound(Uint32 CacheOffset) const
Definition: ShaderResourceCacheGL.hpp:189
uint8_t Uint8
8-bit unsigned integer
Definition: BasicTypes.h:53
const Uint32 m_ResIndex
Definition: ShaderResourceVariableBase.hpp:633
#define VERIFY_EXPR(...)
Definition: DebugUtilities.hpp:79
StorageBufferBindInfo(ShaderVariableManagerGL &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerGL.hpp:170
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
void BindResource(IDeviceObject *pObject, Uint32 ArrayIndex)
Definition: ShaderVariableManagerGL.cpp:298
const PipelineResourceDesc & GetResourceDesc(Uint32 Index) const
Definition: ShaderVariableManagerGL.cpp:564
IShaderResourceVariable * GetVariable(const Char *Name) const
Definition: ShaderVariableManagerGL.cpp:429
Uint16 ShaderType
Definition: DXBCUtils.cpp:70
GLVariableBase(ShaderVariableManagerGL &ParentLayout, Uint32 ResIndex)
Definition: ShaderVariableManagerGL.hpp:108
ShaderVariableManagerGL & m_ParentManager
Definition: ShaderResourceVariableBase.hpp:630
~ShaderVariableManagerGL()
Definition: ShaderVariableManagerGL.cpp:177
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
const ResourceAttribs & GetResourceAttribs(Uint32 Index) const
Definition: ShaderVariableManagerGL.cpp:570
SHADER_RESOURCE_VARIABLE_TYPE
Describes the type of the shader resource variable.
Definition: ShaderResourceVariable.h:48
Resouce mapping.
Definition: ResourceMapping.h:107