/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace //Unnamed namespace
{
//Memory pool used to allocate new texture sets. Memory used by this pool will be released when shutting down DALi
-Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::TextureSet> gTextureSetMemoryPool;
+Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::TextureSet>& GetTextureSetMemoryPool()
+{
+ static Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::TextureSet> gTextureSetMemoryPool;
+ return gTextureSetMemoryPool;
+}
} // namespace
namespace Dali
{
TextureSet* TextureSet::New()
{
- return new(gTextureSetMemoryPool.AllocateRawThreadSafe()) TextureSet();
+ return new(GetTextureSetMemoryPool().AllocateRawThreadSafe()) TextureSet();
}
TextureSet::TextureSet()
void TextureSet::operator delete(void* ptr)
{
- gTextureSetMemoryPool.FreeThreadSafe(static_cast<TextureSet*>(ptr));
+ GetTextureSetMemoryPool().FreeThreadSafe(static_cast<TextureSet*>(ptr));
}
void TextureSet::SetSampler(uint32_t index, Render::Sampler* sampler)
}
mSamplers[index] = sampler;
+
+ if(index < static_cast<uint32_t>(mTextures.Size()))
+ {
+ mTextures[index]->SetUpdated(true);
+ }
}
-void TextureSet::SetTexture(uint32_t index, Render::Texture* texture)
+void TextureSet::SetTexture(uint32_t index, const Render::TextureKey& texture)
{
const uint32_t textureCount = static_cast<uint32_t>(mTextures.Size());
if(textureCount < index + 1)
for(uint32_t i(textureCount); i <= index; ++i)
{
- mTextures[i] = nullptr;
+ mTextures[i] = Render::TextureKey{};
if(!samplerExist)
{
if(texture)
{
mHasAlpha |= texture->HasAlphaChannel();
+ texture->SetUpdated(true);
}
}
return mHasAlpha;
}
+uint32_t TextureSet::GetMemoryPoolCapacity()
+{
+ return GetTextureSetMemoryPool().GetCapacity();
+}
+
} // namespace SceneGraph
} // namespace Internal