WAFFLE_CONTEXT(3)

✨ WAFFLE_CONTEXT(3) ✨

okay bestie, sit down, we're doing the Waffle Manual today πŸ’– this is the page all about the ✨context✨ β€” the thing that holds your OpenGL rendering state. no cap.


πŸŽ€ NAME πŸŽ€

waffle_context, waffle_context_create, waffle_context_destroy, waffle_context_get_native β€” the whole class waffle_context friend group 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <waffle.h>

struct waffle_context;

struct waffle_context*
waffle_context_create(struct waffle_config *config,
                      struct waffle_context *shared_ctx);

bool waffle_context_destroy(struct waffle_context *self);

union waffle_native_context*
waffle_context_get_native(struct waffle_context *self);

🌸 DESCRIPTION 🌸

struct waffle_context

it's an opaque type bestie. you don't get to peek inside, that's the whole vibe πŸ™ˆ

waffle_context_create()

makes you a context for OpenGL rendering, with the properties that config says you want. slay.

here's the tea tho: the context you actually get back? its real properties may differ from what you asked for in config β€” but they're guaranteed to be compatible with them. if you want the full rundown, go read the VERSION PROMOTION section down below πŸ‘‡

and if share_ctx is not null, then your brand-new context gets added to the share group of share_ctx. some data β€” display lists, for example β€” is shared between every context in the same share group. wanna know exactly what's shared? go look at the spec for whichever native platform you're on: the GLX 1.4 Specification[1], the EGL 1.4 Specification[2], or the CGL Reference[3]. iykyk πŸ’…

waffle_context_destroy()

destroys the context and frees its memory. it's giving closure, periodt 🧹

waffle_context_get_native()

grabs the context's underlying native objects. use free(3) to deallocate the pointer you get back, don't just leave it lying there 😭 and if you wanna know what union waffle_native_context even is, that's over in waffle_native(3).


πŸ‘‘ VERSION PROMOTION πŸ‘‘

so the version and profile you asked for come from these config attributes: WAFFLE_CONTEXT_MAJOR_VERSION, WAFFLE_CONTEXT_MINOR_VERSION, WAFFLE_CONTEXT_PROFILE. but the context waffle_context_create hands you back? it may implement any version and profile that is backwards compatible with what you requested. here's exactly how that works:

  • if the chosen API is WAFFLE_OPENGL_ES1, WAFFLE_OPENGL_ES2, or WAFFLE_OPENGL_ES3, then the returned context may implement any of:
    • the requested version.
    • any later version, so long as no features have been from that later version.
  • if the chosen API is WAFFLE_CONTEXT_OPENGL and version 3.0 or less is requested, then the returned context may implement any of:
    • any version no less than that requested and no greater than 3.0.
    • version 3.1, if the GL_ARB_compatibility extension is also implemented.
    • the compatibility profile of version 3.2 or greater.
  • if the chosen API is WAFFLE_CONTEXT_OPENGL and version 3.1 is requested, then the returned context may implement any of:
    • version 3.1, with or without the GL_ARB_compatibility extension.
    • the core profile of version 3.2 or greater.
  • if the chosen API is WAFFLE_CONTEXT_OPENGL and version 3.2 or greater is requested, then the returned context may implement any of:
    • the requested profile and version.
    • the requested profile of any later version, so long as no features have been from that later version and profile.

πŸ’œ RETURN VALUE πŸ’œ

  • functions whose return type is bool return true on success and false on failure. yes queen, binary πŸ’…
  • functions whose return type is a pointer return NULL on failure. sad but true πŸ’€
  • either way, hit up waffle_error_get_info(3) to find out what the errors were about πŸ”

πŸ’€ ERRORS πŸ’€

the complete list of waffle's error codes lives in waffle_error(3), go check it.

and listen: No errors are specific to the waffle_context functions. like, none. zero. that's it. 🫢

🌈 ISSUES 🌈

found a bug? got a feature request? don't be shy bestie, report it here:

https://gitlab.freedesktop.org/mesa/waffle/issues


⭐ SEE ALSO ⭐

waffle(7) waffle_config_choose(3)


πŸŽ€ AUTHOR πŸŽ€

Chad Versace <chad.versace@linux.intel.com> Former maintainer


Copyright Β© 2013 Intel

this manual page is licensed under the Creative Commons Attribution-ShareAlike 3.0 United States License (CC BY-SA 3.0). to view a copy of this license, visit

http://creativecommons.org.license/by-sa/3.0/us.


🧚 NOTES 🧚

  1. GLX 1.4 Specification http://www.opengl.org/registry/doc/glx1.4.pdf
  2. EGL 1.4 Specification http://www.khronos.org/registry/egl/specs/eglspec.1.4.20110406.pdf
  3. CGL Reference https://developer.apple.com/library/mac/#documentation/graphicsimaging/reference/CGL_OpenGL/Reference/reference.html

and that's the whole page, bestie!! you ate πŸ“ this was waffle, dated 07/06/2026, page WAFFLE_CONTEXT(3) β€” go forth and render something iconic πŸ’…βœ¨

πŸ“¦ where this page comes from