return (struct stw_context *) ((st) ? st->st_manager_private : NULL);
}
+
BOOL APIENTRY
-DrvCopyContext(
- DHGLRC dhrcSource,
- DHGLRC dhrcDest,
- UINT fuMask )
+DrvCopyContext(DHGLRC dhrcSource, DHGLRC dhrcDest, UINT fuMask)
{
struct stw_context *src;
struct stw_context *dst;
return FALSE;
pipe_mutex_lock( stw_dev->ctx_mutex );
-
+
src = stw_lookup_context_locked( dhrcSource );
dst = stw_lookup_context_locked( dhrcDest );
- if (src && dst) {
+ if (src && dst) {
/* FIXME */
assert(0);
(void) src;
}
pipe_mutex_unlock( stw_dev->ctx_mutex );
-
+
return ret;
}
+
BOOL APIENTRY
-DrvShareLists(
- DHGLRC dhglrc1,
- DHGLRC dhglrc2 )
+DrvShareLists(DHGLRC dhglrc1, DHGLRC dhglrc2)
{
struct stw_context *ctx1;
struct stw_context *ctx2;
return FALSE;
pipe_mutex_lock( stw_dev->ctx_mutex );
-
+
ctx1 = stw_lookup_context_locked( dhglrc1 );
ctx2 = stw_lookup_context_locked( dhglrc2 );
ret = ctx2->st->share(ctx2->st, ctx1->st);
pipe_mutex_unlock( stw_dev->ctx_mutex );
-
+
return ret;
}
+
DHGLRC APIENTRY
-DrvCreateContext(
- HDC hdc )
+DrvCreateContext(HDC hdc)
{
return DrvCreateLayerContext( hdc, 0 );
}
+
DHGLRC APIENTRY
-DrvCreateLayerContext(
- HDC hdc,
- INT iLayerPlane )
+DrvCreateLayerContext(HDC hdc, INT iLayerPlane)
{
return stw_create_context_attribs(hdc, iLayerPlane, 0, 1, 0, 0,
WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
return 0;
}
+
BOOL APIENTRY
-DrvDeleteContext(
- DHGLRC dhglrc )
+DrvDeleteContext(DHGLRC dhglrc)
{
struct stw_context *ctx ;
BOOL ret = FALSE;
-
+
if (!stw_dev)
return FALSE;
if (ctx) {
struct stw_context *curctx = stw_current_context();
-
+
/* Unbind current if deleting current context. */
if (curctx == ctx)
stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
return ret;
}
+
BOOL APIENTRY
-DrvReleaseContext(
- DHGLRC dhglrc )
+DrvReleaseContext(DHGLRC dhglrc)
{
struct stw_context *ctx;
if (!ctx)
return FALSE;
-
+
/* The expectation is that ctx is the same context which is
* current for this thread. We should check that and return False
* if not the case.
struct stw_context *ctx;
ctx = stw_current_context();
- if(!ctx)
+ if (!ctx)
return 0;
-
+
return ctx->dhglrc;
}
+
HDC
stw_get_current_dc( void )
{
struct stw_context *ctx;
ctx = stw_current_context();
- if(!ctx)
+ if (!ctx)
return NULL;
-
+
return ctx->hdc;
}
+
BOOL
-stw_make_current(
- HDC hdc,
- DHGLRC dhglrc )
+stw_make_current(HDC hdc, DHGLRC dhglrc)
{
struct stw_context *curctx = NULL;
struct stw_context *ctx = NULL;
}
else {
/* Applications should call SetPixelFormat before creating a context,
- * but not all do, and the opengl32 runtime seems to use a default pixel
- * format in some cases, so we must create a framebuffer for those here
+ * but not all do, and the opengl32 runtime seems to use a default
+ * pixel format in some cases, so we must create a framebuffer for
+ * those here.
*/
int iPixelFormat = GetPixelFormat(hdc);
if (iPixelFormat)
if (!fb)
goto fail;
}
-
+
if (fb->iPixelFormat != ctx->iPixelFormat) {
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
goto fail;
} else {
ret = stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
}
-
+
fail:
if (fb) {
}
/* On failure, make the thread's current rendering context not current
- * before returning */
+ * before returning.
+ */
if (!ret) {
stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
ctx = NULL;
p_atomic_inc(&fb->stfb->stamp);
}
+
/**
* Although WGL allows different dispatch entrypoints per context
*/
}
};
+
PGLCLTPROCTABLE APIENTRY
-DrvSetContext(
- HDC hdc,
- DHGLRC dhglrc,
- PFN_SETPROCTABLE pfnSetProcTable )
+DrvSetContext(HDC hdc, DHGLRC dhglrc, PFN_SETPROCTABLE pfnSetProcTable)
{
PGLCLTPROCTABLE r = (PGLCLTPROCTABLE)&cpt;
- if (!stw_make_current( hdc, dhglrc ))
+ if (!stw_make_current(hdc, dhglrc))
r = NULL;
return r;
* stw_dev::fb_mutex global lock.
*/
static inline struct stw_framebuffer *
-stw_framebuffer_from_hwnd_locked(
- HWND hwnd )
+stw_framebuffer_from_hwnd_locked(HWND hwnd)
{
struct stw_framebuffer *fb;
/*
* Sanity checking.
*/
-
assert(fb->hWnd);
assert(fb->width && fb->height);
assert(fb->client_rect.right == fb->client_rect.left + fb->width);
/*
* Get the client area size.
*/
-
if (!GetClientRect(fb->hWnd, &client_rect)) {
return;
}
* preserve the current window size, until the window is restored or
* maximized again.
*/
-
return;
}
* Given an hdc, return the corresponding stw_framebuffer.
*/
static inline struct stw_framebuffer *
-stw_framebuffer_from_hdc_locked(
- HDC hdc )
+stw_framebuffer_from_hdc_locked(HDC hdc)
{
HWND hwnd;
fb = stw_framebuffer_from_hdc_locked(hdc);
if (fb) {
/*
- * SetPixelFormat must be called only once. However ignore
+ * SetPixelFormat must be called only once. However ignore
* pbuffers, for which the framebuffer object is created first.
*/
boolean bPbuffer = fb->bPbuffer;
* must be called when done
*/
struct stw_framebuffer *
-stw_framebuffer_create(
- HDC hdc,
- int iPixelFormat );
+stw_framebuffer_create(HDC hdc, int iPixelFormat);
void
-stw_framebuffer_reference(
- struct stw_framebuffer **ptr,
- struct stw_framebuffer *fb);
+stw_framebuffer_reference(struct stw_framebuffer **ptr,
+ struct stw_framebuffer *fb);
/**
* Search a framebuffer with a matching HWND.
* must be called when done
*/
struct stw_framebuffer *
-stw_framebuffer_from_hwnd(
- HWND hwnd );
+stw_framebuffer_from_hwnd(HWND hwnd);
/**
* Search a framebuffer with a matching HDC.
* must be called when done
*/
struct stw_framebuffer *
-stw_framebuffer_from_hdc(
- HDC hdc );
+stw_framebuffer_from_hdc(HDC hdc);
BOOL
stw_framebuffer_present_locked(HDC hdc,
struct pipe_resource *res);
void
-stw_framebuffer_update(
- struct stw_framebuffer *fb);
+stw_framebuffer_update(struct stw_framebuffer *fb);
/**
* Release stw_framebuffer::mutex lock. This framebuffer must not be accessed
* in the meanwhile.
*/
void
-stw_framebuffer_release(
- struct stw_framebuffer *fb);
+stw_framebuffer_release(struct stw_framebuffer *fb);
/**
* Cleanup any existing framebuffers when exiting application.