* 'for-airlied' of https://gitlab.collabora.com/jakob/virglrenderer-gles:
  vrend: Add optional KHR_debug printing code
  vrend: Replace all uses of glDrawBuffer with glDrawBuffers
  build-sys: Use PKG_CHECK_VAR for libepoxy EGL support checking
macos/master
Dave Airlie 7 years ago
commit 9f928a3384
  1. 11
      configure.ac
  2. 9
      src/vrend_blitter.c
  3. 9
      src/vrend_formats.c
  4. 27
      src/vrend_renderer.c

@ -89,7 +89,7 @@ if test "x$build_tests" = "xyes"; then
fi
AC_CHECK_FUNCS_ONCE([eventfd])
AC_CHECK_HEADERS_ONCE([sys/uio.h epoxy/egl.h])
AC_CHECK_HEADERS_ONCE([sys/uio.h])
AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"])
@ -101,6 +101,13 @@ if test "x$os_win32" = xno; then
fi
PKG_CHECK_MODULES([EPOXY], [epoxy])
PKG_CHECK_VAR(epoxy_has_egl, [epoxy], [epoxy_has_egl])
AS_IF([test "x$epoxy_has_egl" = "x1"], [
epoxy_has_egl=yes
AC_DEFINE([HAVE_EPOXY_EGL_H], [1], [Libepoxy has EGL support.])
],[
epoxy_has_egl=no
])
AC_ARG_WITH([glx], AS_HELP_STRING([--with-glx], [Build with the x11/glx backend]))
AS_IF([test "x$with_glx" = "xyes"], [
@ -109,6 +116,7 @@ AS_IF([test "x$with_glx" = "xyes"], [
])
AM_CONDITIONAL([WITH_GLX], [test "x$with_glx" = "xyes"])
AC_SUBST([DEFINES])
AC_CONFIG_FILES([
virglrenderer.pc
@ -130,6 +138,7 @@ AC_MSG_NOTICE([
win32: $os_win32
glx: $with_glx
egl: $epoxy_has_egl
debug: $enable_debug
tests: $build_tests

@ -535,6 +535,7 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
const struct pipe_blit_info *info)
{
struct vrend_blitter_ctx *blit_ctx = &vrend_blit_ctx;
GLuint buffers;
GLuint prog_id;
GLuint fs_id;
GLint lret;
@ -597,7 +598,8 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
glBindFramebuffer(GL_FRAMEBUFFER_EXT, blit_ctx->fb_id);
vrend_fb_bind_texture(dst_res, 0, info->dst.level, info->dst.box.z);
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
buffers = GL_COLOR_ATTACHMENT0_EXT;
glDrawBuffers(1, &buffers);
glBindTexture(src_res->target, src_res->id);
@ -635,7 +637,10 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
glBindFramebuffer(GL_FRAMEBUFFER_EXT, blit_ctx->fb_id);
vrend_fb_bind_texture(dst_res, 0, info->dst.level, dst_z);
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
buffers = GL_COLOR_ATTACHMENT0_EXT;
glDrawBuffers(1, &buffers);
blitter_set_texcoords(blit_ctx, src_res, info->src.level,
info->src.box.z + src_z, 0,
info->src.box.x, info->src.box.y,

@ -253,7 +253,9 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries)
{
int i;
uint32_t binding = 0;
GLuint buffers;
GLuint tex_id, fb_id;
for (i = 0; i < num_entries; i++) {
GLenum status;
bool is_depth = false;
@ -304,11 +306,14 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries)
glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_2D, tex_id, 0);
is_depth = true;
glDrawBuffer(GL_NONE);
buffers = GL_NONE;
glDrawBuffers(1, &buffers);
} else {
glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex_id, 0);
glDrawBuffer(GL_COLOR_ATTACHMENT0);
buffers = GL_COLOR_ATTACHMENT0_EXT;
glDrawBuffers(1, &buffers);
}
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);

@ -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);

Loading…
Cancel
Save