Browse Source

dxgsg9: fix problems with window without depth buffer

rdb 7 years ago
parent
commit
96860b88e0

+ 2 - 2
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -799,9 +799,9 @@ clear(DrawableRegion *clearable) {
     main_flags |=  D3DCLEAR_TARGET;
     main_flags |=  D3DCLEAR_TARGET;
   }
   }
 
 
-  if (clearable->get_clear_depth_active()) {
+  if (clearable->get_clear_depth_active() &&
+      _screen->_presentation_params.EnableAutoDepthStencil) {
     aux_flags |=  D3DCLEAR_ZBUFFER;
     aux_flags |=  D3DCLEAR_ZBUFFER;
-    nassertv(_screen->_presentation_params.EnableAutoDepthStencil);
   }
   }
 
 
   if (clearable->get_clear_stencil_active()) {
   if (clearable->get_clear_stencil_active()) {

+ 4 - 1
panda/src/dxgsg9/wdxGraphicsWindow9.cxx

@@ -1229,7 +1229,10 @@ init_resized_window() {
   DWORD flags;
   DWORD flags;
   D3DCOLOR clear_color;
   D3DCOLOR clear_color;
 
 
-  flags = D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER;
+  flags = D3DCLEAR_TARGET;
+  if (_fb_properties.get_depth_bits() > 0) {
+    flags |= D3DCLEAR_ZBUFFER;
+  }
   clear_color = 0x00000000;
   clear_color = 0x00000000;
   hr = _wcontext._d3d_device-> Clear (0, nullptr, flags, clear_color, 0.0f, 0);
   hr = _wcontext._d3d_device-> Clear (0, nullptr, flags, clear_color, 0.0f, 0);
   if (FAILED(hr)) {
   if (FAILED(hr)) {