Jump to content
  • Advertisement
Sign in to follow this  
3drookie

whats the difference between these 2 things?

This topic is 4415 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

"video memory " & "AGP memory" when i read about how to create vertex buffers in Direct3D9, i encountered these two concepts. "D3DUSAGE_DYNAMIC" parameter means the vertex buffers lie in AGP memory, "D3DUSAGE_STATIC" parameter means the vertex buffers lie in video memory? in which aspects are these two memory locations different from each other?? where exactly are they? by the way, how do they differ from the system memory??? thanks in advance..

Share this post


Link to post
Share on other sites
Advertisement
Well, it was my understanding that AGP memory and video memory (for an AGP card) are the same thing. I'm not sure where you got your information from, but hopefully someone with more knowledge could explain it. However, I can answer your second question. Video/AGP memory is the memory that belongs to the video card and is much faster for the video card to access the data stored there while system memory is the RAM installed on your computer is alot slower for the video card to access. Hope that helps.

-AJ

Share this post


Link to post
Share on other sites
Unfortunately, u235 is wrong.

Those two identifiers are hints to the driver for how the buffer will be used, to optimize how the card accesses the data. They make sense even without AGP memory.

On systems with AGP memory, there are three classes of memory:

1) System Memory. This is cached, and reasonably fast to read from and write to with the CPU. However, it typically needs an additional copy before the graphics card can use it. System and scratch pool memory goes here.

2) AGP Memory. This is still CPU-local RAM, but it is not cached. This means that it's slow to read from, and it's slow to write to, UNLESS you write sequentially, without doing too much other memory traffic inbetween, and overwrite every byte, so that the write combiners don't need to fetch lines from RAM to do a combine. Thus, generating software-transformed vertices as a stream into this buffer might still be fast. For the GPU, the AGP memory is directly accessible, so no additional copy is needed. Dynamic pool memory goes here.

3) Video Memory. This is RAM that's local to the GPU. It typically has insanely high throughput. It is accessible over the bus for the CPU, but going over the bus is really slow; typically both for reading and for writing. Thus writing directly into this memory (or even worse, reading out of it), is not recommended. Default pool memory goes here.

On systems with PCI-Express, some of the AGP vs system memory differences are reduced, but the usage hints you're giving the driver ("I will change the data by writing it sequentially" vs "I will not change the data much") are still useful for optimizing performance.

Share this post


Link to post
Share on other sites
Video memory is the memory chips physically located on the card. The card can easily access this memory, while reading it from the CPU is extremely slow.

AGP memory a part of your main memory on the motherboard that has been set aside for talking to the graphics card. The card and your CPU can access this memory at a decent speed.

This pageshows that your BIOS "AGP aperture size" controls the size of your AGP memory, and explains how "reducing the AGP aperture size won't save you any RAM. Again, what setting the AGP aperture size does is limit the amount of RAM the AGP bus can appropriate when it needs to. It is not used unless absolutely necessary. So, setting a 64MB AGP aperture doesn't mean 64MB of your RAM will be used up as AGP memory. It will only limit the maximum amount that can be used by the AGP bus to 64MB (with a usable AGP memory size of only 26MB)."

Share this post


Link to post
Share on other sites
1) video memory can mean one of two things depending on the context the term is used in:

a. video memory is generally any memory which is used by the graphics chip.

b. video memory (correctly "local video memory") is memory that exists on the graphic card itself (i.e. RAM chips that live on the graphics card, they are 'local' to the graphics chip).


2) AGP memory is main memory on your system motherboard that has been specially assigned for graphics use. The "AGP Aperture" setting in your system BIOS controls this assignment. The more you have assigned for AGP use, the less you have for general system use. AGP memory is sometimes also known as "non-local video memory".


3a) 'Local' video memory is very fast for the graphics chip to read from and write to because it is 'local' to the graphics chip.

3b) 'Local' video memory is extremely slow to read from using for the system CPU, and reasonably slow to write to using the system CPU.
This is for a number of reasons; partly because the memory is physically on a different board (the graphics card) to the CPU (i.e. it's not 'local' for the CPU); partly because that memory isn't cached at all for reads using the CPU, and only burst cached for writes; partly due to the way data transfers over bus standards such as AGP must be done.


4a) AGP memory is reasonably fast for the graphics chip to read from or write to, but not as fast as local video memory.

4b) AGP memory is fairly slow to read from using the system CPU because it is marked as "Write Combined" so any reads don't benefit from the L2 and L1 caches (i.e. each read is effectively a cache-miss).
AGP memory is however faster than local video memory to read from using the CPU since it is local to the CPU.

4c) AGP memory is reasonably fast to write to using the system CPU. Although not fully cached, "Write Combined" memory uses a small buffer that collects sequential writes to memory (32 or 64 bytes IIRC) and writes them out in one go. This is why sequential access of vertex data using the CPU is preferable for performance.


5) D3DUSAGE_DYNAMIC is only a hint to the display driver about how you intend using that resource, usually it will give you AGP memory, but it isn't guaranteed (so don't rely it!).


6) Generally, for vertex buffers which you need to Lock() and update using the CPU regularly at runtime should be D3DUSAGE_DYNAMIC, and all others should be static.


7) Graphics drivers use techniques such as "buffer renaming" where multiple copies of the buffer are created and cycled through to reduce the chance of stalls when dynamic resources are locked. This is why it's essential to use the D3DLOCK_DISCARD and D3DLOCK_NOOVERWRITE locking flags correctly if you want good performance. It's also one of the many reasons you shouldn't rely on the data pointer from a Lock() after the resource has been unlocked.


8) General advice for good performance:
- treat all graphics resources as write-only for the CPU, particularly those in local video memory. CPU reads from graphics resources is a recipe for slowness.

- CPU writes to locked graphics resources should be done sequentially.

- it's better to write all of a vertex out to memory with the CPU than it is to skip elements of it. Skipping can harm the effectiveness of write combining, and even cause hidden reads in some situations (and reads are bad - see above).


[edit]doh, too slow by a mile [smile] - should have refreshed the page before posting[smile][/edit]

Share this post


Link to post
Share on other sites
Quote:
Original post by S1CA
[edit]doh, too slow by a mile [smile] - should have refreshed the page before posting[smile][/edit]


Bah, don't tell me you were going to scrap this very useful post... Was a very interesting read. :)

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
Unfortunately, u235 is wrong.



My apologies to the OP and all board members whom I have mercilessly shamed with my unknowldgeable post. For those who didn't pick it up, the last part was a joke, but I am very sorry to have distributed disinformation like that. In the Navy we have something called "watch team backup" where everyone backs everyone else up and makes sure they don't screw things up. It just happened here (it happens alot, really, but it's the first time I've thought of it like that) and I love it! [smile]

-AJ

Share this post


Link to post
Share on other sites
here's another question...
since the "local video memory" is fast for video card to manipulate, and the video card dedicated to GRAPHICS PROCESS,why bother to use the "AGP memory"?

is that only because the "local video memory" may be not enough for graphic data storage?

what role does the CPU play in the process of graphics??

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!