Ejemplo n.º 1
0
static inline bool vg_query_extension(const char *ext)
{
   const char *str = (const char*)vgGetString(VG_EXTENSIONS);
   bool ret = str && strstr(str, ext);
   RARCH_LOG("Querying VG extension: %s => %s\n",
         ext, ret ? "exists" : "doesn't exist");

   return ret;
}
Ejemplo n.º 2
0
GLUSboolean GLUSAPIENTRY glusExtensionSupported(const GLUSchar* extension)
{
	const GLUSubyte* allExtensions;
	const GLUSubyte* startExtension;
	GLUSubyte* walkerExtension;
	GLUSubyte* terminatorExtension;

	if (!extension)
	{
		return GLUS_FALSE;
	}

	walkerExtension = (GLUSubyte*)strchr(extension, ' ');
	if (walkerExtension || *extension == '\0')
	{
		return GLUS_FALSE;
	}

	allExtensions = vgGetString(VG_EXTENSIONS);

	startExtension = allExtensions;
	while (startExtension)
	{
		walkerExtension = (GLUSubyte*)strstr((const GLUSchar*)startExtension, extension);

		if (!walkerExtension)
		{
			return GLUS_FALSE;
		}

		terminatorExtension = walkerExtension + strlen(extension);

		if (!terminatorExtension)
		{
			return GLUS_FALSE;
		}

		if (walkerExtension == startExtension || *(walkerExtension - 1) == ' ')
		{
			if (*terminatorExtension == ' ' || *terminatorExtension == '\0')
			{
				return GLUS_TRUE;
			}
		}

		startExtension = (const GLUSubyte*)terminatorExtension;
	}

	return GLUS_FALSE;
}
Ejemplo n.º 3
0
static void display_info(char *label, VGStringID name)
{
	char *info;

	info = (char*) vgGetString(name);

	if (info != NULL) {
		printf("%s: %s\n", label, info);
	} else {
		printf("failed\n");
	}
	

}
Ejemplo n.º 4
0
GLDEF_C TInt E32Main()
    {
    RDebug::Printf("testing VG 1.0 function");
    VGPath path0 = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
    RDebug::Printf("finished testing VG 1.0 function");

#ifdef OPENVG_VERSION_1_1
    if(strcmp((const char*)vgGetString(VG_VERSION), "1.1")==0)
    	{
    	RDebug::Printf("testing function introduced in 1.1");
    	VGFont font = vgCreateFont(245);
    	vgDrawGlyph(font, 2, 256, VG_FALSE);
    	RDebug::Printf("finished testing function introduced in 1.1");
    	}
#endif
    
    return 0;
    }
