Sign in to follow this  
Aqua Costa

GPU memory?

Recommended Posts

Aqua Costa    3691
I know that the GPUs have the VRAM but I was wondering if they have other types of memory and how do they work?

-When I create a buffer, shader resource, render target it is stored in the VRAM right? And when I bind a constant buffer or other resource to a shader where is it stored?
Also, when a shader wants to sample a texture does it sample it from the VRAM or what?

What should be done to improve GPU performance in terms of memory access?

Share this post


Link to post
Share on other sites
Quat    568
[quote]
-When I create a buffer, shader resource, render target it is stored in the VRAM right? And when I bind a constant buffer or other resource to a shader where is it stored?
Also, when a shader wants to sample a texture does it sample it from the VRAM or what?
[/quote]

As far as I know, Direct3D does not mention particular memory regions. It says it will put the resource in the best memory based on usage. I believe an immutable or default resource will always go into VRAM. Dynamic usage will go into PCI express memory. Staging usage stays on CPU memory.

Share this post


Link to post
Share on other sites
MJP    19755
It's depends...there's no guarantees made by the runtime about where a resource will be put (which makes sense, when you consider that some GPU's don't even have dedicated VRAM).

If you want to optimize memory access, the first thing I would do is make sure all of your resources are created with the correct usage. If the CPU is updating it every frame, make sure it's DYNAMIC. If it never changes, make it IMMUTABLE. If the GPU needs write access, make it DEFAULT. Beyond that...it depends on what you're doing it. Different resources are optimized for different access patterns. Probably the only commonality between all of them is that the less you access them, the better. :P

Share this post


Link to post
Share on other sites
Tordin    625
Oh, i Tought it was like this :

When you first create a resrouce, it ends up in the RAM, but when used on a shader it get streamd to the GFX Ram and then used.
and when another resource is streamd the old resource gets overwritten or if there is memory over, just saved and stays until used or overwritten!

Share this post


Link to post
Share on other sites
mhagain    13430
That's more or less the way the managed pool works (and is also true of OpenGL), but there is a Preload method on managed resources that can send them to the GPU in advance of usage. Generally the best thing to do is choose the most appropriate pool based on your usage requirements, reuse resources instead of recreating them where possible, load default pool resources before any other kind (not always possible) so that they're more likely to be in more optimal memory, but otherwise trust the driver (or if you don't trust the driver use D3DCREATE_DISABLE_DRIVER_MANAGEMENT and trust the runtime) to do the right thing. It generally knows more about optimal memory usage patterns for the hardware than you do. There are exceptions but you would need some [i]very[/i] specific behaviour requirements (and hard evidence that the driver is doing the wrong thing, as well as hard evidence that this is definitely the cause of a specific problem you need to solve) before stepping outside of what I've just described.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this