How to accurately compute the memory used by a texture ?
I do the following (for RGB 2D textures):
{
GLint red, green, blue, alpha, width, height;
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width
);
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT,
&height );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &red
);
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE,
&green );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE,
&blue );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE,
&alpha );
int nPixelMemorySize = ( red + green + blue + alpha );
int nTextureMemoryUsage = ( width * height ) * nPixelMemorySize / 8;
}
but it looks like it takes more memory than this is used (if I can
trust the Windows Task Manager !)
Any hints ?
|
|
0
|
|
|
|
Reply
|
jaz
|
1/22/2004 10:29:16 AM |
|
jaymz wrote:
> How to accurately compute the memory used by a texture ?
>
There's all sorts of complications, including mipmapping,
and anisotropic filtering.
> but it looks like it takes more memory than this is used (if I can
> trust the Windows Task Manager !)
>
LOL!
He said "trust the Windows Task Manager"!!!
--
<\___/> For email, remove my socks.
/ O O \
\_____/ FTB. Why isn't there mouse-flavored cat food?
|
|
0
|
|
|
|
Reply
|
fungus
|
1/22/2004 10:52:05 AM
|
|
"jaymz" <jaz@boursorama.com> wrote in message
news:b27c2a59.0401220229.5455562d@posting.google.com...
> How to accurately compute the memory used by a texture ?
> I do the following (for RGB 2D textures):
> {
> GLint red, green, blue, alpha, width, height;
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width
> );
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT,
> &height );
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &red
> );
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE,
> &green );
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE,
> &blue );
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE,
> &alpha );
> int nPixelMemorySize = ( red + green + blue + alpha );
> int nTextureMemoryUsage = ( width * height ) * nPixelMemorySize / 8;
> }
>
> but it looks like it takes more memory than this is used (if I can
> trust the Windows Task Manager !)
>
> Any hints ?
yes, dont trust Task Manager!
Allan
|
|
0
|
|
|
|
Reply
|
Allan
|
1/22/2004 11:23:07 AM
|
|
> but it looks like it takes more memory than this is used (if I can
> trust the Windows Task Manager !)
how do you seperate texture memory usage from the memory used by the rest of
your application in task manager???
regards,
severin
|
|
0
|
|
|
|
Reply
|
Severin
|
1/22/2004 3:34:25 PM
|
|
"jaymz" <jaz@boursorama.com> wrote in message
news:b27c2a59.0401220229.5455562d@posting.google.com...
> How to accurately compute the memory used by a texture ?
> I do the following (for RGB 2D textures):
> {
> GLint red, green, blue, alpha, width, height;
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width
> );
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT,
> &height );
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &red
> );
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE,
> &green );
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE,
> &blue );
> glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE,
> &alpha );
> int nPixelMemorySize = ( red + green + blue + alpha );
> int nTextureMemoryUsage = ( width * height ) * nPixelMemorySize / 8;
> }
>
> but it looks like it takes more memory than this is used (if I can
> trust the Windows Task Manager !)
>
> Any hints ?
Don't mess with it... It depends on driver. Some OpenGL implementations make
copy of texture in system memory. Memory usage can be twice more than you
expect.
yooyo
|
|
0
|
|
|
|
Reply
|
news
|
1/22/2004 3:41:09 PM
|
|
news.individual.net wrote:
>
> Don't mess with it... It depends on driver.
Yep.
> Some OpenGL implementations make
> copy of texture in system memory.
Ummm...make that "all of them. OpenGL needs to be able
to re-upload the texture to the graphics card if the
texture is lost for any reason (texture paging, other
programs using the graphics card, etc).
--
<\___/> For email, remove my socks.
/ O O \
\_____/ FTB. Why isn't there mouse-flavored cat food?
|
|
0
|
|
|
|
Reply
|
fungus
|
1/22/2004 11:54:11 PM
|
|
The problem is that I have a 3D texture cache. And I want to know when
to flush it, that means when the amount of memory used by 3D texture
reach a certain level, to avoid swapping memory to disk.
For that, I need to know how much one texture cost in main memory
(let's say I don't care about the on-board memory, it's a bonus)
When I ask openGL (as detailed in the first message), I get an
estimate of memory, but when I create the texture, the f*** task
manager shows that more memory is really used. And it looks almost
real, as Windows start swapping although my cache is not yet full (and
its size is 30% of system RAM, so it should fit as it's the only app
running)
So, whatever the driver or texture configuration (in my case, I do not
use mimapping or anything else), as I want to ask the driver how much
memory it took for a given texture.
That's it...
No one ever used a 3D texture cache ?
|
|
0
|
|
|
|
Reply
|
jaz
|
1/23/2004 8:32:04 AM
|
|
jaymz wrote:
> The problem is that I have a 3D texture cache. And I want to know when
> to flush it, that means when the amount of memory used by 3D texture
> reach a certain level, to avoid swapping memory to disk.
> For that, I need to know how much one texture cost in main memory
> (let's say I don't care about the on-board memory, it's a bonus)
> When I ask openGL (as detailed in the first message), I get an
> estimate of memory, but when I create the texture, the f*** task
> manager shows that more memory is really used. And it looks almost
> real, as Windows start swapping although my cache is not yet full (and
> its size is 30% of system RAM, so it should fit as it's the only app
> running)
>
> So, whatever the driver or texture configuration (in my case, I do not
> use mimapping or anything else), as I want to ask the driver how much
> memory it took for a given texture.
> That's it...
> No one ever used a 3D texture cache ?
If you're concernd about swapping, why not just not set the heap of the
application to non swapable and watch the free heap space.
Wolfgang
|
|
0
|
|
|
|
Reply
|
Wolfgang
|
1/23/2004 5:18:08 PM
|
|
|
7 Replies
232 Views
(page loaded in 0.554 seconds)
Similiar Articles: Texture memory usage - comp.graphics.api.openglHow to accurately compute the memory used by a texture ? I do the following (for RGB 2D textures): { GLint red, green, blue, alpha, width, height; g... Memory usage - comp.lang.c++Texture memory usage - comp.graphics.api.opengl How to accurately compute the memory used by a texture ? I do the following (for RGB 2D textures): { GLint red, green, blue ... is there an API to get the memory usage of my program - comp.unix ...float vs double? - comp.graphics.api.opengl Texture memory usage - comp.graphics.api.opengl is there an API to get the memory usage of my program - comp.unix ... float vs ... memory consumption - comp.unix.solarisTexture memory usage - comp.graphics.api.opengl How to accurately compute the memory used by a texture ? I do the following (for RGB 2D textures): { GLint red, green, blue ... Copy texture from GPU memory to CPU memory - comp.graphics.api ...Hi All, I have a problem. I need to copy a texture from the gpu memory to the cpu memory. >From what I see, glReadPixels only supports copy from the ... Using 3D Textures - the best way - comp.graphics.api.opengl ...Texture memory usage - comp.graphics.api.opengl The problem is that I have a 3D texture cache. And ... There are ways to determine, if a texture will fit into the ... Fast 2D blit and Fast Texture Upload - comp.graphics.api.opengl ...high kernel memory usage - comp.unix.solaris Fast 2D blit and Fast Texture Upload - comp.graphics.api.opengl ..... OpenGL testing programs, I found the CPU usage is quite ... volumetric textures - comp.graphics.api.openglThey are often too slow or not well > supported and they take up a lot of memory. For a game, just use some nice > tilable 2D stone texture. You can easily produce one by ... What is the fastest bitmap/texture to texture copy with stencil ...(via the GPU) Yes, texture maps are kept in texture memory (on systems that have it), and can be used for texture-mapping primitives extremely fast. Lost Memory in RAM card - comp.sys.hp48Texture memory usage - comp.graphics.api.opengl How to accurately compute the memory used by a ... to re-upload the texture to the graphics card if the texture is lost ... Texture memory usage using OpenGL - Indiegamer Developer ...I'm currently developing a 2D game by OpenGL. Recently I utilize the WinXP Task ... 12MB Sounds about right: 4MB (1024x1024x4) for the original image, plus 4MB for ... Texture Memory Usage - OpenGL - The Industry Standard for High ...Hey there, I wondered if anyone would know, how is texture memory is calculated when ... I wondered if anyone would know, how is texture memory is calculated when ... 7/23/2012 4:42:03 PM
|