Motherboard Forums


Reply
Thread Tools Display Modes

Multiple colors/pixels/outputs per pixel for pixel shaders on DirectX9 graphics cards (OpenGL 3.0) ?

 
 
Skybuck Flying
Guest
Posts: n/a
 
      09-26-2009, 06:39 AM
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.


 
Reply With Quote
 
 
 
 
Bo Schwarzstein
Guest
Posts: n/a
 
      09-27-2009, 12:09 PM
On Sep 26, 2:39*pm, "Skybuck Flying" <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
 
Skybuck Flying
Guest
Posts: n/a
 
      09-30-2009, 09:45 AM
Ok,

Question for you:

Suppose the frame/texture buffers are not cleared.

Suppose only a few verteces are drawn with gl_points.

This would trigger only a few pixel shaders.

What will MRT do ?

Will it only update the pixels from the pixel shaders on the multiple render
targets ?

Or will MRT start copieing everything ?

Bye,
Skybuck.


 
Reply With Quote
 
Skybuck Flying
Guest
Posts: n/a
 
      01-12-2010, 02:06 AM
I am gonna answer my own questions here since now I have more experience
with it !

"Skybuck Flying" <(E-Mail Removed)> wrote in message
news:27cf7$4ac328b5$d53372a9$(E-Mail Removed)1.n b.home.nl...
> Ok,
>
> Question for you:
>
> Suppose the frame/texture buffers are not cleared.


Doesn't matter probably

>
> Suppose only a few verteces are drawn with gl_points.


Yeah

> This would trigger only a few pixel shaders.


Yeah probably

> What will MRT do ?


Read the documentation

In short it can do two things:

1. If the pixel shader outputs one color via Color0 then it's outputted to
all buffers.

2. If the pixel shader outputs individual colors via Color0, Color1, Color2,
Color3, etc then the colors will respectively end up in Buffer0, Buffer1,
Buffer2, Buffer3. So Color0 goes to Buffer0, Color1 goes to Buffer1, and so
on

> Will it only update the pixels from the pixel shaders on the multiple
> render targets ?


Yes, Do you think the GPU is crazy ? Why would it do unnecessary work ?


Seriously that's how it works... the GPU only does what you tell it do... it
can be pixel-efficient probably

> Or will MRT start copieing everything ?


No... if you wanna do a copy... you will have to do that yourself...

Either via pixel shader... or maybe blending the output with something else.

Bye,
Skybuck.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV limitation "per pixel" or "per frame" ? Skybuck Flying Nvidia 2 10-25-2009 10:24 AM
Does mx4000 gpu suports hardware pixel shaders and vertex shaders? amigaboy Nvidia 0 11-14-2005 02:23 PM
Pixel Shaders 3.0 how to turn on in Farcry. Digital Sheep Nvidia 6 04-17-2005 04:26 PM
Pixel Shaders Virgulilla Nvidia 12 03-13-2005 12:36 AM
DirectX9 Black Screen When Exiting Graphics Mode Avi Nvidia 0 07-16-2003 07:12 AM


All times are GMT. The time now is 07:05 AM.


Welcome!
Welcome to Motherboard Point
 

Advertisment