Browse Source

fixed a crash bug with certain cards that do not support stencil buffer. The crash would fail the display of the first frame. Example card, PowerVR kyro

Asad M. Zaman 22 years ago
parent
commit
458d86dcbf
1 changed files with 4 additions and 2 deletions
  1. 4 2
      panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx

+ 4 - 2
panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx

@@ -4767,8 +4767,10 @@ void DXGraphicsStateGuardian8::set_render_target() {
 
 
   _pD3DDevice->GetDepthStencilSurface(&pStencil);
   _pD3DDevice->GetDepthStencilSurface(&pStencil);
   _pD3DDevice->SetRenderTarget(pBack,pStencil);
   _pD3DDevice->SetRenderTarget(pBack,pStencil);
-  pBack->Release();
-  pStencil->Release();
+  if (pBack)
+    pBack->Release();
+  if (pStencil)
+    pStencil->Release();
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////