Ejemplo n.º 5
0
int run(int argc, char **argv,
        init_func init_f,
        reshape_func resh_f,
        draw_func draw_f,
        key_func key_f)
{
   const int winWidth = width, winHeight = height;
   Display *x_dpy;
   Window win;
   EGLSurface egl_surf;
   EGLContext egl_ctx;
   EGLDisplay egl_dpy;
   char *dpyName = NULL;
   GLboolean printInfo = GL_FALSE;
   EGLint egl_major, egl_minor;
   int i;
   const char *s;

   init = init_f;
   draw = draw_f;
   reshape = resh_f;
   keyPress = key_f;

   for (i = 1; i < argc; i++) {
      if (strcmp(argv[i], "-display") == 0) {
         dpyName = argv[i+1];
         i++;
      }
      else if (strcmp(argv[i], "-info") == 0) {
         printInfo = GL_TRUE;
      }
   }

   x_dpy = XOpenDisplay(dpyName);
   if (!x_dpy) {
      printf("Error: couldn't open display %s\n",
	     dpyName ? dpyName : getenv("DISPLAY"));
      return -1;
   }

   egl_dpy = eglGetDisplay(x_dpy);
   if (!egl_dpy) {
      printf("Error: eglGetDisplay() failed\n");
      return -1;
   }

   if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
      printf("Error: eglInitialize() failed\n");
      return -1;
   }

   s = eglQueryString(egl_dpy, EGL_VERSION);
   printf("EGL_VERSION = %s\n", s);

   make_x_window(x_dpy, egl_dpy,
                 "OpenVG Example", 0, 0, winWidth, winHeight,
                 &win, &egl_ctx, &egl_surf);

   XMapWindow(x_dpy, win);
   if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
      printf("Error: eglMakeCurrent() failed\n");
      return -1;
   }

   if (printInfo) {
      printf("VG_RENDERER   = %s\n", (char *) vgGetString(VG_RENDERER));
      printf("VG_VERSION    = %s\n", (char *) vgGetString(VG_VERSION));
      printf("VG_VENDOR     = %s\n", (char *) vgGetString(VG_VENDOR));
   }

   if (init)
      init();

   /* Set initial projection/viewing transformation.
    * We can't be sure we'll get a ConfigureNotify event when the window
    * first appears.
    */
   if (reshape)
      reshape(winWidth, winHeight);

   event_loop(x_dpy, win, egl_dpy, egl_surf);

   eglMakeCurrent(egl_dpy, 0, 0, 0);
   eglDestroyContext(egl_dpy, egl_ctx);
   eglDestroySurface(egl_dpy, egl_surf);
   eglTerminate(egl_dpy);


   XDestroyWindow(x_dpy, win);
   XCloseDisplay(x_dpy);

   return 0;
}
Ejemplo n.º 6
0
/*!***********************************************************************
@Function		OutputAPIInfo
@description	When prefOutputInfo is set to true this function outputs
				various pieces of API dependent information via
				PVRShellOutputDebug.
*************************************************************************/
void PVRShellInit::OutputAPIInfo()
{
	// Output API dependent information
	if(m_pShell->PVRShellGet(prefOutputInfo))
	{
		int i32Values[5];

		m_pShell->PVRShellOutputDebug("\n");
#ifndef BUILD_OVG
		m_pShell->PVRShellOutputDebug("GL:\n");
		m_pShell->PVRShellOutputDebug("  Vendor:   %s\n", (char*) glGetString(GL_VENDOR));
		m_pShell->PVRShellOutputDebug("  Renderer: %s\n", (char*) glGetString(GL_RENDERER));
		m_pShell->PVRShellOutputDebug("  Version:  %s\n", (char*) glGetString(GL_VERSION));
#else
		m_pShell->PVRShellOutputDebug("VG:\n");
		m_pShell->PVRShellOutputDebug("  Vendor:   %s\n", (char*) vgGetString(VG_VENDOR));
		m_pShell->PVRShellOutputDebug("  Renderer: %s\n", (char*) vgGetString(VG_RENDERER));
		m_pShell->PVRShellOutputDebug("  Version:  %s\n", (char*) vgGetString(VG_VERSION));
#endif

		m_pShell->PVRShellOutputDebug("\n");
		m_pShell->PVRShellOutputDebug("EGL:\n");
		m_pShell->PVRShellOutputDebug("  Vendor:   %s\n" , (char*) eglQueryString(gEglDisplay, EGL_VENDOR));
		m_pShell->PVRShellOutputDebug("  Version:  %s\n" , (char*) eglQueryString(gEglDisplay, EGL_VERSION));

#ifdef EGL_VERSION_1_2
		m_pShell->PVRShellOutputDebug("  Client APIs:  %s\n" , (char*) eglQueryString(gEglDisplay, EGL_CLIENT_APIS));
#endif

		m_pShell->PVRShellOutputDebug("\n");
		m_pShell->PVRShellOutputDebug("Window Width:  %i\n" , m_pShell->PVRShellGet(prefWidth));
		m_pShell->PVRShellOutputDebug("Window Height: %i\n" , m_pShell->PVRShellGet(prefHeight));
		m_pShell->PVRShellOutputDebug("Is Rotated: %s\n", m_pShell->PVRShellGet(prefIsRotated) ? "Yes" : "No");
		m_pShell->PVRShellOutputDebug("\n");

		// Colour buffer
		m_pShell->PVRShellOutputDebug("EGL Surface:\n");
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_BUFFER_SIZE , &i32Values[0]);
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_RED_SIZE    , &i32Values[1]);
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_GREEN_SIZE  , &i32Values[2]);
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_BLUE_SIZE   , &i32Values[3]);
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_ALPHA_SIZE  , &i32Values[4]);

		m_pShell->PVRShellOutputDebug("  Colour Buffer:  %i bits (R%i G%i B%i A%i)\n", i32Values[0],i32Values[1],i32Values[2],i32Values[3],i32Values[4]);

		// Depth buffer
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_DEPTH_SIZE , &i32Values[0]);
		m_pShell->PVRShellOutputDebug("  Depth Buffer:   %i bits\n", i32Values[0]);

		// Stencil Buffer
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_STENCIL_SIZE , &i32Values[0]);
		m_pShell->PVRShellOutputDebug("  Stencil Buffer: %i bits\n", i32Values[0]);

		// EGL surface bits support
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_SURFACE_TYPE , &i32Values[0]);
		m_pShell->PVRShellOutputDebug("  Surface type:   %s%s%s\n",	i32Values[0] & EGL_WINDOW_BIT  ? "WINDOW " : "",
																		i32Values[1] & EGL_PBUFFER_BIT ? "PBUFFER " : "",
																		i32Values[2] & EGL_PIXMAP_BIT  ? "PIXMAP " : "");
		// EGL renderable type
