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

Fixes case 1 of #1142
This commit is contained in:
rdb 2021-04-09 10:45:22 +02:00
parent 99a3188af2
commit 715d786813

View File

@ -359,6 +359,12 @@ add_render_texture(Texture *tex, RenderTextureMode mode,
// If we're still planning on binding, indicate it in texture properly.
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);
RenderTexture result;