Freeing memory after glTexDirectVIVMap

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Freeing memory after glTexDirectVIVMap

689 Views
gsoft
Contributor I

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

Labels (1)
Tags (1)
0 Kudos
2 Replies

447 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi Fabien,

I guess this going to help you.

https://community.nxp.com/thread/433086 

0 Kudos

447 Views
gsoft
Contributor I

Hi,

Thank you for your reply. Yes indeed, the crash seems to be related with the memory leak of the 3.0.35. We are currently patching our kernel to check if the problem is fixed.

Beyond the memory leak, what is the best way to release the memory after a glTexDirectVIVMAP? Should the memory be released with glDeleteTexures or with delete [] or with both?

Fabien

0 Kudos