@@ -952,14 +952,15 @@ inline bool DeviceContextBase<ImplementationTraits>::SetRenderTargets(
952952 if (pRTView)
953953 {
954954 const auto & RTVDesc = pRTView->GetDesc ();
955+ const auto & TexDesc = pRTView->GetTexture ()->GetDesc ();
955956 DEV_CHECK_ERR (RTVDesc.ViewType == TEXTURE_VIEW_RENDER_TARGET,
956957 " Texture view object named '" , RTVDesc.Name ? RTVDesc.Name : " " , " ' has incorrect view type (" , GetTexViewTypeLiteralName (RTVDesc.ViewType ), " ). Render target view is expected" );
958+ DEV_CHECK_ERR (m_pBoundFramebuffer || (TexDesc.MiscFlags & MISC_TEXTURE_FLAG_MEMORYLESS) == 0 ,
959+ " Memoryless render target '" , TexDesc.Name , " ' must be used within a framebuffer" );
957960
958961 // Use this RTV to set the render target size
959962 if (m_FramebufferWidth == 0 )
960963 {
961- auto * pTex = pRTView->GetTexture ();
962- const auto & TexDesc = pTex->GetDesc ();
963964 m_FramebufferWidth = std::max (TexDesc.Width >> RTVDesc.MostDetailedMip , 1U );
964965 m_FramebufferHeight = std::max (TexDesc.Height >> RTVDesc.MostDetailedMip , 1U );
965966 m_FramebufferSlices = RTVDesc.NumArraySlices ;
@@ -968,7 +969,6 @@ inline bool DeviceContextBase<ImplementationTraits>::SetRenderTargets(
968969 else
969970 {
970971#ifdef DILIGENT_DEVELOPMENT
971- const auto & TexDesc = pRTView->GetTexture ()->GetDesc ();
972972 DEV_CHECK_ERR (m_FramebufferWidth == std::max (TexDesc.Width >> RTVDesc.MostDetailedMip , 1U ),
973973 " Render target width (" , std::max (TexDesc.Width >> RTVDesc.MostDetailedMip , 1U ), " ) specified by RTV '" , RTVDesc.Name , " ' is inconsistent with the width of previously bound render targets (" , m_FramebufferWidth, " )" );
974974 DEV_CHECK_ERR (m_FramebufferHeight == std::max (TexDesc.Height >> RTVDesc.MostDetailedMip , 1U ),
@@ -994,14 +994,15 @@ inline bool DeviceContextBase<ImplementationTraits>::SetRenderTargets(
994994 if (pDepthStencil != nullptr )
995995 {
996996 const auto & DSVDesc = pDepthStencil->GetDesc ();
997+ const auto & TexDesc = pDepthStencil->GetTexture ()->GetDesc ();
997998 DEV_CHECK_ERR (DSVDesc.ViewType == TEXTURE_VIEW_DEPTH_STENCIL,
998999 " Texture view object named '" , DSVDesc.Name ? DSVDesc.Name : " " , " ' has incorrect view type (" , GetTexViewTypeLiteralName (DSVDesc.ViewType ), " ). Depth stencil view is expected" );
1000+ DEV_CHECK_ERR (m_pBoundFramebuffer || (TexDesc.MiscFlags & MISC_TEXTURE_FLAG_MEMORYLESS) == 0 ,
1001+ " Memoryless depth buffer '" , TexDesc.Name , " ' must be used within a framebuffer" );
9991002
10001003 // Use depth stencil size to set render target size
10011004 if (m_FramebufferWidth == 0 )
10021005 {
1003- auto * pTex = pDepthStencil->GetTexture ();
1004- const auto & TexDesc = pTex->GetDesc ();
10051006 m_FramebufferWidth = std::max (TexDesc.Width >> DSVDesc.MostDetailedMip , 1U );
10061007 m_FramebufferHeight = std::max (TexDesc.Height >> DSVDesc.MostDetailedMip , 1U );
10071008 m_FramebufferSlices = DSVDesc.NumArraySlices ;
@@ -1010,7 +1011,6 @@ inline bool DeviceContextBase<ImplementationTraits>::SetRenderTargets(
10101011 else
10111012 {
10121013#ifdef DILIGENT_DEVELOPMENT
1013- const auto & TexDesc = pDepthStencil->GetTexture ()->GetDesc ();
10141014 DEV_CHECK_ERR (m_FramebufferWidth == std::max (TexDesc.Width >> DSVDesc.MostDetailedMip , 1U ),
10151015 " Depth-stencil target width (" , std::max (TexDesc.Width >> DSVDesc.MostDetailedMip , 1U ), " ) specified by DSV '" , DSVDesc.Name , " ' is inconsistent with the width of previously bound render targets (" , m_FramebufferWidth, " )" );
10161016 DEV_CHECK_ERR (m_FramebufferHeight == std::max (TexDesc.Height >> DSVDesc.MostDetailedMip , 1U ),
@@ -2136,6 +2136,7 @@ inline void DeviceContextBase<ImplementationTraits>::DvpVerifyRenderTargets() co
21362136 const auto & TilePipeline = m_pPipelineState->GetTilePipelineDesc ();
21372137 NumPipelineRenderTargets = TilePipeline.NumRenderTargets ;
21382138 PipelineRTVFormats = TilePipeline.RTVFormats ;
2139+ PipelineDSVFormat = BoundDSVFormat; // to disable warning
21392140 }
21402141 else
21412142 {
0 commit comments