Path: blob/21.2-virgl/src/glx/apple/apple_glx_context.h
4560 views
/*1Copyright (c) 2008, 2009 Apple Inc.23Permission is hereby granted, free of charge, to any person4obtaining a copy of this software and associated documentation files5(the "Software"), to deal in the Software without restriction,6including without limitation the rights to use, copy, modify, merge,7publish, distribute, sublicense, and/or sell copies of the Software,8and to permit persons to whom the Software is furnished to do so,9subject to the following conditions:1011The above copyright notice and this permission notice shall be12included in all copies or substantial portions of the Software.1314THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND17NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT18HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,19WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER21DEALINGS IN THE SOFTWARE.2223Except as contained in this notice, the name(s) of the above24copyright holders shall not be used in advertising or otherwise to25promote the sale, use or other dealings in this Software without26prior written authorization.27*/28#ifndef APPLE_GLX_CONTEXT_H29#define APPLE_GLX_CONTEXT_H3031/* <rdar://problem/6953344> */32#define glTexImage1D glTexImage1D_OSX33#define glTexImage2D glTexImage2D_OSX34#define glTexImage3D glTexImage3D_OSX35#include <OpenGL/CGLTypes.h>36#include <OpenGL/CGLContext.h>37#undef glTexImage1D38#undef glTexImage2D39#undef glTexImage3D4041#include <stdbool.h>42#include <X11/Xlib.h>43#include <GL/glx.h>44#define XP_NO_X_HEADERS45#include <Xplugin.h>46#undef XP_NO_X_HEADERS4748#include "apple_glx_drawable.h"4950struct apple_glx_context51{52CGLContextObj context_obj;53CGLPixelFormatObj pixel_format_obj;54struct apple_glx_drawable *drawable;55pthread_t thread_id;56int screen;57bool double_buffered;58bool uses_stereo;59bool need_update;60bool is_current; /* True if the context is current in some thread. */61bool made_current; /* True if the context has ever been made current. */6263/*64* last_surface is set by the pending_destroy code handler for a drawable.65* Due to a CG difference, we have to recreate a surface if the window66* is unmapped and mapped again.67*/68Window last_surface_window;69struct apple_glx_context *previous, *next;70};7172bool apple_glx_create_context(void **ptr, Display * dpy, int screen,73const void *mode, void *sharedContext,74int *errorptr, bool * x11errorptr);75void apple_glx_destroy_context(void **ptr, Display * dpy);7677bool apple_glx_make_current_context(Display * dpy, void *oldptr, void *ptr,78GLXDrawable drawable);79bool apple_glx_is_current_drawable(Display * dpy, void *ptr,80GLXDrawable drawable);8182bool apple_glx_copy_context(void *currentptr, void *srcptr, void *destptr,83unsigned long mask, int *errorptr,84bool * x11errorptr);8586int apple_glx_context_surface_changed(unsigned int uid, pthread_t caller);8788void apple_glx_context_update(Display * dpy, void *ptr);8990bool apple_glx_context_uses_stereo(void *ptr);9192#endif /*APPLE_GLX_CONTEXT_H */939495