[PATCH 7/7] wined3d: Create debug GL contexts if error tracing is active.

Matteo Bruni mbruni at codeweavers.com
Thu Apr 18 14:20:04 CDT 2013


---
 dlls/wined3d/context.c         | 13 +++++++++++++
 dlls/wined3d/directx.c         |  3 +++
 dlls/wined3d/wined3d_private.h |  1 +
 3 files changed, 17 insertions(+)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index f7f6762..b4aee62 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1257,6 +1257,17 @@ static void bind_dummy_textures(const struct wined3d_device *device, const struc
     }
 }
 
+void set_wgl_context_attribs(int *attribs)
+{
+    if (ERR_ON(d3d))
+    {
+        TRACE("Setting debug flag for the GL context.\n");
+        *attribs++ = WGL_CONTEXT_FLAGS_ARB;
+        *attribs++ = WGL_CONTEXT_DEBUG_BIT_ARB;
+    }
+    *attribs = 0;
+}
+
 /* Do not call while under the GL lock. */
 struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
         struct wined3d_surface *target, const struct wined3d_format *ds_format)
@@ -1370,8 +1381,10 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     if (gl_info->supported[WGL_ARB_CREATE_CONTEXT])
     {
         HGLRC prev_ctx = (device->context_count) ? device->contexts[0]->glCtx : NULL;
+        int attribs[11];
 
         TRACE("Creating a new GL context via wglCreateContextAttribsARB.\n");
+        set_wgl_context_attribs(attribs);
         if (!(ctx = gl_info->p_wglCreateContextAttribsARB(hdc, prev_ctx, NULL)))
         {
             ERR("Failed to create a WGL context.\n");
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index e4cf89a..0d728d9 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -386,6 +386,8 @@ static BOOL WineD3D_CreateFakeGLContext(struct wined3d_adapter *adapter, struct
 
     if (gl_info->p_wglCreateContextAttribsARB)
     {
+        int attribs[11];
+
         if (!wglMakeCurrent(NULL, NULL))
             ERR("Failed to disable fake GL context.\n");
         if (!wglDeleteContext(ctx->gl_ctx))
@@ -395,6 +397,7 @@ static BOOL WineD3D_CreateFakeGLContext(struct wined3d_adapter *adapter, struct
         }
 
         TRACE("Creating a new GL context via wglCreateContextAttribsARB.\n");
+        set_wgl_context_attribs(attribs);
         if (!(ctx->gl_ctx = gl_info->p_wglCreateContextAttribsARB(ctx->dc, NULL, NULL)))
         {
             ERR("Failed to create a WGL context.\n");
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ffb22fe..b3d967b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1247,6 +1247,7 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
         struct wined3d_surface *src_surface, const RECT *src_rect,
         struct wined3d_surface *dst_surface, const RECT *dst_rect) DECLSPEC_HIDDEN;
 
+void set_wgl_context_attribs(int *attribs) DECLSPEC_HIDDEN;
 struct wined3d_context *context_acquire(const struct wined3d_device *device,
         struct wined3d_surface *target) DECLSPEC_HIDDEN;
 void context_alloc_event_query(struct wined3d_context *context,
-- 
1.8.1.5




More information about the wine-patches mailing list