formats: Fix readback condition for depth buffers

The old implementation of vrend_add_formats used to check color readback
format even if a depth buffer is bound. As no texture is attached to the
color buffer for such a FBO, it makes glGetIntegerv with
GL_IMPLEMENTATION_COLOR_READ_TYPE fail, and the error can trigger the
GL_NO_ERROR assertion in the function.

Check only if the depth buffer can be read in such a case.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Akihiko Odaki 3 years ago committed by Gert Wollny
parent a91830a42f
commit 0b595f6275
  1. 4
      src/vrend_formats.c

@ -536,8 +536,8 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries)
formats that are supported as destination formats by glReadPixels. */ formats that are supported as destination formats by glReadPixels. */
if (is_desktop_gl || if (is_desktop_gl ||
(status == GL_FRAMEBUFFER_COMPLETE && (status == GL_FRAMEBUFFER_COMPLETE &&
((is_depth && depth_stencil_formats_can_readback(table[i].format)) || (is_depth ? depth_stencil_formats_can_readback(table[i].format) :
color_format_can_readback(&table[i], gles_ver)))) color_format_can_readback(&table[i], gles_ver))))
flags |= VIRGL_TEXTURE_CAN_READBACK; flags |= VIRGL_TEXTURE_CAN_READBACK;
glDeleteTextures(1, &tex_id); glDeleteTextures(1, &tex_id);

Loading…
Cancel
Save