Jump to content
  • Advertisement
Sign in to follow this  
lomateron

reading texture

This topic is 2322 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible to render to a texture in this way? if there is, how?
The texture is 11x1
The pixel shader will read the 1st pixel and output to it(it can read whatever it wants, the important thing is the output position), then it will jump and read the 3rd pixel(or whatever) and output to it, then it will read the 5ft pixel and output to it,........ until it finishes. I have though on changing the viewport.......propositions plz.

Share this post


Link to post
Share on other sites
Advertisement
You can do it on the graphics card (Like post effects are made with a full screen quad) but the problem is so small that the CPU would be much faster even if you don't read back the result to the CPU.

If you can combine many of your calculations into 512x512 pixels, you can render a quad over the screen and do parallel calculations from one texture to another and then swap pointers to the 2 textures.

Share this post


Link to post
Share on other sites
You need two 11x1 textures, because you can't read and write the same texture at the same time. You have to read from one texture and write to a copy of it.

If you want to skip every second pixel, you can either:
* draw a triangle that covers the whole render-target and use [font=courier new,courier,monospace]SV_Position[/font] in the pixel shader to find out which pixel is being executed, and use [font=courier new,courier,monospace]clip[/font] to abort processing of any 'even' pixels.
OR
* draw a list of points that cover exactly the pixels that you want to process.


Also you can't process the 1st pixel, then 2nd pixel, then the 3rd pixel, etc... The GPU launches the processing of all rasterised pixels in parallel, and the order that they're processed is undefined.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!