Browse Source

display: Prevent attempt to copy depth from non-depth framebuffer

Fixes case 1 of #1142
rdb 4 years ago
parent
commit
715d786813
1 changed files with 6 additions and 0 deletions
  1. 6 0
      panda/src/display/graphicsOutput.cxx

+ 6 - 0
panda/src/display/graphicsOutput.cxx

@@ -359,6 +359,12 @@ add_render_texture(Texture *tex, RenderTextureMode mode,
     // If we're still planning on binding, indicate it in texture properly.
     // If we're still planning on binding, indicate it in texture properly.
     tex->set_render_to_texture(true);
     tex->set_render_to_texture(true);
   }
   }
+  else if ((plane == RTP_depth || plane == RTP_depth_stencil) && _fb_properties.get_depth_bits() == 0) {
+    // If we're not providing the depth buffer, we need something to copy from.
+    display_cat.error()
+      << "add_render_texture: can't copy depth from framebuffer without depth bits!\n";
+    return;
+  }
 
 
   CDWriter cdata(_cycler, true);
   CDWriter cdata(_cycler, true);
   RenderTexture result;
   RenderTexture result;