AnsweredAssumed Answered

Freeing memory after glTexDirectVIVMap

Question asked by Fabien GAIDDON on Apr 25, 2018
Latest reply on Apr 30, 2018 by Fabien GAIDDON

Hi all,

 

I am using an iMX6.Quad

I need to load quickly some 2048x2048 textures into the GPU Mem and the glTexDirectVIVMap extension is perfect for this purpose (Note: once in the GPU Mem, those textures do not need some refresh).

 

I am not sure about how to release the memory.

What am I doing is:

 

uchar* pData = new uchar[memsize]; //pData is 64bits aligned

GLuint iPhysical = ~0U;

 

[...] // Filling pData with some data

 

glGenTextures(1, &iTex);

glBindTexture(GL_TEXTURE_2D, iTex);

 

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

 

glTexDirectVIVMap(GL_TEXTURE_2D, 2048, 2048, GL_VIV_UYVY, (GLvoid**)&pData, &iPhysical);

glTexDirectInvalidateVIV(GL_TEXTURE_2D);

 

[...] // Using the texture with some GL instructions

 

 

It is working pretty well.

When the texture need to be released, I am just deleting it with: delete[] pData.

 

The question is:

Do I need to call glDeleteTextures(1, &iTex) to tell the GLES2 engine that the texture does not exist anymore? Or How can I be sure that the GPU wont use this shared memory space anymore?

 

Since I am using glTexDirectVIVMap, instead of glTexImage2D, my app crash because of the memory used.

 

Thank you for your help.

 

Fabien

Outcomes