Sign in to follow this  
Dybbuk

OpenGL Videocard readbuffer performance

Recommended Posts

Dybbuk    158
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?

Share this post


Link to post
Share on other sites
Kalidor    1087
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.

Share this post


Link to post
Share on other sites
Codemonger    217
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.

Share this post


Link to post
Share on other sites
Dybbuk    158
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]

Share this post


Link to post
Share on other sites
Woodchuck    246
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 :)

Share this post


Link to post
Share on other sites
zedzeek    529
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)

Share this post


Link to post
Share on other sites
Codemonger    217
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.

Share this post


Link to post
Share on other sites
noVum    170
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.

Share this post


Link to post
Share on other sites
Dybbuk    158
@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

Share this post


Link to post
Share on other sites
qazlop    229
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]

Share this post


Link to post
Share on other sites
AdrianL    144
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.



Share this post


Link to post
Share on other sites
Dybbuk    158
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.

Share this post


Link to post
Share on other sites
AdrianL    144
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
I'm not sure if it makes any difference but you might get better performance by rendering to texture instead of rendering to the framebuffer and then reading that back into a texture. They might be the same internally, but its worth checking into.

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  

  • Similar Content

    • By cebugdev
      hi all,

      i am trying to build an OpenGL 2D GUI system, (yeah yeah, i know i should not be re inventing the wheel, but this is for educational and some other purpose only),
      i have built GUI system before using 2D systems such as that of HTML/JS canvas, but in 2D system, i can directly match a mouse coordinates to the actual graphic coordinates with additional computation for screen size/ratio/scale ofcourse.
      now i want to port it to OpenGL, i know that to render a 2D object in OpenGL we specify coordiantes in Clip space or use the orthographic projection, now heres what i need help about.
      1. what is the right way of rendering the GUI? is it thru drawing in clip space or switching to ortho projection?
      2. from screen coordinates (top left is 0,0 nd bottom right is width height), how can i map the mouse coordinates to OpenGL 2D so that mouse events such as button click works? In consideration ofcourse to the current screen/size dimension.
      3. when let say if the screen size/dimension is different, how to handle this? in my previous javascript 2D engine using canvas, i just have my working coordinates and then just perform the bitblk or copying my working canvas to screen canvas and scale the mouse coordinates from there, in OpenGL how to work on a multiple screen sizes (more like an OpenGL ES question).
      lastly, if you guys know any books, resources, links or tutorials that handle or discuss this, i found one with marekknows opengl game engine website but its not free,
      Just let me know. Did not have any luck finding resource in google for writing our own OpenGL GUI framework.
      IF there are no any available online, just let me know, what things do i need to look into for OpenGL and i will study them one by one to make it work.
      thank you, and looking forward to positive replies.
    • By fllwr0491
      I have a few beginner questions about tesselation that I really have no clue.
      The opengl wiki doesn't seem to talk anything about the details.
       
      What is the relationship between TCS layout out and TES layout in?
      How does the tesselator know how control points are organized?
          e.g. If TES input requests triangles, but TCS can output N vertices.
             What happens in this case?
      In this article,
      http://www.informit.com/articles/article.aspx?p=2120983
      the isoline example TCS out=4, but TES in=isoline.
      And gl_TessCoord is only a single one.
      So which ones are the control points?
      How are tesselator building primitives?
    • By Orella
      I've been developing a 2D Engine using SFML + ImGui.
      Here you can see an image
      The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.
      Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine. 
      I've managed to render the editor like I did in the 2D Engine using this example that comes with ImGui. 
      3D Editor preview
      But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.
      If you can provide code will be better. And if you want me to provide any specific code tell me.
      Thanks!
    • By Picpenguin
      Hi
      I'm new to learning OpenGL and still learning C. I'm using SDL2, glew, OpenGL 3.3, linmath and stb_image.
      I started following through learnopengl.com and got through it until I had to load models. The problem is, it uses Assimp for loading models. Assimp is C++ and uses things I don't want in my program (boost for example) and C support doesn't seem that good.
      Things like glVertexAttribPointer and shaders are still confusing to me, but I have to start somewhere right?
      I can't seem to find any good loading/rendering tutorials or source code that is simple to use and easy to understand.
      I have tried this for over a week by myself, searching for solutions but so far no luck. With tinyobjloader-c and project that uses it, FantasyGolfSimulator, I was able to actually load the model with plain color (always the same color no matter what I do) on screen and move it around, but cannot figure out how to use textures or use its multiple textures with it.
      I don't ask much: I just want to load models with textures in them, maybe have lights affect them (directional spotlight etc). Also, some models have multiple parts and multiple textures in them, how can I handle those?
      Are there solutions anywhere?
      Thank you for your time. Sorry if this is a bit confusing, English isn't my native language
    • By dpadam450
      FINALLY, upgrading my engine to openGL 4. I was having some trouble so I started with a stripped down application and was wondering if VAO's are required, because I have a sample working, but if I remove the VAO then it doesn't seem to like drawing my triangle.
  • Popular Now