1Name 2 3 EXT_swap_control 4 5Name Strings 6 7 GLX_EXT_swap_control 8 9Contributors 10 11 Brian Nguyen, NVIDIA, brnguyen at nvidia.com 12 James Jones, NVIDIA, jajones at nvidia.com 13 Ian Romanick, Intel, idr at freedesktop.org 14 Jesse Barnes, Intel, jbarnes at virtuousgeek.org 15 Aaron Plattner, NVIDIA, aplattner at nvidia.com 16 17Contact 18 19 Brian Nguyen, NVIDIA, brnguyen at nvidia.com 20 21Status 22 23 Completed. 24 25Version 26 27 Version 8 (November 8, 2011) 28 29Number 30 31 375 32 33Dependencies 34 35 This specification is written against the GLX 1.3 specification, but 36 only GLX 1.1 or greater with the ARB_get_proc_address extension is 37 required, for glXQueryExtensionString and glXGetProcAddressARB 38 respectively. 39 40 This specification affects the GLX_SGI_swap_control extension. 41 42 Based on GLX_MESA_swap_control version 1.1, GLX_SGI_swap_control 43 version 1.9, and WGL_EXT_swap_control version 1.5. 44 45Overview 46 47 This extension allows an application to specify a minimum 48 periodicity of color buffer swaps, measured in video frame periods, 49 for a particular drawable. It also allows an application to query 50 the swap interval and the implementation-dependent maximum swap 51 interval of a drawable. 52 53IP Status 54 55 There are no known IP issues. 56 57Issues 58 59 1. Should implementations that export GLX_EXT_swap_control also 60 export GL_EXT_swap_control? 61 62 RESOLVED: No. GL_EXT_swap_control is exported by WGL_EXT_swap_control 63 because of shortcomings in the WGL extension querying mechanisms. GLX 64 has no such shortcomings, so exporting only a GLX extension is 65 sufficient. 66 67 2. How should the swap interval interact with non-visible drawables? 68 69 RESOLVED: The definition of the swap interval does not make sense 70 when applied to drawables that are not visible on a display device, 71 so it makes no sense to modify or query the swap interval of such 72 drawables. BadWindow should be returned if the <drawable> argument 73 of glXSwapIntervalEXT is not a window, and the result of querying 74 the swap interval of a non-window drawable should be undefined. 75 76 3. How should the implementations maximum swap interval and current 77 swap interval be exposed? 78 79 RESOVLED: These are both properties of a GLX drawable, so they are 80 exposed through glXQueryDrawable. 81 82New Procedures and Functions 83 84 void glXSwapIntervalEXT(Display *dpy, 85 GLXDrawable drawable, 86 int interval); 87 88New Tokens 89 90 GLX_SWAP_INTERVAL_EXT 0x20F1 91 GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 92 93Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL 94Operation) 95 96 None. 97 98Additions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization) 99 100 None. 101 102Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment 103Operations and the Frame Buffer) 104 105 None. 106 107Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special 108Functions) 109 110 None. 111 112Additions to Chapter 6 of the OpenGL 1.2.1 Specification (State and 113State Requests) 114 115 None. 116 117Additions to the GLX 1.3 Specification 118 119 [Add the following to Section 3.3.10 of the GLX specification 120 (Double Buffering)] 121 122 glXSwapIntervalEXT specifies the minimum number of video frame 123 periods per buffer swap for a particular GLX drawable (e.g. a value 124 of two means that the color buffers will be swapped at most every 125 other video frame). The interval takes effect when glXSwapBuffers 126 is first called on the drawable subsequent to the glXSwapIntervalEXT 127 call. 128 129 A video frame period is the time required by the monitor to display 130 a full frame of video data. In the case of an interlaced monitor, 131 this is typically the time required to display both the even and odd 132 fields of a frame of video data. 133 134 If <interval> is set to a value of 0, buffer swaps are not 135 synchronized to a video frame. The <interval> value is silently 136 clamped to the maximum implementation-dependent value supported 137 before being stored. 138 139 The current swap interval and implementation-dependent max swap 140 interval for a particular drawable can be obtained by calling 141 glXQueryDrawable with the attributes GLX_SWAP_INTERVAL_EXT and 142 GLX_MAX_SWAP_INTERVAL_EXT respectively. The value returned by 143 glXQueryDrawable is undefined if the drawable is not a GLXWindow 144 and these attributes are given. 145 146 Calling glXSwapIntervalSGI is equivalent to calling 147 glXSwapIntervalEXT on the current drawable, if one exists. 148 149GLX Protocol 150 151 One new GLX protocol command is added. 152 153 SwapIntervalEXT 154 1 CARD8 opcode (X assigned) 155 1 16 GLX opcode (glXVendorPrivate) 156 2 5 request length 157 4 1416 vendor-specific opcode 158 4 CARD32 unused 159 4 GLX_DRAWABLE drawable 160 4 INT32 interval 161 162Errors 163 164 glXSwapIntervalEXT generates BadValue if parameter <interval> is 165 less than zero. 166 167 glXSwapIntervalEXT generates BadWindow if parameter <drawable> is 168 not a GLXWindow or Window XID. 169 170Usage Examples 171 172 Example 1: Set swap interval for the current drawable 173 174 Display *dpy = glXGetCurrentDisplay(); 175 GLXDrawable drawable = glXGetCurrentDrawable(); 176 const int interval = 1; 177 178 if (drawable) { 179 glXSwapIntervalEXT(dpy, drawable, interval); 180 } 181 182 Example 2: Query current drawable for swap interval and max swap 183 interval 184 185 Display *dpy = glXGetCurrentDisplay(); 186 GLXDrawable drawable = glXGetCurrentDrawable(); 187 unsigned int swap, maxSwap; 188 189 if (drawable) { 190 glXQueryDrawable(dpy, drawable, GLX_SWAP_INTERVAL_EXT, &swap); 191 glXQueryDrawable(dpy, drawable, GLX_MAX_SWAP_INTERVAL_EXT, 192 &maxSwap); 193 printf("The swap interval is %u and the max swap interval is " 194 "%u\n", swap, maxSwap); 195 } 196 197Version History 198 199 8. 8 Nov 2011 - BrianN 200 - Added missing GLX protocol 201 202 7. 22 Aug 2011 - BrianN 203 - Fixed example code and spec to reflect glXSwapIntervalEXT 204 has void return value 205 206 6. 26 Jan 2010 - AaronP 207 - Fixed and simplified the example code. 208 - Removed temporary tags from enum values. 209 210 5. 08 Oct 2009 - Jon Leech 211 -Fixed typos and removed temporary label on token values 212 213 4. 28 Sep 2009 - JamesJ 214 -Added extension number 215 -Corrected token values 216 217 3. 08 Sep 2009 - JamesJ 218 -Marked complete. 219 220 2. 20 Jul 2009 - BrianN 221 -Fixed formatting issues 222 -Modified proposed error values of glXSwapIntervalEXT 223 224 1. 20 Jul 2009 - BrianN 225 -Initial version 226