Go to the documentation of this file.
53 m_ContentType{ContentType}
99 pSampler = ValidatedCast<SamplerGLImpl>(pTexView->GetSampler());
102 pView = std::move(pTexView);
110 pView = std::move(pBufView);
127 GetUB(CacheOffset).
pBuffer = std::move(pBuff);
132 GetTexture(CacheOffset).
Set(std::move(pTexView),
SetSampler);
137 GetTexture(CacheOffset).
pSampler = ValidatedCast<SamplerGLImpl>(pSampler);
142 GetTexture(CacheOffset).
Set(std::move(pBuffView));
147 GetImage(CacheOffset).
Set(std::move(pTexView),
false);
152 GetImage(CacheOffset).
Set(std::move(pBuffView));
157 GetSSBO(CacheOffset).
pBufferView = std::move(pBuffView);
175 VERIFY_EXPR(dbgIsTextureView || Texture.pTexture ==
nullptr);
176 return Texture.pView;
185 VERIFY_EXPR(dbgIsTextureView || Image.pTexture ==
nullptr);
195 return SSBO.pBufferView;
207 VERIFY(CacheOffset <
GetUBCount(),
"Uniform buffer index (", CacheOffset,
") is out of range");
208 return reinterpret_cast<CachedUB*
>(m_pResourceData + m_UBsOffset)[CacheOffset];
214 return reinterpret_cast<CachedResourceView*
>(m_pResourceData + m_TexturesOffset)[CacheOffset];
219 VERIFY(CacheOffset <
GetImageCount(),
"Image buffer index (", CacheOffset,
") is out of range");
220 return reinterpret_cast<CachedResourceView*
>(m_pResourceData + m_ImagesOffset)[CacheOffset];
225 VERIFY(CacheOffset <
GetSSBOCount(),
"Shader storage block index (", CacheOffset,
") is out of range");
226 return reinterpret_cast<CachedSSBO*
>(m_pResourceData + m_SSBOsOffset)[CacheOffset];
231 return m_MemoryEndOffset != InvalidResourceOffset;
236 #ifdef DILIGENT_DEVELOPMENT
237 void SetStaticResourcesInitialized()
239 m_bStaticResourcesInitialized =
true;
241 bool StaticResourcesInitialized()
const {
return m_bStaticResourcesInitialized; }
245 const std::array<Uint16, 4>& BaseBindings,
246 std::vector<TextureBaseGL*>& WritableTextures,
247 std::vector<BufferGLImpl*>& WritableBuffers)
const;
250 CachedUB& GetUB(
Uint32 CacheOffset)
255 CachedResourceView& GetTexture(
Uint32 CacheOffset)
260 CachedResourceView& GetImage(
Uint32 CacheOffset)
265 CachedSSBO& GetSSBO(
Uint32 CacheOffset)
271 static constexpr
const Uint16 InvalidResourceOffset = 0xFFFF;
272 static constexpr
const Uint16 m_UBsOffset = 0;
274 Uint16 m_TexturesOffset = InvalidResourceOffset;
275 Uint16 m_ImagesOffset = InvalidResourceOffset;
276 Uint16 m_SSBOsOffset = InvalidResourceOffset;
277 Uint16 m_MemoryEndOffset = InvalidResourceOffset;
279 Uint8* m_pResourceData =
nullptr;
280 IMemoryAllocator* m_pAllocator =
nullptr;
285 #ifdef DILIGENT_DEVELOPMENT
286 bool m_bStaticResourcesInitialized =
false;
ResourceCacheContentType
The type of the content that is stored in the shader resource cache.
Definition: ShaderResourceCacheCommon.hpp:39
bool IsUBBound(Uint32 CacheOffset) const
Definition: ShaderResourceCacheGL.hpp:160
const CachedUB & GetConstUB(Uint32 CacheOffset) const
Definition: ShaderResourceCacheGL.hpp:205
Texture sampler interface.
Definition: Sampler.h:192
Uint32 GetUBCount() const
Definition: ShaderResourceCacheGL.hpp:199
RefCntAutoPtr< IDeviceObject > pView
We keep strong reference to the view instead of the reference to the texture or buffer because this i...
Definition: ShaderResourceCacheGL.hpp:80
TextureBaseGL * pTexture
Definition: ShaderResourceCacheGL.hpp:82
void SetSSBO(Uint32 CacheOffset, RefCntAutoPtr< BufferViewGLImpl > &&pBuffView)
Definition: ShaderResourceCacheGL.hpp:155
The class implements a cache that holds resources bound to a specific GL program.
Definition: ShaderResourceCacheGL.hpp:49
~ShaderResourceCacheGL()
Definition: ShaderResourceCacheGL.cpp:94
void SetTexImage(Uint32 CacheOffset, RefCntAutoPtr< TextureViewGLImpl > &&pTexView)
Definition: ShaderResourceCacheGL.hpp:145
Uint32 GetTextureCount() const
Definition: ShaderResourceCacheGL.hpp:200
void SetSampler(Uint32 CacheOffset, ISampler *pSampler)
Definition: ShaderResourceCacheGL.hpp:135
void Initialize(const TResourceCount &Count, IMemoryAllocator &MemAllocator)
Definition: ShaderResourceCacheGL.cpp:52
ResourceCacheContentType GetContentType() const
Definition: ShaderResourceCacheGL.hpp:234
void Set(RefCntAutoPtr< BufferViewGLImpl > &&pBufView)
Definition: ShaderResourceCacheGL.hpp:105
void SetBufImage(Uint32 CacheOffset, RefCntAutoPtr< BufferViewGLImpl > &&pBuffView)
Definition: ShaderResourceCacheGL.hpp:150
bool IsImageBound(Uint32 CacheOffset, bool dbgIsTextureView) const
Definition: ShaderResourceCacheGL.hpp:179
RefCntAutoPtr< BufferGLImpl > pBuffer
Strong reference to the buffer.
Definition: ShaderResourceCacheGL.hpp:69
Definition: ShaderResourceCacheGL.hpp:114
Describes a resource bound to a sampler or an image slot.
Definition: ShaderResourceCacheGL.hpp:73
CachedResourceView() noexcept
Definition: ShaderResourceCacheGL.hpp:88
bool IsTextureBound(Uint32 CacheOffset, bool dbgIsTextureView) const
Definition: ShaderResourceCacheGL.hpp:169
ShaderResourceCacheGL & operator=(const ShaderResourceCacheGL &)=delete
const CachedResourceView & GetConstTexture(Uint32 CacheOffset) const
Definition: ShaderResourceCacheGL.hpp:211
Template class that implements reference counting.
Definition: RefCntAutoPtr.hpp:73
Base implementation of a texture object in OpenGL backend.
Definition: TextureBaseGL.hpp:41
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
void BindResources(GLContextState &GLState, const std::array< Uint16, 4 > &BaseBindings, std::vector< TextureBaseGL * > &WritableTextures, std::vector< BufferGLImpl * > &WritableBuffers) const
Definition: ShaderResourceCacheGL.cpp:121
Buffer object implementation in OpenGL backend.
Definition: BufferGLImpl.hpp:41
SamplerGLImpl * pSampler
Definition: ShaderResourceCacheGL.hpp:86
Describes a resource bound to a uniform buffer or a shader storage block slot.
Definition: ShaderResourceCacheGL.hpp:66
const CachedResourceView & GetConstImage(Uint32 CacheOffset) const
Definition: ShaderResourceCacheGL.hpp:217
void SetUniformBuffer(Uint32 CacheOffset, RefCntAutoPtr< BufferGLImpl > &&pBuff)
Definition: ShaderResourceCacheGL.hpp:125
Base interface for a raw memory allocator.
Definition: MemoryAllocator.h:41
ShaderResourceCacheGL(ResourceCacheContentType ContentType) noexcept
Definition: ShaderResourceCacheGL.hpp:52
RefCntAutoPtr< BufferViewGLImpl > pBufferView
Strong reference to the buffer.
Definition: ShaderResourceCacheGL.hpp:117
uint16_t Uint16
16-bit unsigned integer
Definition: BasicTypes.h:52
void SetTexture(Uint32 CacheOffset, RefCntAutoPtr< TextureViewGLImpl > &&pTexView, bool SetSampler)
Definition: ShaderResourceCacheGL.hpp:130
static size_t GetRequriedMemorySize(const TResourceCount &ResCount)
Definition: ShaderResourceCacheGL.cpp:37
bool IsSSBOBound(Uint32 CacheOffset) const
Definition: ShaderResourceCacheGL.hpp:189
uint8_t Uint8
8-bit unsigned integer
Definition: BasicTypes.h:53
Uint32 GetSSBOCount() const
Definition: ShaderResourceCacheGL.hpp:202
bool IsInitialized() const
Definition: ShaderResourceCacheGL.hpp:229
#define VERIFY_EXPR(...)
Definition: DebugUtilities.hpp:79
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
Uint32 GetImageCount() const
Definition: ShaderResourceCacheGL.hpp:201
void SetTexelBuffer(Uint32 CacheOffset, RefCntAutoPtr< BufferViewGLImpl > &&pBuffView)
Definition: ShaderResourceCacheGL.hpp:140
const CachedSSBO & GetConstSSBO(Uint32 CacheOffset) const
Definition: ShaderResourceCacheGL.hpp:223
std::array< Uint16, 4 > TResourceCount
Definition: ShaderResourceCacheGL.hpp:120
Sampler implementation in OpenGL backend.
Definition: SamplerGLImpl.hpp:38
BufferGLImpl * pBuffer
Definition: ShaderResourceCacheGL.hpp:85
void Set(RefCntAutoPtr< TextureViewGLImpl > &&pTexView, bool SetSampler)
Definition: ShaderResourceCacheGL.hpp:90
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37