PDA

View Full Version : glTexImage3D memory size problem on AMD gpu



BalazsBago
09-30-2014, 05:22 AM
Hello,

i have a strange issue with memory usage of glTexImage3D on AMD video cards.
The uploaded texture use much more memory than it's size.
I have tested with texture 512x512x512(Short).
Memory size readed by : GPU-Z / Process Explorer

Size:
AMD -> ~500 MB
NVidia / Intel -> ~260MB

My code for uploading :
gl.glBindTexture(GL2.GL_TEXTURE_3D, volumeTexturID);

gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_GENERATE_MIPMAP, GL2.GL_FALSE);
gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_MAX_LEVEL, 0);
gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_BASE_LEVEL, 0);

gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP_TO_EDGE);
gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP_TO_EDGE);
gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_WRAP_R, GL2.GL_CLAMP_TO_EDGE);

gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);

gl.glTexImage3D(GL2.GL_TEXTURE_3D, 0, GL2.GL_R16_SNORM, w, h, d, 0, GL2.GL_RED, GL2.GL_SHORT, data.rewind());
gl.glBindTexture(GL2.GL_TEXTURE_3D, 0);


Any ideas why AMD use more memory?

mhagain
09-30-2014, 05:31 AM
The AMD usage being ~twice that of the others is suspicious, and suggests that the AMD driver is doing something like keeping a second copy of the texture in system RAM. Without knowing the driver internals it's hard to say any more.