reading texture

Started by
1 comment, last by Hodgman 12 years, 1 month ago
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.
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.
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.

This topic is closed to new replies.

Advertisement