PDA

View Full Version : Using VRAM and AGP RAM at the same time



Jan
12-04-2002, 04:54 AM
I discovered, that it seems not to be possible to use wglAllocateMemoryNV to get AGP and Video memory at the same time. It always crashes, when i try to allocate two memory chunks. I know, that i have to allocate one big chunk, but i thought, it should be possible, to use two chunks, when they are in different memory.
I would líke to store my static geometry in VRAM, and other stuff in AGP memory, to be able to update that geometry sometimes.
So i think i should only use AGP memory.

However i also discovered something strange about the performance. If i use ordinary system memory, i get around 230 FPS. If i use AGP or VRAM, i get around 220 FPS. Thatīs not very bad, but it doesnīt make sense to me, cause i thought it should be a bit faster, if the geo is stored on board, or at least in AGP memory.
I draw around 4000 Triangles with glDrawElements, but not with one call, because i have to make texture changes, but my engine is optimized to make as few texture changes as possible (and no texture has to be uploaded).

Do i do something important wrong ?

knackered
12-04-2002, 05:02 AM
Good question - I haven't managed to get both agp and video memory allocated at the same time either. I take it we're talking about VAR (nv_vertex_array_range)?

As for your speed problem - make sure your indices (the array you pass to gldrawelements) is in system memory (allocated with a plain old malloc or new) rather than VAR memory. It's a little non-intuitive, but absolutely neccessary.

nutball
12-04-2002, 05:49 AM
I didn't think the VAR extension made any guarantees about what type of memory would be allocated. It merely permits the driver the latitude of optimising access if it sees fit.

It says this, for example:


The memory allocator provided allows the application to tradeoff the desired CPU read frequency, CPU write frequency, and memory priority while still leaving it up to OpenGL implementation the exact memory type to be allocated.

[This message has been edited by nutball (edited 12-04-2002).]

Ysaneya
12-04-2002, 08:01 AM
Really strange, i don't remember having problems allocating two chunks of different memory types. No trick or special parameter, just worked as expected. I did that at work, and we've got quite a few configs.. so..?

Y.

Jan
12-04-2002, 08:16 AM
This is exactly what i do:




int size = (iLevelPolys*24*sizeof(float)) + (iTransparentPolys*27*sizeof (float));

float *data = (float*) wglAllocateMemoryNV (size, 0.2f, 0.2f, 0.75f); //Video-memory
float *data2 = (float*) wglAllocateMemoryNV (size, 0.2f, 0.2f, 0.5f); //AGP-memory

if (data)
Log ("Data is valid.\n");
else
Log ("Data is not valid.\n");

if (data2)
Log ("Data2 is valid.\n");
else
Log ("Data2 is not valid.\n");


And the result is this:

"Data is valid."
"Data2 is not valid."

So? Any error?
Anyway, thanks for your replies.

Jan.

Jan
12-04-2002, 08:22 AM
Ah, i should add this:

I have a Geforce 2 Ti with the newest detonator drivers under Win XP. I have 512 MB Ram and 64 MB are reserved for AGP by the bios.

I am able to get AGP memory alone, but as i said, not both together.

However i think it is not a driver bug, cause my former driver did the same thing (and also under Win ME).

Jan.

Ysaneya
12-04-2002, 08:49 AM
Try 0 0 1 for video memory, and 0 0 0.5 for AGP memory. That's the values i use to have it working. wglAllocateMemory seems to be very picky, so i wouldn't be surprized if the values you provided didn't work..

Y.

Jan
12-04-2002, 09:17 AM
Originally posted by Ysaneya:
Try 0 0 1 for video memory, and 0 0 0.5 for AGP memory. That's the values i use to have it working. wglAllocateMemory seems to be very picky, so i wouldn't be surprized if the values you provided didn't work..

Y.


You were right, with those values it works!

I tested the speed with those values, and it turned out, that Video, AGP and System memory now seem to be at the same speed. I used a level with 40000 triangles and low texture settings, so that i am not limited by fillrate, and i got 11 FPS for all three modes. (Not all polys were visible, i just turned of BFC and BBC to get this amount of triangles.)
I think i can live with this now.

Thanks for the help of all of you.
Jan.

zed
12-04-2002, 06:26 PM
>>I used a level with 40000 triangles and low texture settings, so that i am not limited by fillrate, <<

i wouldnt be so certain, a much better method is making the windows really small eg 100x100 disabling textures etc

jwatte
12-04-2002, 08:46 PM
You can do much more than 40000 triangles per frame at 11 fps, even on a GeForce 2 MX.

You might want to check that you have correct AGP drivers installed (check for the words "PCI mode" in your nVIDIA control panel where it says "bus type" -- if you have that, it's bad).

Make sure your vertices are correctly aligned. 4 byte alignment is a minimum; I'd prefer to pad them to a power of two (16 or 32 bytes, typically).

Make sure you actually turn on the vertex array range using VertexArrayRangeNV().

Make sure the range is valid (Getting VERTEX_ARRAY_RANGE_VALID_NV).

Make sure your indices are GL_UNSIGNED_SHORT type, and live in system memory (malloc()).

Make sure you're not fill limited. You do this by either making the window 50x50 in size, or by calling glCullFace(GL_FRONT_AND_BACK) before rendering.

Olive
12-04-2002, 11:31 PM
And make sur you have one sided lighting !!
(see glLightModel).

knackered
12-04-2002, 11:57 PM
Make sure you've issued this command once at context initialisation:-
glEnableClientState(GL_VERTEX_ARRAY_RANGE_NV);

kurko
12-10-2002, 12:34 PM
while reading the extension i thought you could only store 1 pointer with VertexArrayRangeNV(), for the driver to pull the vertices.
so, whats the use of alloc'ing 2 chunks of memory????
cause i have to flush the VAR before i change it, or the vertices could become invalid.

i thought you could only use 1 large chunk and split it in 2.