aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/glx
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
committermarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
commit0f834b91a4768673833ab4917e87d86c237bb1a6 (patch)
tree363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/hw/xwin/glx
parentfc72edebf875378459368c5383d9023730cbca54 (diff)
downloadvcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/hw/xwin/glx')
-rw-r--r--xorg-server/hw/xwin/glx/glwindows.h20
-rw-r--r--xorg-server/hw/xwin/glx/glwrap.c84
-rw-r--r--xorg-server/hw/xwin/glx/indirect.c2688
-rw-r--r--xorg-server/hw/xwin/glx/wgl_ext_api.h170
-rw-r--r--xorg-server/hw/xwin/glx/winpriv.c58
5 files changed, 1524 insertions, 1496 deletions
diff --git a/xorg-server/hw/xwin/glx/glwindows.h b/xorg-server/hw/xwin/glx/glwindows.h
index cc3f2e6ee..ec1d1f51b 100644
--- a/xorg-server/hw/xwin/glx/glwindows.h
+++ b/xorg-server/hw/xwin/glx/glwindows.h
@@ -28,25 +28,25 @@
* DEALINGS IN THE SOFTWARE.
*/
-
#include <GL/gl.h>
typedef struct {
- unsigned int enableDebug : 1;
- unsigned int enableTrace : 1;
- unsigned int dumpPFD : 1;
- unsigned int dumpHWND : 1;
- unsigned int dumpDC : 1;
- unsigned int enableGLcallTrace : 1;
- unsigned int enableWGLcallTrace :1;
+ unsigned int enableDebug:1;
+ unsigned int enableTrace:1;
+ unsigned int dumpPFD:1;
+ unsigned int dumpHWND:1;
+ unsigned int dumpDC:1;
+ unsigned int enableGLcallTrace:1;
+ unsigned int enableWGLcallTrace:1;
} glxWinDebugSettingsRec;
extern glxWinDebugSettingsRec glxWinDebugSettings;
void glWinCallDelta(void);
void glxWinPushNativeProvider(void);
-const GLubyte* glGetStringWrapperNonstatic(GLenum name);
-void glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width, GLsizei height);
+const GLubyte *glGetStringWrapperNonstatic(GLenum name);
+void glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width,
+ GLsizei height);
void glWinSetupDispatchTable(void);
#if 1
diff --git a/xorg-server/hw/xwin/glx/glwrap.c b/xorg-server/hw/xwin/glx/glwrap.c
index 5190d36f7..690b82926 100644
--- a/xorg-server/hw/xwin/glx/glwrap.c
+++ b/xorg-server/hw/xwin/glx/glwrap.c
@@ -51,54 +51,48 @@ static unsigned int glWinDirectProcCalls = 0;
void
glWinCallDelta(void)
{
- static unsigned int glWinIndirectProcCallsLast = 0;
- static unsigned int glWinDirectProcCallsLast = 0;
- if ((glWinIndirectProcCalls != glWinIndirectProcCallsLast) ||
- (glWinDirectProcCalls != glWinDirectProcCallsLast))
- {
- if (glxWinDebugSettings.enableTrace)
- {
- ErrorF("after %d direct and %d indirect GL calls\n",
- glWinDirectProcCalls - glWinDirectProcCallsLast,
- glWinIndirectProcCalls - glWinIndirectProcCallsLast);
+ static unsigned int glWinIndirectProcCallsLast = 0;
+ static unsigned int glWinDirectProcCallsLast = 0;
+
+ if ((glWinIndirectProcCalls != glWinIndirectProcCallsLast) ||
+ (glWinDirectProcCalls != glWinDirectProcCallsLast)) {
+ if (glxWinDebugSettings.enableTrace) {
+ ErrorF("after %d direct and %d indirect GL calls\n",
+ glWinDirectProcCalls - glWinDirectProcCallsLast,
+ glWinIndirectProcCalls - glWinIndirectProcCallsLast);
}
- glWinDirectProcCallsLast = glWinDirectProcCalls;
- glWinIndirectProcCallsLast = glWinIndirectProcCalls;
+ glWinDirectProcCallsLast = glWinDirectProcCalls;
+ glWinIndirectProcCallsLast = glWinIndirectProcCalls;
}
}
static PROC
-glWinResolveHelper(PROC *cache, char *symbol)
+glWinResolveHelper(PROC * cache, char *symbol)
{
- PROC proc = NULL;
-
- /* If not yet cached, call wglGetProcAddress */
- if ((*cache) == NULL)
- {
- proc = wglGetProcAddress(symbol);
- if (proc == NULL)
- {
- ErrorF("glwrap: Can't resolve \"%s\"\n", symbol);
- (*cache) = (PROC)-1;
+ PROC proc = NULL;
+
+ /* If not yet cached, call wglGetProcAddress */
+ if ((*cache) == NULL) {
+ proc = wglGetProcAddress(symbol);
+ if (proc == NULL) {
+ ErrorF("glwrap: Can't resolve \"%s\"\n", symbol);
+ (*cache) = (PROC) - 1;
}
- else
- {
- ErrorF("glwrap: Resolved \"%s\"\n", symbol);
- (*cache) = proc;
+ else {
+ ErrorF("glwrap: Resolved \"%s\"\n", symbol);
+ (*cache) = proc;
}
}
- /* Cached wglGetProcAddress failure */
- else if ((*cache) == (PROC)-1)
- {
- proc = 0;
+ /* Cached wglGetProcAddress failure */
+ else if ((*cache) == (PROC) - 1) {
+ proc = 0;
}
- /* Cached wglGetProcAddress result */
- else
- {
- proc = (*cache);
+ /* Cached wglGetProcAddress result */
+ else {
+ proc = (*cache);
}
- return proc;
+ return proc;
}
#define RESOLVE_RET(proctype, symbol, retval) \
@@ -129,20 +123,24 @@ glWinResolveHelper(PROC *cache, char *symbol)
Special non-static wrapper for glGetString for debug output
*/
-const GLubyte* glGetStringWrapperNonstatic(GLenum name)
+const GLubyte *
+glGetStringWrapperNonstatic(GLenum name)
{
- return glGetString(name);
+ return glGetString(name);
}
/*
Special non-static wrapper for glAddSwapHintRectWIN for copySubBuffers
*/
-typedef void (__stdcall *PFNGLADDSWAPHINTRECTWIN)(GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (__stdcall * PFNGLADDSWAPHINTRECTWIN) (GLint x, GLint y,
+ GLsizei width,
+ GLsizei height);
-void glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width, GLsizei height)
+void
+glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width,
+ GLsizei height)
{
- RESOLVE(PFNGLADDSWAPHINTRECTWIN, "glAddSwapHintRectWIN");
- proc(x, y, width, height);
+ RESOLVE(PFNGLADDSWAPHINTRECTWIN, "glAddSwapHintRectWIN");
+ proc(x, y, width, height);
}
-
diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c
index 86fef55d1..56f677a8f 100644
--- a/xorg-server/hw/xwin/glx/indirect.c
+++ b/xorg-server/hw/xwin/glx/indirect.c
@@ -105,56 +105,53 @@
* structure definitions
*/
-typedef struct __GLXWinContext __GLXWinContext;
+typedef struct __GLXWinContext __GLXWinContext;
typedef struct __GLXWinDrawable __GLXWinDrawable;
typedef struct __GLXWinScreen glxWinScreen;
typedef struct __GLXWinConfig GLXWinConfig;
struct __GLXWinContext {
- __GLXcontext base;
- HGLRC ctx; /* Windows GL Context */
- __GLXWinContext *shareContext; /* Context with which we will share display lists and textures */
- HWND hwnd; /* For detecting when HWND has changed */
+ __GLXcontext base;
+ HGLRC ctx; /* Windows GL Context */
+ __GLXWinContext *shareContext; /* Context with which we will share display lists and textures */
+ HWND hwnd; /* For detecting when HWND has changed */
};
-struct __GLXWinDrawable
-{
- __GLXdrawable base;
- __GLXWinContext *drawContext;
- __GLXWinContext *readContext;
-
- /* If this drawable is GLX_DRAWABLE_PBUFFER */
- HPBUFFERARB hPbuffer;
-
- /* If this drawable is GLX_DRAWABLE_PIXMAP */
- HDC dibDC;
- HBITMAP hDIB;
- HBITMAP hOldDIB; /* original DIB for DC */
- void *pOldBits; /* original pBits for this drawable's pixmap */
+struct __GLXWinDrawable {
+ __GLXdrawable base;
+ __GLXWinContext *drawContext;
+ __GLXWinContext *readContext;
+
+ /* If this drawable is GLX_DRAWABLE_PBUFFER */
+ HPBUFFERARB hPbuffer;
+
+ /* If this drawable is GLX_DRAWABLE_PIXMAP */
+ HDC dibDC;
+ HBITMAP hDIB;
+ HBITMAP hOldDIB; /* original DIB for DC */
+ void *pOldBits; /* original pBits for this drawable's pixmap */
};
-struct __GLXWinScreen
-{
- __GLXscreen base;
+struct __GLXWinScreen {
+ __GLXscreen base;
- /* Supported GLX extensions */
- unsigned char glx_enable_bits[__GLX_EXT_BYTES];
+ /* Supported GLX extensions */
+ unsigned char glx_enable_bits[__GLX_EXT_BYTES];
- Bool has_WGL_ARB_multisample;
- Bool has_WGL_ARB_pixel_format;
- Bool has_WGL_ARB_pbuffer;
- Bool has_WGL_ARB_render_texture;
+ Bool has_WGL_ARB_multisample;
+ Bool has_WGL_ARB_pixel_format;
+ Bool has_WGL_ARB_pbuffer;
+ Bool has_WGL_ARB_render_texture;
- /* wrapped screen functions */
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
- CopyWindowProcPtr CopyWindow;
+ /* wrapped screen functions */
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ CopyWindowProcPtr CopyWindow;
};
-struct __GLXWinConfig
-{
- __GLXconfig base;
- int pixelFormatIndex;
+struct __GLXWinConfig {
+ __GLXconfig base;
+ int pixelFormatIndex;
};
/* ---------------------------------------------------------------------- */
@@ -169,9 +166,10 @@ struct __GLXWinConfig
GLWIN_DEBUG_MSG("Got HWND %p for window '%s'", hwnd, buffer); \
}
-glxWinDebugSettingsRec glxWinDebugSettings = { 0, 0, 0, 0, 0, 0};
+glxWinDebugSettingsRec glxWinDebugSettings = { 0, 0, 0, 0, 0, 0 };
-static void glxWinInitDebugSettings(void)
+static void
+glxWinInitDebugSettings(void)
{
char *envptr;
@@ -204,8 +202,7 @@ static void glxWinInitDebugSettings(void)
glxWinDebugSettings.enableWGLcallTrace = (atoi(envptr) == 1);
envptr = getenv("GLWIN_DEBUG_ALL");
- if (envptr != NULL)
- {
+ if (envptr != NULL) {
glxWinDebugSettings.enableDebug = 1;
glxWinDebugSettings.enableTrace = 1;
glxWinDebugSettings.dumpPFD = 1;
@@ -213,36 +210,33 @@ static void glxWinInitDebugSettings(void)
glxWinDebugSettings.dumpDC = 1;
glxWinDebugSettings.enableGLcallTrace = 1;
glxWinDebugSettings.enableWGLcallTrace = 1;
- }
+ }
}
static
-const char *glxWinErrorMessage(void)
+const char *
+glxWinErrorMessage(void)
{
- static char errorbuffer[1024];
- unsigned int last_error = GetLastError();
-
- if (!FormatMessage(
- FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK,
- NULL,
- last_error,
- 0,
- (LPTSTR) &errorbuffer,
- sizeof(errorbuffer),
- NULL ))
- {
- snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error");
+ static char errorbuffer[1024];
+ unsigned int last_error = GetLastError();
+
+ if (!FormatMessage
+ (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
+ FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, last_error, 0,
+ (LPTSTR) & errorbuffer, sizeof(errorbuffer), NULL)) {
+ snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error");
}
- if ((errorbuffer[strlen(errorbuffer)-1] == '\n') || (errorbuffer[strlen(errorbuffer)-1] == '\r'))
- errorbuffer[strlen(errorbuffer)-1] = 0;
+ if ((errorbuffer[strlen(errorbuffer) - 1] == '\n') ||
+ (errorbuffer[strlen(errorbuffer) - 1] == '\r'))
+ errorbuffer[strlen(errorbuffer) - 1] = 0;
- sprintf(errorbuffer + strlen(errorbuffer), " (%08x)", last_error);
+ sprintf(errorbuffer + strlen(errorbuffer), " (%08x)", last_error);
- return errorbuffer;
+ return errorbuffer;
}
-static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd);
+static void pfdOut(const PIXELFORMATDESCRIPTOR * pfd);
#define DUMP_PFD_FLAG(flag) \
if (pfd->dwFlags & flag) { \
@@ -250,36 +244,39 @@ static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd);
pipesym = " | "; \
}
-static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd)
+static void
+pfdOut(const PIXELFORMATDESCRIPTOR * pfd)
{
- const char *pipesym = ""; /* will be set after first flag dump */
+ const char *pipesym = ""; /* will be set after first flag dump */
+
ErrorF("PIXELFORMATDESCRIPTOR:\n");
ErrorF("nSize = %u\n", pfd->nSize);
ErrorF("nVersion = %u\n", pfd->nVersion);
ErrorF("dwFlags = %lu = {", pfd->dwFlags);
- DUMP_PFD_FLAG(PFD_DOUBLEBUFFER);
- DUMP_PFD_FLAG(PFD_STEREO);
- DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW);
- DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP);
- DUMP_PFD_FLAG(PFD_SUPPORT_GDI);
- DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL);
- DUMP_PFD_FLAG(PFD_GENERIC_FORMAT);
- DUMP_PFD_FLAG(PFD_NEED_PALETTE);
- DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE);
- DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE);
- DUMP_PFD_FLAG(PFD_SWAP_COPY);
- DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS);
- DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED);
- DUMP_PFD_FLAG(PFD_SUPPORT_DIRECTDRAW);
- DUMP_PFD_FLAG(PFD_DIRECT3D_ACCELERATED);
- DUMP_PFD_FLAG(PFD_SUPPORT_COMPOSITION);
- DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE);
- DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE);
- DUMP_PFD_FLAG(PFD_STEREO_DONTCARE);
+ DUMP_PFD_FLAG(PFD_DOUBLEBUFFER);
+ DUMP_PFD_FLAG(PFD_STEREO);
+ DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW);
+ DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP);
+ DUMP_PFD_FLAG(PFD_SUPPORT_GDI);
+ DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL);
+ DUMP_PFD_FLAG(PFD_GENERIC_FORMAT);
+ DUMP_PFD_FLAG(PFD_NEED_PALETTE);
+ DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE);
+ DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE);
+ DUMP_PFD_FLAG(PFD_SWAP_COPY);
+ DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS);
+ DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED);
+ DUMP_PFD_FLAG(PFD_SUPPORT_DIRECTDRAW);
+ DUMP_PFD_FLAG(PFD_DIRECT3D_ACCELERATED);
+ DUMP_PFD_FLAG(PFD_SUPPORT_COMPOSITION);
+ DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE);
+ DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE);
+ DUMP_PFD_FLAG(PFD_STEREO_DONTCARE);
ErrorF("}\n");
ErrorF("iPixelType = %hu = %s\n", pfd->iPixelType,
- (pfd->iPixelType == PFD_TYPE_RGBA ? "PFD_TYPE_RGBA" : "PFD_TYPE_COLORINDEX"));
+ (pfd->iPixelType ==
+ PFD_TYPE_RGBA ? "PFD_TYPE_RGBA" : "PFD_TYPE_COLORINDEX"));
ErrorF("cColorBits = %hhu\n", pfd->cColorBits);
ErrorF("cRedBits = %hhu\n", pfd->cRedBits);
ErrorF("cRedShift = %hhu\n", pfd->cRedShift);
@@ -308,87 +305,88 @@ static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd)
static const char *
visual_class_name(int cls)
{
- switch (cls) {
- case GLX_STATIC_COLOR:
- return "StaticColor";
- case GLX_PSEUDO_COLOR:
- return "PseudoColor";
- case GLX_STATIC_GRAY:
- return "StaticGray";
- case GLX_GRAY_SCALE:
- return "GrayScale";
- case GLX_TRUE_COLOR:
- return "TrueColor";
- case GLX_DIRECT_COLOR:
- return "DirectColor";
- default:
- return "-none-";
- }
+ switch (cls) {
+ case GLX_STATIC_COLOR:
+ return "StaticColor";
+ case GLX_PSEUDO_COLOR:
+ return "PseudoColor";
+ case GLX_STATIC_GRAY:
+ return "StaticGray";
+ case GLX_GRAY_SCALE:
+ return "GrayScale";
+ case GLX_TRUE_COLOR:
+ return "TrueColor";
+ case GLX_DIRECT_COLOR:
+ return "DirectColor";
+ default:
+ return "-none-";
+ }
}
static const char *
swap_method_name(int mthd)
{
- switch (mthd)
- {
+ switch (mthd) {
case GLX_SWAP_EXCHANGE_OML:
- return "xchg";
+ return "xchg";
case GLX_SWAP_COPY_OML:
- return "copy";
+ return "copy";
case GLX_SWAP_UNDEFINED_OML:
- return " ";
+ return " ";
default:
- return "????";
+ return "????";
}
}
static void
-fbConfigsDump(unsigned int n, __GLXconfig *c)
+fbConfigsDump(unsigned int n, __GLXconfig * c)
{
- ErrorF("%d fbConfigs\n", n);
- ErrorF("pxf vis fb render Ste aux accum MS drawable Group/\n");
- ErrorF("idx ID ID VisualType Depth Lvl RGB CI DB Swap reo R G B A Z S buf AR AG AB AA bufs num W P Pb Float Trans Caveat\n");
- ErrorF("-----------------------------------------------------------------------------------------------------------------------------\n");
-
- while (c != NULL)
- {
- unsigned int i = ((GLXWinConfig *)c)->pixelFormatIndex;
-
- ErrorF("%3d %3x %3x "
- "%-11s"
- " %3d %3d %s %s %s %s %s "
- "%2d %2d %2d %2d "
- "%2d %2d "
- "%2d "
- "%2d %2d %2d %2d"
- " %2d %2d"
- " %s %s %s "
- " %s "
- " %s "
- " %d %s"
- "\n",
- i, c->visualID, c->fbconfigID,
- visual_class_name(c->visualType),
- c->rgbBits ? c->rgbBits : c->indexBits,
- c->level,
- (c->renderType & GLX_RGBA_BIT) ? "y" : ".",
- (c->renderType & GLX_COLOR_INDEX_BIT) ? "y" : ".",
- c->doubleBufferMode ? "y" : ".",
- swap_method_name(c->swapMethod),
- c->stereoMode ? "y" : ".",
- c->redBits, c->greenBits, c->blueBits, c->alphaBits,
- c->depthBits, c->stencilBits,
- c->numAuxBuffers,
- c->accumRedBits, c->accumGreenBits, c->accumBlueBits, c->accumAlphaBits,
- c->sampleBuffers, c->samples,
- (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".",
- (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".",
- (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".",
- ".",
- (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
- c->visualSelectGroup, (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ");
-
- c = c->next;
+ ErrorF("%d fbConfigs\n", n);
+ ErrorF
+ ("pxf vis fb render Ste aux accum MS drawable Group/\n");
+ ErrorF
+ ("idx ID ID VisualType Depth Lvl RGB CI DB Swap reo R G B A Z S buf AR AG AB AA bufs num W P Pb Float Trans Caveat\n");
+ ErrorF
+ ("-----------------------------------------------------------------------------------------------------------------------------\n");
+
+ while (c != NULL) {
+ unsigned int i = ((GLXWinConfig *) c)->pixelFormatIndex;
+
+ ErrorF("%3d %3x %3x "
+ "%-11s"
+ " %3d %3d %s %s %s %s %s "
+ "%2d %2d %2d %2d "
+ "%2d %2d "
+ "%2d "
+ "%2d %2d %2d %2d"
+ " %2d %2d"
+ " %s %s %s "
+ " %s "
+ " %s "
+ " %d %s"
+ "\n",
+ i, c->visualID, c->fbconfigID,
+ visual_class_name(c->visualType),
+ c->rgbBits ? c->rgbBits : c->indexBits,
+ c->level,
+ (c->renderType & GLX_RGBA_BIT) ? "y" : ".",
+ (c->renderType & GLX_COLOR_INDEX_BIT) ? "y" : ".",
+ c->doubleBufferMode ? "y" : ".",
+ swap_method_name(c->swapMethod),
+ c->stereoMode ? "y" : ".",
+ c->redBits, c->greenBits, c->blueBits, c->alphaBits,
+ c->depthBits, c->stencilBits,
+ c->numAuxBuffers,
+ c->accumRedBits, c->accumGreenBits, c->accumBlueBits,
+ c->accumAlphaBits, c->sampleBuffers, c->samples,
+ (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".",
+ (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".",
+ (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".", ".",
+ (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
+ c->visualSelectGroup,
+ (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ");
+
+ c = c->next;
}
}
@@ -398,28 +396,33 @@ fbConfigsDump(unsigned int n, __GLXconfig *c)
*/
static __GLXscreen *glxWinScreenProbe(ScreenPtr pScreen);
-static __GLXcontext *glxWinCreateContext(__GLXscreen *screen,
- __GLXconfig *modes,
- __GLXcontext *baseShareContext);
+static __GLXcontext *glxWinCreateContext(__GLXscreen * screen,
+ __GLXconfig * modes,
+ __GLXcontext * baseShareContext);
static __GLXdrawable *glxWinCreateDrawable(ClientPtr client,
- __GLXscreen *screen,
- DrawablePtr pDraw,
- XID drawId,
- int type,
- XID glxDrawId,
- __GLXconfig *conf);
+ __GLXscreen * screen,
+ DrawablePtr pDraw,
+ XID drawId,
+ int type,
+ XID glxDrawId, __GLXconfig * conf);
static Bool glxWinRealizeWindow(WindowPtr pWin);
static Bool glxWinUnrealizeWindow(WindowPtr pWin);
-static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-static HDC glxWinMakeDC(__GLXWinContext *gc, __GLXWinDrawable *draw, HDC *hdc, HWND *hwnd);
-static void glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable *draw);
-
-static void glxWinCreateConfigs(HDC dc, glxWinScreen *screen);
-static void glxWinCreateConfigsExt(HDC hdc, glxWinScreen *screen);
-static int fbConfigToPixelFormat(__GLXconfig *mode, PIXELFORMATDESCRIPTOR *pfdret, int drawableTypeOverride);
-static int fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig *mode, int drawableTypeOverride, glxWinScreen *winScreen);
+static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+static HDC glxWinMakeDC(__GLXWinContext * gc, __GLXWinDrawable * draw,
+ HDC * hdc, HWND * hwnd);
+static void glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable * draw);
+
+static void glxWinCreateConfigs(HDC dc, glxWinScreen * screen);
+static void glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen);
+static int fbConfigToPixelFormat(__GLXconfig * mode,
+ PIXELFORMATDESCRIPTOR * pfdret,
+ int drawableTypeOverride);
+static int fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode,
+ int drawableTypeOverride,
+ glxWinScreen * winScreen);
/* ---------------------------------------------------------------------- */
/*
@@ -435,7 +438,7 @@ __GLXprovider __glXWGLProvider = {
void
glxWinPushNativeProvider(void)
{
- GlxPushProvider(&__glXWGLProvider);
+ GlxPushProvider(&__glXWGLProvider);
}
/* ---------------------------------------------------------------------- */
@@ -444,7 +447,7 @@ glxWinPushNativeProvider(void)
*/
static void
-glxWinScreenDestroy(__GLXscreen *screen)
+glxWinScreenDestroy(__GLXscreen * screen)
{
GLWIN_DEBUG_MSG("glxWinScreenDestroy(%p)", screen);
__glXScreenDestroy(screen);
@@ -452,14 +455,15 @@ glxWinScreenDestroy(__GLXscreen *screen)
}
static int
-glxWinScreenSwapInterval(__GLXdrawable *drawable, int interval)
+glxWinScreenSwapInterval(__GLXdrawable * drawable, int interval)
{
- BOOL ret = wglSwapIntervalEXTWrapper(interval);
- if (!ret)
- {
- ErrorF("wglSwapIntervalEXT interval %d failed:%s\n", interval, glxWinErrorMessage());
+ BOOL ret = wglSwapIntervalEXTWrapper(interval);
+
+ if (!ret) {
+ ErrorF("wglSwapIntervalEXT interval %d failed:%s\n", interval,
+ glxWinErrorMessage());
}
- return ret;
+ return ret;
}
/*
@@ -468,44 +472,41 @@ glxWinScreenSwapInterval(__GLXdrawable *drawable, int interval)
static void
glxLogExtensions(const char *prefix, const char *extensions)
{
- int length = 0;
- char *strl;
- char *str = strdup(extensions);
+ int length = 0;
+ char *strl;
+ char *str = strdup(extensions);
- if (str == NULL)
- {
- ErrorF("glxLogExtensions: xalloc error\n");
- return;
+ if (str == NULL) {
+ ErrorF("glxLogExtensions: xalloc error\n");
+ return;
}
- strl = strtok(str, " ");
- ErrorF("%s%s", prefix, strl);
- length = strlen(prefix) + strlen(strl);
+ strl = strtok(str, " ");
+ ErrorF("%s%s", prefix, strl);
+ length = strlen(prefix) + strlen(strl);
- while (1)
- {
- strl = strtok(NULL, " ");
- if (strl == NULL) break;
+ while (1) {
+ strl = strtok(NULL, " ");
+ if (strl == NULL)
+ break;
- if (length + strlen(strl) + 1 > 120)
- {
- ErrorF("\n");
- ErrorF("%s",prefix);
- length = strlen(prefix);
+ if (length + strlen(strl) + 1 > 120) {
+ ErrorF("\n");
+ ErrorF("%s", prefix);
+ length = strlen(prefix);
}
- else
- {
- ErrorF(" ");
- length++;
+ else {
+ ErrorF(" ");
+ length++;
}
- ErrorF("%s", strl);
- length = length + strlen(strl);
+ ErrorF("%s", strl);
+ length = length + strlen(strl);
}
- ErrorF("\n");
+ ErrorF("\n");
- free(str);
+ free(str);
}
/* This is called by GlxExtensionInit() asking the GLX provider if it can handle the screen... */
@@ -524,18 +525,18 @@ glxWinScreenProbe(ScreenPtr pScreen)
glxWinInitDebugSettings();
if (pScreen == NULL)
- return NULL;
+ return NULL;
- if (!winCheckScreenAiglxIsSupported(pScreen))
- {
- LogMessage(X_ERROR,"AIGLX: No native OpenGL in modes with a root window\n");
+ if (!winCheckScreenAiglxIsSupported(pScreen)) {
+ LogMessage(X_ERROR,
+ "AIGLX: No native OpenGL in modes with a root window\n");
return NULL;
- }
+ }
screen = calloc(1, sizeof(glxWinScreen));
if (NULL == screen)
- return NULL;
+ return NULL;
/* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */
screen->RealizeWindow = pScreen->RealizeWindow;
@@ -550,33 +551,36 @@ glxWinScreenProbe(ScreenPtr pScreen)
// create window class
#define WIN_GL_TEST_WINDOW_CLASS "XWinGLTest"
{
- static wATOM glTestWndClass = 0;
- if (glTestWndClass == 0)
- {
- WNDCLASSEX wc;
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = DefWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = GetModuleHandle(NULL);
- wc.hIcon = 0;
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = WIN_GL_TEST_WINDOW_CLASS;
- wc.hIconSm = 0;
- RegisterClassEx (&wc);
- }
+ static wATOM glTestWndClass = 0;
+
+ if (glTestWndClass == 0) {
+ WNDCLASSEX wc;
+
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = DefWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = GetModuleHandle(NULL);
+ wc.hIcon = 0;
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WIN_GL_TEST_WINDOW_CLASS;
+ wc.hIconSm = 0;
+ RegisterClassEx(&wc);
+ }
}
// create an invisible window for a scratch DC
hwnd = CreateWindowExA(0,
WIN_GL_TEST_WINDOW_CLASS,
"XWin GL Renderer Capabilities Test Window",
- 0, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
+ 0, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL),
+ NULL);
if (hwnd == NULL)
- LogMessage(X_ERROR,"AIGLX: Couldn't create a window for render capabilities testing\n");
+ LogMessage(X_ERROR,
+ "AIGLX: Couldn't create a window for render capabilities testing\n");
hdc = GetDC(hwnd);
@@ -592,10 +596,11 @@ glxWinScreenProbe(ScreenPtr pScreen)
ErrorF("GL_VERSION: %s\n", glGetStringWrapperNonstatic(GL_VERSION));
ErrorF("GL_VENDOR: %s\n", glGetStringWrapperNonstatic(GL_VENDOR));
ErrorF("GL_RENDERER: %s\n", glGetStringWrapperNonstatic(GL_RENDERER));
- gl_extensions = (const char *)glGetStringWrapperNonstatic(GL_EXTENSIONS);
+ gl_extensions = (const char *) glGetStringWrapperNonstatic(GL_EXTENSIONS);
glxLogExtensions("GL_EXTENSIONS: ", gl_extensions);
wgl_extensions = wglGetExtensionsStringARBWrapper(hdc);
- if (!wgl_extensions) wgl_extensions = "";
+ if (!wgl_extensions)
+ wgl_extensions = "";
glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions);
// Can you see the problem here? The extensions string is DC specific
@@ -604,48 +609,50 @@ glxWinScreenProbe(ScreenPtr pScreen)
// those screens to be accelerated in XP and earlier...
{
- // testing facility to not use any WGL extensions
- char *envptr = getenv("GLWIN_NO_WGL_EXTENSIONS");
- if ((envptr != NULL) && (atoi(envptr) != 0))
- {
- ErrorF("GLWIN_NO_WGL_EXTENSIONS is set, ignoring WGL_EXTENSIONS\n");
- wgl_extensions = "";
+ // testing facility to not use any WGL extensions
+ char *envptr = getenv("GLWIN_NO_WGL_EXTENSIONS");
+
+ if ((envptr != NULL) && (atoi(envptr) != 0)) {
+ ErrorF("GLWIN_NO_WGL_EXTENSIONS is set, ignoring WGL_EXTENSIONS\n");
+ wgl_extensions = "";
}
}
{
- Bool glx_sgi_make_current_read = FALSE;
-
- //
- // Based on the WGL extensions available, enable various GLX extensions
- // XXX: make this table-driven ?
- //
- memset(screen->glx_enable_bits, 0, __GLX_EXT_BYTES);
-
- __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_info");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_rating");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig");
-
- if (strstr(wgl_extensions, "WGL_ARB_make_current_read"))
- {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_make_current_read");
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
- glx_sgi_make_current_read = TRUE;
+ Bool glx_sgi_make_current_read = FALSE;
+
+ //
+ // Based on the WGL extensions available, enable various GLX extensions
+ // XXX: make this table-driven ?
+ //
+ memset(screen->glx_enable_bits, 0, __GLX_EXT_BYTES);
+
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_info");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_rating");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig");
+
+ if (strstr(wgl_extensions, "WGL_ARB_make_current_read")) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_make_current_read");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
+ glx_sgi_make_current_read = TRUE;
}
- if (strstr(gl_extensions, "GL_WIN_swap_hint"))
- {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
- LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
+ if (strstr(gl_extensions, "GL_WIN_swap_hint")) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_copy_sub_buffer");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
}
- if (strstr(wgl_extensions, "WGL_EXT_swap_control"))
- {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_swap_control");
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
+ if (strstr(wgl_extensions, "WGL_EXT_swap_control")) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_swap_control");
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_MESA_swap_control");
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
}
/* // Hmm? screen->texOffset */
@@ -656,105 +663,102 @@ glxWinScreenProbe(ScreenPtr pScreen)
/* screen->has_WGL_ARB_render_texture = TRUE; */
/* } */
- if (strstr(wgl_extensions, "WGL_ARB_pbuffer"))
- {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_pbuffer");
- LogMessage(X_INFO, "AIGLX: enabled GLX_SGIX_pbuffer\n");
- screen->has_WGL_ARB_pbuffer = TRUE;
+ if (strstr(wgl_extensions, "WGL_ARB_pbuffer")) {
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_pbuffer");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGIX_pbuffer\n");
+ screen->has_WGL_ARB_pbuffer = TRUE;
}
- if (strstr(wgl_extensions, "WGL_ARB_multisample"))
- {
- __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_multisample");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIS_multisample");
- LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_multisample and GLX_SGIS_multisample\n");
- screen->has_WGL_ARB_multisample = TRUE;
+ if (strstr(wgl_extensions, "WGL_ARB_multisample")) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_ARB_multisample");
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGIS_multisample");
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_ARB_multisample and GLX_SGIS_multisample\n");
+ screen->has_WGL_ARB_multisample = TRUE;
}
- screen->base.destroy = glxWinScreenDestroy;
- screen->base.createContext = glxWinCreateContext;
- screen->base.createDrawable = glxWinCreateDrawable;
- screen->base.swapInterval = glxWinScreenSwapInterval;
- screen->base.pScreen = pScreen;
-
- // Creating the fbConfigs initializes screen->base.fbconfigs and screen->base.numFBConfigs
- if (strstr(wgl_extensions, "WGL_ARB_pixel_format"))
- {
- glxWinCreateConfigsExt(hdc, screen);
-
- /*
- Some graphics drivers appear to advertise WGL_ARB_pixel_format,
- but it doesn't work usefully, so we have to be prepared for it
- to fail and fall back to using DescribePixelFormat()
- */
- if (screen->base.numFBConfigs > 0)
- {
- screen->has_WGL_ARB_pixel_format = TRUE;
+ screen->base.destroy = glxWinScreenDestroy;
+ screen->base.createContext = glxWinCreateContext;
+ screen->base.createDrawable = glxWinCreateDrawable;
+ screen->base.swapInterval = glxWinScreenSwapInterval;
+ screen->base.pScreen = pScreen;
+
+ // Creating the fbConfigs initializes screen->base.fbconfigs and screen->base.numFBConfigs
+ if (strstr(wgl_extensions, "WGL_ARB_pixel_format")) {
+ glxWinCreateConfigsExt(hdc, screen);
+
+ /*
+ Some graphics drivers appear to advertise WGL_ARB_pixel_format,
+ but it doesn't work usefully, so we have to be prepared for it
+ to fail and fall back to using DescribePixelFormat()
+ */
+ if (screen->base.numFBConfigs > 0) {
+ screen->has_WGL_ARB_pixel_format = TRUE;
}
}
- if (screen->base.numFBConfigs <= 0)
- {
- glxWinCreateConfigs(hdc, screen);
- screen->has_WGL_ARB_pixel_format = FALSE;
+ if (screen->base.numFBConfigs <= 0) {
+ glxWinCreateConfigs(hdc, screen);
+ screen->has_WGL_ARB_pixel_format = FALSE;
}
- /*
- If we still didn't get any fbConfigs, we can't provide GLX for this screen
- */
- if (screen->base.numFBConfigs <= 0)
- {
- free(screen);
- LogMessage(X_ERROR,"AIGLX: No fbConfigs could be made from native OpenGL pixel formats\n");
- return NULL;
- }
-
- /* These will be set by __glXScreenInit */
- screen->base.visuals = NULL;
- screen->base.numVisuals = 0;
-
- __glXScreenInit(&screen->base, pScreen);
-
- // dump out fbConfigs now fbConfigIds and visualIDs have been assigned
- fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs);
-
- // Override the GL extensions string set by __glXScreenInit()
- screen->base.GLextensions = strdup(gl_extensions);
-
- // Generate the GLX extensions string (overrides that set by __glXScreenInit())
- {
- unsigned int buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
- if (buffer_size > 0)
- {
- free(screen->base.GLXextensions);
-
- screen->base.GLXextensions = xnfalloc(buffer_size);
- __glXGetExtensionString(screen->glx_enable_bits, screen->base.GLXextensions);
- }
- }
-
- //
- // Override the GLX version (__glXScreenInit() sets it to "1.2")
- // if we have all the needed extensions to operate as a higher version
- //
- // SGIX_fbconfig && SGIX_pbuffer && SGI_make_current_read -> 1.3
- // ARB_multisample -> 1.4
- //
- if (screen->has_WGL_ARB_pbuffer && glx_sgi_make_current_read)
+ /*
+ If we still didn't get any fbConfigs, we can't provide GLX for this screen
+ */
+ if (screen->base.numFBConfigs <= 0) {
+ free(screen);
+ LogMessage(X_ERROR,
+ "AIGLX: No fbConfigs could be made from native OpenGL pixel formats\n");
+ return NULL;
+ }
+
+ /* These will be set by __glXScreenInit */
+ screen->base.visuals = NULL;
+ screen->base.numVisuals = 0;
+
+ __glXScreenInit(&screen->base, pScreen);
+
+ // dump out fbConfigs now fbConfigIds and visualIDs have been assigned
+ fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs);
+
+ // Override the GL extensions string set by __glXScreenInit()
+ screen->base.GLextensions = strdup(gl_extensions);
+
+ // Generate the GLX extensions string (overrides that set by __glXScreenInit())
{
- if (screen->has_WGL_ARB_multisample)
- {
- screen->base.GLXmajor = 1;
- screen->base.GLXminor = 4;
+ unsigned int buffer_size =
+ __glXGetExtensionString(screen->glx_enable_bits, NULL);
+ if (buffer_size > 0) {
+ free(screen->base.GLXextensions);
+
+ screen->base.GLXextensions = xnfalloc(buffer_size);
+ __glXGetExtensionString(screen->glx_enable_bits,
+ screen->base.GLXextensions);
}
- else
- {
- screen->base.GLXmajor = 1;
- screen->base.GLXminor = 3;
+ }
+
+ //
+ // Override the GLX version (__glXScreenInit() sets it to "1.2")
+ // if we have all the needed extensions to operate as a higher version
+ //
+ // SGIX_fbconfig && SGIX_pbuffer && SGI_make_current_read -> 1.3
+ // ARB_multisample -> 1.4
+ //
+ if (screen->has_WGL_ARB_pbuffer && glx_sgi_make_current_read) {
+ if (screen->has_WGL_ARB_multisample) {
+ screen->base.GLXmajor = 1;
+ screen->base.GLXminor = 4;
+ }
+ else {
+ screen->base.GLXmajor = 1;
+ screen->base.GLXminor = 3;
}
}
}
- LogMessage(X_INFO, "AIGLX: Set GLX version to %d.%d\n", screen->base.GLXmajor, screen->base.GLXminor);
+ LogMessage(X_INFO, "AIGLX: Set GLX version to %d.%d\n",
+ screen->base.GLXmajor, screen->base.GLXminor);
wglMakeCurrent(NULL, NULL);
wglDeleteContext(hglrc);
@@ -786,7 +790,6 @@ glxWinRealizeWindow(WindowPtr pWin)
return result;
}
-
static void
glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
@@ -796,9 +799,8 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
GLWIN_TRACE_MSG("glxWinCopyWindow pWindow %p", pWindow);
- dixLookupResourceByType((pointer) &pGlxDraw, pWindow->drawable.id, __glXDrawableRes,
- NullClient, DixUnknownAccess);
-
+ dixLookupResourceByType((pointer) &pGlxDraw, pWindow->drawable.id,
+ __glXDrawableRes, NullClient, DixUnknownAccess);
/*
Discard any CopyWindow requests if a GL drawing context is pointing at the window
@@ -806,12 +808,11 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
For regions which are being drawn by GL, the shadow framebuffer doesn't have the
correct bits, so we wish to avoid shadow framebuffer damage occuring, which will
cause those incorrect bits to be transferred to the display....
- */
- if (pGlxDraw && pGlxDraw->drawContext)
- {
+ */
+ if (pGlxDraw && pGlxDraw->drawContext) {
GLWIN_DEBUG_MSG("glxWinCopyWindow: discarding");
return;
- }
+ }
GLWIN_DEBUG_MSG("glxWinCopyWindow - passing to hw layer");
@@ -825,7 +826,7 @@ glxWinUnrealizeWindow(WindowPtr pWin)
{
Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen;
- glxWinScreen *screenPriv = (glxWinScreen *)glxGetScreen(pScreen);
+ glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen);
GLWIN_DEBUG_MSG("glxWinUnrealizeWindow");
@@ -842,132 +843,126 @@ glxWinUnrealizeWindow(WindowPtr pWin)
*/
static GLboolean
-glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable *base)
+glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base)
{
HDC dc;
HWND hwnd;
BOOL ret;
- __GLXWinDrawable *draw = (__GLXWinDrawable *)base;
+ __GLXWinDrawable *draw = (__GLXWinDrawable *) base;
/* Swap buffers on the last active context for drawing on the drawable */
- if (draw->drawContext == NULL)
- {
+ if (draw->drawContext == NULL) {
GLWIN_TRACE_MSG("glxWinSwapBuffers - no context for drawable");
return GL_FALSE;
- }
+ }
- GLWIN_TRACE_MSG("glxWinSwapBuffers on drawable %p, last context %p (native ctx %p)", base, draw->drawContext, draw->drawContext->ctx);
+ GLWIN_TRACE_MSG
+ ("glxWinSwapBuffers on drawable %p, last context %p (native ctx %p)",
+ base, draw->drawContext, draw->drawContext->ctx);
/*
draw->drawContext->base.drawPriv will not be set if the context is not current anymore,
but if it is, it should point to this drawable....
- */
- assert((draw->drawContext->base.drawPriv == NULL) || (draw->drawContext->base.drawPriv == base));
+ */
+ assert((draw->drawContext->base.drawPriv == NULL) ||
+ (draw->drawContext->base.drawPriv == base));
dc = glxWinMakeDC(draw->drawContext, draw, &dc, &hwnd);
if (dc == NULL)
- return GL_FALSE;
+ return GL_FALSE;
ret = wglSwapLayerBuffers(dc, WGL_SWAP_MAIN_PLANE);
glxWinReleaseDC(hwnd, dc, draw);
- if (!ret)
- {
+ if (!ret) {
ErrorF("wglSwapBuffers failed: %s\n", glxWinErrorMessage());
return GL_FALSE;
- }
+ }
return GL_TRUE;
}
static void
-glxWinDrawableCopySubBuffer(__GLXdrawable *drawable,
+glxWinDrawableCopySubBuffer(__GLXdrawable * drawable,
int x, int y, int w, int h)
{
- glAddSwapHintRectWINWrapperNonstatic(x, y, w, h);
- glxWinDrawableSwapBuffers(NULL, drawable);
+ glAddSwapHintRectWINWrapperNonstatic(x, y, w, h);
+ glxWinDrawableSwapBuffers(NULL, drawable);
}
static void
-glxWinDrawableDestroy(__GLXdrawable *base)
+glxWinDrawableDestroy(__GLXdrawable * base)
{
- __GLXWinDrawable *glxPriv = (__GLXWinDrawable *)base;
+ __GLXWinDrawable *glxPriv = (__GLXWinDrawable *) base;
+
+ if (glxPriv->drawContext &&
+ (__glXLastContext == &((glxPriv->drawContext)->base))) {
+ // if this context is current and has unflushed commands, say we have flushed them
+ // (don't actually flush them, the window is going away anyhow, and an implict flush occurs
+ // on the next context change)
+ // (GLX core considers it an error when we try to select a new current context if the old one
+ // has unflushed commands, but the window has disappeared..)
+ __glXLastContext->hasUnflushedCommands = FALSE;
+ __glXLastContext = NULL;
+ }
- if (glxPriv->drawContext && (__glXLastContext == &((glxPriv->drawContext)->base)))
- {
- // if this context is current and has unflushed commands, say we have flushed them
- // (don't actually flush them, the window is going away anyhow, and an implict flush occurs
- // on the next context change)
- // (GLX core considers it an error when we try to select a new current context if the old one
- // has unflushed commands, but the window has disappeared..)
- __glXLastContext->hasUnflushedCommands = FALSE;
- __glXLastContext = NULL;
- }
-
- if (glxPriv->hPbuffer)
- if (!wglDestroyPbufferARBWrapper(glxPriv->hPbuffer))
- {
- ErrorF("wglDestroyPbufferARB failed: %s\n", glxWinErrorMessage());
- }
-
- if (glxPriv->dibDC)
- {
- // restore the default DIB
- SelectObject(glxPriv->dibDC, glxPriv->hOldDIB);
+ if (glxPriv->hPbuffer)
+ if (!wglDestroyPbufferARBWrapper(glxPriv->hPbuffer)) {
+ ErrorF("wglDestroyPbufferARB failed: %s\n", glxWinErrorMessage());
+ }
- if (!DeleteDC(glxPriv->dibDC))
- {
- ErrorF("DeleteDC failed: %s\n", glxWinErrorMessage());
+ if (glxPriv->dibDC) {
+ // restore the default DIB
+ SelectObject(glxPriv->dibDC, glxPriv->hOldDIB);
+
+ if (!DeleteDC(glxPriv->dibDC)) {
+ ErrorF("DeleteDC failed: %s\n", glxWinErrorMessage());
}
}
- if (glxPriv->hDIB)
- {
- if (!DeleteObject(glxPriv->hDIB))
- {
- ErrorF("DeleteObject failed: %s\n", glxWinErrorMessage());
+ if (glxPriv->hDIB) {
+ if (!DeleteObject(glxPriv->hDIB)) {
+ ErrorF("DeleteObject failed: %s\n", glxWinErrorMessage());
}
- ((PixmapPtr)glxPriv->base.pDraw)->devPrivate.ptr = glxPriv->pOldBits;
+ ((PixmapPtr) glxPriv->base.pDraw)->devPrivate.ptr = glxPriv->pOldBits;
}
- GLWIN_DEBUG_MSG("glxWinDestroyDrawable");
- free(glxPriv);
+ GLWIN_DEBUG_MSG("glxWinDestroyDrawable");
+ free(glxPriv);
}
static __GLXdrawable *
glxWinCreateDrawable(ClientPtr client,
- __GLXscreen *screen,
- DrawablePtr pDraw,
- XID drawId,
- int type,
- XID glxDrawId,
- __GLXconfig *conf)
+ __GLXscreen * screen,
+ DrawablePtr pDraw,
+ XID drawId, int type, XID glxDrawId, __GLXconfig * conf)
{
- __GLXWinDrawable *glxPriv;
+ __GLXWinDrawable *glxPriv;
- glxPriv = malloc(sizeof *glxPriv);
+ glxPriv = malloc(sizeof *glxPriv);
- if (glxPriv == NULL)
- return NULL;
+ if (glxPriv == NULL)
+ return NULL;
- memset(glxPriv, 0, sizeof *glxPriv);
+ memset(glxPriv, 0, sizeof *glxPriv);
- if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
- free(glxPriv);
- return NULL;
- }
+ if (!__glXDrawableInit
+ (&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
+ free(glxPriv);
+ return NULL;
+ }
- glxPriv->base.destroy = glxWinDrawableDestroy;
- glxPriv->base.swapBuffers = glxWinDrawableSwapBuffers;
- glxPriv->base.copySubBuffer = glxWinDrawableCopySubBuffer;
- // glxPriv->base.waitX what are these for?
- // glxPriv->base.waitGL
+ glxPriv->base.destroy = glxWinDrawableDestroy;
+ glxPriv->base.swapBuffers = glxWinDrawableSwapBuffers;
+ glxPriv->base.copySubBuffer = glxWinDrawableCopySubBuffer;
+ // glxPriv->base.waitX what are these for?
+ // glxPriv->base.waitGL
- GLWIN_DEBUG_MSG("glxWinCreateDrawable %p", glxPriv);
+ GLWIN_DEBUG_MSG("glxWinCreateDrawable %p", glxPriv);
- return &glxPriv->base;
+ return &glxPriv->base;
}
/* ---------------------------------------------------------------------- */
@@ -976,21 +971,21 @@ glxWinCreateDrawable(ClientPtr client,
*/
static
-int glxWinBindTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap)
+ int
+glxWinBindTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap)
{
- ErrorF("glxWinBindTexImage: not implemented\n");
- return FALSE;
+ ErrorF("glxWinBindTexImage: not implemented\n");
+ return FALSE;
}
static
-int glxWinReleaseTexImage(__GLXcontext *baseContext,
- int buffer,
- __GLXdrawable *pixmap)
+ int
+glxWinReleaseTexImage(__GLXcontext * baseContext,
+ int buffer, __GLXdrawable * pixmap)
{
- ErrorF(" glxWinReleaseTexImage: not implemented\n");
- return FALSE;
+ ErrorF(" glxWinReleaseTexImage: not implemented\n");
+ return FALSE;
}
/* ---------------------------------------------------------------------- */
@@ -1013,41 +1008,44 @@ int glxWinReleaseTexImage(__GLXcontext *baseContext,
*/
static Bool
-glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawableTypeOverride)
+glxWinSetPixelFormat(__GLXWinContext * gc, HDC hdc, int bppOverride,
+ int drawableTypeOverride)
{
- __GLXscreen *screen = gc->base.pGlxScreen;
- glxWinScreen *winScreen = (glxWinScreen *)screen;
-
- __GLXconfig *config = gc->base.config;
- GLXWinConfig *winConfig = (GLXWinConfig *)config;
+ __GLXscreen *screen = gc->base.pGlxScreen;
+ glxWinScreen *winScreen = (glxWinScreen *) screen;
- GLWIN_DEBUG_MSG("glxWinSetPixelFormat: pixelFormatIndex %d", winConfig->pixelFormatIndex);
+ __GLXconfig *config = gc->base.config;
+ GLXWinConfig *winConfig = (GLXWinConfig *) config;
- /*
- Normally, we can just use the the pixelFormatIndex corresponding
- to the fbconfig which has been specified by the client
- */
+ GLWIN_DEBUG_MSG("glxWinSetPixelFormat: pixelFormatIndex %d",
+ winConfig->pixelFormatIndex);
- if (!((bppOverride && (bppOverride != (config->redBits + config->greenBits + config->blueBits) ))
- || ((config->drawableType & drawableTypeOverride) == 0)))
- {
- if (!SetPixelFormat(hdc, winConfig->pixelFormatIndex, NULL))
- {
- ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ /*
+ Normally, we can just use the the pixelFormatIndex corresponding
+ to the fbconfig which has been specified by the client
+ */
+
+ if (!
+ ((bppOverride &&
+ (bppOverride !=
+ (config->redBits + config->greenBits + config->blueBits)))
+ || ((config->drawableType & drawableTypeOverride) == 0))) {
+ if (!SetPixelFormat(hdc, winConfig->pixelFormatIndex, NULL)) {
+ ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
- /*
- However, in certain special cases this pixel format will be incompatible with the
- use we are going to put it to, so we need to re-evaluate the pixel format to use:
+ /*
+ However, in certain special cases this pixel format will be incompatible with the
+ use we are going to put it to, so we need to re-evaluate the pixel format to use:
- 1) When PFD_DRAW_TO_BITMAP is set, ChoosePixelFormat() always returns a format with
+ 1) When PFD_DRAW_TO_BITMAP is set, ChoosePixelFormat() always returns a format with
the cColorBits we asked for, so we need to ensure it matches the bpp of the bitmap
- 2) Applications may assume that visuals selected with glXChooseVisual() work with
+ 2) Applications may assume that visuals selected with glXChooseVisual() work with
pixmap drawables (there is no attribute to explicitly query for pixmap drawable
support as there is for glXChooseFBConfig())
(it's arguable this is an error in the application, but we try to make it work)
@@ -1056,348 +1054,363 @@ glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawable
by default, but if the actual drawable type we're trying to select the context
on (drawableTypeOverride) isn't supported by the selected fbConfig, reconsider
and see if we can find a suitable one...
- */
- ErrorF("glxWinSetPixelFormat: having second thoughts: cColorbits %d, bppOveride %d; config->drawableType %d, drawableTypeOverride %d\n",
- (config->redBits + config->greenBits + config->blueBits), bppOverride, config->drawableType, drawableTypeOverride);
-
- if (!winScreen->has_WGL_ARB_pixel_format)
- {
- PIXELFORMATDESCRIPTOR pfd;
- int pixelFormat;
-
- /* convert fbConfig to PFD */
- if (fbConfigToPixelFormat(gc->base.config, &pfd, drawableTypeOverride))
- {
- ErrorF("glxWinSetPixelFormat: fbConfigToPixelFormat failed\n");
- return FALSE;
+ */
+ ErrorF
+ ("glxWinSetPixelFormat: having second thoughts: cColorbits %d, bppOveride %d; config->drawableType %d, drawableTypeOverride %d\n",
+ (config->redBits + config->greenBits + config->blueBits), bppOverride,
+ config->drawableType, drawableTypeOverride);
+
+ if (!winScreen->has_WGL_ARB_pixel_format) {
+ PIXELFORMATDESCRIPTOR pfd;
+ int pixelFormat;
+
+ /* convert fbConfig to PFD */
+ if (fbConfigToPixelFormat(gc->base.config, &pfd, drawableTypeOverride)) {
+ ErrorF("glxWinSetPixelFormat: fbConfigToPixelFormat failed\n");
+ return FALSE;
}
- if (glxWinDebugSettings.dumpPFD)
- pfdOut(&pfd);
+ if (glxWinDebugSettings.dumpPFD)
+ pfdOut(&pfd);
- if (bppOverride)
- {
- GLWIN_DEBUG_MSG("glxWinSetPixelFormat: Forcing bpp from %d to %d\n", pfd.cColorBits, bppOverride);
- pfd.cColorBits = bppOverride;
+ if (bppOverride) {
+ GLWIN_DEBUG_MSG("glxWinSetPixelFormat: Forcing bpp from %d to %d\n",
+ pfd.cColorBits, bppOverride);
+ pfd.cColorBits = bppOverride;
}
- pixelFormat = ChoosePixelFormat(hdc, &pfd);
- if (pixelFormat == 0)
- {
- ErrorF("ChoosePixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ pixelFormat = ChoosePixelFormat(hdc, &pfd);
+ if (pixelFormat == 0) {
+ ErrorF("ChoosePixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
- GLWIN_DEBUG_MSG("ChoosePixelFormat: chose pixelFormatIndex %d", pixelFormat);
- ErrorF("ChoosePixelFormat: chose pixelFormatIndex %d (rather than %d as originally planned)\n", pixelFormat, winConfig->pixelFormatIndex);
+ GLWIN_DEBUG_MSG("ChoosePixelFormat: chose pixelFormatIndex %d",
+ pixelFormat);
+ ErrorF
+ ("ChoosePixelFormat: chose pixelFormatIndex %d (rather than %d as originally planned)\n",
+ pixelFormat, winConfig->pixelFormatIndex);
- if (!SetPixelFormat(hdc, pixelFormat, &pfd))
- {
- ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ if (!SetPixelFormat(hdc, pixelFormat, &pfd)) {
+ ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
}
- else
- {
- int pixelFormat = fbConfigToPixelFormatIndex(hdc, gc->base.config, drawableTypeOverride, winScreen);
- if (pixelFormat == 0)
- {
- ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ else {
+ int pixelFormat =
+ fbConfigToPixelFormatIndex(hdc, gc->base.config,
+ drawableTypeOverride, winScreen);
+ if (pixelFormat == 0) {
+ ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
- GLWIN_DEBUG_MSG("wglChoosePixelFormat: chose pixelFormatIndex %d", pixelFormat);
- ErrorF("wglChoosePixelFormat: chose pixelFormatIndex %d (rather than %d as originally planned)\n", pixelFormat, winConfig->pixelFormatIndex);
+ GLWIN_DEBUG_MSG("wglChoosePixelFormat: chose pixelFormatIndex %d",
+ pixelFormat);
+ ErrorF
+ ("wglChoosePixelFormat: chose pixelFormatIndex %d (rather than %d as originally planned)\n",
+ pixelFormat, winConfig->pixelFormatIndex);
- if (!SetPixelFormat(hdc, pixelFormat, NULL))
- {
- ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
- return FALSE;
+ if (!SetPixelFormat(hdc, pixelFormat, NULL)) {
+ ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage());
+ return FALSE;
}
}
- return TRUE;
+ return TRUE;
}
static HDC
-glxWinMakeDC(__GLXWinContext *gc, __GLXWinDrawable *draw, HDC *hdc, HWND *hwnd)
+glxWinMakeDC(__GLXWinContext * gc, __GLXWinDrawable * draw, HDC * hdc,
+ HWND * hwnd)
{
- *hdc = NULL;
- *hwnd = NULL;
+ *hdc = NULL;
+ *hwnd = NULL;
- if (draw == NULL)
- {
- GLWIN_TRACE_MSG("No drawable for context %p (native ctx %p)", gc, gc->ctx);
- return NULL;
+ if (draw == NULL) {
+ GLWIN_TRACE_MSG("No drawable for context %p (native ctx %p)", gc,
+ gc->ctx);
+ return NULL;
}
- switch (draw->base.type)
- {
+ switch (draw->base.type) {
case GLX_DRAWABLE_WINDOW:
{
- WindowPtr pWin;
+ WindowPtr pWin;
- pWin = (WindowPtr) draw->base.pDraw;
- if (pWin == NULL)
- {
- GLWIN_TRACE_MSG("for drawable %p, no WindowPtr", pWin);
- return NULL;
+ pWin = (WindowPtr) draw->base.pDraw;
+ if (pWin == NULL) {
+ GLWIN_TRACE_MSG("for drawable %p, no WindowPtr", pWin);
+ return NULL;
}
- *hwnd = winGetWindowInfo(pWin);
+ *hwnd = winGetWindowInfo(pWin);
- if (*hwnd == NULL)
- {
- ErrorF("No HWND error: %s\n", glxWinErrorMessage());
- return NULL;
+ if (*hwnd == NULL) {
+ ErrorF("No HWND error: %s\n", glxWinErrorMessage());
+ return NULL;
}
- *hdc = GetDC(*hwnd);
+ *hdc = GetDC(*hwnd);
- if (*hdc == NULL)
- ErrorF("GetDC error: %s\n", glxWinErrorMessage());
+ if (*hdc == NULL)
+ ErrorF("GetDC error: %s\n", glxWinErrorMessage());
- /* Check if the hwnd has changed... */
- if (*hwnd != gc->hwnd)
- {
- if (glxWinDebugSettings.enableTrace)
- GLWIN_DEBUG_HWND(*hwnd);
+ /* Check if the hwnd has changed... */
+ if (*hwnd != gc->hwnd) {
+ if (glxWinDebugSettings.enableTrace)
+ GLWIN_DEBUG_HWND(*hwnd);
- GLWIN_TRACE_MSG("for context %p (native ctx %p), hWnd changed from %p to %p", gc, gc->ctx, gc->hwnd, *hwnd);
- gc->hwnd = *hwnd;
+ GLWIN_TRACE_MSG
+ ("for context %p (native ctx %p), hWnd changed from %p to %p",
+ gc, gc->ctx, gc->hwnd, *hwnd);
+ gc->hwnd = *hwnd;
- /* We must select a pixelformat, but SetPixelFormat can only be called once for a window... */
- if (!glxWinSetPixelFormat(gc, *hdc, 0, GLX_WINDOW_BIT))
- {
- ErrorF("glxWinSetPixelFormat error: %s\n", glxWinErrorMessage());
- ReleaseDC(*hwnd, *hdc);
- *hdc = NULL;
- return NULL;
+ /* We must select a pixelformat, but SetPixelFormat can only be called once for a window... */
+ if (!glxWinSetPixelFormat(gc, *hdc, 0, GLX_WINDOW_BIT)) {
+ ErrorF("glxWinSetPixelFormat error: %s\n",
+ glxWinErrorMessage());
+ ReleaseDC(*hwnd, *hdc);
+ *hdc = NULL;
+ return NULL;
}
}
}
- break;
+ break;
- case GLX_DRAWABLE_PBUFFER:
+ case GLX_DRAWABLE_PBUFFER:
{
- *hdc = wglGetPbufferDCARBWrapper(draw->hPbuffer);
+ *hdc = wglGetPbufferDCARBWrapper(draw->hPbuffer);
- if (*hdc == NULL)
- ErrorF("GetDC (pbuffer) error: %s\n", glxWinErrorMessage());
+ if (*hdc == NULL)
+ ErrorF("GetDC (pbuffer) error: %s\n", glxWinErrorMessage());
}
- break;
+ break;
- case GLX_DRAWABLE_PIXMAP:
+ case GLX_DRAWABLE_PIXMAP:
{
- *hdc = draw->dibDC;
+ *hdc = draw->dibDC;
}
- break;
+ break;
- default:
+ default:
{
- ErrorF("glxWinMakeDC: tried to makeDC for unhandled drawable type %d\n", draw->base.type);
+ ErrorF("glxWinMakeDC: tried to makeDC for unhandled drawable type %d\n",
+ draw->base.type);
+ }
}
- }
- if (glxWinDebugSettings.dumpDC)
- GLWIN_DEBUG_MSG("Got HDC %p", *hdc);
+ if (glxWinDebugSettings.dumpDC)
+ GLWIN_DEBUG_MSG("Got HDC %p", *hdc);
- return *hdc;
+ return *hdc;
}
static void
-glxWinReleaseDC(HWND hwnd, HDC hdc,__GLXWinDrawable *draw)
+glxWinReleaseDC(HWND hwnd, HDC hdc, __GLXWinDrawable * draw)
{
- switch (draw->base.type)
- {
+ switch (draw->base.type) {
case GLX_DRAWABLE_WINDOW:
{
- ReleaseDC(hwnd, hdc);
+ ReleaseDC(hwnd, hdc);
}
- break;
+ break;
- case GLX_DRAWABLE_PBUFFER:
+ case GLX_DRAWABLE_PBUFFER:
{
- if (!wglReleasePbufferDCARBWrapper(draw->hPbuffer, hdc))
- {
- ErrorF("wglReleasePbufferDCARB error: %s\n", glxWinErrorMessage());
+ if (!wglReleasePbufferDCARBWrapper(draw->hPbuffer, hdc)) {
+ ErrorF("wglReleasePbufferDCARB error: %s\n", glxWinErrorMessage());
}
}
- break;
+ break;
- case GLX_DRAWABLE_PIXMAP:
+ case GLX_DRAWABLE_PIXMAP:
{
- // don't release DC, the memory DC lives as long as the bitmap
+ // don't release DC, the memory DC lives as long as the bitmap
- // We must ensure that all GDI drawing into the bitmap has completed
- // in case we subsequently access the bits from it
- GdiFlush();
+ // We must ensure that all GDI drawing into the bitmap has completed
+ // in case we subsequently access the bits from it
+ GdiFlush();
}
- break;
+ break;
- default:
+ default:
{
- ErrorF("glxWinReleaseDC: tried to releaseDC for unhandled drawable type %d\n", draw->base.type);
+ ErrorF
+ ("glxWinReleaseDC: tried to releaseDC for unhandled drawable type %d\n",
+ draw->base.type);
+ }
}
- }
}
static void
-glxWinDeferredCreateContext(__GLXWinContext *gc, __GLXWinDrawable *draw)
+glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
{
- HDC dc;
- HWND hwnd;
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: attach context %p to drawable %p", gc, draw);
+ HDC dc;
+ HWND hwnd;
+
+ GLWIN_DEBUG_MSG
+ ("glxWinDeferredCreateContext: attach context %p to drawable %p", gc,
+ draw);
- switch (draw->base.type)
- {
+ switch (draw->base.type) {
case GLX_DRAWABLE_WINDOW:
{
- WindowPtr pWin = (WindowPtr) draw->base.pDraw;
+ WindowPtr pWin = (WindowPtr) draw->base.pDraw;
- if (!(gc->base.config->drawableType & GLX_WINDOW_BIT))
- {
- ErrorF("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_WINDOW_BIT to a GLX_DRAWABLE_WINDOW drawable\n");
+ if (!(gc->base.config->drawableType & GLX_WINDOW_BIT)) {
+ ErrorF
+ ("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_WINDOW_BIT to a GLX_DRAWABLE_WINDOW drawable\n");
}
- if (pWin == NULL)
- {
- GLWIN_DEBUG_MSG("Deferring until X window is created");
- return;
+ if (pWin == NULL) {
+ GLWIN_DEBUG_MSG("Deferring until X window is created");
+ return;
}
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: pWin %p", pWin);
+ GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: pWin %p", pWin);
- if (winGetWindowInfo(pWin) == NULL)
- {
- GLWIN_DEBUG_MSG("Deferring until native window is created");
- return;
+ if (winGetWindowInfo(pWin) == NULL) {
+ GLWIN_DEBUG_MSG("Deferring until native window is created");
+ return;
}
}
- break;
+ break;
case GLX_DRAWABLE_PBUFFER:
{
- if (draw->hPbuffer == NULL)
- {
- __GLXscreen *screen;
- glxWinScreen *winScreen;
- int pixelFormat;
- // XXX: which DC are supposed to use???
- HDC screenDC = GetDC(NULL);
+ if (draw->hPbuffer == NULL) {
+ __GLXscreen *screen;
+ glxWinScreen *winScreen;
+ int pixelFormat;
- if (!(gc->base.config->drawableType & GLX_PBUFFER_BIT))
- {
- ErrorF("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_PBUFFER_BIT to a GLX_DRAWABLE_PBUFFER drawable\n");
+ // XXX: which DC are supposed to use???
+ HDC screenDC = GetDC(NULL);
+
+ if (!(gc->base.config->drawableType & GLX_PBUFFER_BIT)) {
+ ErrorF
+ ("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_PBUFFER_BIT to a GLX_DRAWABLE_PBUFFER drawable\n");
}
- screen = gc->base.pGlxScreen;
- winScreen = (glxWinScreen *)screen;
+ screen = gc->base.pGlxScreen;
+ winScreen = (glxWinScreen *) screen;
- pixelFormat = fbConfigToPixelFormatIndex(screenDC, gc->base.config, GLX_DRAWABLE_PBUFFER, winScreen);
- if (pixelFormat == 0)
- {
- ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
- return;
+ pixelFormat =
+ fbConfigToPixelFormatIndex(screenDC, gc->base.config,
+ GLX_DRAWABLE_PBUFFER, winScreen);
+ if (pixelFormat == 0) {
+ ErrorF("wglChoosePixelFormat error: %s\n",
+ glxWinErrorMessage());
+ return;
}
- draw->hPbuffer = wglCreatePbufferARBWrapper(screenDC, pixelFormat, draw->base.pDraw->width, draw->base.pDraw->height, NULL);
- ReleaseDC(NULL, screenDC);
+ draw->hPbuffer =
+ wglCreatePbufferARBWrapper(screenDC, pixelFormat,
+ draw->base.pDraw->width,
+ draw->base.pDraw->height, NULL);
+ ReleaseDC(NULL, screenDC);
- if (draw->hPbuffer == NULL)
- {
- ErrorF("wglCreatePbufferARBWrapper error: %s\n", glxWinErrorMessage());
- return;
+ if (draw->hPbuffer == NULL) {
+ ErrorF("wglCreatePbufferARBWrapper error: %s\n",
+ glxWinErrorMessage());
+ return;
}
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: pBuffer %p created for drawable %p", draw->hPbuffer, draw);
+ GLWIN_DEBUG_MSG
+ ("glxWinDeferredCreateContext: pBuffer %p created for drawable %p",
+ draw->hPbuffer, draw);
}
}
- break;
+ break;
case GLX_DRAWABLE_PIXMAP:
{
- if (draw->dibDC == NULL)
- {
- BITMAPINFOHEADER bmpHeader;
- void *pBits;
-
- memset (&bmpHeader, 0, sizeof(BITMAPINFOHEADER));
- bmpHeader.biSize = sizeof(BITMAPINFOHEADER);
- bmpHeader.biWidth = draw->base.pDraw->width;
- bmpHeader.biHeight = draw->base.pDraw->height;
- bmpHeader.biPlanes = 1;
- bmpHeader.biBitCount = draw->base.pDraw->bitsPerPixel;
- bmpHeader.biCompression = BI_RGB;
-
- if (!(gc->base.config->drawableType & GLX_PIXMAP_BIT))
- {
- ErrorF("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_PIXMAP_BIT to a GLX_DRAWABLE_PIXMAP drawable\n");
+ if (draw->dibDC == NULL) {
+ BITMAPINFOHEADER bmpHeader;
+ void *pBits;
+
+ memset(&bmpHeader, 0, sizeof(BITMAPINFOHEADER));
+ bmpHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmpHeader.biWidth = draw->base.pDraw->width;
+ bmpHeader.biHeight = draw->base.pDraw->height;
+ bmpHeader.biPlanes = 1;
+ bmpHeader.biBitCount = draw->base.pDraw->bitsPerPixel;
+ bmpHeader.biCompression = BI_RGB;
+
+ if (!(gc->base.config->drawableType & GLX_PIXMAP_BIT)) {
+ ErrorF
+ ("glxWinDeferredCreateContext: tried to attach a context whose fbConfig doesn't have drawableType GLX_PIXMAP_BIT to a GLX_DRAWABLE_PIXMAP drawable\n");
}
- draw->dibDC = CreateCompatibleDC(NULL);
- if (draw->dibDC == NULL)
- {
- ErrorF("CreateCompatibleDC error: %s\n", glxWinErrorMessage());
- return;
+ draw->dibDC = CreateCompatibleDC(NULL);
+ if (draw->dibDC == NULL) {
+ ErrorF("CreateCompatibleDC error: %s\n", glxWinErrorMessage());
+ return;
}
- draw->hDIB = CreateDIBSection(draw->dibDC, (BITMAPINFO *)&bmpHeader, DIB_RGB_COLORS, &pBits, 0, 0);
- if (draw->dibDC == NULL)
- {
- ErrorF("CreateDIBSection error: %s\n", glxWinErrorMessage());
- return;
+ draw->hDIB =
+ CreateDIBSection(draw->dibDC, (BITMAPINFO *) & bmpHeader,
+ DIB_RGB_COLORS, &pBits, 0, 0);
+ if (draw->dibDC == NULL) {
+ ErrorF("CreateDIBSection error: %s\n", glxWinErrorMessage());
+ return;
}
- // XXX: CreateDIBSection insists on allocating the bitmap memory for us, so we're going to
- // need some jiggery pokery to point the underlying X Drawable's bitmap at the same set of bits
- // so that they can be read with XGetImage as well as glReadPixels, assuming the formats are
- // even compatible ...
- draw->pOldBits = ((PixmapPtr)draw->base.pDraw)->devPrivate.ptr;
- ((PixmapPtr)draw->base.pDraw)->devPrivate.ptr = pBits;
-
- // Select the DIB into the DC
- draw->hOldDIB = SelectObject(draw->dibDC, draw->hDIB);
- if (!draw->hOldDIB)
- {
- ErrorF("SelectObject error: %s\n", glxWinErrorMessage());
+ // XXX: CreateDIBSection insists on allocating the bitmap memory for us, so we're going to
+ // need some jiggery pokery to point the underlying X Drawable's bitmap at the same set of bits
+ // so that they can be read with XGetImage as well as glReadPixels, assuming the formats are
+ // even compatible ...
+ draw->pOldBits = ((PixmapPtr) draw->base.pDraw)->devPrivate.ptr;
+ ((PixmapPtr) draw->base.pDraw)->devPrivate.ptr = pBits;
+
+ // Select the DIB into the DC
+ draw->hOldDIB = SelectObject(draw->dibDC, draw->hDIB);
+ if (!draw->hOldDIB) {
+ ErrorF("SelectObject error: %s\n", glxWinErrorMessage());
}
- // Set the pixel format of the bitmap
- glxWinSetPixelFormat(gc, draw->dibDC, draw->base.pDraw->bitsPerPixel, GLX_PIXMAP_BIT);
+ // Set the pixel format of the bitmap
+ glxWinSetPixelFormat(gc, draw->dibDC,
+ draw->base.pDraw->bitsPerPixel,
+ GLX_PIXMAP_BIT);
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: DIB bitmap %p created for drawable %p", draw->hDIB, draw);
+ GLWIN_DEBUG_MSG
+ ("glxWinDeferredCreateContext: DIB bitmap %p created for drawable %p",
+ draw->hDIB, draw);
}
}
- break;
+ break;
default:
{
- ErrorF("glxWinDeferredCreateContext: tried to attach unhandled drawable type %d\n", draw->base.type);
- return;
+ ErrorF
+ ("glxWinDeferredCreateContext: tried to attach unhandled drawable type %d\n",
+ draw->base.type);
+ return;
+ }
}
- }
- dc = glxWinMakeDC(gc, draw, &dc, &hwnd);
- gc->ctx = wglCreateContext(dc);
- glxWinReleaseDC(hwnd, dc, draw);
+ dc = glxWinMakeDC(gc, draw, &dc, &hwnd);
+ gc->ctx = wglCreateContext(dc);
+ glxWinReleaseDC(hwnd, dc, draw);
- if (gc->ctx == NULL)
- {
- ErrorF("wglCreateContext error: %s\n", glxWinErrorMessage());
- return;
+ if (gc->ctx == NULL) {
+ ErrorF("wglCreateContext error: %s\n", glxWinErrorMessage());
+ return;
}
- GLWIN_DEBUG_MSG("glxWinDeferredCreateContext: attached context %p to native context %p drawable %p", gc, gc->ctx, draw);
+ GLWIN_DEBUG_MSG
+ ("glxWinDeferredCreateContext: attached context %p to native context %p drawable %p",
+ gc, gc->ctx, draw);
- // if the native context was created successfully, shareLists if needed
- if (gc->ctx && gc->shareContext)
- {
- GLWIN_DEBUG_MSG("glxWinCreateContextReal shareLists with context %p (native ctx %p)", gc->shareContext, gc->shareContext->ctx);
+ // if the native context was created successfully, shareLists if needed
+ if (gc->ctx && gc->shareContext) {
+ GLWIN_DEBUG_MSG
+ ("glxWinCreateContextReal shareLists with context %p (native ctx %p)",
+ gc->shareContext, gc->shareContext->ctx);
- if (!wglShareLists(gc->shareContext->ctx, gc->ctx))
- {
- ErrorF("wglShareLists error: %s\n", glxWinErrorMessage());
+ if (!wglShareLists(gc->shareContext->ctx, gc->ctx)) {
+ ErrorF("wglShareLists error: %s\n", glxWinErrorMessage());
}
}
}
@@ -1407,183 +1420,177 @@ glxWinDeferredCreateContext(__GLXWinContext *gc, __GLXWinDrawable *draw)
* Context functions
*/
-
/* Context manipulation routines should return TRUE on success, FALSE on failure */
static int
-glxWinContextMakeCurrent(__GLXcontext *base)
+glxWinContextMakeCurrent(__GLXcontext * base)
{
- __GLXWinContext *gc = (__GLXWinContext *)base;
- BOOL ret;
- HDC drawDC;
- HDC readDC = NULL;
- __GLXdrawable *drawPriv;
- __GLXdrawable *readPriv = NULL;
- HWND hDrawWnd;
- HWND hReadWnd;
-
- GLWIN_TRACE_MSG("glxWinContextMakeCurrent context %p (native ctx %p)", gc, gc->ctx);
- glWinCallDelta();
-
- /* Keep a note of the last active context in the drawable */
- drawPriv = gc->base.drawPriv;
- ((__GLXWinDrawable *)drawPriv)->drawContext = gc;
-
- if (gc->ctx == NULL)
- {
- glxWinDeferredCreateContext(gc, (__GLXWinDrawable *)drawPriv);
+ __GLXWinContext *gc = (__GLXWinContext *) base;
+ BOOL ret;
+ HDC drawDC;
+ HDC readDC = NULL;
+ __GLXdrawable *drawPriv;
+ __GLXdrawable *readPriv = NULL;
+ HWND hDrawWnd;
+ HWND hReadWnd;
+
+ GLWIN_TRACE_MSG("glxWinContextMakeCurrent context %p (native ctx %p)", gc,
+ gc->ctx);
+ glWinCallDelta();
+
+ /* Keep a note of the last active context in the drawable */
+ drawPriv = gc->base.drawPriv;
+ ((__GLXWinDrawable *) drawPriv)->drawContext = gc;
+
+ if (gc->ctx == NULL) {
+ glxWinDeferredCreateContext(gc, (__GLXWinDrawable *) drawPriv);
}
- if (gc->ctx == NULL)
- {
- ErrorF("glxWinContextMakeCurrent: Native context is NULL\n");
- return FALSE;
+ if (gc->ctx == NULL) {
+ ErrorF("glxWinContextMakeCurrent: Native context is NULL\n");
+ return FALSE;
}
- drawDC = glxWinMakeDC(gc, (__GLXWinDrawable *)drawPriv, &drawDC, &hDrawWnd);
- if (drawDC == NULL)
- {
- ErrorF("glxWinMakeDC failed for drawDC\n");
- return FALSE;
+ drawDC =
+ glxWinMakeDC(gc, (__GLXWinDrawable *) drawPriv, &drawDC, &hDrawWnd);
+ if (drawDC == NULL) {
+ ErrorF("glxWinMakeDC failed for drawDC\n");
+ return FALSE;
}
- if ((gc->base.readPriv != NULL) && (gc->base.readPriv != gc->base.drawPriv))
- {
- // XXX: should only occur with WGL_ARB_make_current_read
- /*
- If there is a separate read drawable, create a separate read DC, and
- use the wglMakeContextCurrent extension to make the context current drawing
- to one DC and reading from the other
- */
- readPriv = gc->base.readPriv;
- readDC = glxWinMakeDC(gc, (__GLXWinDrawable *)readPriv, &readDC, &hReadWnd);
- if (readDC == NULL)
- {
- ErrorF("glxWinMakeDC failed for readDC\n");
- glxWinReleaseDC(hDrawWnd, drawDC, (__GLXWinDrawable *)drawPriv);
- return FALSE;
+ if ((gc->base.readPriv != NULL) && (gc->base.readPriv != gc->base.drawPriv)) {
+ // XXX: should only occur with WGL_ARB_make_current_read
+ /*
+ If there is a separate read drawable, create a separate read DC, and
+ use the wglMakeContextCurrent extension to make the context current drawing
+ to one DC and reading from the other
+ */
+ readPriv = gc->base.readPriv;
+ readDC =
+ glxWinMakeDC(gc, (__GLXWinDrawable *) readPriv, &readDC, &hReadWnd);
+ if (readDC == NULL) {
+ ErrorF("glxWinMakeDC failed for readDC\n");
+ glxWinReleaseDC(hDrawWnd, drawDC, (__GLXWinDrawable *) drawPriv);
+ return FALSE;
}
- ret = wglMakeContextCurrentARBWrapper(drawDC, readDC, gc->ctx);
- if (!ret)
- {
- ErrorF("wglMakeContextCurrentARBWrapper error: %s\n", glxWinErrorMessage());
+ ret = wglMakeContextCurrentARBWrapper(drawDC, readDC, gc->ctx);
+ if (!ret) {
+ ErrorF("wglMakeContextCurrentARBWrapper error: %s\n",
+ glxWinErrorMessage());
}
}
- else
- {
- /* Otherwise, just use wglMakeCurrent */
- ret = wglMakeCurrent(drawDC, gc->ctx);
- if (!ret)
- {
- ErrorF("wglMakeCurrent error: %s\n", glxWinErrorMessage());
+ else {
+ /* Otherwise, just use wglMakeCurrent */
+ ret = wglMakeCurrent(drawDC, gc->ctx);
+ if (!ret) {
+ ErrorF("wglMakeCurrent error: %s\n", glxWinErrorMessage());
}
}
- // apparently make current could fail if the context is current in a different thread,
- // but that shouldn't be able to happen in the current server...
+ // apparently make current could fail if the context is current in a different thread,
+ // but that shouldn't be able to happen in the current server...
- glxWinReleaseDC(hDrawWnd, drawDC, (__GLXWinDrawable *)drawPriv);
- if (readDC)
- glxWinReleaseDC(hReadWnd, readDC, (__GLXWinDrawable *)readPriv);
+ glxWinReleaseDC(hDrawWnd, drawDC, (__GLXWinDrawable *) drawPriv);
+ if (readDC)
+ glxWinReleaseDC(hReadWnd, readDC, (__GLXWinDrawable *) readPriv);
- return ret;
+ return ret;
}
static int
-glxWinContextLoseCurrent(__GLXcontext *base)
+glxWinContextLoseCurrent(__GLXcontext * base)
{
- BOOL ret;
- __GLXWinContext *gc = (__GLXWinContext *)base;
+ BOOL ret;
+ __GLXWinContext *gc = (__GLXWinContext *) base;
- GLWIN_TRACE_MSG("glxWinContextLoseCurrent context %p (native ctx %p)", gc, gc->ctx);
- glWinCallDelta();
+ GLWIN_TRACE_MSG("glxWinContextLoseCurrent context %p (native ctx %p)", gc,
+ gc->ctx);
+ glWinCallDelta();
- /*
- An error seems to be reported if we try to make no context current
- if there is already no current context, so avoid doing that...
- */
- if (__glXLastContext != NULL)
- {
- ret = wglMakeCurrent(NULL, NULL); /* We don't need a DC when setting no current context */
- if (!ret)
- ErrorF("glxWinContextLoseCurrent error: %s\n", glxWinErrorMessage());
+ /*
+ An error seems to be reported if we try to make no context current
+ if there is already no current context, so avoid doing that...
+ */
+ if (__glXLastContext != NULL) {
+ ret = wglMakeCurrent(NULL, NULL); /* We don't need a DC when setting no current context */
+ if (!ret)
+ ErrorF("glxWinContextLoseCurrent error: %s\n",
+ glxWinErrorMessage());
}
- return TRUE;
+ return TRUE;
}
static int
-glxWinContextCopy(__GLXcontext *dst_base, __GLXcontext *src_base, unsigned long mask)
+glxWinContextCopy(__GLXcontext * dst_base, __GLXcontext * src_base,
+ unsigned long mask)
{
- __GLXWinContext *dst = (__GLXWinContext *)dst_base;
- __GLXWinContext *src = (__GLXWinContext *)src_base;
- BOOL ret;
+ __GLXWinContext *dst = (__GLXWinContext *) dst_base;
+ __GLXWinContext *src = (__GLXWinContext *) src_base;
+ BOOL ret;
- GLWIN_DEBUG_MSG("glxWinContextCopy");
+ GLWIN_DEBUG_MSG("glxWinContextCopy");
- ret = wglCopyContext(src->ctx, dst->ctx, mask);
- if (!ret)
- {
- ErrorF("wglCopyContext error: %s\n", glxWinErrorMessage());
+ ret = wglCopyContext(src->ctx, dst->ctx, mask);
+ if (!ret) {
+ ErrorF("wglCopyContext error: %s\n", glxWinErrorMessage());
}
- return ret;
+ return ret;
}
static void
-glxWinContextDestroy(__GLXcontext *base)
+glxWinContextDestroy(__GLXcontext * base)
{
- __GLXWinContext *gc = (__GLXWinContext *)base;
+ __GLXWinContext *gc = (__GLXWinContext *) base;
- if (gc != NULL)
- {
- GLWIN_DEBUG_MSG("GLXcontext %p destroyed (native ctx %p)", base, gc->ctx);
+ if (gc != NULL) {
+ GLWIN_DEBUG_MSG("GLXcontext %p destroyed (native ctx %p)", base,
+ gc->ctx);
- if (gc->ctx)
- {
- /* It's bad style to delete the context while it's still current */
- if (wglGetCurrentContext() == gc->ctx)
- {
- wglMakeCurrent(NULL, NULL);
+ if (gc->ctx) {
+ /* It's bad style to delete the context while it's still current */
+ if (wglGetCurrentContext() == gc->ctx) {
+ wglMakeCurrent(NULL, NULL);
}
- {
- BOOL ret = wglDeleteContext(gc->ctx);
- if (!ret)
- ErrorF("wglDeleteContext error: %s\n", glxWinErrorMessage());
- }
+ {
+ BOOL ret = wglDeleteContext(gc->ctx);
- gc->ctx = NULL;
+ if (!ret)
+ ErrorF("wglDeleteContext error: %s\n",
+ glxWinErrorMessage());
+ }
+
+ gc->ctx = NULL;
}
- free(gc);
+ free(gc);
}
}
static __GLXcontext *
-glxWinCreateContext(__GLXscreen *screen,
- __GLXconfig *modes,
- __GLXcontext *baseShareContext)
+glxWinCreateContext(__GLXscreen * screen,
+ __GLXconfig * modes, __GLXcontext * baseShareContext)
{
__GLXWinContext *context;
- __GLXWinContext *shareContext = (__GLXWinContext *)baseShareContext;
+ __GLXWinContext *shareContext = (__GLXWinContext *) baseShareContext;
- static __GLXtextureFromPixmap glxWinTextureFromPixmap =
- {
+ static __GLXtextureFromPixmap glxWinTextureFromPixmap = {
glxWinBindTexImage,
glxWinReleaseTexImage
- };
+ };
- context = (__GLXWinContext *)calloc(1, sizeof(__GLXWinContext));
+ context = (__GLXWinContext *) calloc(1, sizeof(__GLXWinContext));
if (!context)
return NULL;
memset(context, 0, sizeof *context);
- context->base.destroy = glxWinContextDestroy;
- context->base.makeCurrent = glxWinContextMakeCurrent;
- context->base.loseCurrent = glxWinContextLoseCurrent;
- context->base.copy = glxWinContextCopy;
+ context->base.destroy = glxWinContextDestroy;
+ context->base.makeCurrent = glxWinContextMakeCurrent;
+ context->base.loseCurrent = glxWinContextLoseCurrent;
+ context->base.copy = glxWinContextCopy;
context->base.textureFromPixmap = &glxWinTextureFromPixmap;
context->base.config = modes;
context->base.pGlxScreen = screen;
@@ -1605,32 +1612,33 @@ glxWinCreateContext(__GLXscreen *screen,
*/
static int
-fbConfigToPixelFormat(__GLXconfig *mode, PIXELFORMATDESCRIPTOR *pfdret, int drawableTypeOverride)
+fbConfigToPixelFormat(__GLXconfig * mode, PIXELFORMATDESCRIPTOR * pfdret,
+ int drawableTypeOverride)
{
PIXELFORMATDESCRIPTOR pfd = {
- sizeof(PIXELFORMATDESCRIPTOR), /* size of this pfd */
- 1, /* version number */
- PFD_SUPPORT_OPENGL, /* support OpenGL */
- PFD_TYPE_RGBA, /* RGBA type */
- 24, /* 24-bit color depth */
- 0, 0, 0, 0, 0, 0, /* color bits ignored */
- 0, /* no alpha buffer */
- 0, /* shift bit ignored */
- 0, /* no accumulation buffer */
- 0, 0, 0, 0, /* accum bits ignored */
- 32, /* 32-bit z-buffer */
- 0, /* no stencil buffer */
- 0, /* no auxiliary buffer */
- PFD_MAIN_PLANE, /* main layer */
- 0, /* reserved */
- 0, 0, 0 /* layer masks ignored */
+ sizeof(PIXELFORMATDESCRIPTOR), /* size of this pfd */
+ 1, /* version number */
+ PFD_SUPPORT_OPENGL, /* support OpenGL */
+ PFD_TYPE_RGBA, /* RGBA type */
+ 24, /* 24-bit color depth */
+ 0, 0, 0, 0, 0, 0, /* color bits ignored */
+ 0, /* no alpha buffer */
+ 0, /* shift bit ignored */
+ 0, /* no accumulation buffer */
+ 0, 0, 0, 0, /* accum bits ignored */
+ 32, /* 32-bit z-buffer */
+ 0, /* no stencil buffer */
+ 0, /* no auxiliary buffer */
+ PFD_MAIN_PLANE, /* main layer */
+ 0, /* reserved */
+ 0, 0, 0 /* layer masks ignored */
};
if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT)
- pfd.dwFlags |= PFD_DRAW_TO_WINDOW; /* support window */
+ pfd.dwFlags |= PFD_DRAW_TO_WINDOW; /* support window */
if ((mode->drawableType | drawableTypeOverride) & GLX_PIXMAP_BIT)
- pfd.dwFlags |= (PFD_DRAW_TO_BITMAP | PFD_SUPPORT_GDI); /* supports software rendering to bitmap */
+ pfd.dwFlags |= (PFD_DRAW_TO_BITMAP | PFD_SUPPORT_GDI); /* supports software rendering to bitmap */
if (mode->stereoMode) {
pfd.dwFlags |= PFD_STEREO;
@@ -1642,15 +1650,17 @@ fbConfigToPixelFormat(__GLXconfig *mode, PIXELFORMATDESCRIPTOR *pfdret, int draw
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = mode->redBits + mode->greenBits + mode->blueBits;
pfd.cRedBits = mode->redBits;
- pfd.cRedShift = 0; /* FIXME */
+ pfd.cRedShift = 0; /* FIXME */
pfd.cGreenBits = mode->greenBits;
- pfd.cGreenShift = 0; /* FIXME */
+ pfd.cGreenShift = 0; /* FIXME */
pfd.cBlueBits = mode->blueBits;
- pfd.cBlueShift = 0; /* FIXME */
+ pfd.cBlueShift = 0; /* FIXME */
pfd.cAlphaBits = mode->alphaBits;
- pfd.cAlphaShift = 0; /* FIXME */
+ pfd.cAlphaShift = 0; /* FIXME */
- pfd.cAccumBits = mode->accumRedBits + mode->accumGreenBits + mode->accumBlueBits + mode->accumAlphaBits;
+ pfd.cAccumBits =
+ mode->accumRedBits + mode->accumGreenBits + mode->accumBlueBits +
+ mode->accumAlphaBits;
pfd.cAccumRedBits = mode->accumRedBits;
pfd.cAccumGreenBits = mode->accumGreenBits;
pfd.cAccumBlueBits = mode->accumBlueBits;
@@ -1671,94 +1681,98 @@ fbConfigToPixelFormat(__GLXconfig *mode, PIXELFORMATDESCRIPTOR *pfdret, int draw
#define SET_ATTR_VALUE(attr, value) { attribList[i++] = attr; attribList[i++] = value; assert(i < NUM_ELEMENTS(attribList)); }
static int
-fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig *mode, int drawableTypeOverride, glxWinScreen *winScreen)
+fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode,
+ int drawableTypeOverride, glxWinScreen * winScreen)
{
- UINT numFormats;
- unsigned int i = 0;
-
- /* convert fbConfig to attr-value list */
- int attribList[60];
-
- SET_ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, TRUE);
- SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, (mode->visualType == GLX_TRUE_COLOR) ? WGL_TYPE_RGBA_ARB : WGL_TYPE_COLORINDEX_ARB);
- SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, (mode->visualType == GLX_TRUE_COLOR) ? mode->rgbBits : mode->indexBits);
- SET_ATTR_VALUE(WGL_RED_BITS_ARB, mode->redBits);
- SET_ATTR_VALUE(WGL_GREEN_BITS_ARB, mode->greenBits);
- SET_ATTR_VALUE(WGL_BLUE_BITS_ARB, mode->blueBits);
- SET_ATTR_VALUE(WGL_ALPHA_BITS_ARB, mode->alphaBits);
- SET_ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, mode->accumRedBits);
- SET_ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, mode->accumGreenBits);
- SET_ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, mode->accumBlueBits);
- SET_ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, mode->accumAlphaBits);
- SET_ATTR_VALUE(WGL_DEPTH_BITS_ARB, mode->depthBits);
- SET_ATTR_VALUE(WGL_STENCIL_BITS_ARB, mode->stencilBits);
- SET_ATTR_VALUE(WGL_AUX_BUFFERS_ARB, mode->numAuxBuffers);
-
- if (mode->doubleBufferMode)
- SET_ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, TRUE);
-
- if (mode->stereoMode)
- SET_ATTR_VALUE(WGL_STEREO_ARB, TRUE);
-
- // Some attributes are only added to the list if the value requested is not 'don't care', as exactly matching that is daft..
- if (mode->swapMethod == GLX_SWAP_EXCHANGE_OML)
- SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_EXCHANGE_ARB);
-
- if (mode->swapMethod == GLX_SWAP_COPY_OML)
- SET_ATTR_VALUE(WGL_SWAP_COPY_ARB, TRUE);
-
- // XXX: this should probably be the other way around, but that messes up drawableTypeOverride
- if (mode->visualRating == GLX_SLOW_VISUAL_EXT)
- SET_ATTR_VALUE(WGL_ACCELERATION_ARB, WGL_NO_ACCELERATION_ARB);
-
- // must support all the drawable types the mode supports
- if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT)
- SET_ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB,TRUE);
-
- // XXX: this is a horrible hacky heuristic, in fact this whole drawableTypeOverride thing is a bad idea
- // try to avoid asking for formats which don't exist (by not asking for all when adjusting the config to include the drawableTypeOverride)
- if (drawableTypeOverride == GLX_WINDOW_BIT)
- {
- if (mode->drawableType & GLX_PIXMAP_BIT)
- SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
+ UINT numFormats;
+ unsigned int i = 0;
+
+ /* convert fbConfig to attr-value list */
+ int attribList[60];
+
+ SET_ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, TRUE);
+ SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB,
+ (mode->visualType ==
+ GLX_TRUE_COLOR) ? WGL_TYPE_RGBA_ARB :
+ WGL_TYPE_COLORINDEX_ARB);
+ SET_ATTR_VALUE(WGL_COLOR_BITS_ARB,
+ (mode->visualType ==
+ GLX_TRUE_COLOR) ? mode->rgbBits : mode->indexBits);
+ SET_ATTR_VALUE(WGL_RED_BITS_ARB, mode->redBits);
+ SET_ATTR_VALUE(WGL_GREEN_BITS_ARB, mode->greenBits);
+ SET_ATTR_VALUE(WGL_BLUE_BITS_ARB, mode->blueBits);
+ SET_ATTR_VALUE(WGL_ALPHA_BITS_ARB, mode->alphaBits);
+ SET_ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, mode->accumRedBits);
+ SET_ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, mode->accumGreenBits);
+ SET_ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, mode->accumBlueBits);
+ SET_ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, mode->accumAlphaBits);
+ SET_ATTR_VALUE(WGL_DEPTH_BITS_ARB, mode->depthBits);
+ SET_ATTR_VALUE(WGL_STENCIL_BITS_ARB, mode->stencilBits);
+ SET_ATTR_VALUE(WGL_AUX_BUFFERS_ARB, mode->numAuxBuffers);
+
+ if (mode->doubleBufferMode)
+ SET_ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, TRUE);
+
+ if (mode->stereoMode)
+ SET_ATTR_VALUE(WGL_STEREO_ARB, TRUE);
+
+ // Some attributes are only added to the list if the value requested is not 'don't care', as exactly matching that is daft..
+ if (mode->swapMethod == GLX_SWAP_EXCHANGE_OML)
+ SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_EXCHANGE_ARB);
+
+ if (mode->swapMethod == GLX_SWAP_COPY_OML)
+ SET_ATTR_VALUE(WGL_SWAP_COPY_ARB, TRUE);
+
+ // XXX: this should probably be the other way around, but that messes up drawableTypeOverride
+ if (mode->visualRating == GLX_SLOW_VISUAL_EXT)
+ SET_ATTR_VALUE(WGL_ACCELERATION_ARB, WGL_NO_ACCELERATION_ARB);
+
+ // must support all the drawable types the mode supports
+ if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT)
+ SET_ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, TRUE);
- if (mode->drawableType & GLX_PBUFFER_BIT)
- if (winScreen->has_WGL_ARB_pbuffer)
- SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
+ // XXX: this is a horrible hacky heuristic, in fact this whole drawableTypeOverride thing is a bad idea
+ // try to avoid asking for formats which don't exist (by not asking for all when adjusting the config to include the drawableTypeOverride)
+ if (drawableTypeOverride == GLX_WINDOW_BIT) {
+ if (mode->drawableType & GLX_PIXMAP_BIT)
+ SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
+
+ if (mode->drawableType & GLX_PBUFFER_BIT)
+ if (winScreen->has_WGL_ARB_pbuffer)
+ SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
}
- else
- {
- if (drawableTypeOverride & GLX_PIXMAP_BIT)
- SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
+ else {
+ if (drawableTypeOverride & GLX_PIXMAP_BIT)
+ SET_ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, TRUE);
- if (drawableTypeOverride & GLX_PBUFFER_BIT)
- if (winScreen->has_WGL_ARB_pbuffer)
- SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
+ if (drawableTypeOverride & GLX_PBUFFER_BIT)
+ if (winScreen->has_WGL_ARB_pbuffer)
+ SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
}
- SET_ATTR_VALUE(0, 0); // terminator
+ SET_ATTR_VALUE(0, 0); // terminator
- /* choose the first match */
- {
- int pixelFormatIndex;
+ /* choose the first match */
+ {
+ int pixelFormatIndex;
- if (!wglChoosePixelFormatARBWrapper(hdc, attribList, NULL, 1, &pixelFormatIndex, &numFormats))
- {
- ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
- }
- else
- {
- if (numFormats > 0)
- {
- GLWIN_DEBUG_MSG("wglChoosePixelFormat: chose pixelFormatIndex %d)", pixelFormatIndex);
- return pixelFormatIndex;
- }
- else
- ErrorF("wglChoosePixelFormat couldn't decide\n");
- }
- }
+ if (!wglChoosePixelFormatARBWrapper
+ (hdc, attribList, NULL, 1, &pixelFormatIndex, &numFormats)) {
+ ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage());
+ }
+ else {
+ if (numFormats > 0) {
+ GLWIN_DEBUG_MSG
+ ("wglChoosePixelFormat: chose pixelFormatIndex %d)",
+ pixelFormatIndex);
+ return pixelFormatIndex;
+ }
+ else
+ ErrorF("wglChoosePixelFormat couldn't decide\n");
+ }
+ }
- return 0;
+ return 0;
}
/* ---------------------------------------------------------------------- */
@@ -1769,586 +1783,614 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig *mode, int drawableTypeOverride,
// Create the GLXconfigs using DescribePixelFormat()
//
static void
-glxWinCreateConfigs(HDC hdc, glxWinScreen *screen)
+glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)
{
- GLXWinConfig *c, *result, *prev = NULL;
- int numConfigs = 0;
- int i = 0;
- int n = 0;
- PIXELFORMATDESCRIPTOR pfd;
+ GLXWinConfig *c, *result, *prev = NULL;
+ int numConfigs = 0;
+ int i = 0;
+ int n = 0;
+ PIXELFORMATDESCRIPTOR pfd;
- GLWIN_DEBUG_MSG("glxWinCreateConfigs");
+ GLWIN_DEBUG_MSG("glxWinCreateConfigs");
- screen->base.numFBConfigs = 0;
- screen->base.fbconfigs = NULL;
+ screen->base.numFBConfigs = 0;
+ screen->base.fbconfigs = NULL;
- // get the number of pixelformats
- numConfigs = DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL);
- GLWIN_DEBUG_MSG("DescribePixelFormat says %d possible pixel formats", numConfigs);
+ // get the number of pixelformats
+ numConfigs =
+ DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL);
+ GLWIN_DEBUG_MSG("DescribePixelFormat says %d possible pixel formats",
+ numConfigs);
- /* alloc */
- result = malloc(sizeof(GLXWinConfig) * numConfigs);
+ /* alloc */
+ result = malloc(sizeof(GLXWinConfig) * numConfigs);
- if (NULL == result)
- {
- return;
+ if (NULL == result) {
+ return;
}
- memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
- n = 0;
+ memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
+ n = 0;
- /* fill in configs */
- for (i = 0; i < numConfigs; i++)
- {
- int rc;
+ /* fill in configs */
+ for (i = 0; i < numConfigs; i++) {
+ int rc;
- c = &(result[i]);
- c->base.next = NULL;
- c->pixelFormatIndex = i+1;
+ c = &(result[i]);
+ c->base.next = NULL;
+ c->pixelFormatIndex = i + 1;
- rc = DescribePixelFormat(hdc, i+1, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ rc = DescribePixelFormat(hdc, i + 1, sizeof(PIXELFORMATDESCRIPTOR),
+ &pfd);
- if (!rc)
- {
- ErrorF("DescribePixelFormat failed for index %d, error %s\n", i+1, glxWinErrorMessage());
- break;
+ if (!rc) {
+ ErrorF("DescribePixelFormat failed for index %d, error %s\n", i + 1,
+ glxWinErrorMessage());
+ break;
}
- if (glxWinDebugSettings.dumpPFD)
- pfdOut(&pfd);
+ if (glxWinDebugSettings.dumpPFD)
+ pfdOut(&pfd);
- if (!(pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP)) || !(pfd.dwFlags & PFD_SUPPORT_OPENGL))
- {
- GLWIN_DEBUG_MSG("pixelFormat %d has unsuitable flags 0x%08lx, skipping", i+1, pfd.dwFlags);
- continue;
+ if (!(pfd.dwFlags & (PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP)) ||
+ !(pfd.dwFlags & PFD_SUPPORT_OPENGL)) {
+ GLWIN_DEBUG_MSG
+ ("pixelFormat %d has unsuitable flags 0x%08lx, skipping", i + 1,
+ pfd.dwFlags);
+ continue;
}
- c->base.doubleBufferMode = (pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE;
- c->base.stereoMode = (pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE;
+ c->base.doubleBufferMode =
+ (pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE;
+ c->base.stereoMode = (pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE;
- c->base.redBits = pfd.cRedBits;
- c->base.greenBits = pfd.cGreenBits;
- c->base.blueBits = pfd.cBlueBits;
- c->base.alphaBits = pfd.cAlphaBits;
+ c->base.redBits = pfd.cRedBits;
+ c->base.greenBits = pfd.cGreenBits;
+ c->base.blueBits = pfd.cBlueBits;
+ c->base.alphaBits = pfd.cAlphaBits;
- c->base.redMask = BITS_AND_SHIFT_TO_MASK(pfd.cRedBits, pfd.cRedShift);
- c->base.greenMask = BITS_AND_SHIFT_TO_MASK(pfd.cGreenBits, pfd.cGreenShift);
- c->base.blueMask = BITS_AND_SHIFT_TO_MASK(pfd.cBlueBits, pfd.cBlueShift);
- c->base.alphaMask = BITS_AND_SHIFT_TO_MASK(pfd.cAlphaBits, pfd.cAlphaShift);
+ c->base.redMask = BITS_AND_SHIFT_TO_MASK(pfd.cRedBits, pfd.cRedShift);
+ c->base.greenMask =
+ BITS_AND_SHIFT_TO_MASK(pfd.cGreenBits, pfd.cGreenShift);
+ c->base.blueMask =
+ BITS_AND_SHIFT_TO_MASK(pfd.cBlueBits, pfd.cBlueShift);
+ c->base.alphaMask =
+ BITS_AND_SHIFT_TO_MASK(pfd.cAlphaBits, pfd.cAlphaShift);
- c->base.rgbBits = pfd.cColorBits;
+ c->base.rgbBits = pfd.cColorBits;
- if (pfd.iPixelType == PFD_TYPE_COLORINDEX)
- {
- c->base.indexBits = pfd.cColorBits;
+ if (pfd.iPixelType == PFD_TYPE_COLORINDEX) {
+ c->base.indexBits = pfd.cColorBits;
}
- else
- {
- c->base.indexBits = 0;
+ else {
+ c->base.indexBits = 0;
}
- c->base.accumRedBits = pfd.cAccumRedBits;
- c->base.accumGreenBits = pfd.cAccumGreenBits;
- c->base.accumBlueBits = pfd.cAccumBlueBits;
- c->base.accumAlphaBits = pfd.cAccumAlphaBits;
- // pfd.cAccumBits;
+ c->base.accumRedBits = pfd.cAccumRedBits;
+ c->base.accumGreenBits = pfd.cAccumGreenBits;
+ c->base.accumBlueBits = pfd.cAccumBlueBits;
+ c->base.accumAlphaBits = pfd.cAccumAlphaBits;
+ // pfd.cAccumBits;
- c->base.depthBits = pfd.cDepthBits;
- c->base.stencilBits = pfd.cStencilBits;
- c->base.numAuxBuffers = pfd.cAuxBuffers;
+ c->base.depthBits = pfd.cDepthBits;
+ c->base.stencilBits = pfd.cStencilBits;
+ c->base.numAuxBuffers = pfd.cAuxBuffers;
- // pfd.iLayerType; // ignored
- c->base.level = 0;
- // pfd.dwLayerMask; // ignored
- // pfd.dwDamageMask; // ignored
+ // pfd.iLayerType; // ignored
+ c->base.level = 0;
+ // pfd.dwLayerMask; // ignored
+ // pfd.dwDamageMask; // ignored
- c->base.pixmapMode = 0;
- c->base.visualID = -1; // will be set by __glXScreenInit()
+ c->base.pixmapMode = 0;
+ c->base.visualID = -1; // will be set by __glXScreenInit()
- /* EXT_visual_rating / GLX 1.2 */
- if (pfd.dwFlags & PFD_GENERIC_FORMAT)
- {
- c->base.visualRating = GLX_SLOW_VISUAL_EXT;
+ /* EXT_visual_rating / GLX 1.2 */
+ if (pfd.dwFlags & PFD_GENERIC_FORMAT) {
+ c->base.visualRating = GLX_SLOW_VISUAL_EXT;
}
- else
- {
- // PFD_GENERIC_ACCELERATED is not considered, so this may be MCD or ICD acclerated...
- c->base.visualRating = GLX_NONE_EXT;
+ else {
+ // PFD_GENERIC_ACCELERATED is not considered, so this may be MCD or ICD acclerated...
+ c->base.visualRating = GLX_NONE_EXT;
}
- /* EXT_visual_info / GLX 1.2 */
- if (pfd.iPixelType == PFD_TYPE_COLORINDEX)
- {
- c->base.visualType = GLX_STATIC_COLOR;
+ /* EXT_visual_info / GLX 1.2 */
+ if (pfd.iPixelType == PFD_TYPE_COLORINDEX) {
+ c->base.visualType = GLX_STATIC_COLOR;
- if (!getenv("GLWIN_ENABLE_COLORINDEX_FBCONFIGS"))
- {
- GLWIN_DEBUG_MSG("pixelFormat %d is PFD_TYPE_COLORINDEX, skipping", i+1);
- continue;
+ if (!getenv("GLWIN_ENABLE_COLORINDEX_FBCONFIGS")) {
+ GLWIN_DEBUG_MSG
+ ("pixelFormat %d is PFD_TYPE_COLORINDEX, skipping", i + 1);
+ continue;
}
}
- else
- {
- c->base.visualType = GLX_TRUE_COLOR;
+ else {
+ c->base.visualType = GLX_TRUE_COLOR;
}
- // pfd.dwVisibleMask; ???
- c->base.transparentPixel = GLX_NONE;
- c->base.transparentRed = GLX_NONE;
- c->base.transparentGreen = GLX_NONE;
- c->base.transparentBlue = GLX_NONE;
- c->base.transparentAlpha = GLX_NONE;
- c->base.transparentIndex = GLX_NONE;
-
- /* ARB_multisample / SGIS_multisample */
- c->base.sampleBuffers = 0;
- c->base.samples = 0;
-
- /* SGIX_fbconfig / GLX 1.3 */
- c->base.drawableType = (((pfd.dwFlags & PFD_DRAW_TO_WINDOW) ? GLX_WINDOW_BIT : 0)
- | ((pfd.dwFlags & PFD_DRAW_TO_BITMAP) ? GLX_PIXMAP_BIT : 0));
-
- if (pfd.iPixelType == PFD_TYPE_COLORINDEX)
- {
- c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
+ // pfd.dwVisibleMask; ???
+ c->base.transparentPixel = GLX_NONE;
+ c->base.transparentRed = GLX_NONE;
+ c->base.transparentGreen = GLX_NONE;
+ c->base.transparentBlue = GLX_NONE;
+ c->base.transparentAlpha = GLX_NONE;
+ c->base.transparentIndex = GLX_NONE;
+
+ /* ARB_multisample / SGIS_multisample */
+ c->base.sampleBuffers = 0;
+ c->base.samples = 0;
+
+ /* SGIX_fbconfig / GLX 1.3 */
+ c->base.drawableType =
+ (((pfd.dwFlags & PFD_DRAW_TO_WINDOW) ? GLX_WINDOW_BIT : 0)
+ | ((pfd.dwFlags & PFD_DRAW_TO_BITMAP) ? GLX_PIXMAP_BIT : 0));
+
+ if (pfd.iPixelType == PFD_TYPE_COLORINDEX) {
+ c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
}
- else
- {
- c->base.renderType = GLX_RGBA_BIT;
+ else {
+ c->base.renderType = GLX_RGBA_BIT;
}
- c->base.xRenderable = GL_TRUE;
- c->base.fbconfigID = -1; // will be set by __glXScreenInit()
+ c->base.xRenderable = GL_TRUE;
+ c->base.fbconfigID = -1; // will be set by __glXScreenInit()
- /* SGIX_pbuffer / GLX 1.3 */
- // XXX: How can we find these values out ???
- c->base.maxPbufferWidth = -1;
- c->base.maxPbufferHeight = -1;
- c->base.maxPbufferPixels = -1;
- c->base.optimalPbufferWidth = 0; // there is no optimal value
- c->base.optimalPbufferHeight = 0;
+ /* SGIX_pbuffer / GLX 1.3 */
+ // XXX: How can we find these values out ???
+ c->base.maxPbufferWidth = -1;
+ c->base.maxPbufferHeight = -1;
+ c->base.maxPbufferPixels = -1;
+ c->base.optimalPbufferWidth = 0; // there is no optimal value
+ c->base.optimalPbufferHeight = 0;
- /* SGIX_visual_select_group */
- // arrange for visuals with the best acceleration to be preferred in selection
- switch (pfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED))
- {
+ /* SGIX_visual_select_group */
+ // arrange for visuals with the best acceleration to be preferred in selection
+ switch (pfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED)) {
case 0:
- c->base.visualSelectGroup = 2;
- break;
+ c->base.visualSelectGroup = 2;
+ break;
case PFD_GENERIC_ACCELERATED:
- c->base.visualSelectGroup = 1;
- break;
+ c->base.visualSelectGroup = 1;
+ break;
case PFD_GENERIC_FORMAT:
- c->base.visualSelectGroup = 0;
- break;
+ c->base.visualSelectGroup = 0;
+ break;
default:
- ;
- // "can't happen"
+ ;
+ // "can't happen"
}
- /* OML_swap_method */
- if (pfd.dwFlags & PFD_SWAP_EXCHANGE)
- c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
- else if (pfd.dwFlags & PFD_SWAP_COPY)
- c->base.swapMethod = GLX_SWAP_COPY_OML;
- else
- c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
+ /* OML_swap_method */
+ if (pfd.dwFlags & PFD_SWAP_EXCHANGE)
+ c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
+ else if (pfd.dwFlags & PFD_SWAP_COPY)
+ c->base.swapMethod = GLX_SWAP_COPY_OML;
+ else
+ c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
- /* EXT_import_context */
- c->base.screen = screen->base.pScreen->myNum;
+ /* EXT_import_context */
+ c->base.screen = screen->base.pScreen->myNum;
- /* EXT_texture_from_pixmap */
- c->base.bindToTextureRgb = -1;
- c->base.bindToTextureRgba = -1;
- c->base.bindToMipmapTexture = -1;
- c->base.bindToTextureTargets = -1;
- c->base.yInverted = -1;
+ /* EXT_texture_from_pixmap */
+ c->base.bindToTextureRgb = -1;
+ c->base.bindToTextureRgba = -1;
+ c->base.bindToMipmapTexture = -1;
+ c->base.bindToTextureTargets = -1;
+ c->base.yInverted = -1;
- n++;
+ n++;
- // update previous config to point to this config
- if (prev)
- prev->base.next = &(c->base);
+ // update previous config to point to this config
+ if (prev)
+ prev->base.next = &(c->base);
- prev = c;
+ prev = c;
}
- GLWIN_DEBUG_MSG("found %d pixelFormats suitable for conversion to fbConfigs", n);
+ GLWIN_DEBUG_MSG
+ ("found %d pixelFormats suitable for conversion to fbConfigs", n);
- screen->base.numFBConfigs = n;
- screen->base.fbconfigs = &(result->base);
+ screen->base.numFBConfigs = n;
+ screen->base.fbconfigs = &(result->base);
}
// helper function to access an attribute value from an attribute value array by attribute
static
-int getAttrValue(const int attrs[], int values[], unsigned int num, int attr, int fallback)
+ int
+getAttrValue(const int attrs[], int values[], unsigned int num, int attr,
+ int fallback)
{
- unsigned int i;
- for (i = 0; i < num; i++)
- {
- if (attrs[i] == attr)
- {
- GLWIN_TRACE_MSG("getAttrValue attr 0x%x, value %d", attr, values[i]);
- return values[i];
+ unsigned int i;
+
+ for (i = 0; i < num; i++) {
+ if (attrs[i] == attr) {
+ GLWIN_TRACE_MSG("getAttrValue attr 0x%x, value %d", attr,
+ values[i]);
+ return values[i];
}
}
- ErrorF("getAttrValue failed to find attr 0x%x, using default value %d\n", attr, fallback);
- return fallback;
+ ErrorF("getAttrValue failed to find attr 0x%x, using default value %d\n",
+ attr, fallback);
+ return fallback;
}
//
// Create the GLXconfigs using wglGetPixelFormatAttribfvARB() extension
//
static void
-glxWinCreateConfigsExt(HDC hdc, glxWinScreen *screen)
+glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)
{
- GLXWinConfig *c, *result, *prev = NULL;
- int i = 0;
- int n = 0;
+ GLXWinConfig *c, *result, *prev = NULL;
+ int i = 0;
+ int n = 0;
- const int attr = WGL_NUMBER_PIXEL_FORMATS_ARB;
- int numConfigs;
+ const int attr = WGL_NUMBER_PIXEL_FORMATS_ARB;
+ int numConfigs;
- int attrs[50];
- unsigned int num_attrs = 0;
+ int attrs[50];
+ unsigned int num_attrs = 0;
- GLWIN_DEBUG_MSG("glxWinCreateConfigsExt");
+ GLWIN_DEBUG_MSG("glxWinCreateConfigsExt");
- screen->base.numFBConfigs = 0;
- screen->base.fbconfigs = NULL;
+ screen->base.numFBConfigs = 0;
+ screen->base.fbconfigs = NULL;
- if (!wglGetPixelFormatAttribivARBWrapper(hdc, 0, 0, 1, &attr, &numConfigs))
- {
- ErrorF("wglGetPixelFormatAttribivARB failed for WGL_NUMBER_PIXEL_FORMATS_ARB: %s\n", glxWinErrorMessage());
- return;
+ if (!wglGetPixelFormatAttribivARBWrapper(hdc, 0, 0, 1, &attr, &numConfigs)) {
+ ErrorF
+ ("wglGetPixelFormatAttribivARB failed for WGL_NUMBER_PIXEL_FORMATS_ARB: %s\n",
+ glxWinErrorMessage());
+ return;
}
- GLWIN_DEBUG_MSG("wglGetPixelFormatAttribivARB says %d possible pixel formats", numConfigs);
+ GLWIN_DEBUG_MSG
+ ("wglGetPixelFormatAttribivARB says %d possible pixel formats",
+ numConfigs);
- /* alloc */
- result = malloc(sizeof(GLXWinConfig) * numConfigs);
+ /* alloc */
+ result = malloc(sizeof(GLXWinConfig) * numConfigs);
- if (NULL == result)
- {
- return;
+ if (NULL == result) {
+ return;
}
- memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
- n = 0;
+ memset(result, 0, sizeof(GLXWinConfig) * numConfigs);
+ n = 0;
#define ADD_ATTR(a) { attrs[num_attrs++] = a; assert(num_attrs < NUM_ELEMENTS(attrs)); }
- ADD_ATTR(WGL_DRAW_TO_WINDOW_ARB);
- ADD_ATTR(WGL_DRAW_TO_BITMAP_ARB);
- ADD_ATTR(WGL_ACCELERATION_ARB);
- ADD_ATTR(WGL_SWAP_LAYER_BUFFERS_ARB);
- ADD_ATTR(WGL_NUMBER_OVERLAYS_ARB);
- ADD_ATTR(WGL_NUMBER_UNDERLAYS_ARB);
- ADD_ATTR(WGL_TRANSPARENT_ARB);
- ADD_ATTR(WGL_TRANSPARENT_RED_VALUE_ARB);
- ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
- ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
- ADD_ATTR(WGL_TRANSPARENT_ALPHA_VALUE_ARB);
- ADD_ATTR(WGL_SUPPORT_OPENGL_ARB);
- ADD_ATTR(WGL_DOUBLE_BUFFER_ARB);
- ADD_ATTR(WGL_STEREO_ARB);
- ADD_ATTR(WGL_PIXEL_TYPE_ARB);
- ADD_ATTR(WGL_COLOR_BITS_ARB);
- ADD_ATTR(WGL_RED_BITS_ARB);
- ADD_ATTR(WGL_RED_SHIFT_ARB);
- ADD_ATTR(WGL_GREEN_BITS_ARB);
- ADD_ATTR(WGL_GREEN_SHIFT_ARB);
- ADD_ATTR(WGL_BLUE_BITS_ARB);
- ADD_ATTR(WGL_BLUE_SHIFT_ARB);
- ADD_ATTR(WGL_ALPHA_BITS_ARB);
- ADD_ATTR(WGL_ALPHA_SHIFT_ARB);
- ADD_ATTR(WGL_ACCUM_RED_BITS_ARB);
- ADD_ATTR(WGL_ACCUM_GREEN_BITS_ARB);
- ADD_ATTR(WGL_ACCUM_BLUE_BITS_ARB);
- ADD_ATTR(WGL_ACCUM_ALPHA_BITS_ARB);
- ADD_ATTR(WGL_DEPTH_BITS_ARB);
- ADD_ATTR(WGL_STENCIL_BITS_ARB);
- ADD_ATTR(WGL_AUX_BUFFERS_ARB);
- ADD_ATTR(WGL_SWAP_METHOD_ARB);
-
- if (screen->has_WGL_ARB_multisample)
- {
- // we may not query these attrs if WGL_ARB_multisample is not offered
- ADD_ATTR(WGL_SAMPLE_BUFFERS_ARB);
- ADD_ATTR(WGL_SAMPLES_ARB);
+ ADD_ATTR(WGL_DRAW_TO_WINDOW_ARB);
+ ADD_ATTR(WGL_DRAW_TO_BITMAP_ARB);
+ ADD_ATTR(WGL_ACCELERATION_ARB);
+ ADD_ATTR(WGL_SWAP_LAYER_BUFFERS_ARB);
+ ADD_ATTR(WGL_NUMBER_OVERLAYS_ARB);
+ ADD_ATTR(WGL_NUMBER_UNDERLAYS_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_RED_VALUE_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_GREEN_VALUE_ARB);
+ ADD_ATTR(WGL_TRANSPARENT_ALPHA_VALUE_ARB);
+ ADD_ATTR(WGL_SUPPORT_OPENGL_ARB);
+ ADD_ATTR(WGL_DOUBLE_BUFFER_ARB);
+ ADD_ATTR(WGL_STEREO_ARB);
+ ADD_ATTR(WGL_PIXEL_TYPE_ARB);
+ ADD_ATTR(WGL_COLOR_BITS_ARB);
+ ADD_ATTR(WGL_RED_BITS_ARB);
+ ADD_ATTR(WGL_RED_SHIFT_ARB);
+ ADD_ATTR(WGL_GREEN_BITS_ARB);
+ ADD_ATTR(WGL_GREEN_SHIFT_ARB);
+ ADD_ATTR(WGL_BLUE_BITS_ARB);
+ ADD_ATTR(WGL_BLUE_SHIFT_ARB);
+ ADD_ATTR(WGL_ALPHA_BITS_ARB);
+ ADD_ATTR(WGL_ALPHA_SHIFT_ARB);
+ ADD_ATTR(WGL_ACCUM_RED_BITS_ARB);
+ ADD_ATTR(WGL_ACCUM_GREEN_BITS_ARB);
+ ADD_ATTR(WGL_ACCUM_BLUE_BITS_ARB);
+ ADD_ATTR(WGL_ACCUM_ALPHA_BITS_ARB);
+ ADD_ATTR(WGL_DEPTH_BITS_ARB);
+ ADD_ATTR(WGL_STENCIL_BITS_ARB);
+ ADD_ATTR(WGL_AUX_BUFFERS_ARB);
+ ADD_ATTR(WGL_SWAP_METHOD_ARB);
+
+ if (screen->has_WGL_ARB_multisample) {
+ // we may not query these attrs if WGL_ARB_multisample is not offered
+ ADD_ATTR(WGL_SAMPLE_BUFFERS_ARB);
+ ADD_ATTR(WGL_SAMPLES_ARB);
}
- if (screen->has_WGL_ARB_render_texture)
- {
- // we may not query these attrs if WGL_ARB_render_texture is not offered
- ADD_ATTR(WGL_BIND_TO_TEXTURE_RGB_ARB);
- ADD_ATTR(WGL_BIND_TO_TEXTURE_RGBA_ARB);
+ if (screen->has_WGL_ARB_render_texture) {
+ // we may not query these attrs if WGL_ARB_render_texture is not offered
+ ADD_ATTR(WGL_BIND_TO_TEXTURE_RGB_ARB);
+ ADD_ATTR(WGL_BIND_TO_TEXTURE_RGBA_ARB);
}
- if (screen->has_WGL_ARB_pbuffer)
- {
- // we may not query these attrs if WGL_ARB_pbuffer is not offered
- ADD_ATTR(WGL_DRAW_TO_PBUFFER_ARB);
- ADD_ATTR(WGL_MAX_PBUFFER_PIXELS_ARB);
- ADD_ATTR(WGL_MAX_PBUFFER_WIDTH_ARB);
- ADD_ATTR(WGL_MAX_PBUFFER_HEIGHT_ARB);
+ if (screen->has_WGL_ARB_pbuffer) {
+ // we may not query these attrs if WGL_ARB_pbuffer is not offered
+ ADD_ATTR(WGL_DRAW_TO_PBUFFER_ARB);
+ ADD_ATTR(WGL_MAX_PBUFFER_PIXELS_ARB);
+ ADD_ATTR(WGL_MAX_PBUFFER_WIDTH_ARB);
+ ADD_ATTR(WGL_MAX_PBUFFER_HEIGHT_ARB);
}
- /* fill in configs */
- for (i = 0; i < numConfigs; i++)
- {
- int values[num_attrs];
+ /* fill in configs */
+ for (i = 0; i < numConfigs; i++) {
+ int values[num_attrs];
- c = &(result[i]);
- c->base.next = NULL;
- c->pixelFormatIndex = i+1;
+ c = &(result[i]);
+ c->base.next = NULL;
+ c->pixelFormatIndex = i + 1;
- if (!wglGetPixelFormatAttribivARBWrapper(hdc, i+1, 0, num_attrs, attrs, values))
- {
- ErrorF("wglGetPixelFormatAttribivARB failed for index %d, error %s\n", i+1, glxWinErrorMessage());
- break;
+ if (!wglGetPixelFormatAttribivARBWrapper
+ (hdc, i + 1, 0, num_attrs, attrs, values)) {
+ ErrorF
+ ("wglGetPixelFormatAttribivARB failed for index %d, error %s\n",
+ i + 1, glxWinErrorMessage());
+ break;
}
#define ATTR_VALUE(a, d) getAttrValue(attrs, values, num_attrs, (a), (d))
- if (!ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, 0))
- {
- GLWIN_DEBUG_MSG("pixelFormat %d isn't WGL_SUPPORT_OPENGL_ARB, skipping", i+1);
- continue;
+ if (!ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, 0)) {
+ GLWIN_DEBUG_MSG
+ ("pixelFormat %d isn't WGL_SUPPORT_OPENGL_ARB, skipping",
+ i + 1);
+ continue;
}
- c->base.doubleBufferMode = ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, 0) ? GL_TRUE : GL_FALSE;
- c->base.stereoMode = ATTR_VALUE(WGL_STEREO_ARB, 0) ? GL_TRUE : GL_FALSE;
-
- c->base.redBits = ATTR_VALUE(WGL_RED_BITS_ARB, 0);
- c->base.greenBits = ATTR_VALUE(WGL_GREEN_BITS_ARB, 0);
- c->base.blueBits = ATTR_VALUE(WGL_BLUE_BITS_ARB, 0);
- c->base.alphaBits = ATTR_VALUE(WGL_ALPHA_BITS_ARB, 0);
-
- c->base.redMask = BITS_AND_SHIFT_TO_MASK(c->base.redBits, ATTR_VALUE(WGL_RED_SHIFT_ARB, 0));
- c->base.greenMask = BITS_AND_SHIFT_TO_MASK(c->base.greenBits, ATTR_VALUE(WGL_GREEN_SHIFT_ARB, 0));
- c->base.blueMask = BITS_AND_SHIFT_TO_MASK(c->base.blueBits, ATTR_VALUE(WGL_BLUE_SHIFT_ARB, 0));
- c->base.alphaMask = BITS_AND_SHIFT_TO_MASK(c->base.alphaBits, ATTR_VALUE(WGL_ALPHA_SHIFT_ARB, 0));
-
- switch (ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0))
- {
+ c->base.doubleBufferMode =
+ ATTR_VALUE(WGL_DOUBLE_BUFFER_ARB, 0) ? GL_TRUE : GL_FALSE;
+ c->base.stereoMode = ATTR_VALUE(WGL_STEREO_ARB, 0) ? GL_TRUE : GL_FALSE;
+
+ c->base.redBits = ATTR_VALUE(WGL_RED_BITS_ARB, 0);
+ c->base.greenBits = ATTR_VALUE(WGL_GREEN_BITS_ARB, 0);
+ c->base.blueBits = ATTR_VALUE(WGL_BLUE_BITS_ARB, 0);
+ c->base.alphaBits = ATTR_VALUE(WGL_ALPHA_BITS_ARB, 0);
+
+ c->base.redMask =
+ BITS_AND_SHIFT_TO_MASK(c->base.redBits,
+ ATTR_VALUE(WGL_RED_SHIFT_ARB, 0));
+ c->base.greenMask =
+ BITS_AND_SHIFT_TO_MASK(c->base.greenBits,
+ ATTR_VALUE(WGL_GREEN_SHIFT_ARB, 0));
+ c->base.blueMask =
+ BITS_AND_SHIFT_TO_MASK(c->base.blueBits,
+ ATTR_VALUE(WGL_BLUE_SHIFT_ARB, 0));
+ c->base.alphaMask =
+ BITS_AND_SHIFT_TO_MASK(c->base.alphaBits,
+ ATTR_VALUE(WGL_ALPHA_SHIFT_ARB, 0));
+
+ switch (ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0)) {
case WGL_TYPE_COLORINDEX_ARB:
- c->base.indexBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
- c->base.rgbBits = 0;
- c->base.visualType = GLX_STATIC_COLOR;
-
- if (!getenv("GLWIN_ENABLE_COLORINDEX_FBCONFIGS"))
- {
- GLWIN_DEBUG_MSG("pixelFormat %d is WGL_TYPE_COLORINDEX_ARB, skipping", i+1);
- continue;
+ c->base.indexBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
+ c->base.rgbBits = 0;
+ c->base.visualType = GLX_STATIC_COLOR;
+
+ if (!getenv("GLWIN_ENABLE_COLORINDEX_FBCONFIGS")) {
+ GLWIN_DEBUG_MSG
+ ("pixelFormat %d is WGL_TYPE_COLORINDEX_ARB, skipping",
+ i + 1);
+ continue;
}
- break;
+ break;
case WGL_TYPE_RGBA_FLOAT_ARB:
- GLWIN_DEBUG_MSG("pixelFormat %d is WGL_TYPE_RGBA_FLOAT_ARB, skipping", i+1);
- continue;
+ GLWIN_DEBUG_MSG
+ ("pixelFormat %d is WGL_TYPE_RGBA_FLOAT_ARB, skipping", i + 1);
+ continue;
case WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT:
- GLWIN_DEBUG_MSG("pixelFormat %d is WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT, skipping", i+1);
- continue;
+ GLWIN_DEBUG_MSG
+ ("pixelFormat %d is WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT, skipping",
+ i + 1);
+ continue;
case WGL_TYPE_RGBA_ARB:
- c->base.indexBits = 0;
- c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
- c->base.visualType = GLX_TRUE_COLOR;
- break;
+ c->base.indexBits = 0;
+ c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0);
+ c->base.visualType = GLX_TRUE_COLOR;
+ break;
default:
- ErrorF("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_PIXEL_TYPE_ARB\n", ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0));
- continue;
+ ErrorF
+ ("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_PIXEL_TYPE_ARB\n",
+ ATTR_VALUE(WGL_PIXEL_TYPE_ARB, 0));
+ continue;
}
- c->base.accumRedBits = ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, 0);
- c->base.accumGreenBits = ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, 0);
- c->base.accumBlueBits = ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, 0);
- c->base.accumAlphaBits = ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, 0);
+ c->base.accumRedBits = ATTR_VALUE(WGL_ACCUM_RED_BITS_ARB, 0);
+ c->base.accumGreenBits = ATTR_VALUE(WGL_ACCUM_GREEN_BITS_ARB, 0);
+ c->base.accumBlueBits = ATTR_VALUE(WGL_ACCUM_BLUE_BITS_ARB, 0);
+ c->base.accumAlphaBits = ATTR_VALUE(WGL_ACCUM_ALPHA_BITS_ARB, 0);
- c->base.depthBits = ATTR_VALUE(WGL_DEPTH_BITS_ARB, 0);
- c->base.stencilBits = ATTR_VALUE(WGL_STENCIL_BITS_ARB, 0);
- c->base.numAuxBuffers = ATTR_VALUE(WGL_AUX_BUFFERS_ARB, 0);
+ c->base.depthBits = ATTR_VALUE(WGL_DEPTH_BITS_ARB, 0);
+ c->base.stencilBits = ATTR_VALUE(WGL_STENCIL_BITS_ARB, 0);
+ c->base.numAuxBuffers = ATTR_VALUE(WGL_AUX_BUFFERS_ARB, 0);
- {
- int layers = ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB,0) + ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0);
+ {
+ int layers =
+ ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB,
+ 0) + ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0);
- if (layers > 0)
- {
- ErrorF("pixelFormat %d: has %d overlay, %d underlays which aren't currently handled", i, ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB,0), ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0));
- // XXX: need to iterate over layers?
- }
- }
- c->base.level = 0;
+ if (layers > 0) {
+ ErrorF
+ ("pixelFormat %d: has %d overlay, %d underlays which aren't currently handled",
+ i, ATTR_VALUE(WGL_NUMBER_OVERLAYS_ARB, 0),
+ ATTR_VALUE(WGL_NUMBER_UNDERLAYS_ARB, 0));
+ // XXX: need to iterate over layers?
+ }
+ }
+ c->base.level = 0;
- c->base.pixmapMode = 0; // ???
- c->base.visualID = -1; // will be set by __glXScreenInit()
+ c->base.pixmapMode = 0; // ???
+ c->base.visualID = -1; // will be set by __glXScreenInit()
- /* EXT_visual_rating / GLX 1.2 */
- switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0))
- {
+ /* EXT_visual_rating / GLX 1.2 */
+ switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0)) {
default:
- ErrorF("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_ACCELERATION_ARB\n", ATTR_VALUE(WGL_ACCELERATION_ARB, 0));
+ ErrorF
+ ("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_ACCELERATION_ARB\n",
+ ATTR_VALUE(WGL_ACCELERATION_ARB, 0));
case WGL_NO_ACCELERATION_ARB:
- c->base.visualRating = GLX_SLOW_VISUAL_EXT;
- break;
+ c->base.visualRating = GLX_SLOW_VISUAL_EXT;
+ break;
case WGL_GENERIC_ACCELERATION_ARB:
case WGL_FULL_ACCELERATION_ARB:
- c->base.visualRating = GLX_NONE_EXT;
- break;
+ c->base.visualRating = GLX_NONE_EXT;
+ break;
}
- /* EXT_visual_info / GLX 1.2 */
- // c->base.visualType is set above
- if (ATTR_VALUE(WGL_TRANSPARENT_ARB, 0))
- {
- c->base.transparentPixel = (c->base.visualType == GLX_TRUE_COLOR) ? GLX_TRANSPARENT_RGB_EXT : GLX_TRANSPARENT_INDEX_EXT;
- c->base.transparentRed = ATTR_VALUE(WGL_TRANSPARENT_RED_VALUE_ARB, 0);
- c->base.transparentGreen = ATTR_VALUE(WGL_TRANSPARENT_GREEN_VALUE_ARB, 0);
- c->base.transparentBlue = ATTR_VALUE(WGL_TRANSPARENT_BLUE_VALUE_ARB, 0);
- c->base.transparentAlpha = ATTR_VALUE(WGL_TRANSPARENT_ALPHA_VALUE_ARB, 0);
- c->base.transparentIndex = ATTR_VALUE(WGL_TRANSPARENT_INDEX_VALUE_ARB, 0);
- }
- else
- {
- c->base.transparentPixel = GLX_NONE_EXT;
- c->base.transparentRed = GLX_NONE;
- c->base.transparentGreen = GLX_NONE;
- c->base.transparentBlue = GLX_NONE;
- c->base.transparentAlpha = GLX_NONE;
- c->base.transparentIndex = GLX_NONE;
+ /* EXT_visual_info / GLX 1.2 */
+ // c->base.visualType is set above
+ if (ATTR_VALUE(WGL_TRANSPARENT_ARB, 0)) {
+ c->base.transparentPixel =
+ (c->base.visualType ==
+ GLX_TRUE_COLOR) ? GLX_TRANSPARENT_RGB_EXT :
+ GLX_TRANSPARENT_INDEX_EXT;
+ c->base.transparentRed =
+ ATTR_VALUE(WGL_TRANSPARENT_RED_VALUE_ARB, 0);
+ c->base.transparentGreen =
+ ATTR_VALUE(WGL_TRANSPARENT_GREEN_VALUE_ARB, 0);
+ c->base.transparentBlue =
+ ATTR_VALUE(WGL_TRANSPARENT_BLUE_VALUE_ARB, 0);
+ c->base.transparentAlpha =
+ ATTR_VALUE(WGL_TRANSPARENT_ALPHA_VALUE_ARB, 0);
+ c->base.transparentIndex =
+ ATTR_VALUE(WGL_TRANSPARENT_INDEX_VALUE_ARB, 0);
+ }
+ else {
+ c->base.transparentPixel = GLX_NONE_EXT;
+ c->base.transparentRed = GLX_NONE;
+ c->base.transparentGreen = GLX_NONE;
+ c->base.transparentBlue = GLX_NONE;
+ c->base.transparentAlpha = GLX_NONE;
+ c->base.transparentIndex = GLX_NONE;
}
- /* ARB_multisample / SGIS_multisample */
- if (screen->has_WGL_ARB_multisample)
- {
- c->base.sampleBuffers = ATTR_VALUE(WGL_SAMPLE_BUFFERS_ARB, 0);
- c->base.samples = ATTR_VALUE(WGL_SAMPLES_ARB, 0);
+ /* ARB_multisample / SGIS_multisample */
+ if (screen->has_WGL_ARB_multisample) {
+ c->base.sampleBuffers = ATTR_VALUE(WGL_SAMPLE_BUFFERS_ARB, 0);
+ c->base.samples = ATTR_VALUE(WGL_SAMPLES_ARB, 0);
}
- else
- {
- c->base.sampleBuffers = 0;
- c->base.samples = 0;
+ else {
+ c->base.sampleBuffers = 0;
+ c->base.samples = 0;
}
- /* SGIX_fbconfig / GLX 1.3 */
- c->base.drawableType = ((ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, 0) ? GLX_WINDOW_BIT : 0)
- | (ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, 0) ? GLX_PIXMAP_BIT : 0)
- | (ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, 0) ? GLX_PBUFFER_BIT : 0));
-
- /*
- Assume OpenGL RGBA rendering is available on all visuals
- (it is specified to render to red component in single-channel visuals,
- if supported, but there doesn't seem to be any mechanism to check if it
- is supported)
-
- Color index rendering is only supported on single-channel visuals
- */
- if (c->base.visualType == GLX_STATIC_COLOR)
- {
- c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
+ /* SGIX_fbconfig / GLX 1.3 */
+ c->base.drawableType =
+ ((ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, 0) ? GLX_WINDOW_BIT : 0)
+ | (ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, 0) ? GLX_PIXMAP_BIT : 0)
+ | (ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, 0) ? GLX_PBUFFER_BIT : 0));
+
+ /*
+ Assume OpenGL RGBA rendering is available on all visuals
+ (it is specified to render to red component in single-channel visuals,
+ if supported, but there doesn't seem to be any mechanism to check if it
+ is supported)
+
+ Color index rendering is only supported on single-channel visuals
+ */
+ if (c->base.visualType == GLX_STATIC_COLOR) {
+ c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT;
}
- else
- {
- c->base.renderType = GLX_RGBA_BIT;
+ else {
+ c->base.renderType = GLX_RGBA_BIT;
}
- c->base.xRenderable = GL_TRUE;
- c->base.fbconfigID = -1; // will be set by __glXScreenInit()
+ c->base.xRenderable = GL_TRUE;
+ c->base.fbconfigID = -1; // will be set by __glXScreenInit()
- /* SGIX_pbuffer / GLX 1.3 */
- if (screen->has_WGL_ARB_pbuffer)
- {
- c->base.maxPbufferWidth = ATTR_VALUE(WGL_MAX_PBUFFER_WIDTH_ARB, -1);
- c->base.maxPbufferHeight = ATTR_VALUE(WGL_MAX_PBUFFER_HEIGHT_ARB, -1);
- c->base.maxPbufferPixels = ATTR_VALUE(WGL_MAX_PBUFFER_PIXELS_ARB, -1);
+ /* SGIX_pbuffer / GLX 1.3 */
+ if (screen->has_WGL_ARB_pbuffer) {
+ c->base.maxPbufferWidth = ATTR_VALUE(WGL_MAX_PBUFFER_WIDTH_ARB, -1);
+ c->base.maxPbufferHeight =
+ ATTR_VALUE(WGL_MAX_PBUFFER_HEIGHT_ARB, -1);
+ c->base.maxPbufferPixels =
+ ATTR_VALUE(WGL_MAX_PBUFFER_PIXELS_ARB, -1);
}
- else
- {
- c->base.maxPbufferWidth = -1;
- c->base.maxPbufferHeight = -1;
- c->base.maxPbufferPixels = -1;
+ else {
+ c->base.maxPbufferWidth = -1;
+ c->base.maxPbufferHeight = -1;
+ c->base.maxPbufferPixels = -1;
}
- c->base.optimalPbufferWidth = 0; // there is no optimal value
- c->base.optimalPbufferHeight = 0;
+ c->base.optimalPbufferWidth = 0; // there is no optimal value
+ c->base.optimalPbufferHeight = 0;
- /* SGIX_visual_select_group */
- // arrange for visuals with the best acceleration to be preferred in selection
- switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0))
- {
+ /* SGIX_visual_select_group */
+ // arrange for visuals with the best acceleration to be preferred in selection
+ switch (ATTR_VALUE(WGL_ACCELERATION_ARB, 0)) {
case WGL_FULL_ACCELERATION_ARB:
- c->base.visualSelectGroup = 2;
- break;
+ c->base.visualSelectGroup = 2;
+ break;
case WGL_GENERIC_ACCELERATION_ARB:
- c->base.visualSelectGroup = 1;
- break;
+ c->base.visualSelectGroup = 1;
+ break;
default:
case WGL_NO_ACCELERATION_ARB:
- c->base.visualSelectGroup = 0;
- break;
+ c->base.visualSelectGroup = 0;
+ break;
}
- /* OML_swap_method */
- switch (ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0))
- {
+ /* OML_swap_method */
+ switch (ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0)) {
case WGL_SWAP_EXCHANGE_ARB:
- c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
- break;
+ c->base.swapMethod = GLX_SWAP_EXCHANGE_OML;
+ break;
case WGL_SWAP_COPY_ARB:
- c->base.swapMethod = GLX_SWAP_COPY_OML;
- break;
+ c->base.swapMethod = GLX_SWAP_COPY_OML;
+ break;
default:
- ErrorF("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_SWAP_METHOD_ARB\n", ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0));
+ ErrorF
+ ("wglGetPixelFormatAttribivARB returned unknown value 0x%x for WGL_SWAP_METHOD_ARB\n",
+ ATTR_VALUE(WGL_SWAP_METHOD_ARB, 0));
case WGL_SWAP_UNDEFINED_ARB:
- c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
+ c->base.swapMethod = GLX_SWAP_UNDEFINED_OML;
}
- /* EXT_import_context */
- c->base.screen = screen->base.pScreen->myNum;
-
- /* EXT_texture_from_pixmap */
- /*
- Mesa's DRI configs always have bindToTextureRgb/Rgba TRUE (see driCreateConfigs(), so setting
- bindToTextureRgb/bindToTextureRgba to FALSE means that swrast can't find any fbConfigs to use,
- so setting these to 0, even if we know bindToTexture isn't available, isn't a good idea...
- */
- if (screen->has_WGL_ARB_render_texture)
- {
- c->base.bindToTextureRgb = ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGB_ARB, -1);
- c->base.bindToTextureRgba = ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGBA_ARB, -1);
+ /* EXT_import_context */
+ c->base.screen = screen->base.pScreen->myNum;
+
+ /* EXT_texture_from_pixmap */
+ /*
+ Mesa's DRI configs always have bindToTextureRgb/Rgba TRUE (see driCreateConfigs(), so setting
+ bindToTextureRgb/bindToTextureRgba to FALSE means that swrast can't find any fbConfigs to use,
+ so setting these to 0, even if we know bindToTexture isn't available, isn't a good idea...
+ */
+ if (screen->has_WGL_ARB_render_texture) {
+ c->base.bindToTextureRgb =
+ ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGB_ARB, -1);
+ c->base.bindToTextureRgba =
+ ATTR_VALUE(WGL_BIND_TO_TEXTURE_RGBA_ARB, -1);
}
- else
- {
- c->base.bindToTextureRgb = -1;
- c->base.bindToTextureRgba = -1;
+ else {
+ c->base.bindToTextureRgb = -1;
+ c->base.bindToTextureRgba = -1;
}
- c->base.bindToMipmapTexture = -1;
- c->base.bindToTextureTargets = GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT | GLX_TEXTURE_RECTANGLE_BIT_EXT;
- c->base.yInverted = -1;
+ c->base.bindToMipmapTexture = -1;
+ c->base.bindToTextureTargets =
+ GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
+ GLX_TEXTURE_RECTANGLE_BIT_EXT;
+ c->base.yInverted = -1;
- n++;
+ n++;
- // update previous config to point to this config
- if (prev)
- prev->base.next = &(c->base);
+ // update previous config to point to this config
+ if (prev)
+ prev->base.next = &(c->base);
- prev = c;
+ prev = c;
}
- screen->base.numFBConfigs = n;
- screen->base.fbconfigs = &(result->base);
+ screen->base.numFBConfigs = n;
+ screen->base.fbconfigs = &(result->base);
}
diff --git a/xorg-server/hw/xwin/glx/wgl_ext_api.h b/xorg-server/hw/xwin/glx/wgl_ext_api.h
index 3c8a5eb0f..b7231eb13 100644
--- a/xorg-server/hw/xwin/glx/wgl_ext_api.h
+++ b/xorg-server/hw/xwin/glx/wgl_ext_api.h
@@ -1,87 +1,83 @@
-/*
- * File: wgl_ext_api.h
- * Purpose: Wrapper functions for Win32 OpenGL wgl extension functions
- *
- * Authors: Jon TURNEY
- *
- * Copyright (c) Jon TURNEY 2009
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef wgl_ext_api_h
-#define wgl_ext_api_h
-
-#include <GL/wglext.h>
-
-void wglResolveExtensionProcs(void);
-
-/*
- Prototypes for wrapper functions we actually use
- XXX: should be automatically generated as well
-*/
-
-const char *wglGetExtensionsStringARBWrapper(HDC hdc);
-BOOL wglMakeContextCurrentARBWrapper(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
-HDC wglGetCurrentReadDCARBWrapper(VOID);
-
-BOOL wglGetPixelFormatAttribivARBWrapper(HDC hdc,
- int iPixelFormat,
- int iLayerPlane,
- UINT nAttributes,
- const int *piAttributes,
- int *piValues);
-
-BOOL wglGetPixelFormatAttribfvARBWrapper(HDC hdc,
- int iPixelFormat,
- int iLayerPlane,
- UINT nAttributes,
- const int *piAttributes,
- FLOAT *pfValues);
-
-BOOL wglChoosePixelFormatARBWrapper(HDC hdc,
- const int *piAttribIList,
- const FLOAT *pfAttribFList,
- UINT nMaxFormats,
- int *piFormats,
- UINT *nNumFormats);
-
-HPBUFFERARB wglCreatePbufferARBWrapper(HDC hDC,
- int iPixelFormat,
- int iWidth,
- int iHeight,
- const int *piAttribList);
-
-HDC wglGetPbufferDCARBWrapper(HPBUFFERARB hPbuffer);
-
-int wglReleasePbufferDCARBWrapper(HPBUFFERARB hPbuffer,
- HDC hDC);
-
-BOOL wglDestroyPbufferARBWrapper(HPBUFFERARB hPbuffer);
-
-BOOL wglQueryPbufferARBWrapper(HPBUFFERARB hPbuffer,
- int iAttribute,
- int *piValue);
-
-BOOL wglSwapIntervalEXTWrapper(int interval);
-
-int wglGetSwapIntervalEXTWrapper(void);
-
-#endif /* wgl_ext_api_h */
+/*
+ * File: wgl_ext_api.h
+ * Purpose: Wrapper functions for Win32 OpenGL wgl extension functions
+ *
+ * Authors: Jon TURNEY
+ *
+ * Copyright (c) Jon TURNEY 2009
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef wgl_ext_api_h
+#define wgl_ext_api_h
+
+#include <GL/wglext.h>
+
+void wglResolveExtensionProcs(void);
+
+/*
+ Prototypes for wrapper functions we actually use
+ XXX: should be automatically generated as well
+*/
+
+const char *wglGetExtensionsStringARBWrapper(HDC hdc);
+BOOL wglMakeContextCurrentARBWrapper(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+HDC wglGetCurrentReadDCARBWrapper(VOID);
+
+BOOL wglGetPixelFormatAttribivARBWrapper(HDC hdc,
+ int iPixelFormat,
+ int iLayerPlane,
+ UINT nAttributes,
+ const int *piAttributes,
+ int *piValues);
+
+BOOL wglGetPixelFormatAttribfvARBWrapper(HDC hdc,
+ int iPixelFormat,
+ int iLayerPlane,
+ UINT nAttributes,
+ const int *piAttributes,
+ FLOAT * pfValues);
+
+BOOL wglChoosePixelFormatARBWrapper(HDC hdc,
+ const int *piAttribIList,
+ const FLOAT * pfAttribFList,
+ UINT nMaxFormats,
+ int *piFormats, UINT * nNumFormats);
+
+HPBUFFERARB wglCreatePbufferARBWrapper(HDC hDC,
+ int iPixelFormat,
+ int iWidth,
+ int iHeight, const int *piAttribList);
+
+HDC wglGetPbufferDCARBWrapper(HPBUFFERARB hPbuffer);
+
+int wglReleasePbufferDCARBWrapper(HPBUFFERARB hPbuffer, HDC hDC);
+
+BOOL wglDestroyPbufferARBWrapper(HPBUFFERARB hPbuffer);
+
+BOOL wglQueryPbufferARBWrapper(HPBUFFERARB hPbuffer,
+ int iAttribute, int *piValue);
+
+BOOL wglSwapIntervalEXTWrapper(int interval);
+
+int wglGetSwapIntervalEXTWrapper(void);
+
+#endif /* wgl_ext_api_h */
diff --git a/xorg-server/hw/xwin/glx/winpriv.c b/xorg-server/hw/xwin/glx/winpriv.c
index 460973730..4f6e4ffd5 100644
--- a/xorg-server/hw/xwin/glx/winpriv.c
+++ b/xorg-server/hw/xwin/glx/winpriv.c
@@ -12,26 +12,26 @@
#include "winwindow.h"
void
-winCreateWindowsWindow (WindowPtr pWin);
+ winCreateWindowsWindow(WindowPtr pWin);
+
/**
* Return size and handles of a window.
* If pWin is NULL, then the information for the root window is requested.
*/
-HWND winGetWindowInfo(WindowPtr pWin)
+HWND
+winGetWindowInfo(WindowPtr pWin)
{
winTrace("%s: pWin %p XID 0x%x\n", __FUNCTION__, pWin, pWin->drawable.id);
/* a real window was requested */
- if (pWin != NULL)
- {
+ if (pWin != NULL) {
/* Get the window and screen privates */
ScreenPtr pScreen = pWin->drawable.pScreen;
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
winScreenInfoPtr pScreenInfo = NULL;
HWND hwnd = NULL;
- if (pWinScreen == NULL)
- {
+ if (pWinScreen == NULL) {
ErrorF("winGetWindowInfo: screen has no privates\n");
return NULL;
}
@@ -41,48 +41,42 @@ HWND winGetWindowInfo(WindowPtr pWin)
pScreenInfo = pWinScreen->pScreenInfo;
#ifdef XWIN_MULTIWINDOW
/* check for multiwindow mode */
- if (pScreenInfo->fMultiWindow)
- {
+ if (pScreenInfo->fMultiWindow) {
winWindowPriv(pWin);
- if (pWinPriv == NULL)
- {
+ if (pWinPriv == NULL) {
ErrorF("winGetWindowInfo: window has no privates\n");
return hwnd;
}
- if (pWinPriv->hWnd == NULL)
- {
- winCreateWindowsWindow(pWin);
- ErrorF("winGetWindowInfo: forcing window to exist...\n");
+ if (pWinPriv->hWnd == NULL) {
+ winCreateWindowsWindow(pWin);
+ ErrorF("winGetWindowInfo: forcing window to exist...\n");
}
- if (pWinPriv->hWnd != NULL)
- {
+ if (pWinPriv->hWnd != NULL) {
/* copy window handle */
hwnd = pWinPriv->hWnd;
/* mark GLX active on that hwnd */
pWinPriv->fWglUsed = TRUE;
- }
+ }
return hwnd;
}
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
/* check for multiwindow external wm mode */
- if (pScreenInfo->fMWExtWM)
- {
+ if (pScreenInfo->fMWExtWM) {
win32RootlessWindowPtr pRLWinPriv
- = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
+ = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
if (pRLWinPriv == NULL) {
ErrorF("winGetWindowInfo: window has no privates\n");
return hwnd;
}
- if (pRLWinPriv->hWnd != NULL)
- {
+ if (pRLWinPriv->hWnd != NULL) {
/* copy window handle */
hwnd = pRLWinPriv->hWnd;
}
@@ -90,13 +84,11 @@ HWND winGetWindowInfo(WindowPtr pWin)
}
#endif
}
- else
- {
+ else {
ScreenPtr pScreen = g_ScreenInfo[0].pScreen;
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
- if (pWinScreen == NULL)
- {
+ if (pWinScreen == NULL) {
ErrorF("winGetWindowInfo: screen has no privates\n");
return NULL;
}
@@ -112,18 +104,18 @@ HWND winGetWindowInfo(WindowPtr pWin)
Bool
winCheckScreenAiglxIsSupported(ScreenPtr pScreen)
{
- winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
- winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo;
+ winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
+ winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo;
#ifdef XWIN_MULTIWINDOW
- if (pScreenInfo->fMultiWindow)
- return TRUE;
+ if (pScreenInfo->fMultiWindow)
+ return TRUE;
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
- if (pScreenInfo->fMWExtWM)
- return TRUE;
+ if (pScreenInfo->fMWExtWM)
+ return TRUE;
#endif
- return FALSE;
+ return FALSE;
}