// test data brick
class Brick
{
public:
Brick() { data = new U32[27]; }
virtual ~Brick() { delete[] data; }
U32* data;
};
Texture3D* OctreeMipmapper::GenerateBrickTexture()
{
auto ret = new Texture3D();
ret->Initialize();
ret->Storage(GL_R32UI, SV3(g_brickSize)); // g_brickSize = 3u, SV3 is a 3d-signed-int-vec
ret->SetScaleFilter(GL_LINEAR, GL_LINEAR);
ret->SetWrapFilter(GL_CLAMP_TO_BORDER);
ret->SetBorderColorIiv(SV4{ 0u, 0u, 0u, 0u });
//ret->GenerateBindlessImageHandle(GL_R32UI);
return ret;
}
void OctreeMipmapper::InitOctreeBrick()
{
auto texNum = m_octree->GetTexNum(); // texNum = 600000u
m_albedoBricks.resize(texNum);
m_normalBricks.resize(texNum);
m_bricks.resize(texNum);
for (U32 i = 0u; i < texNum; ++i)
{
m_bricks[i] = new Brick();
m_albedoBricks[i] = GenerateBrickTexture();
//m_normalBricks[i] = GenerateBrickTexture();
}
}
Above is my source code, as you can see, the amount of bricks vector is 600000, and the texture is a 3d-single-channel texture with 27 texel(3 * 3 * 3). So, the data size is 600000 * 27 * 4 bytes = 64MB. But when i run the code, the memory usage of these textures is over 3GB, it make me confused. I wanna what opengl has done in glTextureStorage3D function