MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / createDepthBufferFor

Method createDepthBufferFor

OgreMain/src/OgreRenderSystem.cpp:670–695  ·  view source on GitHub ↗

---------------------------------------------------------------------

Source from the content-addressed store, hash-verified

668 }
669 //---------------------------------------------------------------------
670 TextureGpu *RenderSystem::createDepthBufferFor( TextureGpu *colourTexture, bool preferDepthTexture,
671 PixelFormatGpu depthBufferFormat, uint16 poolId )
672 {
673 uint32 textureFlags = TextureFlags::RenderToTexture;
674
675 if( !preferDepthTexture )
676 textureFlags |= TextureFlags::NotTexture | TextureFlags::DiscardableContent;
677
678 char tmpBuffer[64];
679 LwString depthBufferName( LwString::FromEmptyPointer( tmpBuffer, sizeof( tmpBuffer ) ) );
680 depthBufferName.a( "DepthBuffer_", Id::generateNewId<TextureGpu>() );
681
682 TextureGpu *retVal = mTextureGpuManager->createTexture(
683 depthBufferName.c_str(), GpuPageOutStrategy::Discard, textureFlags, TextureTypes::Type2D );
684 retVal->setResolution( colourTexture->getInternalWidth(), colourTexture->getInternalHeight() );
685 retVal->setPixelFormat( depthBufferFormat );
686 retVal->_setDepthBufferDefaults( poolId, preferDepthTexture, depthBufferFormat );
687 retVal->_setSourceType( TextureSourceType::SharedDepthBuffer );
688 retVal->setSampleDescription( colourTexture->getRequestedSampleDescription() );
689
690 retVal->_transitionTo( GpuResidency::Resident, (uint8 *)0 );
691
692 // Start reference count on the depth buffer here
693 mSharedDepthBufferRefs[retVal] = 1u;
694 return retVal;
695 }
696 //---------------------------------------------------------------------
697 TextureGpu *RenderSystem::getDepthBufferFor( TextureGpu *colourTexture, uint16 poolId,
698 bool preferDepthTexture,

Callers

nothing calls this directly

Calls 11

getInternalWidthMethod · 0.80
getInternalHeightMethod · 0.80
setPixelFormatMethod · 0.80
_setSourceTypeMethod · 0.80
setSampleDescriptionMethod · 0.80
_transitionToMethod · 0.80
createTextureMethod · 0.45
c_strMethod · 0.45
setResolutionMethod · 0.45

Tested by

no test coverage detected