@ -61,6 +61,9 @@
/* debugging aid to dump shaders */
int vrend_dump_shaders ;
/* debugging via KHR_debug extension */
int vrend_use_debug_cb = 0 ;
struct vrend_if_cbs * vrend_clicbs ;
struct vrend_fence {
@ -3813,6 +3816,17 @@ static void vrend_renderer_use_threaded_sync(void)
}
# endif
static void vrend_debug_cb ( GLenum source , GLenum type , GLuint id ,
GLenum severity , GLsizei length ,
const GLchar * message , const void * userParam )
{
if ( type ! = GL_DEBUG_TYPE_ERROR ) {
return ;
}
fprintf ( stderr , " ERROR: %s \n " , message ) ;
}
int vrend_renderer_init ( struct vrend_if_cbs * cbs , uint32_t flags )
{
int gl_ver ;
@ -3833,6 +3847,13 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
vrend_clicbs - > make_current ( 0 , gl_context ) ;
gl_ver = epoxy_gl_version ( ) ;
/* enable error output as early as possible */
if ( vrend_use_debug_cb & & epoxy_has_gl_extension ( " GL_KHR_debug " ) ) {
glDebugMessageCallback ( vrend_debug_cb , NULL ) ;
glEnable ( GL_DEBUG_OUTPUT ) ;
glDisable ( GL_DEBUG_OUTPUT_SYNCHRONOUS ) ;
}
vrend_state . gl_major_ver = gl_ver / 10 ;
vrend_state . gl_minor_ver = gl_ver % 10 ;
if ( gl_ver > 30 & & ! epoxy_has_gl_extension ( " GL_ARB_compatibility " ) ) {
@ -4676,6 +4697,8 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
gltype = tex_conv_table [ res - > base . format ] . gltype ;
if ( ( ! vrend_state . use_core_profile ) & & ( res - > y_0_top ) ) {
GLuint buffers ;
if ( res - > readback_fb_id = = 0 | | res - > readback_fb_level ! = info - > level ) {
GLuint fb_id ;
if ( res - > readback_fb_id )
@ -4690,7 +4713,9 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
} else {
glBindFramebufferEXT ( GL_FRAMEBUFFER_EXT , res - > readback_fb_id ) ;
}
glDrawBuffer ( GL_COLOR_ATTACHMENT0_EXT ) ;
buffers = GL_COLOR_ATTACHMENT0_EXT ;
glDrawBuffers ( 1 , & buffers ) ;
vrend_blend_enable ( ctx , false ) ;
vrend_depth_test_enable ( ctx , false ) ;
vrend_alpha_test_enable ( ctx , false ) ;