PDA

View Full Version : MSAA and access to individual samples



addmx
06-05-2009, 01:38 AM
Hi
As my engine uses defered shading - the antialiasing support is pain in the ass ;)
I render GBuffer to my multiple color attachment with MSAA
but in the second phase of defered shading I need the access to individual samples from albedo and normal map texture.
GL_EXT_framebuffer_blit provides resolve from MSAA rendebuffer to texture - but the sample information is lost.
Is there any extension to access individual samples of MSAA renderbuffer in shader ? (hardware is capable couse dx10 contains such a thing and it works fine - but i'm doomed to opengl right now :| )

martinsm
06-05-2009, 01:44 AM
Yes, such extension exists. It is Nvidia only: NV_explicit_multisample (http://www.opengl.org/registry/specs/NV/explicit_multisample.txt)

addmx
06-05-2009, 03:28 AM
slightly offtopic:
is there any way to use it with CG or it is available only thru native glsl shaders ? (i use gp4fp profile to compile my CG shaders)
Any working example would be great ;)

Olso is this extension (or similar one) exist on high-end ATI hardware ? I do not have ATI at the moment to check :/.

Jan
06-05-2009, 04:27 AM
AFAIK ATI doesn't provide this extension or something similar ATM.

However i am pretty sure the ARB is working on a standardized version of it.

Jan.

martinsm
06-05-2009, 04:28 AM
No, on ATI currently there is no feature to access individual samples of MSAA renderbuffer in OpenGL.

Don't know about CG. I do not see any point of using it instead of GLSL which is in OpenGL core.

dletozeun
06-05-2009, 05:47 AM
I do not see any point of using it instead of GLSL which is in OpenGL core.


One good point is that Cg API is usable with OpenGL AND DirectX unlike the glsl one and it avoid you to rewrite your shaders if you have to support opengl and directx api.

Dark Photon
06-05-2009, 06:55 AM
I do not see any point of using it instead of GLSL which is in OpenGL core.
Additionally, with Cg you get "precompiled shaders" support and potentially run-time shader compilation support "in the background".

For those that'd like to:

* load/activate materials/shaders from disk at run-time to support extended flights through large databases, OR
* support dynamically changing major rendering engine display modes

...without breaking frame and without having to know and precompile at startup the plethora of all shaders permutations for all possible materials, Cg is really the only OpenGL-supporting high-level shading language option right now that stands a shot.

As you'd expect, compiling and optimizing high-level language shaders like GLSL is slooowww and totally impractical in the foreground at run-time in the draw thread... ...that is, unless you don't mind your user thinking your application is trash because it locked up for a while. In our world, that'd be an instant bug report that had to be fixed at high priority.

Brolingstanz
06-05-2009, 09:23 AM
Perhaps we could all lobby the other vendors to implement the latest Cg version or even to make Cg a replacement for GLSL... :p
*disappears behind wall of stone*

addmx
06-05-2009, 12:33 PM
Well the CG is the only reasonable shading language if *nix and windows needs to be supported, as Dark Photon says - if a lot of shaders need to be compiled / loaded in rendering thread and shaders are loooooong - glsl compilation time can take few minutes (!!!) and CG allows them to be precompiled and just loaded within few hundret of ms.

CG works (almost) fine on ATI HD Radeons.

Starfox
06-06-2009, 02:42 PM
slightly offtopic:
is there any way to use it with CG or it is available only thru native glsl shaders ? (i use gp4fp profile to compile my CG shaders)
Any working example would be great ;)


I made one: http://www.gamedev.net/community/forums/topic.asp?topic_id=537066

Enjoy ;)