From b37ab49b5265f0832e1c477c8d77567f97700a47 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 22 Dec 2017 18:57:44 +0000 Subject: [PATCH] vrend: Improved KHR_debug usage Make sure we add debug printing to the sub-context and disable printing when getting the format list. Signed-off-by: Jakob Bornecrantz Signed-off-by: Dave Airlie --- src/vrend_renderer.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index ce04106..e741434 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -100,6 +100,7 @@ struct global_renderer_state { bool inited; bool use_core_profile; + bool have_debug_cb; bool have_mesa_invert; bool have_samplers; bool have_robustness; @@ -3852,6 +3853,7 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags) glDebugMessageCallback(vrend_debug_cb, NULL); glEnable(GL_DEBUG_OUTPUT); glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + vrend_state.have_debug_cb = true; } vrend_state.gl_major_ver = gl_ver / 10; @@ -3901,8 +3903,18 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags) vrend_object_set_destroy_callback(VIRGL_OBJECT_SAMPLER_STATE, vrend_destroy_sampler_state_object); vrend_object_set_destroy_callback(VIRGL_OBJECT_VERTEX_ELEMENTS, vrend_destroy_vertex_elements_object); + /* disable for format testing, spews a lot of errors */ + if (vrend_state.have_debug_cb) { + glDisable(GL_DEBUG_OUTPUT); + } + vrend_build_format_list(); + /* disable for format testing */ + if (vrend_state.have_debug_cb) { + glDisable(GL_DEBUG_OUTPUT); + } + vrend_clicbs->destroy_gl_context(gl_context); list_inithead(&vrend_state.fence_list); list_inithead(&vrend_state.fence_wait_list); @@ -6449,6 +6461,13 @@ void vrend_renderer_create_sub_ctx(struct vrend_context *ctx, int sub_ctx_id) sub->gl_context = vrend_clicbs->create_gl_context(0, &ctx_params); vrend_clicbs->make_current(0, sub->gl_context); + /* enable if vrend_renderer_init function has done it as well */ + if (vrend_state.have_debug_cb) { + glDebugMessageCallback(vrend_debug_cb, NULL); + glEnable(GL_DEBUG_OUTPUT); + glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + } + sub->sub_ctx_id = sub_ctx_id; if (!vrend_state.have_vertex_attrib_binding) {