From 3fd73723a34d629c5889a3b1b0391a942f3ccc46 Mon Sep 17 00:00:00 2001 From: Mikhail Burakov Date: Wed, 12 Apr 2023 13:27:16 +0200 Subject: Fix LOOKUP_FUNCTION macro in gpu code --- gpu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gpu.c b/gpu.c index a00eb53..ea455e8 100644 --- a/gpu.c +++ b/gpu.c @@ -37,11 +37,11 @@ #include "toolbox/utils.h" #define _(...) __VA_ARGS__ -#define LOOKUP_FUNCTION(a, b) \ +#define LOOKUP_FUNCTION(a, b, c) \ gpu_context->b = (a)eglGetProcAddress(#b); \ if (!gpu_context->b) { \ LOG("Failed to look up " #b " function"); \ - goto rollback_display; \ + goto c; \ } // TODO(mburakov): It should be theoretically possible to do everything in a @@ -343,8 +343,10 @@ struct GpuContext* GpuContextCreate(enum YuvColorspace colorspace, !HasExtension(egl_ext, "EGL_EXT_image_dma_buf_import") || !HasExtension(egl_ext, "EGL_EXT_image_dma_buf_import_modifiers")) goto rollback_display; - LOOKUP_FUNCTION(PFNEGLQUERYDMABUFFORMATSEXTPROC, eglQueryDmaBufFormatsEXT) - LOOKUP_FUNCTION(PFNEGLQUERYDMABUFMODIFIERSEXTPROC, eglQueryDmaBufModifiersEXT) + LOOKUP_FUNCTION(PFNEGLQUERYDMABUFFORMATSEXTPROC, eglQueryDmaBufFormatsEXT, + rollback_display) + LOOKUP_FUNCTION(PFNEGLQUERYDMABUFMODIFIERSEXTPROC, eglQueryDmaBufModifiersEXT, + rollback_display) if (!eglBindAPI(EGL_OPENGL_ES_API)) { LOG("Failed to bind egl api (%s)", EglErrorString(eglGetError())); @@ -379,7 +381,7 @@ struct GpuContext* GpuContextCreate(enum YuvColorspace colorspace, LOG("GL_EXTENSIONS: %s", gl_ext); if (!HasExtension(gl_ext, "GL_OES_EGL_image")) goto rollback_context; LOOKUP_FUNCTION(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC, - glEGLImageTargetTexture2DOES) + glEGLImageTargetTexture2DOES, rollback_context) gpu_context->program_luma = CreateGlProgram(_binary_vertex_glsl_start, _binary_vertex_glsl_end, -- cgit v1.2.3