Depth sharing Design

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.

Re: Depth sharing Design

Postby xadhoom » Wed Feb 24, 2010 9:47 am

Noman,

Are these changes implicitly used by the Deferred Rendering Sample or would it need to adapt the Compositor scripts?

xad
User avatar
xadhoom
Minaton
 
Posts: 973
Kudos: 2
Joined: 28 Dec 2007
Location: Germany

Re: Depth sharing Design

Postby masterfalcon » Wed Feb 24, 2010 10:11 am

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?


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.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4264
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN

Re: Depth sharing Design

Postby dark_sylinc » Sat Feb 27, 2010 9:20 pm

Yay!! it's on trunk! :)
I've closed the SF.Net patch & tagged as accepted.

xadhoom wrote:Noman,

Are these changes implicitly used by the Deferred Rendering Sample or would it need to adapt the Compositor scripts?

xad

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.)

masterfalcon wrote:
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?


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.

I didn't touch GLES/2 at all.
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
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
 
Posts: 787
Kudos: 160
Joined: 21 Jul 2007
Location: Buenos Aires, Argentina

Re: Depth sharing Design

Postby moagames » Fri Mar 05, 2010 3:18 pm

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.
moagames
Halfling
 
Posts: 70
Kudos: 1
Joined: 10 Apr 2008

Re: Depth sharing Design

Postby dark_sylinc » Fri Mar 05, 2010 6:43 pm

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.

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.

Before these changes, the same effect was being achieved through a hack in Ogre RenderSystem.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
 
Posts: 787
Kudos: 160
Joined: 21 Jul 2007
Location: Buenos Aires, Argentina

Re: Depth sharing Design

Postby Noman » Fri Mar 05, 2010 7:29 pm

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...
User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
 
Posts: 714
Kudos: 2
Joined: 31 Jan 2005
Location: Israel

Re: Depth sharing Design

Postby masterfalcon » Sun Mar 14, 2010 12:09 am

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.
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();

...
}


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.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4264
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN

Re: Depth sharing Design

Postby dark_sylinc » Sun Mar 14, 2010 6:28 am

Thanks!
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();


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
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
 
Posts: 787
Kudos: 160
Joined: 21 Jul 2007
Location: Buenos Aires, Argentina

Re: Depth sharing Design

Postby masterfalcon » Sun Mar 14, 2010 7:33 am

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:
Code: Select all
            if( !mStencilBuffer || mStencilBuffer == mDepthBuffer )
               bSameStencil = stencilFormat == GL_NONE;
            else
            {
                if( mStencilBuffer )
                    bSameStencil = stencilFormat == mStencilBuffer->getGLFormat();
            }


If so, then I could make the change and check it in for all 3 GL render systems.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4264
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN

Re: Depth sharing Design

Postby sinbad » Mon Mar 15, 2010 3:44 pm

Looks right to me.
User avatar
sinbad
OGRE Founder (Retired)
OGRE Founder (Retired)
 
Posts: 25870
Kudos: 63
Joined: 06 Oct 2002
Location: Guernsey, Channel Islands

Re: Depth sharing Design

Postby masterfalcon » Mon Mar 15, 2010 5:18 pm

Cool. I'll check this in tonight. Gotta uncouple it from a bunch of other GL ES changes first.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4264
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN

Re: Depth sharing Design

Postby Wolfmanfx » Sun Mar 28, 2010 9:26 pm

I have updated my c# editor to the latest trunk and get an exception when i generate several windows on runtime
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)

with opengl everything works.

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.
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
 
Posts: 1426
Kudos: 98
Joined: 03 Feb 2006
Location: Austria - Leoben

Re: Depth sharing Design

Postby sinbad » Mon Mar 29, 2010 12:19 pm

The DirectX Debug Runtime should give you some more details on the error.
User avatar
sinbad
OGRE Founder (Retired)
OGRE Founder (Retired)
 
Posts: 25870
Kudos: 63
Joined: 06 Oct 2002
Location: Guernsey, Channel Islands

Re: Depth sharing Design

Postby Wolfmanfx » Mon Mar 29, 2010 1:05 pm

Will make a detailed report tonight.
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
 
Posts: 1426
Kudos: 98
Joined: 03 Feb 2006
Location: Austria - Leoben

Re: Depth sharing Design

Postby Wolfmanfx » Mon Mar 29, 2010 11:08 pm

Tried debug runtime not much info gained from that i also tried this

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)


anyway hints how i can track down this, i think this is related to the depth sharing feature because everything worked before just fine.
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
 
Posts: 1426
Kudos: 98
Joined: 03 Feb 2006
Location: Austria - Leoben

Re: Depth sharing Design

Postby sinbad » Tue Mar 30, 2010 3:45 pm

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?
User avatar
sinbad
OGRE Founder (Retired)
OGRE Founder (Retired)
 
Posts: 25870
Kudos: 63
Joined: 06 Oct 2002
Location: Guernsey, Channel Islands

Re: Depth sharing Design

Postby Wolfmanfx » Tue Mar 30, 2010 9:30 pm

i did not (just checked the console :roll: )
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
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
 
Posts: 1426
Kudos: 98
Joined: 03 Feb 2006
Location: Austria - Leoben

Re: Depth sharing Design

Postby sinbad » Wed Mar 31, 2010 12:40 pm

User avatar
sinbad
OGRE Founder (Retired)
OGRE Founder (Retired)
 
Posts: 25870
Kudos: 63
Joined: 06 Oct 2002
Location: Guernsey, Channel Islands

Re: Depth sharing Design

Postby Lee04 » Fri Apr 02, 2010 5:25 pm

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
Ph.D. student in game development
User avatar
Lee04
Gargoyle
 
Posts: 1010
Kudos: 2
Joined: 05 Jul 2004
Location: Sweden

Re: Depth sharing Design

Postby sinbad » Fri Apr 02, 2010 5:26 pm

You can backport it if you like, otherwise just use the default branch from Mercurial.
User avatar
sinbad
OGRE Founder (Retired)
OGRE Founder (Retired)
 
Posts: 25870
Kudos: 63
Joined: 06 Oct 2002
Location: Guernsey, Channel Islands

Re: Depth sharing Design

Postby masterfalcon » Fri Apr 09, 2010 3:14 pm

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.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4264
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN

Re: Depth sharing Design

Postby masterfalcon » Sat Apr 10, 2010 6:16 am

Additional note: Packed formats are no longer detected.
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4264
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN

Re: Depth sharing Design

Postby dark_sylinc » Sat Apr 10, 2010 11:43 pm

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.

anyway hints how i can track down this, i think this is related to the depth sharing feature because everything worked before just fine.

Try placing a breakpoint at file OgreD3D9RenderSystem.cpp, function D3D9RenderSystem::_setRenderTarget, line ~2872:
Code: Select all
hr = getActiveD3D9Device()->SetDepthStencilSurface( depthSurface );


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:
and get an exception when i generate several windows on runtime

Could you provide the code on how you generate those several windows?
That would definately help
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
 
Posts: 787
Kudos: 160
Joined: 21 Jul 2007
Location: Buenos Aires, Argentina

Re: Depth sharing Design

Postby dark_sylinc » Sun Apr 11, 2010 12:05 am

@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.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
 
Posts: 787
Kudos: 160
Joined: 21 Jul 2007
Location: Buenos Aires, Argentina

Re: Depth sharing Design

Postby masterfalcon » Sun Apr 11, 2010 1:02 am

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:

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
};
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
 
Posts: 4264
Kudos: 129
Joined: 25 Feb 2007
Location: Bloomington, MN

PreviousNext

Return to Developer talk

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests