invor

Call to glTexStorage3D causes excessive system memory usage

Discussion created by invor on Jul 21, 2017
Latest reply on Jul 11, 2019 by dorisyan

Hi all,

 

using more than a single (mipmap) level in a call to glTexStorage3D() to allocate storage for a 2D texture array causes my application to use a huge amount of system memory. For example, after creating a texture with a resoultion of 64x64 texels and 2048 layers, using GL_RGBA8 and 7 levels for a full mipmap chain, my application's RAM usage goes up to nearly 1.7GB, which I believe is about 25x the theoretical size of the texture! This is the call I use is:

 

glTexStorage3D(GL_TEXTURE_2D_ARRAY, 7, GL_RGBA8, 64, 64, 2048);

 

I have attached the source code of a minimal application that reproduces the issue. I'm using a RX480 and driver version 17.7.1 (on Windows 10).

 

A few observations I have made so far:

- using only 1 level but the same resolution and layer count hardly uses any RAM at all (certainly less than a 1/7 at the very least)

- RAM usage doesn't seem to further increase with increasing texture size (tested from 64x64 to 256x256 using different internal formats)

- trying to create anything larger than 256x256x2048 and 7 levels crashes my application

- a call to glTexStorage3D with GL_TEXTURE_3D (still using 7 mipmap levels and the same resolution) hardly uses any RAM at all

- running the code on an NVIDIA GeForce 970 or 840m doesn't cause this huge RAM usage

 

So am I provoking this behaviour somehow, or is there something weird going in the driver? In my current research work I need to create up to a few hundred texture arrays so I'm running out of RAM fast at the moment. Any help or hints are greatly appreciated!

 

Cheers,

Attachments

Outcomes