Skip to main content
GameDev.net gamedev.net
🔒 Locked

Videocard readbuffer performance

Started by Dybbuk Feb 15, 2005 at 12:49 PM 14 replies 3.1k views
Original Post
Dybbuk
Dybbuk
I'm working on a project wich requires the readback of large buffers. I once wrote a realtime raytracer using openGL for first hit optimisation among some others things. To do this i had to readback the framebuffer using glReadpixels. Unfortunately the download speed was reached on my gf4. At 1024x768 it was hardly realtime anymore. I looked around and read that the readback is slow. For my current project i need to read back large panorama views, wich are much larger than 1024x768. So my questions are: 1. Are there any cards wich have suitable for this problem. 2. Is there any resource on the internet about this (specs?) 3. any other way?
Kalidor
Kalidor
Disclaimer: I'm pretty sure this is accurate but not 100%, so please feel free to correct me if I'm wrong.

It's not really the card itself that makes reading back a framebuffer or whatever so slow although it does stall the pipeline. The slowest part is that AGP is terrible at sending stuff to system ram. PCI express is slowly becoming more widespread, which is much faster for both sending to vram and system ram.
Codemonger
Codemonger
Your best bet is to start getting into pixel shader 3.0, this should give you access to being able to start a raytracer in a pixel shader ... with this link there is an example from nvidia named "Raytrace" that can give you a head start (scroll down the page).

http://developer.nvidia.com/object/fx_composer_shaders.html

[edit] If you are looking for a cheap 3.0 video card Nvidia just came out with a 6200 model which is a cheap low-end 3.0 ps/vs video card. it comes in AGP/PCI-EXPRESS.
-------------Become part of developing the specifications of a new language. Visit CodeBASIC.org
Dybbuk
Dybbuk
Thanks for your reply but,
The things about that raytracer where just a background story to introduce my problem. I need to readback a large buffer for a new project. I did'nt start coding yet, but i expect to run into some problems because of my earlier experience.

It's for a commercial project, so i'm not really on a tight budget, but i will need some numbers or specs to make my boss buy one.

[EDIT added:]
I think readback bandwidth of the AGP bus is kindda slow, but most cards can't fill it by far, but i don't have any numbers.
So if anybody knows the exact readback bandwidth speed of the AGP bus and PCI express, plz let me know
(Googling for it myself atm)
[/EDIT]
Woodchuck
Woodchuck
From my experience, i WRITE 175 screens of 640*480 per second on a geforce2 with AGP2x. In 1024*768, if i remember, i obtain 50-60. (note that quake2 in software run at 45fps in 1024*768 with an Athlon 1.5Ghz on the same bus ;)
I think read operations are similar in term of speed. If no, they are less fast.

Hope that help you :)
zedzeek
zedzeek
see GL_EXT_pixel_buffer_object,
the problem is what do u want to do with the data, if its quite simple (and can run in a fragment program then u could just copy the buffer into a texture)
Codemonger
Codemonger
Quote:
Original post by zedzeek
see GL_EXT_pixel_buffer_object,
the problem is what do u want to do with the data, if its quite simple (and can run in a fragment program then u could just copy the buffer into a texture)


Pixel Shader 3.0 uses Multiple Render Targets, so you could easily use this to perform multiple tasks within the fragment/pixel shader all in one pass. You could even do very complex stuff. I haven't tried it because I sorta stuck to PS 2.0, but i wan't to move to 3.0 for this very reason, store info on multiple render targets and read output via cpu/gpu. And now that 3.0 will become main stream in probably a year (once new consoles come out), then its something to start programming with now. This is something I would seriously consider, especially if you want to manipulate pixels.
-------------Become part of developing the specifications of a new language. Visit CodeBASIC.org
Fruny
Fruny
GPU programming is all about avoiding to have to read pixels back to the CPU. Check www.gpgpu.org
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
noVum
noVum
Quote:
Pixel Shader 3.0 uses Multiple Render Targets, so you could easily use this to perform multiple tasks within the fragment/pixel shader all in one pass.
MRTs are supported with PS 2.0 aswell, but GeForce FX does not support it. ATi does.
Dybbuk
Dybbuk
@Fruny
I know most card aren't build for it, but i really NEED to read back those pixels.

@zedzeek
GL_EXT_pixel_buffer_object can save the data on the card, but how do i get it in CPU ram or on disk??

@all
thx for helping so far
zedzeek
zedzeek
i havent actually used the extension but my understanding is that it accelerates readpixel performance, thus into the cpu
qazlop
qazlop
Your best bet is a PCI-Express card. The main difference between AGP and PCIe is that PCIe has the same bandwidth for writing as well as reading.

Unfortunatly I dont know of any benchmarks for this type of thing since its reletivly new use of the GPU. Most drivers and cards are not optimized for this. agp cards would almost be suitable if it were not for the poor drivers/hardware.

On my 6800 PCIe card i get about 600MB/sec throughput using floating point buffers. This is about 39Mpixels/sec or 148 frames per second assuming a 512x512 area. The benchmark does nothing else but read from the buffer. This may or may not be useful information since this result can change based on drivers and on what you have the card do. benchmark here (http://graphics.stanford.edu/projects/gpubench/)

Also going up in buffer size (ie 1024 or 2048) did not change the throuput at all. Thus 74 frames per second at 1024x1024 or 37 frames per second at 2048x2048.

Warning teh above benchmarl uses glReadPixels() which may or may not be the most optimal way to read the buffer. There may be extensions that are more optimized, or possibly d3d methods that are faster. I only warn you because this is not a definitive benchmark by any means at all. Just a number to show you realtime may be possibly with the better cards.


Also check out the ati line of cards that are PCIe since they may have better support. The nvidia cards are tricky since not all the cards are PCIe native, some (like 6800 ultra) use a bridge. This means the card is basically an AGP card running on a PCIe bus. The 6600GT is a native PCIe card, so it should have faster readback then the bridged cards put out by nvidia. Some standard 6800s are native and some are not. I think all the 6xxx cards will eventually become native, its a matter of time. You dont want to take that chance, and would really be careful if you choose an Nvidia card.

I suggest some research, possibly creating a benhmark demo for ppl to test their configs so you can decide on the card to get.

[Edited by - qazlop on February 16, 2005 12:44:44 AM]
AdrianL
AdrianL
NVidia improved their readback performance by a factor of 4/5 between the geforce 5 and geforce 6.

I've benchmarked a gf6800 GT AGP and got readback of ~1gb/sec compared to ~200mb/sec on a gf5900.

Until their current generation ATI have had lower readback performance than NVidia. I'm not sure what speed is acheivable on their latest cards.



Dybbuk
Dybbuk
Thnx for the replys so far. I heard some numbers and got a faint idea what to expect. But i would like some more numbers so i will make a little demo with a massive buffer to readback.

Didn't find anything new about extensions, so i'll stick to glReadPixels. I also read about directDraw, but i have to develop in linux so that won't work.
I think i'd better make the benchmark for windows so more ppl will be able to run it. (and maybe a linux demo too for comparison)

I'll get back at it later today.
AdrianL
AdrianL
This benchmark with source code might help you.

http://www.mars3d.com/Software/PixPerf.zip

Run it as follows:

pixperf -read -type ubyte -format bgra -size 128
pixperf -read -type ubyte -format bgra -size 128 -readpdr

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.