Archived

This topic is now archived and is closed to further replies.

fa_Q

Vertex Cache

Recommended Posts

Hi may i know if a vertex cache is something i have to implement myself to batch polys or is it something that is in directx/hardware etc..?

Share this post


Link to post
Share on other sites
The term cache simply refers to a memory structure used to temporarily store elements for faster access, making use of time coherency. It has absolutely nothing to do with the proximity to the CPU/GPU. You often have near caches (eg. the x86 L1 cache), but you can aswell have network caches, disk caches, etc.

A vertex cache is a somewhat ambiguous term. What is commonly referred to as vertex cache, is a small data area in the GPU, that is used to cache the last 10 to 30 transformed vertices. This speeds up rendering, since primitves sharing the same vertex don''t need to transform it more than once, if (and only if) thevertex happens to be in the cache at the time the primitve indexes it.

Now, you actively have to make use of that cache. It will only be activated, if you are using indexed primitives (indexed triangle lists or tristrips). Furthermore, you need to somehow organize your geometry in a cache-friendly way: indices to shared vertices should follow closely in the mesh, otherwise the transformed vertex will be pushed out of the cache before it is being used again. Both NVidia and ATI have appropriate cache optimization tools available.

A different definition of vertex cache is a data structure in VRAM or AGP RAM, that can hold whole geometry batches for faster access. This kind of structure is not directly supported by an API, so you''ll have to code it yourself. For simple 3D, it''s not important, but it''s crucial for high performance with complex geometry.

Share this post


Link to post
Share on other sites
There are two kinds vertex cache.
One is the pre-T&L vertex cache,it is just a nromal memory cache.
The other is the post-T&L vertex cache.The post-T&L vertex cache is used FIFO.

Share this post


Link to post
Share on other sites
Apologies in advance for playing necromancer with an old thread, but...


quote:
A different definition of vertex cache is a data structure in VRAM or AGP RAM, that can hold whole geometry batches for faster access. This kind of structure is not directly supported by an API, so you''ll have to code it yourself.


- What does the V stand for in this instance of "VRAM"?

- How does one specifically access VRAM, or AGP RAM?

- Once the geometry is stored in the VRAM/AGP RAM, how does one actually use the API (eg. DirectX) to render the geometry?

Share this post


Link to post
Share on other sites
Here''s how one renders stuff using DirectX VBs :-

Load your object
Create a vertex buffer
Lock it
Copy the vertices from the object into the VB
Unlock it
Set the stream source
Set the shaders
Render using Primitives (Tristrips are preferable, especially with Index Bufers)

The first two tutorials in the DirectX SDK show exactly how to do this.

Share this post


Link to post
Share on other sites