2
0
Эх сурвалжийг харах

Since it was encountered in the wild (#1092), make failure to create the read-only depth stencil view only result in a warning instead of error, and fallback to the normal view if read-only view is not available. It is only needed when sampling and depth-testing the same texture in the HWDepth renderpaths.

Lasse Öörni 10 жил өмнө
parent
commit
675aa9c94c

+ 1 - 1
Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp

@@ -2501,7 +2501,7 @@ void Graphics::PrepareDraw()
             depthStencil_ ? (ID3D11DepthStencilView*)depthStencil_->GetRenderTargetView() : impl_->defaultDepthStencilView_;
 
         // If possible, bind a read-only depth stencil view to allow reading depth in shader
-        if (!depthWrite_ && depthStencil_)
+        if (!depthWrite_ && depthStencil_ && depthStencil_->GetReadOnlyView())
             impl_->depthStencilView_ = (ID3D11DepthStencilView*)depthStencil_->GetReadOnlyView();
 
         for (unsigned i = 0; i < MAX_RENDERTARGETS; ++i)

+ 1 - 4
Source/Urho3D/Graphics/Direct3D11/D3D11Texture2D.cpp

@@ -538,10 +538,7 @@ bool Texture2D::Create()
             (ID3D11DepthStencilView**)&renderSurface_->readOnlyView_);
 
         if (!renderSurface_->readOnlyView_)
-        {
-            URHO3D_LOGERROR("Failed to create read-only depth-stencil view for texture");
-            return false;
-        }
+            URHO3D_LOGWARNING("Failed to create read-only depth-stencil view for texture");
     }
 
     return true;