#ifdef EGL_VERSION_1_2
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_RENDERABLE_TYPE , &i32Values[0]);
		m_pShell->PVRShellOutputDebug("  Renderable type: %s%s%s%s\n", i32Values[0] & EGL_OPENVG_BIT ? "OPENVG " : "",
															i32Values[0] & EGL_OPENGL_ES_BIT ? "OPENGL_ES " : "",
#ifdef EGL_OPENGL_BIT
															i32Values[0] & EGL_OPENGL_BIT ? "OPENGL " :
#endif
															"",
															i32Values[0] & EGL_OPENGL_ES2_BIT ? "OPENGL_ES2 " : "");
#endif

#ifndef BUILD_OVG
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_SAMPLE_BUFFERS , &i32Values[0]);
		eglGetConfigAttrib(gEglDisplay, gEglConfig, EGL_SAMPLES , &i32Values[1]);
		m_pShell->PVRShellOutputDebug("  Sample buffer No.: %i\n", i32Values[0]);
		m_pShell->PVRShellOutputDebug("  Samples per pixel: %i\n", i32Values[1]);
#else
		m_pShell->PVRShellOutputDebug("\n");

		switch(vgGeti(VG_RENDERING_QUALITY))
		{
			case VG_RENDERING_QUALITY_BETTER:
				m_pShell->PVRShellOutputDebug("Rendering quality:  VG_RENDERING_QUALITY_BETTER\n");
			break;
			case VG_RENDERING_QUALITY_FASTER:
				m_pShell->PVRShellOutputDebug("Rendering quality:  VG_RENDERING_QUALITY_FASTER\n");
			break;
			default:
				m_pShell->PVRShellOutputDebug("Rendering quality:  VG_RENDERING_QUALITY_NONANTIALIASED\n");
		}

