Fix bug: copy-to-ram depth texture binding gets format set to RGB

This was a regression introduced by be8f4de33789cbb96551bb34b1ba85e7134d1e73

Fixes: #212
This commit is contained in:
rdb 2017-12-16 21:01:43 +01:00
parent e4a817b469
commit 29f50be15e
2 changed files with 24 additions and 3 deletions

View File

@ -275,12 +275,21 @@ add_render_texture(Texture *tex, RenderTextureMode mode,
// Choose a default bitplane.
if (plane == RTP_COUNT) {
if (tex->get_format() == Texture::F_depth_stencil) {
switch (tex->get_format()) {
case Texture::F_depth_stencil:
plane = RTP_depth_stencil;
} else if (tex->get_format() == Texture::F_depth_component) {
break;
case Texture::F_depth_component:
case Texture::F_depth_component16:
case Texture::F_depth_component24:
case Texture::F_depth_component32:
plane = RTP_depth;
} else {
break;
default:
plane = RTP_color;
break;
}
}

View File

@ -6455,6 +6455,18 @@ framebuffer_copy_to_ram(Texture *tex, int view, int z,
}
break;
case Texture::F_depth_component16:
component_type = Texture::T_unsigned_short;
break;
case Texture::F_depth_component24:
component_type = Texture::T_unsigned_int;
break;
case Texture::F_depth_component32:
component_type = Texture::T_float;
break;
default:
if (_current_properties->get_srgb_color()) {
if (_current_properties->get_alpha_bits()) {