* wglCreateContextAttribsARB() to actually create a rendering context.
*/
struct stw_context *
-stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
+stw_create_context_attribs(HDC hdc, INT iLayerPlane, struct stw_context *shareCtx,
int majorVersion, int minorVersion,
int contextFlags, int profileMask)
{
const struct stw_pixelformat_info *pfi;
struct st_context_attribs attribs;
struct stw_context *ctx = NULL;
- struct stw_context *shareCtx = NULL;
enum st_context_error ctx_err = 0;
if (!stw_dev)
pfi = stw_pixelformat_get_info( iPixelFormat );
- if (hShareContext != 0) {
- stw_lock_contexts(stw_dev);
- shareCtx = stw_lookup_context_locked( hShareContext );
+ if (shareCtx != NULL)
shareCtx->shared = TRUE;
- stw_unlock_contexts(stw_dev);
- }
ctx = CALLOC_STRUCT( stw_context );
if (ctx == NULL)
};
struct stw_context *stw_create_context_attribs(HDC hdc, INT iLayerPlane,
- DHGLRC hShareContext,
+ struct stw_context *shareCtx,
int majorVersion, int minorVersion,
int contextFlags, int profileMask);
LeaveCriticalSection(&stw_dev->ctx_mutex);
}
+static inline struct stw_context *
+stw_lookup_context( DHGLRC dhglrc )
+{
+ struct stw_context *ret;
+ stw_lock_contexts(stw_dev);
+ ret = stw_lookup_context_locked(dhglrc);
+ stw_unlock_contexts(stw_dev);
+ return ret;
+}
+
static inline void
stw_lock_framebuffers(struct stw_device *stw_dev)
share_dhglrc = (DHGLRC)(INT_PTR)hShareContext;
}
- struct stw_context *stw_ctx = stw_create_context_attribs(hDC, layerPlane, share_dhglrc,
+ struct stw_context *share_stw = stw_lookup_context(share_dhglrc);
+
+ struct stw_context *stw_ctx = stw_create_context_attribs(hDC, layerPlane, share_stw,
majorVersion, minorVersion,
contextFlags, profileMask);