#endif
	}
}
Ejemplo n.º 7
0
static void *vg_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{
   vg_t *vg = (vg_t*)calloc(1, sizeof(vg_t));
   if (!vg)
      return NULL;

   vg->driver = gfx_ctx_init_first(GFX_CTX_OPENVG_API, 0, 0);

   if (!vg->driver)
   {
      free(vg);
      return NULL;
   }

   vg->driver->get_video_size(&vg->mScreenWidth, &vg->mScreenHeight);
   RARCH_LOG("Detecting screen resolution %ux%u.\n", vg->mScreenWidth, vg->mScreenHeight);

   vg->driver->swap_interval(video->vsync ? 1 : 0);
   vg->driver->update_window_title();

   vg->mTexType = video->rgb32 ? VG_sXRGB_8888 : VG_sRGB_565;
   vg->mKeepAspect = video->force_aspect;

   unsigned win_width  = video->width;
   unsigned win_height = video->height;
   if (video->fullscreen && (win_width == 0) && (win_height == 0))
   {
      win_width  = vg->mScreenWidth;
      win_height = vg->mScreenHeight;
   }

   if (!vg->driver->set_video_mode(win_width, win_height, video->fullscreen))
   {
      free(vg);
      return NULL;
   }

   vg->driver->get_video_size(&vg->mScreenWidth, &vg->mScreenHeight);
   RARCH_LOG("Verified window resolution %ux%u.\n", vg->mScreenWidth, vg->mScreenHeight);
   vg->should_resize = true;

   if (vg->driver->translate_aspect)
      vg->mScreenAspect = vg->driver->translate_aspect(vg->mScreenWidth, vg->mScreenHeight);
   else
      vg->mScreenAspect = (float)vg->mScreenWidth / vg->mScreenHeight;

   VGfloat clearColor[4] = {0, 0, 0, 1};
   vgSetfv(VG_CLEAR_COLOR, 4, clearColor);

   vg->mTextureWidth = vg->mTextureHeight = video->input_scale * RARCH_SCALE_BASE;
   vg->mImage = vgCreateImage(vg->mTexType, vg->mTextureWidth, vg->mTextureHeight,
         video->smooth ? VG_IMAGE_QUALITY_BETTER : VG_IMAGE_QUALITY_NONANTIALIASED);
   vg_set_nonblock_state(vg, !video->vsync);

   vg->driver->input_driver(input, input_data);

   if (g_settings.video.font_enable && font_renderer_create_default(&vg->font_driver, &vg->mFontRenderer))
   {
      vg->mFont = vgCreateFont(0);

      if (vg->mFont != VG_INVALID_HANDLE)
      {
         vg->mFontsOn = true;

         vg->mFontHeight = g_settings.video.font_size * (g_settings.video.font_scale ? (float) vg->mScreenWidth / 1280.0f : 1.0f);

         vg->mPaintFg = vgCreatePaint();
         vg->mPaintBg = vgCreatePaint();
         VGfloat paintFg[] = { g_settings.video.msg_color_r, g_settings.video.msg_color_g, g_settings.video.msg_color_b, 1.0f };
         VGfloat paintBg[] = { g_settings.video.msg_color_r / 2.0f, g_settings.video.msg_color_g / 2.0f, g_settings.video.msg_color_b / 2.0f, 0.5f };

         vgSetParameteri(vg->mPaintFg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
         vgSetParameterfv(vg->mPaintFg, VG_PAINT_COLOR, 4, paintFg);

         vgSetParameteri(vg->mPaintBg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
         vgSetParameterfv(vg->mPaintBg, VG_PAINT_COLOR, 4, paintBg);
      }
   }

   if (vg_query_extension("KHR_EGL_image") && vg->driver->init_egl_image_buffer(video))
   {
      pvgCreateEGLImageTargetKHR = (PFNVGCREATEEGLIMAGETARGETKHRPROC)vg->driver->get_proc_address("vgCreateEGLImageTargetKHR");

      if (pvgCreateEGLImageTargetKHR)
      {
         RARCH_LOG("[VG] Using EGLImage buffer\n");
         vg->mEglImageBuf = true;
      }
   }

#if 0
   const char *ext = (const char*)vgGetString(VG_EXTENSIONS);
   if (ext)
      RARCH_LOG("[VG] Supported extensions: %s\n", ext);
#endif

   return vg;
}
Ejemplo n.º 8
0
void process_vg_info(writer &p_vg_writer, egl_scope const &p_egl_scope)
{
	EGLint attribs[] =
	{
		EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
		EGL_RED_SIZE, 1,
		EGL_GREEN_SIZE, 1,
		EGL_BLUE_SIZE, 1,
		EGL_NONE
	};

	EGLint num_configs;
	EGLConfig config;
	if (!eglChooseConfig(p_egl_scope.get_display(), attribs, &config, 1, &num_configs) || (num_configs < 1))
	{
		PRINT_EGL_ERROR("Could not find config for OpenVG (perhaps this API is unsupported?)");
		return;
	}

	EGLint vid;
	if (!eglGetConfigAttrib(p_egl_scope.get_display(), config, EGL_NATIVE_VISUAL_ID, &vid))
	{
		PRINT_EGL_ERROR("Could not get native visual ID from chosen config");
		return;
	}


	native_window window(p_egl_scope.get_native_display(), vid);

	eglBindAPI(EGL_OPENVG_API);

	scoped_context context(p_egl_scope.get_display(), eglCreateContext(p_egl_scope.get_display(), config, EGL_NO_CONTEXT, NULL));
	scoped_surface surface(p_egl_scope.get_display(), eglCreateWindowSurface(p_egl_scope.get_display(), config, window.get_egl_native_window(), NULL));

	if (!eglMakeCurrent(p_egl_scope.get_display(), surface.get_surface(), surface.get_surface(), context.get_context()))
	{
		PRINT_EGL_ERROR("eglMakeCurrent() failed");
		return;
	}

	p_vg_writer.write_main_vg_info(
		  reinterpret_cast < char const * > (vgGetString(VG_VENDOR))
		, reinterpret_cast < char const * > (vgGetString(VG_VERSION))
		, reinterpret_cast < char const * > (vgGetString(VG_RENDERER))
		, reinterpret_cast < char const * > (vgGetString(VG_EXTENSIONS))
	);

	openvg_stats stats;
	stats.m_max_scissor_rects          = vgGeti(VG_MAX_SCISSOR_RECTS);
	stats.m_max_dash_count             = vgGeti(VG_MAX_DASH_COUNT);
	stats.m_max_kernel_size            = vgGeti(VG_MAX_KERNEL_SIZE);
	stats.m_max_separable_kernel_size  = vgGeti(VG_MAX_SEPARABLE_KERNEL_SIZE);
	stats.m_max_color_ramp_stops       = vgGeti(VG_MAX_COLOR_RAMP_STOPS);
	stats.m_max_image_width            = vgGeti(VG_MAX_IMAGE_WIDTH);
	stats.m_max_image_height           = vgGeti(VG_MAX_IMAGE_HEIGHT);
	stats.m_max_image_pixels           = vgGeti(VG_MAX_IMAGE_PIXELS);
	stats.m_max_image_bytes            = vgGeti(VG_MAX_IMAGE_BYTES);
	stats.m_max_gaussian_std_deviation = vgGeti(VG_MAX_GAUSSIAN_STD_DEVIATION);

	p_vg_writer.write_vg_stats(stats);

	p_vg_writer.begin_write_vg_image_format_acceleration();
	for (image_format_accel_entry const *accel_entry = image_format_accel_table; accel_entry->m_name != NULL; ++accel_entry)
	{
		VGHardwareQueryResult acceleration = vgHardwareQuery(VG_IMAGE_FORMAT_QUERY, accel_entry->m_format);
		p_vg_writer.write_vg_image_format_acceleration(accel_entry->m_format, accel_entry->m_name, (acceleration == VG_HARDWARE_ACCELERATED));
	}
	p_vg_writer.end_write_vg_image_format_acceleration();

	p_vg_writer.write_vg_path_datatype_acceleration(
		  get_path_datatype_acceleration(VG_PATH_DATATYPE_S_8)
		, get_path_datatype_acceleration(VG_PATH_DATATYPE_S_16)
		, get_path_datatype_acceleration(VG_PATH_DATATYPE_S_32)
		, get_path_datatype_acceleration(VG_PATH_DATATYPE_F)
	);

	eglMakeCurrent(p_egl_scope.get_display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
Ejemplo n.º 9
0
Archivo: vg.c Proyecto: mak77/RetroArch
static void *vg_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{
   unsigned temp_width = 0, temp_height = 0;
   VGfloat clearColor[4] = {0, 0, 0, 1};
   settings_t        *settings = config_get_ptr();
   driver_t            *driver = driver_get_ptr();
   const gfx_ctx_driver_t *ctx = NULL;
   vg_t                    *vg = (vg_t*)calloc(1, sizeof(vg_t));

   if (!vg)
      goto error;

   ctx = gfx_ctx_init_first(vg, settings->video.context_driver,
         GFX_CTX_OPENVG_API, 0, 0, false);

   if (!ctx)
      goto error;

   driver->video_context = ctx;

   gfx_ctx_get_video_size(vg, &temp_width, &temp_height);
   RARCH_LOG("Detecting screen resolution %ux%u.\n", temp_width, temp_height);

   if (temp_width != 0 && temp_height != 0)
   {
      video_driver_set_size_width(temp_width);
      video_driver_set_size_width(temp_height);
   }

   gfx_ctx_swap_interval(vg, video->vsync ? 1 : 0);

   gfx_ctx_update_window_title(vg);

   vg->mTexType    = video->rgb32 ? VG_sXRGB_8888 : VG_sRGB_565;
   vg->keep_aspect = video->force_aspect;

   unsigned win_width  = video->width;
   unsigned win_height = video->height;
   if (video->fullscreen && (win_width == 0) && (win_height == 0))
   {
      video_driver_get_size(&temp_width, &temp_height);

      win_width  = temp_width;
      win_height = temp_height;
   }

   if (!gfx_ctx_set_video_mode(vg, win_width, win_height, video->fullscreen))
      goto error;

   video_driver_get_size(&temp_width, &temp_height);

   temp_width  = 0;
   temp_height = 0;
   gfx_ctx_get_video_size(vg, &temp_width, &temp_height);
   vg->should_resize = true;

   if (temp_width != 0 && temp_height != 0)
   {
      RARCH_LOG("Verified window resolution %ux%u.\n", temp_width, temp_height);
      video_driver_set_size_width(temp_width);
      video_driver_set_size_height(temp_height);
   }

   video_driver_get_size(&temp_width, &temp_height);

   vg->mScreenAspect = (float)temp_width / temp_height;

   gfx_ctx_translate_aspect(vg, &vg->mScreenAspect, temp_width, temp_height);

   vgSetfv(VG_CLEAR_COLOR, 4, clearColor);

   vg->mTextureWidth = vg->mTextureHeight = video->input_scale * RARCH_SCALE_BASE;
   vg->mImage = vgCreateImage(vg->mTexType, vg->mTextureWidth, vg->mTextureHeight,
         video->smooth ? VG_IMAGE_QUALITY_BETTER : VG_IMAGE_QUALITY_NONANTIALIASED);
   vg_set_nonblock_state(vg, !video->vsync);

   gfx_ctx_input_driver(vg, input, input_data);

   if (settings->video.font_enable && font_renderer_create_default(&vg->font_driver, &vg->mFontRenderer,
            *settings->video.font_path ? settings->video.font_path : NULL, settings->video.font_size))
   {
      vg->mFont            = vgCreateFont(0);

      if (vg->mFont != VG_INVALID_HANDLE)
      {
         vg->mFontsOn      = true;
         vg->mFontHeight   = settings->video.font_size;
         vg->mPaintFg      = vgCreatePaint();
         vg->mPaintBg      = vgCreatePaint();
         VGfloat paintFg[] = { settings->video.msg_color_r, settings->video.msg_color_g, settings->video.msg_color_b, 1.0f };
         VGfloat paintBg[] = { settings->video.msg_color_r / 2.0f, settings->video.msg_color_g / 2.0f, settings->video.msg_color_b / 2.0f, 0.5f };

         vgSetParameteri(vg->mPaintFg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
         vgSetParameterfv(vg->mPaintFg, VG_PAINT_COLOR, 4, paintFg);

         vgSetParameteri(vg->mPaintBg, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
         vgSetParameterfv(vg->mPaintBg, VG_PAINT_COLOR, 4, paintBg);
      }
   }

   if (vg_query_extension("KHR_EGL_image") && gfx_ctx_image_buffer_init(vg, video))
   {
      pvgCreateEGLImageTargetKHR = (PFNVGCREATEEGLIMAGETARGETKHRPROC)gfx_ctx_get_proc_address("vgCreateEGLImageTargetKHR");

      if (pvgCreateEGLImageTargetKHR)
      {
         RARCH_LOG("[VG] Using EGLImage buffer\n");
         vg->mEglImageBuf = true;
      }
   }

#if 0
   const char *ext = (const char*)vgGetString(VG_EXTENSIONS);
   if (ext)
      RARCH_LOG("[VG] Supported extensions: %s\n", ext);
#endif

   return vg;

error:
   if (vg)
      free(vg);
   if (driver)
      driver->video_context = NULL;
   return NULL;
}