On Sep 26, 2:39*pm, "Skybuck Flying" <BloodySh...@hotmail.com> wrote:
> Hello,
>
> I am wondering if it's possible to output multiple colors/pixels/outputs per
> pixel for a pixel shader ?
>
> So instead of
>
> Float4 PSMAin()
> {
>
> }
>
> It would be something like (conceptually):
> Float4 Float4 Float4 Float4 PsMain()
> {
> * * Return Color0/Pixel0/Texture0
> * * Return Color1/Pixel1/Texture1
> * * Return Color2/Pixel2/Texture2
> * * Return Color3/Pixel3/Texture3
>
> }
>
> These could be stuffed into a structure to make it look more nice... for
> example:
>
> FourPixels PsMain()
> {
> * * Return FourPixels;
>
> }
>
> However I wonder if this can work on DirectX9 graphics cards because I never
> tried it...
>
> I also wonder what the necessary opengl bindings would be...
>
> Probably 4 buffers attached to some frame buffer object and use render to
> texture ?
>
> The following document mentions 4 output semantics for pixel shaders:
>
> COLOR0, COLOR1, COLOR2, COLOR3
>
> This is related to CGFX.
>
> Using_SAS_v1_01.pdf
>
> I am not sure if these can all be used at the same time for a pixel
> shader... as demonstrated in the examples above...
>
> Can somebody please enlighten me ?
>
> Euhm to be clear, this feature could be handy for gpgpu programming... so
> more state can be kept, processed and passed through the pixel shaders from
> pass to pass.
>
> Thank you for any answers,
> * Bye,
> * * Skybuck.
I'm sorry that I am not familar with DX but OpenGL. Since GL 2.0, your
GPU could use MRT in your Pixel Shader to output data into texture
render targets.
They could be used at the same time if you prepared the enough render
targets to retreive the data. In fact the GPU could output unlimited
render targets but the boundwidth is the greatest problem . As I known
current GPU supports at most 4 render target, e.g, 4x4=16 FP32
scalars, that should be enough for defered shading.
|