Stefan Dösinger : wined3d: Implement a detection for the MacOS OpenGL implementation.

Alexandre Julliard julliard at winehq.org
Fri Nov 9 07:44:19 CST 2007


Module: wine
Branch: master
Commit: f79ca75d082bbe7fa2e132da7576717312d4f0a1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f79ca75d082bbe7fa2e132da7576717312d4f0a1

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Thu Nov  8 22:08:08 2007 +0100

wined3d: Implement a detection for the MacOS OpenGL implementation.

---

 dlls/wined3d/directx.c    |   32 ++++++++++++++++++++++++++++++++
 include/wine/wined3d_gl.h |   17 +++++++++++++++++
 2 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index cff6550..65a5b2a 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -44,6 +44,8 @@ static const struct {
     /* APPLE */
     {"GL_APPLE_client_storage",             APPLE_CLIENT_STORAGE},
     {"GL_APPLE_fence",                      APPLE_FENCE},
+    {"GL_APPLE_flush_render",               APPLE_FLUSH_RENDER},
+    {"GL_APPLE_ycbcr_422",                  APPLE_YCBCR_422},
 
     /* ATI */
     {"GL_ATI_separate_stencil",             ATI_SEPARATE_STENCIL},
@@ -2715,6 +2717,33 @@ ULONG WINAPI D3DCB_DefaultDestroyVolume(IWineD3DVolume *pVolume) {
     return IUnknown_Release(volumeParent);
 }
 
+static BOOL implementation_is_apple(WineD3D_GL_Info *gl_info) {
+    /* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
+     * the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
+     * detect the Apple OpenGL implementation to apply some extension fixups afterwards.
+     *
+     * Detecting this isn't really easy. The vendor string doesn't mention Apple. Compile-time checks
+     * aren't sufficient either because a Linux binary may display on a macos X server via remote X11.
+     * So try to detect the GL implementation by looking at certain Apple extensions. Some extensions
+     * like client storage might be supported on other implementations too, but GL_APPLE_flush_render
+     * is specific to the MacOS window management, and GL_APPLE_ycbcr_422 is a Quicktime specific, so
+     * it the chance that other implementations support it is rather rare since Win32 Quicktime uses
+     * DirectDraw, not OpenGL.
+     */
+    if(gl_info->supported[APPLE_FENCE] &&
+       gl_info->supported[APPLE_CLIENT_STORAGE] &&
+       gl_info->supported[APPLE_FLUSH_RENDER] &&
+       gl_info->supported[APPLE_YCBCR_422]) {
+        TRACE_(d3d_caps)("GL_APPLE_fence, GL_APPLE_client_storage, GL_APPLE_flush_render and GL_ycbcr_422 are supported\n");
+        TRACE_(d3d_caps)("Activating MacOS fixups\n");
+        return TRUE;
+    } else {
+        TRACE_(d3d_caps)("Apple extensions are not supported\n");
+        TRACE_(d3d_caps)("Not activating MacOS fixups\n");
+        return FALSE;
+    }
+}
+
 #define PUSH1(att)        attribs[nAttribs++] = (att);
 #define GLINFO_LOCATION (Adapters[0].gl_info)
 BOOL InitAdapters(void) {
@@ -2769,6 +2798,7 @@ BOOL InitAdapters(void) {
         int attribute;
         DISPLAY_DEVICEW DisplayDevice;
         HDC hdc;
+        BOOL apple;
 
         TRACE("Initializing default adapter\n");
         Adapters[0].monitorPoint.x = -1;
@@ -2853,6 +2883,8 @@ BOOL InitAdapters(void) {
         }
         WineD3D_ReleaseFakeGLContext();
 
+        apple = implementation_is_apple(&Adapters[0].gl_info);
+
         select_shader_mode(&Adapters[0].gl_info, WINED3DDEVTYPE_HAL, &ps_selected_mode, &vs_selected_mode);
         select_shader_max_constants(ps_selected_mode, vs_selected_mode, &Adapters[0].gl_info);
 
diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h
index 1c316e9..254826e 100644
--- a/include/wine/wined3d_gl.h
+++ b/include/wine/wined3d_gl.h
@@ -2854,6 +2854,18 @@ typedef int (WINE_GLAPI * PGLXFNWAITVIDEOSYNCSGIPROC) (int, int, unsigned int *)
 #define GL_DEPTH_CLAMP_NV                   0x864F
 #endif
 
+/* GL_APPLE_flush_render */
+typedef void (WINE_GLAPI * PGLFNFLUSHRENDERAPPLEPROC) (void);
+typedef void (WINE_GLAPI * PGLFNFINISHRENDERAPPLEPROC) (void);
+
+/* GL_APPLE_ycbcr_422 */
+#ifndef GL_APPLE_ycbcr_422
+#define GL_APPLE_ycbcr_422
+#define GL_YCBCR_422_APPLE                  0x85B9
+#define UNSIGNED_SHORT_8_8_APPLE            0x85BA
+#define UNSIGNED_SHORT_8_8_REV_APPLE        0x85BB
+#endif
+
 /* GL_VERSION_2_0 */
 #ifndef GL_VERSION_2_0
 #define GL_VERSION_2_0 1
@@ -3206,6 +3218,8 @@ typedef enum _GL_SupportedExt {
   /* APPLE */
   APPLE_FENCE,
   APPLE_CLIENT_STORAGE,
+  APPLE_FLUSH_RENDER,
+  APPLE_YCBCR_422,
   /* SGI */
   SGI_VIDEO_SYNC,
   SGIS_GENERATE_MIPMAP,
@@ -3488,6 +3502,9 @@ typedef enum _GL_SupportedExt {
     /* GLX_SGI_video_sync */ \
     USE_GL_FUNC(PGLXFNGETVIDEOSYNCSGIPROC,                      glXGetVideoSyncSGI); \
     USE_GL_FUNC(PGLXFNWAITVIDEOSYNCSGIPROC,                     glXWaitVideoSyncSGI); \
+    /* GL_APPLE_flush_render */ \
+    USE_GL_FUNC(PGLFNFLUSHRENDERAPPLEPROC,                      glFlushRenderApple); \
+    USE_GL_FUNC(PGLFNFINISHRENDERAPPLEPROC,                     glFinishRenderApple); \
 
 /* OpenGL 2.0 functions */
 #define GL2_FUNCS_GEN \




More information about the wine-cvs mailing list