Depth sharing Design
- xadhoom
- Minaton
- Posts: 973
- Joined: Fri Dec 28, 2007 4:35 pm
- Location: Germany
- x 1
Re: Depth sharing Design
Noman,
Are these changes implicitly used by the Deferred Rendering Sample or would it need to adapt the Compositor scripts?
xad
Are these changes implicitly used by the Deferred Rendering Sample or would it need to adapt the Compositor scripts?
xad
- masterfalcon
- OGRE Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
- Contact:
Re: Depth sharing Design
Sure thing. I know that they both have some compilation errors right now. It's way late right now but I'll work on it tomorrow.Noman wrote:I'm just the middle-man... It's dark_sylinc who did the real work.
Speaking of GLES/2 - I don't think they were modified. They might have some pure-virtual calls that might cause linker errors. (Can't check since I don't have a compilation environment for them).
Can you make sure that they still compile correctly?
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1280
- Contact:
Re: Depth sharing Design
Yay!! it's on trunk!
I've closed the SF.Net patch & tagged as accepted.
Probably it's the pure virtual function RenderSystem::_createDepthBufferFor()
As for implementing this for GLES/2, I usually started with new RenderSystems by creating a derived class from DepthBuffer (i.e. GLESDepthBuffer), the most vital function to overload is DepthBuffer::isCompatible()
Then _createDepthBufferFor() needs to be overloaded too so you can allocate GLESDepthBuffer.
Also not to forget to set the right RenderCapabilitiesFlags
The rest is pretty much generic code that abstractly deals with the details.
I'm glad you like it.
Thanks
Dark Sylinc
I've closed the SF.Net patch & tagged as accepted.
The Deferred Rendering Sample was slightly changed (C++ code, I think 3 lines were changed) so that shadow textures are put in a different pool. The compositors scripts weren't changed at all (an alternative solution would've been to change all compositor scripts used by that sample to use a different pool and leave the shadow textures untouched.)xadhoom wrote:Noman,
Are these changes implicitly used by the Deferred Rendering Sample or would it need to adapt the Compositor scripts?
xad
I didn't touch GLES/2 at all.masterfalcon wrote:Sure thing. I know that they both have some compilation errors right now. It's way late right now but I'll work on it tomorrow.Noman wrote:I'm just the middle-man... It's dark_sylinc who did the real work.
Speaking of GLES/2 - I don't think they were modified. They might have some pure-virtual calls that might cause linker errors. (Can't check since I don't have a compilation environment for them).
Can you make sure that they still compile correctly?
Probably it's the pure virtual function RenderSystem::_createDepthBufferFor()
As for implementing this for GLES/2, I usually started with new RenderSystems by creating a derived class from DepthBuffer (i.e. GLESDepthBuffer), the most vital function to overload is DepthBuffer::isCompatible()
Then _createDepthBufferFor() needs to be overloaded too so you can allocate GLESDepthBuffer.
Also not to forget to set the right RenderCapabilitiesFlags
The rest is pretty much generic code that abstractly deals with the details.
I'm glad you like it.
Thanks
Dark Sylinc
-
- Halfling
- Posts: 70
- Joined: Thu Apr 10, 2008 8:10 pm
- x 1
Re: Depth sharing Design
Hi all,
I have a question regarding the changes made and the deferred shading compositor:
If I understood it correctly, the changes were made, so that the depth buffer can now be shared through different render targets, but nevertheless in the DeferredShading/ShowLit compositor the first thing that is done is, to clear the depth buffer and to rebuild it according to the GBuffer.
Couldn't we now just reuse the same depth buffer of the last compositor (DeferredShading/GBuffer) and save some shader operations ?
Thanks for clarifying.
I have a question regarding the changes made and the deferred shading compositor:
If I understood it correctly, the changes were made, so that the depth buffer can now be shared through different render targets, but nevertheless in the DeferredShading/ShowLit compositor the first thing that is done is, to clear the depth buffer and to rebuild it according to the GBuffer.
Couldn't we now just reuse the same depth buffer of the last compositor (DeferredShading/GBuffer) and save some shader operations ?
Thanks for clarifying.
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1280
- Contact:
Re: Depth sharing Design
I'm not deeply familiar with DeferredShading's code, but the changes made were made so that the Depth Buffer would be NOT shared between the shadow texture render targets and the Deferred shading textures. There are multiple textures that may or may not (I don't know, but at least 2 textures do) take advantage of sharing the same depth buffer, but the shadow textures won't interfere in the middle of the operations.moagames wrote: I have a question regarding the changes made and the deferred shading compositor:
If I understood it correctly, the changes were made, so that the depth buffer can now be shared through different render targets, but nevertheless in the DeferredShading/ShowLit compositor the first thing that is done is, to clear the depth buffer and to rebuild it according to the GBuffer.
Couldn't we now just reuse the same depth buffer of the last compositor (DeferredShading/GBuffer) and save some shader operations ?
Thanks for clarifying.
Before these changes, the same effect was being achieved through a hack in Ogre RenderSystem.
- Noman
- OGRE Retired Team Member
- Posts: 714
- Joined: Mon Jan 31, 2005 7:21 pm
- Location: Israel
- x 2
- Contact:
Re: Depth sharing Design
moagames is right essentially. However, I haven't had the time to try to remove the depth-rebuilding part of the shader. Its also a good idea to show that it is possible to rebuild it if needed, but in the case of the deferred shading demo, it might not be needed anymore...
- masterfalcon
- OGRE Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
- Contact:
Re: Depth sharing Design
I just realized that depth sharing was busted on GLES and I may have found a small bug which might affect the GL rendersystem too.
Is the else if correct? It doesn't look like it should ever be possible to get in there because bSameStencil will be false initially.
Code: Select all
bool GLDepthBuffer::isCompatible( RenderTarget *renderTarget ) const
{
...
bool bSameStencil = false;
if( !mStencilBuffer || mStencilBuffer == mDepthBuffer )
bSameStencil = stencilFormat == GL_NONE;
else if( bSameStencil )
bSameStencil = stencilFormat == mStencilBuffer->getGLFormat();
...
}
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1280
- Contact:
Re: Depth sharing Design
Thanks!
It's a bug.
It should be:
The "else if" was supposed to prevent calling getGLFormat() since mStencilBuffer may be null.
Good job spotting it. Stencil buffers separate from Depth buffers setups are extremely rare (dunno about GLES). That buggy code could've been unnoticed for a very long time.
Thanks
Dark Sylinc
It's a bug.
It should be:
Code: Select all
if( !mStencilBuffer || mStencilBuffer == mDepthBuffer )
bSameStencil = stencilFormat == GL_NONE;
else if( mStencilBuffer )
bSameStencil = stencilFormat == mStencilBuffer->getGLFormat();
Good job spotting it. Stencil buffers separate from Depth buffers setups are extremely rare (dunno about GLES). That buggy code could've been unnoticed for a very long time.
Thanks
Dark Sylinc
- masterfalcon
- OGRE Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
- Contact:
Re: Depth sharing Design
Cool cool. At the moment GL ES is using separate buffers(though I haven't actually checked if it's working right).
So should it have been:
If so, then I could make the change and check it in for all 3 GL render systems.
So should it have been:
Code: Select all
if( !mStencilBuffer || mStencilBuffer == mDepthBuffer )
bSameStencil = stencilFormat == GL_NONE;
else
{
if( mStencilBuffer )
bSameStencil = stencilFormat == mStencilBuffer->getGLFormat();
}
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
- masterfalcon
- OGRE Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
- Contact:
Re: Depth sharing Design
Cool. I'll check this in tonight. Gotta uncouple it from a bunch of other GL ES changes first.
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
Re: Depth sharing Design
I have updated my c# editor to the latest trunk and get an exception when i generate several windows on runtime
with opengl everything works.
I pass the c# window handle as externalwindow to ogre.
Code: Select all
22:20:28: D3D9: Vertex texture format supported - PF_FLOAT16_RGB
22:20:28: D3D9: Vertex texture format supported - PF_FLOAT16_RGBA
22:20:28: D3D9: Vertex texture format supported - PF_FLOAT32_RGB
22:20:28: D3D9: Vertex texture format supported - PF_FLOAT32_RGBA
22:20:28: D3D9: Vertex texture format supported - PF_FLOAT16_R
22:20:28: D3D9: Vertex texture format supported - PF_FLOAT32_R
22:20:28: D3D9: Vertex texture format supported - PF_FLOAT16_GR
22:20:28: D3D9: Vertex texture format supported - PF_FLOAT32_GR
22:25:35: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:35: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:35: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:35: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:35: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:35: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:35: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:35: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:35: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
22:25:36: OGRE EXCEPTION(3:RenderingAPIException): Failed to setDepthStencil : Invalid call in D3D9RenderSystem::_setViewport at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2876)
I pass the c# window handle as externalwindow to ogre.
Last edited by Wolfmanfx on Mon Mar 29, 2010 1:08 pm, edited 1 time in total.
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
Re: Depth sharing Design
The DirectX Debug Runtime should give you some more details on the error.
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
Re: Depth sharing Design
Tried debug runtime not much info gained from that i also tried this
anyway hints how i can track down this, i think this is related to the depth sharing feature because everything worked before just fine.
Code: Select all
RenderTarget::RenderTarget()
:mPriority(OGRE_DEFAULT_RT_GROUP),
mActive(true),
mAutoUpdate(true),
mHwGamma(false),
mFSAA(0),
mDepthBuffer(0),
mDepthBufferPoolId(DepthBuffer::POOL_NO_DEPTH)
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
Re: Depth sharing Design
When you run the DirectX debug runtime (from the Dx9 SDK tools), in the Visual Studio output window you will get a dump of additional information right where the D3D error was thrown. Did you check the output window?
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
Re: Depth sharing Design
i did not (just checked the console )
Code: Select all
First-chance exception at 0x75939617 in Editor.exe: Microsoft C++ exception: Ogre::RenderingAPIException at memory location 0x004adaec..
First-chance exception at 0x75939617 in Editor.exe: Microsoft C++ exception: Ogre::Exception at memory location 0x004ae240..
Direct3D9: (ERROR) :**** The D3DUSAGE_DEPTHSTENCIL is not set on this surface.
Direct3D9: (ERROR) :**** You need to add D3DUSAGE_DEPTHSTENCIL to the Usage parameter
Direct3D9: (ERROR) :**** when creating the surface. SetDepthStencilSurface failed.
D3D9 Helper: IDirect3DDevice9::SetDepthStencilSurface failed: D3DERR_INVALIDCALL
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
Re: Depth sharing Design
Created a bug to track this: http://www.ogre3d.org/mantis/view.php?id=309
- Lee04
- Minaton
- Posts: 945
- Joined: Mon Jul 05, 2004 4:06 pm
- Location: Sweden
- x 1
Re: Depth sharing Design
Hi
Can the depth sharing patch be applied on to 1.7 of Ogre or do I need some special version of Ogre to use depth sharing patch?
Thanks
Lee
Can the depth sharing patch be applied on to 1.7 of Ogre or do I need some special version of Ogre to use depth sharing patch?
Thanks
Lee
Ph.D. student in game development
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
Re: Depth sharing Design
You can backport it if you like, otherwise just use the default branch from Mercurial.
- masterfalcon
- OGRE Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
- Contact:
Re: Depth sharing Design
I may have discovered a problem with depth sharing, not sure if it's related to wolfman's problems or not. GL ES doesn't have as many stencil or depth formats as desktop GL. As a result we usually end up with 24 bit depth and 8 bit stencil. RTT's are just blank then. I tried this in desktop GL by commenting out some formats in GLFBORenderTexture to be the same as GL ES and I got the same results. Either garbage in the buffers or just blank.
I haven't had a chance to look into why it's not working, I just figured it out late last night(or early this morning) but I thought it'd be good to get it out there to get some thoughts.
I haven't had a chance to look into why it's not working, I just figured it out late last night(or early this morning) but I thought it'd be good to get it out there to get some thoughts.
- masterfalcon
- OGRE Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
- Contact:
Re: Depth sharing Design
Additional note: Packed formats are no longer detected.
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1280
- Contact:
Re: Depth sharing Design
Whoa! I hate when phpBB3 doesn't email you about replies to your post. I came to this post again by looking at sinbad's tweets.
I haven't yet switched to Mercurial.
I'm very intrigued how a D3D9 surface ended up in a DepthBuffer class without the D3DUSAGE_DEPTHSTENCIL parameter.
If you're courageous enough, try figguring yourself what's going on
If you're scared, select the "depthBuffer" variable, right click, select "QuickWatch..." expand all variables as most as possible, screendump and post it. Hopefully we may spot the bug with that
Also copy-pasting the callstack won't hurt.
Edit:
You (Wolfmanfx) said:
That would definately help
I haven't yet switched to Mercurial.
I'm very intrigued how a D3D9 surface ended up in a DepthBuffer class without the D3DUSAGE_DEPTHSTENCIL parameter.
Try placing a breakpoint at file OgreD3D9RenderSystem.cpp, function D3D9RenderSystem::_setRenderTarget, line ~2872:anyway hints how i can track down this, i think this is related to the depth sharing feature because everything worked before just fine.
Code: Select all
hr = getActiveD3D9Device()->SetDepthStencilSurface( depthSurface );
If you're scared, select the "depthBuffer" variable, right click, select "QuickWatch..." expand all variables as most as possible, screendump and post it. Hopefully we may spot the bug with that
Also copy-pasting the callstack won't hurt.
Edit:
You (Wolfmanfx) said:
Could you provide the code on how you generate those several windows?and get an exception when i generate several windows on runtime
That would definately help
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1280
- Contact:
Re: Depth sharing Design
@masterfalcon:
I'm not very familiar with OGL so I could have made some mistakes, but last time I checked, depth & stencil formats are enumerated and detected in GLFBOManager::detectFBOFormats(), later to be matched using GLFBOManager::getBestDepthStencil, both functions were left untouched; but calling those functions was moved from FBO's initialization (I think it was a function called from the constructor) to GLRenderSystem.
May be if you share how you modified OGL so that it behaves like in GL ES I could reproduce it too.
I'm not very familiar with OGL so I could have made some mistakes, but last time I checked, depth & stencil formats are enumerated and detected in GLFBOManager::detectFBOFormats(), later to be matched using GLFBOManager::getBestDepthStencil, both functions were left untouched; but calling those functions was moved from FBO's initialization (I think it was a function called from the constructor) to GLRenderSystem.
May be if you share how you modified OGL so that it behaves like in GL ES I could reproduce it too.
- masterfalcon
- OGRE Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
- Contact:
Re: Depth sharing Design
All but the packed formats are detected right. I haven't tracked it down yet but i have a feeling that it's something like one call that's wrong.
In OgreGLFBORenderTexture.cpp:
In OgreGLFBORenderTexture.cpp:
Code: Select all
/// Stencil and depth formats to be tried
static const GLenum stencilFormats[] =
{
GL_NONE, // No stencil
// GL_STENCIL_INDEX1_EXT,
// GL_STENCIL_INDEX4_EXT,
GL_STENCIL_INDEX8_EXT,
// GL_STENCIL_INDEX16_EXT
};
static const size_t stencilBits[] =
{
0, /*1, 4*/, 8//, 16
};
#define STENCILFORMAT_COUNT (sizeof(stencilFormats)/sizeof(GLenum))
static const GLenum depthFormats[] =
{
GL_NONE,
GL_DEPTH_COMPONENT16,
GL_DEPTH_COMPONENT24, // Prefer 24 bit depth
// GL_DEPTH_COMPONENT32,
GL_DEPTH24_STENCIL8_EXT // packed depth / stencil
};
static const size_t depthBits[] =
{
0,16,24,/*32,*/24
};