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

Rendering and reading from texture, affordable?

Started by Filip Strugar Apr 23, 2004 at 12:59 PM 3 replies 750+ views
Original Post
Filip Strugar
Filip Strugar
Does anyone here have experience with render/reading texture? One possible solution to some problem of mine is to render scene to, for example, 64x64 texture, lock it, read it - per frame. Rendering is fast (not much data is rendered, large batches, no texturing or lighting). How fast is reading from texture? System is no less than ATI9600XT, >1GHz CPU, etc. Expected framerate at which the whole process shouldn''t take more than 15% of frame time is around 100. Is this possible? I can, ofcourse, solve the problem on CPU but I don''t have idea which solution would be faster...
Rhapsodus
Rhapsodus
What do you mean by reading it?

It depends on what operations you are doing during the reading stage... but my intuition says that if you read a graphic the slowest way possible: per pixel, then reading an entire 64x64 texture would come out to 4096 iterations...
neneboricua19
neneboricua19
quote:
Original post by Filip Strugar
Does anyone here have experience with render/reading texture?

One possible solution to some problem of mine is to render scene to, for example, 64x64 texture, lock it, read it - per frame.
Rendering is fast (not much data is rendered, large batches, no texturing or lighting).
How fast is reading from texture?
System is no less than ATI9600XT, >1GHz CPU, etc. Expected framerate at which the whole process shouldn''t take more than 15% of frame time is around 100.

Is this possible?

I can, ofcourse, solve the problem on CPU but I don''t have idea which solution would be faster...

Is it possible for you to avoid the lock step? In general, reading surface data back from the graphics card is slow because all rendering must stop and the graphics card has to transfer that data to system memory.

What are you trying to do exactly? Could you possibly avoid the lock call and instead set the 64x64 surface as a texture that you can read using a pixel shader?

neneboricua
Filip Strugar
Filip Strugar
Thanks for the answers,

I need to hit-test for example 32x32 rays that go from near to far plane, to get better shadow frustum approximation

I can do that either by hit testing on CPU - or drawing, and unprojecting z buffer (or z texture) to obtain points.

But I suppose that it''s faster to go the CPU way because of that video->system ram data transfer lockup!
Tom
Tom
Yeah, definitely do not read textures per-pixel from video memory. It sounds to me like you''re just going to have to test different methods and see which yields the best performance. You''re creating your resources using D3DPOOL_MANAGED, right? (I am assuming DirectX 8. Correct me if I''m wrong.) You might also try using a surface instead of a texture. I don''t know if that should make a difference or not.
GDNet+. It's only $5 a month. You know you want it.

Topic Locked

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

Sign in to reply to this topic.