Horde3D

Next-Generation Graphics Engine
It is currently 29.03.2024, 07:34

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 06.05.2010, 10:49 
Offline

Joined: 24.03.2010, 10:17
Posts: 55
In the current SVN (240), multi-sampled render targets are broken, resulting in invalid pipeline and/or wrong depth resolve.
The first problem: The multisampled depth render buffer is not correctly initialized in egRendererBase.cpp, line 836:
Code:
glRenderbufferStorageMultisampleEXT( GL_RENDERBUFFER_EXT, rb.samples, tex.format, rb.width, rb.height );
tex.format is wrong, must be the _depthFormat (GL_DEPTH_COMPONENT16/24).
With this change, FBO setup will complete, so all fine here.

The next problem: the multisampled depth buffer is not correctly resolved when you want to bind it to a regular depth texture.
egRendererBase.cpp, line 917
Code:
glReadBuffer( GL_NONE );
glDrawBuffer( GL_NONE );
GL_NONE is wrong, as then no read/write buffer is bound, but actually we need GL_DEPTH_ATTACHMENT_EXT for both read/write.

I attached a patch (svn-diff to rev. 240 of egRendererBase.cpp) which fixes the problem, working both on Linux and OSX.

Alex


Attachments:
MultiSampleDepthRTFix.txt [1.12 KiB]
Downloaded 674 times
Top
 Profile  
Reply with quote  
PostPosted: 06.05.2010, 23:44 
Offline

Joined: 24.03.2010, 10:17
Posts: 55
A small edit.
As Marciano pointed out, this does not seem to work on ATI as the calls in my patch
Code:
glReadBuffer(GL_DEPTH_ATTACHMENT_EXT)
glDrawBuffer(GL_DEPTH_ATTACHMENT_EXT)
seem to be illegal (although they worked for us).
We will further investigate, but if anybody has a suggestion, feel free to drop in...


Top
 Profile  
Reply with quote  
PostPosted: 09.05.2010, 17:09 
Offline

Joined: 24.03.2010, 10:17
Posts: 55
I've just found out that Renderer::initStates disables multisampling and there is no call to enable it again (on a per-render-target basis).
So I added
Code:
if (rb.fboMS != 0)
  glEnable(GL_MULTISAMPLE);
else
  glDisable(GL_MULTISAMPLE);
in RendererBase::setRenderBuffer and now finally I got AA working.
Still I need a different target than GL_NONE
Code:
glDrawBuffer(GL_NONE);
glDrawBuffer(GL_NONE);
in RendererBase::resolveRenderBuffer, otherwise the depth buffer is not correctly resolved.
But I suspect this might be a driver bug (OSX 10.6.4, MBP).


Top
 Profile  
Reply with quote  
PostPosted: 11.05.2010, 22:33 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Thanks Alex, MSAA should be fixed now.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group