Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright IBM Corporation 2004 |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * on the rights to use, copy, modify, merge, publish, distribute, sub |
| 9 | * license, and/or sell copies of the Software, and to permit persons to whom |
| 10 | * the Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice (including the next |
| 13 | * paragraph) shall be included in all copies or substantial portions of the |
| 14 | * Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
| 19 | * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | /** |
| 26 | * \file glx_pbuffer.c |
| 27 | * Implementation of pbuffer related functions. |
RALOVICH, Kristóf | 0896268 | 2009-08-12 12:41:22 +0200 | [diff] [blame] | 28 | * |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 29 | * \author Ian Romanick <idr@us.ibm.com> |
| 30 | */ |
| 31 | |
| 32 | #include <inttypes.h> |
| 33 | #include "glxclient.h" |
Brian Paul | 82dfd4b | 2005-08-11 14:18:53 +0000 | [diff] [blame] | 34 | #include <X11/extensions/extutil.h> |
| 35 | #include <X11/extensions/Xext.h> |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 36 | #include <assert.h> |
| 37 | #include <string.h> |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 38 | #include "glxextensions.h" |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 39 | |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 40 | #ifdef GLX_USE_APPLEGL |
| 41 | #include <pthread.h> |
| 42 | #include "apple_glx_drawable.h" |
| 43 | #include "glx_error.h" |
| 44 | #endif |
| 45 | |
Tormod Volden | e857303 | 2009-09-20 20:20:01 +0200 | [diff] [blame] | 46 | #define WARN_ONCE_GLX_1_3(a, b) { \ |
| 47 | static int warned=1; \ |
| 48 | if(warned) { \ |
| 49 | warn_GLX_1_3((a), b ); \ |
| 50 | warned=0; \ |
| 51 | } \ |
| 52 | } |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 53 | |
| 54 | /** |
Ian Romanick | 1f309c4 | 2009-09-15 13:12:22 -0700 | [diff] [blame] | 55 | * Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems. |
| 56 | */ |
| 57 | static void |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 58 | warn_GLX_1_3(Display * dpy, const char *function_name) |
Ian Romanick | 1f309c4 | 2009-09-15 13:12:22 -0700 | [diff] [blame] | 59 | { |
Kristian Høgsberg | c356f58 | 2010-07-28 11:16:00 -0400 | [diff] [blame] | 60 | struct glx_display *priv = __glXInitialize(dpy); |
Ian Romanick | 1f309c4 | 2009-09-15 13:12:22 -0700 | [diff] [blame] | 61 | |
| 62 | if (priv->minorVersion < 3) { |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 63 | fprintf(stderr, |
| 64 | "WARNING: Application calling GLX 1.3 function \"%s\" " |
| 65 | "when GLX 1.3 is not supported! This is an application bug!\n", |
| 66 | function_name); |
Ian Romanick | 1f309c4 | 2009-09-15 13:12:22 -0700 | [diff] [blame] | 67 | } |
| 68 | } |
| 69 | |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 70 | #ifndef GLX_USE_APPLEGL |
Ian Romanick | 1f309c4 | 2009-09-15 13:12:22 -0700 | [diff] [blame] | 71 | /** |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 72 | * Change a drawable's attribute. |
| 73 | * |
| 74 | * This function is used to implement \c glXSelectEvent and |
| 75 | * \c glXSelectEventSGIX. |
| 76 | * |
| 77 | * \note |
| 78 | * This function dynamically determines whether to use the SGIX_pbuffer |
| 79 | * version of the protocol or the GLX 1.3 version of the protocol. |
| 80 | * |
| 81 | * \todo |
| 82 | * This function needs to be modified to work with direct-rendering drivers. |
| 83 | */ |
| 84 | static void |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 85 | ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable, |
| 86 | const CARD32 * attribs, size_t num_attribs) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 87 | { |
Kristian Høgsberg | c356f58 | 2010-07-28 11:16:00 -0400 | [diff] [blame] | 88 | struct glx_display *priv = __glXInitialize(dpy); |
Jon TURNEY | ae9487c | 2010-08-09 14:47:26 +0100 | [diff] [blame] | 89 | #ifdef GLX_DIRECT_RENDERING |
Vinson Lee | 5c9e54f | 2010-07-15 00:20:41 -0700 | [diff] [blame] | 90 | __GLXDRIdrawable *pdraw; |
Jon TURNEY | ae9487c | 2010-08-09 14:47:26 +0100 | [diff] [blame] | 91 | #endif |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 92 | CARD32 *output; |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 93 | CARD8 opcode; |
Nick Bowler | f8d81c3 | 2010-07-14 12:01:49 -0400 | [diff] [blame] | 94 | int i; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 95 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 96 | if ((dpy == NULL) || (drawable == 0)) { |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 97 | return; |
| 98 | } |
| 99 | |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 100 | opcode = __glXSetupForCommand(dpy); |
| 101 | if (!opcode) |
| 102 | return; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 103 | |
| 104 | LockDisplay(dpy); |
| 105 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 106 | if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) { |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 107 | xGLXChangeDrawableAttributesReq *req; |
| 108 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 109 | GetReqExtra(GLXChangeDrawableAttributes, 8 + (8 * num_attribs), req); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 110 | output = (CARD32 *) (req + 1); |
| 111 | |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 112 | req->reqType = opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 113 | req->glxCode = X_GLXChangeDrawableAttributes; |
| 114 | req->drawable = drawable; |
| 115 | req->numAttribs = (CARD32) num_attribs; |
| 116 | } |
| 117 | else { |
| 118 | xGLXVendorPrivateWithReplyReq *vpreq; |
| 119 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 120 | GetReqExtra(GLXVendorPrivateWithReply, 4 + (8 * num_attribs), vpreq); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 121 | output = (CARD32 *) (vpreq + 1); |
| 122 | |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 123 | vpreq->reqType = opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 124 | vpreq->glxCode = X_GLXVendorPrivateWithReply; |
| 125 | vpreq->vendorCode = X_GLXvop_ChangeDrawableAttributesSGIX; |
| 126 | |
| 127 | output[0] = (CARD32) drawable; |
| 128 | output++; |
| 129 | } |
| 130 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 131 | (void) memcpy(output, attribs, sizeof(CARD32) * 2 * num_attribs); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 132 | |
| 133 | UnlockDisplay(dpy); |
| 134 | SyncHandle(); |
| 135 | |
Jon TURNEY | ae9487c | 2010-08-09 14:47:26 +0100 | [diff] [blame] | 136 | #ifdef GLX_DIRECT_RENDERING |
| 137 | pdraw = GetGLXDRIDrawable(dpy, drawable); |
| 138 | |
Nick Bowler | f8d81c3 | 2010-07-14 12:01:49 -0400 | [diff] [blame] | 139 | for (i = 0; i < num_attribs; i++) { |
| 140 | switch(attribs[i * 2]) { |
| 141 | case GLX_EVENT_MASK: |
| 142 | /* Keep a local copy for masking out DRI2 proto events as needed */ |
| 143 | pdraw->eventMask = attribs[i * 2 + 1]; |
| 144 | break; |
| 145 | } |
| 146 | } |
Jon TURNEY | ae9487c | 2010-08-09 14:47:26 +0100 | [diff] [blame] | 147 | #endif |
Nick Bowler | f8d81c3 | 2010-07-14 12:01:49 -0400 | [diff] [blame] | 148 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 149 | return; |
| 150 | } |
| 151 | |
| 152 | |
Michel Dänzer | 23635510 | 2008-04-10 15:45:52 -0400 | [diff] [blame] | 153 | #ifdef GLX_DIRECT_RENDERING |
Michel Dänzer | 23635510 | 2008-04-10 15:45:52 -0400 | [diff] [blame] | 154 | static GLenum |
| 155 | determineTextureTarget(const int *attribs, int numAttribs) |
| 156 | { |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 157 | GLenum target = 0; |
| 158 | int i; |
Michel Dänzer | 23635510 | 2008-04-10 15:45:52 -0400 | [diff] [blame] | 159 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 160 | for (i = 0; i < numAttribs; i++) { |
| 161 | if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) { |
| 162 | switch (attribs[2 * i + 1]) { |
| 163 | case GLX_TEXTURE_2D_EXT: |
| 164 | target = GL_TEXTURE_2D; |
| 165 | break; |
| 166 | case GLX_TEXTURE_RECTANGLE_EXT: |
| 167 | target = GL_TEXTURE_RECTANGLE_ARB; |
| 168 | break; |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | return target; |
Michel Dänzer | 23635510 | 2008-04-10 15:45:52 -0400 | [diff] [blame] | 174 | } |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 175 | |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 176 | static GLenum |
| 177 | determineTextureFormat(const int *attribs, int numAttribs) |
| 178 | { |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 179 | int i; |
| 180 | |
| 181 | for (i = 0; i < numAttribs; i++) { |
| 182 | if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT) |
RALOVICH, Kristóf | 0896268 | 2009-08-12 12:41:22 +0200 | [diff] [blame] | 183 | return attribs[2 * i + 1]; |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | return 0; |
| 187 | } |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 188 | |
| 189 | static void |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 190 | CreateDRIDrawable(Display *dpy, struct glx_config *config, |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 191 | XID drawable, XID glxdrawable, |
| 192 | const int *attrib_list, size_t num_attribs) |
| 193 | { |
Kristian Høgsberg | c356f58 | 2010-07-28 11:16:00 -0400 | [diff] [blame] | 194 | struct glx_display *const priv = __glXInitialize(dpy); |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 195 | __GLXDRIdrawable *pdraw; |
Kristian Høgsberg | 66fc35c | 2010-07-28 10:28:43 -0400 | [diff] [blame] | 196 | struct glx_screen *psc; |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 197 | |
Kristian Høgsberg | 66fc35c | 2010-07-28 10:28:43 -0400 | [diff] [blame] | 198 | psc = priv->screens[config->screen]; |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 199 | if (psc->driScreen == NULL) |
| 200 | return; |
| 201 | |
| 202 | pdraw = psc->driScreen->createDrawable(psc, drawable, |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 203 | glxdrawable, config); |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 204 | if (pdraw == NULL) { |
| 205 | fprintf(stderr, "failed to create drawable\n"); |
| 206 | return; |
| 207 | } |
| 208 | |
Kristian Høgsberg | e3e8196 | 2010-07-19 21:15:50 -0400 | [diff] [blame] | 209 | if (__glxHashInsert(priv->drawHash, glxdrawable, pdraw)) { |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 210 | (*pdraw->destroyDrawable) (pdraw); |
| 211 | return; /* FIXME: Check what we're supposed to do here... */ |
| 212 | } |
| 213 | |
| 214 | pdraw->textureTarget = determineTextureTarget(attrib_list, num_attribs); |
| 215 | pdraw->textureFormat = determineTextureFormat(attrib_list, num_attribs); |
| 216 | } |
| 217 | |
| 218 | static void |
| 219 | DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable) |
| 220 | { |
Kristian Høgsberg | c356f58 | 2010-07-28 11:16:00 -0400 | [diff] [blame] | 221 | struct glx_display *const priv = __glXInitialize(dpy); |
Kristian Høgsberg | eeaab20 | 2010-07-22 22:36:37 -0400 | [diff] [blame] | 222 | __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); |
Kristian Høgsberg | 80e48dd | 2010-09-09 08:06:40 -0400 | [diff] [blame^] | 223 | XID xid; |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 224 | |
| 225 | if (pdraw != NULL) { |
Kristian Høgsberg | 80e48dd | 2010-09-09 08:06:40 -0400 | [diff] [blame^] | 226 | xid = pdraw->xDrawable; |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 227 | (*pdraw->destroyDrawable) (pdraw); |
Kristian Høgsberg | e3e8196 | 2010-07-19 21:15:50 -0400 | [diff] [blame] | 228 | __glxHashDelete(priv->drawHash, drawable); |
Kristian Høgsberg | d8ab9aa | 2010-09-08 20:55:02 -0400 | [diff] [blame] | 229 | if (destroy_xdrawable) |
Kristian Høgsberg | 80e48dd | 2010-09-09 08:06:40 -0400 | [diff] [blame^] | 230 | XFreePixmap(priv->dpy, xid); |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 231 | } |
| 232 | } |
| 233 | |
| 234 | #else |
| 235 | |
| 236 | static void |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 237 | CreateDRIDrawable(Display *dpy, const struct glx_config * fbconfig, |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 238 | XID drawable, XID glxdrawable, |
| 239 | const int *attrib_list, size_t num_attribs) |
| 240 | { |
| 241 | } |
| 242 | |
| 243 | static void |
| 244 | DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable) |
| 245 | { |
| 246 | } |
| 247 | |
Michel Dänzer | 23635510 | 2008-04-10 15:45:52 -0400 | [diff] [blame] | 248 | #endif |
| 249 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 250 | /** |
| 251 | * Get a drawable's attribute. |
| 252 | * |
| 253 | * This function is used to implement \c glXGetSelectedEvent and |
| 254 | * \c glXGetSelectedEventSGIX. |
| 255 | * |
| 256 | * \note |
| 257 | * This function dynamically determines whether to use the SGIX_pbuffer |
| 258 | * version of the protocol or the GLX 1.3 version of the protocol. |
| 259 | * |
| 260 | * \todo |
| 261 | * The number of attributes returned is likely to be small, probably less than |
| 262 | * 10. Given that, this routine should try to use an array on the stack to |
| 263 | * capture the reply rather than always calling Xmalloc. |
| 264 | * |
| 265 | * \todo |
| 266 | * This function needs to be modified to work with direct-rendering drivers. |
| 267 | */ |
| 268 | static int |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 269 | GetDrawableAttribute(Display * dpy, GLXDrawable drawable, |
| 270 | int attribute, unsigned int *value) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 271 | { |
Kristian Høgsberg | c356f58 | 2010-07-28 11:16:00 -0400 | [diff] [blame] | 272 | struct glx_display *priv; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 273 | xGLXGetDrawableAttributesReply reply; |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 274 | CARD32 *data; |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 275 | CARD8 opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 276 | unsigned int length; |
| 277 | unsigned int i; |
| 278 | unsigned int num_attributes; |
Owain G. Ainsworth | b4866f8 | 2009-01-11 20:40:07 +0000 | [diff] [blame] | 279 | GLboolean use_glx_1_3; |
Adam Jackson | d25ad50 | 2006-04-07 00:05:50 +0000 | [diff] [blame] | 280 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 281 | if ((dpy == NULL) || (drawable == 0)) { |
Adam Jackson | d25ad50 | 2006-04-07 00:05:50 +0000 | [diff] [blame] | 282 | return 0; |
| 283 | } |
| 284 | |
| 285 | priv = __glXInitialize(dpy); |
Owain G. Ainsworth | b4866f8 | 2009-01-11 20:40:07 +0000 | [diff] [blame] | 286 | use_glx_1_3 = ((priv->majorVersion > 1) || (priv->minorVersion >= 3)); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 287 | |
Brian Paul | 42725d6 | 2006-02-07 00:39:56 +0000 | [diff] [blame] | 288 | *value = 0; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 289 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 290 | |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 291 | opcode = __glXSetupForCommand(dpy); |
| 292 | if (!opcode) |
| 293 | return 0; |
| 294 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 295 | LockDisplay(dpy); |
| 296 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 297 | if (use_glx_1_3) { |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 298 | xGLXGetDrawableAttributesReq *req; |
| 299 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 300 | GetReqExtra(GLXGetDrawableAttributes, 4, req); |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 301 | req->reqType = opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 302 | req->glxCode = X_GLXGetDrawableAttributes; |
| 303 | req->drawable = drawable; |
| 304 | } |
| 305 | else { |
| 306 | xGLXVendorPrivateWithReplyReq *vpreq; |
| 307 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 308 | GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 309 | data = (CARD32 *) (vpreq + 1); |
| 310 | data[0] = (CARD32) drawable; |
| 311 | |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 312 | vpreq->reqType = opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 313 | vpreq->glxCode = X_GLXVendorPrivateWithReply; |
| 314 | vpreq->vendorCode = X_GLXvop_GetDrawableAttributesSGIX; |
| 315 | } |
| 316 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 317 | _XReply(dpy, (xReply *) & reply, 0, False); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 318 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 319 | if (reply.type == X_Error) { |
| 320 | UnlockDisplay(dpy); |
| 321 | SyncHandle(); |
| 322 | return 0; |
Brian Paul | 42725d6 | 2006-02-07 00:39:56 +0000 | [diff] [blame] | 323 | } |
| 324 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 325 | length = reply.length; |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 326 | if (length) { |
| 327 | num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2; |
| 328 | data = (CARD32 *) Xmalloc(length * sizeof(CARD32)); |
| 329 | if (data == NULL) { |
| 330 | /* Throw data on the floor */ |
| 331 | _XEatData(dpy, length); |
| 332 | } |
| 333 | else { |
| 334 | _XRead(dpy, (char *) data, length * sizeof(CARD32)); |
Brian Paul | 42725d6 | 2006-02-07 00:39:56 +0000 | [diff] [blame] | 335 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 336 | /* Search the set of returned attributes for the attribute requested by |
| 337 | * the caller. |
| 338 | */ |
| 339 | for (i = 0; i < num_attributes; i++) { |
| 340 | if (data[i * 2] == attribute) { |
| 341 | *value = data[(i * 2) + 1]; |
| 342 | break; |
| 343 | } |
| 344 | } |
Brian Paul | 42725d6 | 2006-02-07 00:39:56 +0000 | [diff] [blame] | 345 | |
Jeremy Huddleston | 80b280d | 2010-04-02 01:35:19 -0700 | [diff] [blame] | 346 | #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 347 | { |
Kristian Høgsberg | eeaab20 | 2010-07-22 22:36:37 -0400 | [diff] [blame] | 348 | __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); |
Michel Dänzer | 23635510 | 2008-04-10 15:45:52 -0400 | [diff] [blame] | 349 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 350 | if (pdraw != NULL && !pdraw->textureTarget) |
| 351 | pdraw->textureTarget = |
| 352 | determineTextureTarget((const int *) data, num_attributes); |
Eric Anholt | 66175aa | 2009-03-18 12:07:09 -0700 | [diff] [blame] | 353 | if (pdraw != NULL && !pdraw->textureFormat) |
| 354 | pdraw->textureFormat = |
| 355 | determineTextureFormat((const int *) data, num_attributes); |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 356 | } |
Michel Dänzer | 23635510 | 2008-04-10 15:45:52 -0400 | [diff] [blame] | 357 | #endif |
| 358 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 359 | Xfree(data); |
| 360 | } |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 361 | } |
| 362 | |
| 363 | UnlockDisplay(dpy); |
| 364 | SyncHandle(); |
| 365 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 366 | return 0; |
| 367 | } |
| 368 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 369 | /** |
| 370 | * Create a non-pbuffer GLX drawable. |
| 371 | * |
| 372 | * \todo |
| 373 | * This function needs to be modified to work with direct-rendering drivers. |
| 374 | */ |
| 375 | static GLXDrawable |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 376 | CreateDrawable(Display *dpy, struct glx_config *config, |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 377 | Drawable drawable, const int *attrib_list, CARD8 glxCode) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 378 | { |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 379 | xGLXCreateWindowReq *req; |
| 380 | CARD32 *data; |
Ian Romanick | b47731f | 2005-03-04 17:53:24 +0000 | [diff] [blame] | 381 | unsigned int i; |
David Reveman | 342d1de | 2006-04-11 12:07:41 +0000 | [diff] [blame] | 382 | CARD8 opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 383 | |
Ian Romanick | b47731f | 2005-03-04 17:53:24 +0000 | [diff] [blame] | 384 | i = 0; |
| 385 | if (attrib_list) { |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 386 | while (attrib_list[i * 2] != None) |
| 387 | i++; |
Ian Romanick | b47731f | 2005-03-04 17:53:24 +0000 | [diff] [blame] | 388 | } |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 389 | |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 390 | opcode = __glXSetupForCommand(dpy); |
| 391 | if (!opcode) |
| 392 | return None; |
David Reveman | 342d1de | 2006-04-11 12:07:41 +0000 | [diff] [blame] | 393 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 394 | LockDisplay(dpy); |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 395 | GetReqExtra(GLXCreateWindow, 8 * i, req); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 396 | data = (CARD32 *) (req + 1); |
| 397 | |
David Reveman | 342d1de | 2006-04-11 12:07:41 +0000 | [diff] [blame] | 398 | req->reqType = opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 399 | req->glxCode = glxCode; |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 400 | req->screen = config->screen; |
| 401 | req->fbconfig = config->fbconfigID; |
| 402 | req->window = drawable; |
| 403 | req->glxwindow = XAllocID(dpy); |
| 404 | req->numAttribs = i; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 405 | |
Brian Paul | 5f40a7a | 2010-03-02 07:34:29 -0700 | [diff] [blame] | 406 | if (attrib_list) |
| 407 | memcpy(data, attrib_list, 8 * i); |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 408 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 409 | UnlockDisplay(dpy); |
| 410 | SyncHandle(); |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 411 | |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 412 | CreateDRIDrawable(dpy, config, drawable, req->glxwindow, attrib_list, i); |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 413 | |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 414 | return req->glxwindow; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | |
| 418 | /** |
| 419 | * Destroy a non-pbuffer GLX drawable. |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 420 | */ |
| 421 | static void |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 422 | DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 423 | { |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 424 | xGLXDestroyPbufferReq *req; |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 425 | CARD8 opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 426 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 427 | if ((dpy == NULL) || (drawable == 0)) { |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 428 | return; |
| 429 | } |
| 430 | |
| 431 | |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 432 | opcode = __glXSetupForCommand(dpy); |
| 433 | if (!opcode) |
| 434 | return; |
| 435 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 436 | LockDisplay(dpy); |
| 437 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 438 | GetReqExtra(GLXDestroyPbuffer, 4, req); |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 439 | req->reqType = opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 440 | req->glxCode = glxCode; |
| 441 | req->pbuffer = (GLXPbuffer) drawable; |
| 442 | |
| 443 | UnlockDisplay(dpy); |
| 444 | SyncHandle(); |
| 445 | |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 446 | DestroyDRIDrawable(dpy, drawable, GL_FALSE); |
Kristian Høgsberg | e82dd8c | 2008-03-26 19:26:59 -0400 | [diff] [blame] | 447 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 448 | return; |
| 449 | } |
| 450 | |
| 451 | |
| 452 | /** |
| 453 | * Create a pbuffer. |
| 454 | * |
| 455 | * This function is used to implement \c glXCreatePbuffer and |
| 456 | * \c glXCreateGLXPbufferSGIX. |
| 457 | * |
| 458 | * \note |
| 459 | * This function dynamically determines whether to use the SGIX_pbuffer |
| 460 | * version of the protocol or the GLX 1.3 version of the protocol. |
| 461 | * |
| 462 | * \todo |
| 463 | * This function needs to be modified to work with direct-rendering drivers. |
| 464 | */ |
| 465 | static GLXDrawable |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 466 | CreatePbuffer(Display * dpy, struct glx_config *config, |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 467 | unsigned int width, unsigned int height, |
| 468 | const int *attrib_list, GLboolean size_in_attribs) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 469 | { |
Kristian Høgsberg | c356f58 | 2010-07-28 11:16:00 -0400 | [diff] [blame] | 470 | struct glx_display *priv = __glXInitialize(dpy); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 471 | GLXDrawable id = 0; |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 472 | CARD32 *data; |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 473 | CARD8 opcode; |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 474 | unsigned int i; |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 475 | Pixmap pixmap; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 476 | |
Ian Romanick | b47731f | 2005-03-04 17:53:24 +0000 | [diff] [blame] | 477 | i = 0; |
| 478 | if (attrib_list) { |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 479 | while (attrib_list[i * 2]) |
| 480 | i++; |
Ian Romanick | b47731f | 2005-03-04 17:53:24 +0000 | [diff] [blame] | 481 | } |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 482 | |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 483 | opcode = __glXSetupForCommand(dpy); |
| 484 | if (!opcode) |
| 485 | return None; |
| 486 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 487 | LockDisplay(dpy); |
| 488 | id = XAllocID(dpy); |
| 489 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 490 | if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) { |
| 491 | xGLXCreatePbufferReq *req; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 492 | unsigned int extra = (size_in_attribs) ? 0 : 2; |
| 493 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 494 | GetReqExtra(GLXCreatePbuffer, (8 * (i + extra)), req); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 495 | data = (CARD32 *) (req + 1); |
| 496 | |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 497 | req->reqType = opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 498 | req->glxCode = X_GLXCreatePbuffer; |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 499 | req->screen = config->screen; |
| 500 | req->fbconfig = config->fbconfigID; |
| 501 | req->pbuffer = id; |
| 502 | req->numAttribs = i + extra; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 503 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 504 | if (!size_in_attribs) { |
| 505 | data[(2 * i) + 0] = GLX_PBUFFER_WIDTH; |
| 506 | data[(2 * i) + 1] = width; |
| 507 | data[(2 * i) + 2] = GLX_PBUFFER_HEIGHT; |
| 508 | data[(2 * i) + 3] = height; |
| 509 | data += 4; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 510 | } |
| 511 | } |
| 512 | else { |
| 513 | xGLXVendorPrivateReq *vpreq; |
| 514 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 515 | GetReqExtra(GLXVendorPrivate, 20 + (8 * i), vpreq); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 516 | data = (CARD32 *) (vpreq + 1); |
| 517 | |
Kristian Høgsberg | c25eb99 | 2006-06-13 01:41:18 +0000 | [diff] [blame] | 518 | vpreq->reqType = opcode; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 519 | vpreq->glxCode = X_GLXVendorPrivate; |
| 520 | vpreq->vendorCode = X_GLXvop_CreateGLXPbufferSGIX; |
| 521 | |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 522 | data[0] = config->screen; |
| 523 | data[1] = config->fbconfigID; |
| 524 | data[2] = id; |
| 525 | data[3] = width; |
| 526 | data[4] = height; |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 527 | data += 5; |
| 528 | } |
| 529 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 530 | (void) memcpy(data, attrib_list, sizeof(CARD32) * 2 * i); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 531 | |
| 532 | UnlockDisplay(dpy); |
| 533 | SyncHandle(); |
| 534 | |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 535 | pixmap = XCreatePixmap(dpy, RootWindow(dpy, config->screen), |
| 536 | width, height, config->rgbBits); |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 537 | |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 538 | CreateDRIDrawable(dpy, config, pixmap, id, attrib_list, i); |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 539 | |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 540 | return id; |
| 541 | } |
| 542 | |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 543 | /** |
| 544 | * Destroy a pbuffer. |
| 545 | * |
| 546 | * This function is used to implement \c glXDestroyPbuffer and |
| 547 | * \c glXDestroyGLXPbufferSGIX. |
| 548 | * |
| 549 | * \note |
| 550 | * This function dynamically determines whether to use the SGIX_pbuffer |
| 551 | * version of the protocol or the GLX 1.3 version of the protocol. |
| 552 | */ |
| 553 | static void |
| 554 | DestroyPbuffer(Display * dpy, GLXDrawable drawable) |
| 555 | { |
Kristian Høgsberg | c356f58 | 2010-07-28 11:16:00 -0400 | [diff] [blame] | 556 | struct glx_display *priv = __glXInitialize(dpy); |
Kristian Høgsberg | 5a43dba | 2010-04-09 17:16:33 -0400 | [diff] [blame] | 557 | CARD8 opcode; |
| 558 | |
| 559 | if ((dpy == NULL) || (drawable == 0)) { |
| 560 | return; |
| 561 | } |
| 562 | |
| 563 | opcode = __glXSetupForCommand(dpy); |
| 564 | if (!opcode) |
| 565 | return; |
| 566 | |
| 567 | LockDisplay(dpy); |
| 568 | |
| 569 | if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) { |
| 570 | xGLXDestroyPbufferReq *req; |
| 571 | |
| 572 | GetReq(GLXDestroyPbuffer, req); |
| 573 | req->reqType = opcode; |
| 574 | req->glxCode = X_GLXDestroyPbuffer; |
| 575 | req->pbuffer = (GLXPbuffer) drawable; |
| 576 | } |
| 577 | else { |
| 578 | xGLXVendorPrivateWithReplyReq *vpreq; |
| 579 | CARD32 *data; |
| 580 | |
| 581 | GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq); |
| 582 | data = (CARD32 *) (vpreq + 1); |
| 583 | |
| 584 | data[0] = (CARD32) drawable; |
| 585 | |
| 586 | vpreq->reqType = opcode; |
| 587 | vpreq->glxCode = X_GLXVendorPrivateWithReply; |
| 588 | vpreq->vendorCode = X_GLXvop_DestroyGLXPbufferSGIX; |
| 589 | } |
| 590 | |
| 591 | UnlockDisplay(dpy); |
| 592 | SyncHandle(); |
| 593 | |
| 594 | DestroyDRIDrawable(dpy, drawable, GL_TRUE); |
| 595 | |
| 596 | return; |
| 597 | } |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 598 | |
| 599 | /** |
| 600 | * Create a new pbuffer. |
| 601 | */ |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 602 | _X_EXPORT GLXPbufferSGIX |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 603 | glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config, |
| 604 | unsigned int width, unsigned int height, |
| 605 | int *attrib_list) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 606 | { |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 607 | return (GLXPbufferSGIX) CreatePbuffer(dpy, (struct glx_config *) config, |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 608 | width, height, |
| 609 | attrib_list, GL_FALSE); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 610 | } |
| 611 | |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 612 | #endif /* GLX_USE_APPLEGL */ |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 613 | |
| 614 | /** |
| 615 | * Create a new pbuffer. |
| 616 | */ |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 617 | _X_EXPORT GLXPbuffer |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 618 | glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 619 | { |
Kristian Høgsberg | 8b20411 | 2007-08-27 14:16:30 -0400 | [diff] [blame] | 620 | int i, width, height; |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 621 | #ifdef GLX_USE_APPLEGL |
| 622 | GLXPbuffer result; |
| 623 | int errorcode; |
| 624 | #endif |
Kristian Høgsberg | 8b20411 | 2007-08-27 14:16:30 -0400 | [diff] [blame] | 625 | |
| 626 | width = 0; |
| 627 | height = 0; |
| 628 | |
Tormod Volden | e857303 | 2009-09-20 20:20:01 +0200 | [diff] [blame] | 629 | WARN_ONCE_GLX_1_3(dpy, __func__); |
Ian Romanick | 1f309c4 | 2009-09-15 13:12:22 -0700 | [diff] [blame] | 630 | |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 631 | #ifdef GLX_USE_APPLEGL |
| 632 | for (i = 0; attrib_list[i]; ++i) { |
| 633 | switch (attrib_list[i]) { |
| 634 | case GLX_PBUFFER_WIDTH: |
| 635 | width = attrib_list[i + 1]; |
| 636 | ++i; |
| 637 | break; |
| 638 | |
| 639 | case GLX_PBUFFER_HEIGHT: |
| 640 | height = attrib_list[i + 1]; |
| 641 | ++i; |
| 642 | break; |
| 643 | |
| 644 | case GLX_LARGEST_PBUFFER: |
| 645 | /* This is a hint we should probably handle, but how? */ |
| 646 | ++i; |
| 647 | break; |
| 648 | |
| 649 | case GLX_PRESERVED_CONTENTS: |
| 650 | /* The contents are always preserved with AppleSGLX with CGL. */ |
| 651 | ++i; |
| 652 | break; |
| 653 | |
| 654 | default: |
| 655 | return None; |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | if (apple_glx_pbuffer_create(dpy, config, width, height, &errorcode, |
| 660 | &result)) { |
| 661 | /* |
| 662 | * apple_glx_pbuffer_create only sets the errorcode to core X11 |
| 663 | * errors. |
| 664 | */ |
| 665 | __glXSendError(dpy, errorcode, 0, X_GLXCreatePbuffer, true); |
| 666 | |
| 667 | return None; |
| 668 | } |
| 669 | |
| 670 | return result; |
| 671 | #else |
Kristian Høgsberg | 8b20411 | 2007-08-27 14:16:30 -0400 | [diff] [blame] | 672 | for (i = 0; attrib_list[i * 2]; i++) { |
| 673 | switch (attrib_list[i * 2]) { |
| 674 | case GLX_PBUFFER_WIDTH: |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 675 | width = attrib_list[i * 2 + 1]; |
| 676 | break; |
Kristian Høgsberg | 8b20411 | 2007-08-27 14:16:30 -0400 | [diff] [blame] | 677 | case GLX_PBUFFER_HEIGHT: |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 678 | height = attrib_list[i * 2 + 1]; |
| 679 | break; |
Kristian Høgsberg | 8b20411 | 2007-08-27 14:16:30 -0400 | [diff] [blame] | 680 | } |
| 681 | } |
| 682 | |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 683 | return (GLXPbuffer) CreatePbuffer(dpy, (struct glx_config *) config, |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 684 | width, height, attrib_list, GL_TRUE); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 685 | #endif |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 686 | } |
| 687 | |
| 688 | |
| 689 | /** |
| 690 | * Destroy an existing pbuffer. |
| 691 | */ |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 692 | _X_EXPORT void |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 693 | glXDestroyPbuffer(Display * dpy, GLXPbuffer pbuf) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 694 | { |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 695 | #ifdef GLX_USE_APPLEGL |
| 696 | if (apple_glx_pbuffer_destroy(dpy, pbuf)) { |
| 697 | __glXSendError(dpy, GLXBadPbuffer, pbuf, X_GLXDestroyPbuffer, false); |
| 698 | } |
| 699 | #else |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 700 | DestroyPbuffer(dpy, pbuf); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 701 | #endif |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 702 | } |
| 703 | |
| 704 | |
| 705 | /** |
| 706 | * Query an attribute of a drawable. |
| 707 | */ |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 708 | _X_EXPORT void |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 709 | glXQueryDrawable(Display * dpy, GLXDrawable drawable, |
| 710 | int attribute, unsigned int *value) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 711 | { |
Tormod Volden | e857303 | 2009-09-20 20:20:01 +0200 | [diff] [blame] | 712 | WARN_ONCE_GLX_1_3(dpy, __func__); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 713 | #ifdef GLX_USE_APPLEGL |
| 714 | Window root; |
| 715 | int x, y; |
| 716 | unsigned int width, height, bd, depth; |
| 717 | |
| 718 | if (apple_glx_pixmap_query(drawable, attribute, value)) |
| 719 | return; /*done */ |
| 720 | |
| 721 | if (apple_glx_pbuffer_query(drawable, attribute, value)) |
| 722 | return; /*done */ |
| 723 | |
| 724 | /* |
| 725 | * The OpenGL spec states that we should report GLXBadDrawable if |
| 726 | * the drawable is invalid, however doing so would require that we |
| 727 | * use XSetErrorHandler(), which is known to not be thread safe. |
| 728 | * If we use a round-trip call to validate the drawable, there could |
| 729 | * be a race, so instead we just opt in favor of letting the |
| 730 | * XGetGeometry request fail with a GetGeometry request X error |
| 731 | * rather than GLXBadDrawable, in what is hoped to be a rare |
| 732 | * case of an invalid drawable. In practice most and possibly all |
| 733 | * X11 apps using GLX shouldn't notice a difference. |
| 734 | */ |
| 735 | if (XGetGeometry |
| 736 | (dpy, drawable, &root, &x, &y, &width, &height, &bd, &depth)) { |
| 737 | switch (attribute) { |
| 738 | case GLX_WIDTH: |
| 739 | *value = width; |
| 740 | break; |
| 741 | |
| 742 | case GLX_HEIGHT: |
| 743 | *value = height; |
| 744 | break; |
| 745 | } |
| 746 | } |
| 747 | #else |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 748 | GetDrawableAttribute(dpy, drawable, attribute, value); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 749 | #endif |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 750 | } |
| 751 | |
| 752 | |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 753 | #ifndef GLX_USE_APPLEGL |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 754 | /** |
| 755 | * Query an attribute of a pbuffer. |
| 756 | */ |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 757 | _X_EXPORT int |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 758 | glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable, |
| 759 | int attribute, unsigned int *value) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 760 | { |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 761 | return GetDrawableAttribute(dpy, drawable, attribute, value); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 762 | } |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 763 | #endif |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 764 | |
| 765 | /** |
| 766 | * Select the event mask for a drawable. |
| 767 | */ |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 768 | _X_EXPORT void |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 769 | glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 770 | { |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 771 | #ifdef GLX_USE_APPLEGL |
| 772 | XWindowAttributes xwattr; |
| 773 | |
| 774 | if (apple_glx_pbuffer_set_event_mask(drawable, mask)) |
| 775 | return; /*done */ |
| 776 | |
| 777 | /* |
| 778 | * The spec allows a window, but currently there are no valid |
| 779 | * events for a window, so do nothing. |
| 780 | */ |
| 781 | if (XGetWindowAttributes(dpy, drawable, &xwattr)) |
| 782 | return; /*done */ |
| 783 | /* The drawable seems to be invalid. Report an error. */ |
| 784 | |
| 785 | __glXSendError(dpy, GLXBadDrawable, drawable, |
| 786 | X_GLXChangeDrawableAttributes, false); |
| 787 | #else |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 788 | CARD32 attribs[2]; |
| 789 | |
| 790 | attribs[0] = (CARD32) GLX_EVENT_MASK; |
| 791 | attribs[1] = (CARD32) mask; |
| 792 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 793 | ChangeDrawableAttribute(dpy, drawable, attribs, 1); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 794 | #endif |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 795 | } |
| 796 | |
| 797 | |
| 798 | /** |
| 799 | * Get the selected event mask for a drawable. |
| 800 | */ |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 801 | _X_EXPORT void |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 802 | glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 803 | { |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 804 | #ifdef GLX_USE_APPLEGL |
| 805 | XWindowAttributes xwattr; |
| 806 | |
| 807 | if (apple_glx_pbuffer_get_event_mask(drawable, mask)) |
| 808 | return; /*done */ |
| 809 | |
| 810 | /* |
| 811 | * The spec allows a window, but currently there are no valid |
| 812 | * events for a window, so do nothing, but set the mask to 0. |
| 813 | */ |
| 814 | if (XGetWindowAttributes(dpy, drawable, &xwattr)) { |
| 815 | /* The window is valid, so set the mask to 0. */ |
| 816 | *mask = 0; |
| 817 | return; /*done */ |
| 818 | } |
| 819 | /* The drawable seems to be invalid. Report an error. */ |
| 820 | |
| 821 | __glXSendError(dpy, GLXBadDrawable, drawable, X_GLXGetDrawableAttributes, |
| 822 | true); |
| 823 | #else |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 824 | unsigned int value; |
| 825 | |
| 826 | |
| 827 | /* The non-sense with value is required because on LP64 platforms |
| 828 | * sizeof(unsigned int) != sizeof(unsigned long). On little-endian |
| 829 | * we could just type-cast the pointer, but why? |
| 830 | */ |
| 831 | |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 832 | GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value); |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 833 | *mask = value; |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 834 | #endif |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 835 | } |
| 836 | |
| 837 | |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 838 | _X_EXPORT GLXPixmap |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 839 | glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap, |
| 840 | const int *attrib_list) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 841 | { |
Tormod Volden | e857303 | 2009-09-20 20:20:01 +0200 | [diff] [blame] | 842 | WARN_ONCE_GLX_1_3(dpy, __func__); |
Ian Romanick | 1f309c4 | 2009-09-15 13:12:22 -0700 | [diff] [blame] | 843 | |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 844 | #ifdef GLX_USE_APPLEGL |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 845 | const struct glx_config *modes = (const __GLcontextModes *) config; |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 846 | |
| 847 | if (apple_glx_pixmap_create(dpy, modes->screen, pixmap, modes)) |
| 848 | return None; |
| 849 | |
| 850 | return pixmap; |
| 851 | #else |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 852 | return CreateDrawable(dpy, (struct glx_config *) config, |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 853 | (Drawable) pixmap, attrib_list, X_GLXCreatePixmap); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 854 | #endif |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 855 | } |
| 856 | |
| 857 | |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 858 | _X_EXPORT GLXWindow |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 859 | glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, |
| 860 | const int *attrib_list) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 861 | { |
Tormod Volden | e857303 | 2009-09-20 20:20:01 +0200 | [diff] [blame] | 862 | WARN_ONCE_GLX_1_3(dpy, __func__); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 863 | #ifdef GLX_USE_APPLEGL |
| 864 | XWindowAttributes xwattr; |
| 865 | XVisualInfo *visinfo; |
Ian Romanick | 1f309c4 | 2009-09-15 13:12:22 -0700 | [diff] [blame] | 866 | |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 867 | (void) attrib_list; /*unused according to GLX 1.4 */ |
| 868 | |
| 869 | XGetWindowAttributes(dpy, win, &xwattr); |
| 870 | |
| 871 | visinfo = glXGetVisualFromFBConfig(dpy, config); |
| 872 | |
| 873 | if (NULL == visinfo) { |
| 874 | __glXSendError(dpy, GLXBadFBConfig, 0, X_GLXCreateWindow, false); |
| 875 | return None; |
| 876 | } |
| 877 | |
| 878 | if (visinfo->visualid != XVisualIDFromVisual(xwattr.visual)) { |
| 879 | __glXSendError(dpy, BadMatch, 0, X_GLXCreateWindow, true); |
| 880 | return None; |
| 881 | } |
| 882 | |
| 883 | XFree(visinfo); |
| 884 | |
| 885 | return win; |
| 886 | #else |
Kristian Høgsberg | 6ddf66e | 2010-07-28 10:07:52 -0400 | [diff] [blame] | 887 | return CreateDrawable(dpy, (struct glx_config *) config, |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 888 | (Drawable) win, attrib_list, X_GLXCreateWindow); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 889 | #endif |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 890 | } |
| 891 | |
| 892 | |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 893 | _X_EXPORT void |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 894 | glXDestroyPixmap(Display * dpy, GLXPixmap pixmap) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 895 | { |
Tormod Volden | e857303 | 2009-09-20 20:20:01 +0200 | [diff] [blame] | 896 | WARN_ONCE_GLX_1_3(dpy, __func__); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 897 | #ifdef GLX_USE_APPLEGL |
| 898 | if (apple_glx_pixmap_destroy(dpy, pixmap)) |
| 899 | __glXSendError(dpy, GLXBadPixmap, pixmap, X_GLXDestroyPixmap, false); |
| 900 | #else |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 901 | DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 902 | #endif |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 903 | } |
| 904 | |
| 905 | |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 906 | _X_EXPORT void |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 907 | glXDestroyWindow(Display * dpy, GLXWindow win) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 908 | { |
Tormod Volden | e857303 | 2009-09-20 20:20:01 +0200 | [diff] [blame] | 909 | WARN_ONCE_GLX_1_3(dpy, __func__); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 910 | #ifndef GLX_USE_APPLEGL |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 911 | DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow); |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 912 | #endif |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 913 | } |
| 914 | |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 915 | #ifndef GLX_USE_APPLEGL |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 916 | _X_EXPORT |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 917 | GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX, |
| 918 | (Display * dpy, GLXPbufferSGIX pbuf), |
| 919 | (dpy, pbuf), glXDestroyPbuffer) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 920 | |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 921 | _X_EXPORT |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 922 | GLX_ALIAS_VOID(glXSelectEventSGIX, |
| 923 | (Display * dpy, GLXDrawable drawable, |
RALOVICH, Kristóf | 0896268 | 2009-08-12 12:41:22 +0200 | [diff] [blame] | 924 | unsigned long mask), (dpy, drawable, mask), glXSelectEvent) |
Adam Jackson | cb3610e | 2004-10-25 21:09:16 +0000 | [diff] [blame] | 925 | |
Kristian Høgsberg | 38c51a7 | 2010-07-28 10:20:41 -0400 | [diff] [blame] | 926 | _X_EXPORT |
RALOVICH, Kristóf | 2d4c26b | 2008-10-13 14:12:02 +0200 | [diff] [blame] | 927 | GLX_ALIAS_VOID(glXGetSelectedEventSGIX, |
| 928 | (Display * dpy, GLXDrawable drawable, |
| 929 | unsigned long *mask), (dpy, drawable, mask), |
| 930 | glXGetSelectedEvent) |
Jeremy Huddleston | ad503c4 | 2010-04-01 11:01:31 -0700 | [diff] [blame] | 931 | #endif |