SpiecsEngine
 
Loading...
Searching...
No Matches

◆ Registry()

uint32_t Spices::BindLessTextureManager::Registry ( const std::string & name)
static

Registry a texture to bind less texture descriptor set array index.

Return ID if texture already registry.

Find a empty slot to store texture.

Return ID if texture already registry.

Find a empty slot to store texture.

Definition at line 18 of file BindLessTextureManager.cpp.

19 {
21
22 std::unique_lock<std::mutex> lock(m_Mutex);
23
27 if (m_TextureIDMap.find(name) != m_TextureIDMap.end())
28 {
29 return m_TextureIDMap[name];
30 }
31
35 else
36 {
37 for (uint32_t i = 0; i < SpicesShader::BINDLESS_TEXTURE_MAXNUM; i++)
38 {
39 if (m_TextureInfoMap.find(i) == m_TextureInfoMap.end())
40 {
41 m_TextureInfoMap[i] = "";
42 m_TextureIDMap[name] = i;
43 return i;
44 }
45 }
46
47 SPICES_CORE_ERROR("Up to Maxium Bindless Texture Number : 65536")
48
49 return 0;
50 }
51 }
#define SPICES_PROFILE_ZONE
static std::unordered_map< uint32_t, std::string > m_TextureInfoMap
Hashmap of array index and "".
static std::mutex m_Mutex
Mutex of this BindLessTextureManager.
static std::unordered_map< std::string, uint32_t > m_TextureIDMap
Hashmap of texture path and array index.