Commit bc2db78c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Explicitly document some more consequences of GL locking policy.

The basic rule is that you can't call anything that takes the user32 / gdi32 lock while under the GL (winex11) lock. As a consequence, you can't call anything like context_acquire() or context_destroy() either.
parent c6a65562
......@@ -686,6 +686,7 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *This, const struct wined3d_gl_inf
return This->resource.allocatedMemory;
}
/* Do not call while under the GL lock. */
static void STDMETHODCALLTYPE buffer_UnLoad(IWineD3DBuffer *iface)
{
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
......@@ -724,6 +725,7 @@ static void STDMETHODCALLTYPE buffer_UnLoad(IWineD3DBuffer *iface)
resource_unload((IWineD3DResourceImpl *)This);
}
/* Do not call while under the GL lock. */
static ULONG STDMETHODCALLTYPE buffer_Release(IWineD3DBuffer *iface)
{
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
......@@ -921,6 +923,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
LEAVE_GL();
}
/* Do not call while under the GL lock. */
static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
{
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
......
......@@ -833,6 +833,7 @@ err:
context->valid = 0;
}
/* Do not call while under the GL lock. */
static void context_validate(struct wined3d_context *context)
{
HWND wnd = WindowFromDC(context->hdc);
......@@ -848,6 +849,7 @@ static void context_validate(struct wined3d_context *context)
context_update_window(context);
}
/* Do not call while under the GL lock. */
static void context_destroy_gl_resources(struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
......@@ -980,6 +982,7 @@ struct wined3d_context *context_get_current(void)
return TlsGetValue(wined3d_context_tls_idx);
}
/* Do not call while under the GL lock. */
BOOL context_set_current(struct wined3d_context *ctx)
{
struct wined3d_context *old = context_get_current();
......@@ -1264,18 +1267,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
return iPixelFormat;
}
/*****************************************************************************
* context_create
*
* Creates a new context.
*
* * Params:
* This: Device to activate the context for
* target: Surface this context will render to
* win_handle: handle to the window which we are drawing to
* pPresentParameters: contains the pixelformats to use for onscreen rendering
*
*****************************************************************************/
/* Do not call while under the GL lock. */
struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain,
IWineD3DSurfaceImpl *target, const struct wined3d_format *ds_format)
{
......@@ -1597,16 +1589,7 @@ out:
return NULL;
}
/*****************************************************************************
* context_destroy
*
* Destroys a wined3d context
*
* Params:
* This: Device to activate the context for
* context: Context to destroy
*
*****************************************************************************/
/* Do not call while under the GL lock. */
void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context)
{
BOOL destroy;
......@@ -1883,18 +1866,7 @@ static struct wined3d_context *findThreadContextForSwapChain(IWineD3DSwapChain *
return swapchain_create_context_for_thread(swapchain);
}
/*****************************************************************************
* FindContext
*
* Finds a context for the current render target and thread
*
* Parameters:
* target: Render target to find the context for
* tid: Thread to activate the context for
*
* Returns: The needed context
*
*****************************************************************************/
/* Do not call while under the GL lock. */
static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target)
{
struct wined3d_context *current_context = context_get_current();
......@@ -2300,19 +2272,7 @@ static void context_setup_target(IWineD3DDeviceImpl *device,
context_set_render_offscreen(context, StateTable, render_offscreen);
}
/*****************************************************************************
* context_acquire
*
* Finds a rendering context and drawable matching the device and render
* target for the current thread, activates them and puts them into the
* requested state.
*
* Params:
* This: Device to activate the context for
* target: Requested render target
* usage: Prepares the context for blitting, drawing or other actions
*
*****************************************************************************/
/* Do not call while under the GL lock. */
struct wined3d_context *context_acquire(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *target)
{
struct wined3d_context *current_context = context_get_current();
......
......@@ -27,6 +27,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
/* Do not call while under the GL lock. */
static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb)
{
/* Override the IWineD3DResource Preload method. */
......@@ -161,6 +162,7 @@ static ULONG WINAPI IWineD3DCubeTextureImpl_AddRef(IWineD3DCubeTexture *iface) {
return InterlockedIncrement(&This->resource.ref);
}
/* Do not call while under the GL lock. */
static ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface) {
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
ULONG ref;
......@@ -198,10 +200,12 @@ static DWORD WINAPI IWineD3DCubeTextureImpl_GetPriority(IWineD3DCubeTexture *ifa
return resource_get_priority((IWineD3DResource *)iface);
}
/* Do not call while under the GL lock. */
static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) {
cubetexture_internal_preload((IWineD3DBaseTexture *) iface, SRGB_ANY);
}
/* Do not call while under the GL lock. */
static void WINAPI IWineD3DCubeTextureImpl_UnLoad(IWineD3DCubeTexture *iface)
{
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
......
......@@ -1259,6 +1259,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface,
return WINED3D_OK;
}
/* Do not call while under the GL lock. */
static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface,
WINED3DPRESENT_PARAMETERS *present_parameters, WINED3DSURFTYPE surface_type,
void *parent, IWineD3DSwapChain **swapchain)
......@@ -6079,6 +6080,7 @@ static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, const WINED3DPRE
return FALSE;
}
/* Do not call while under the GL lock. */
static void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChainImpl *swapchain)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
......@@ -6123,6 +6125,7 @@ static void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChainImpl
swapchain->num_contexts = 0;
}
/* Do not call while under the GL lock. */
static HRESULT create_primary_opengl_context(IWineD3DDevice *iface, IWineD3DSwapChainImpl *swapchain)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
......@@ -6187,7 +6190,10 @@ err:
return hr;
}
static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters) {
/* Do not call while under the GL lock. */
static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
WINED3DPRESENT_PARAMETERS *pPresentationParameters)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
IWineD3DSwapChainImpl *swapchain;
HRESULT hr;
......
......@@ -243,6 +243,7 @@ static void WineD3D_ReleaseFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
}
}
/* Do not call while under the GL lock. */
static BOOL WineD3D_CreateFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
{
PIXELFORMATDESCRIPTOR pfd;
......@@ -5080,6 +5081,7 @@ static void fillGLAttribFuncs(const struct wined3d_gl_info *gl_info)
}
}
/* Do not call while under the GL lock. */
static BOOL InitAdapters(IWineD3DImpl *This)
{
static HMODULE mod_gl;
......@@ -5409,6 +5411,7 @@ const struct wined3d_parent_ops wined3d_null_parent_ops =
wined3d_null_wined3d_object_destroyed,
};
/* Do not call while under the GL lock. */
HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent)
{
wined3d->lpVtbl = &IWineD3D_Vtbl;
......
......@@ -1630,6 +1630,7 @@ static ULONG STDMETHODCALLTYPE vertexshader_AddRef(IWineD3DVertexShader *iface)
return refcount;
}
/* Do not call while under the GL lock. */
static ULONG STDMETHODCALLTYPE vertexshader_Release(IWineD3DVertexShader *iface)
{
IWineD3DVertexShaderImpl *shader = (IWineD3DVertexShaderImpl *)iface;
......@@ -1925,6 +1926,7 @@ static ULONG STDMETHODCALLTYPE geometryshader_AddRef(IWineD3DGeometryShader *ifa
return refcount;
}
/* Do not call while under the GL lock. */
static ULONG STDMETHODCALLTYPE geometryshader_Release(IWineD3DGeometryShader *iface)
{
struct wined3d_geometryshader *shader = (struct wined3d_geometryshader *)iface;
......@@ -2020,6 +2022,7 @@ static ULONG STDMETHODCALLTYPE pixelshader_AddRef(IWineD3DPixelShader *iface)
return refcount;
}
/* Do not call while under the GL lock. */
static ULONG STDMETHODCALLTYPE pixelshader_Release(IWineD3DPixelShader *iface)
{
IWineD3DPixelShaderImpl *shader = (IWineD3DPixelShaderImpl *)iface;
......
......@@ -1040,6 +1040,7 @@ static BOOL surface_convert_color_to_float(IWineD3DSurfaceImpl *surface, DWORD c
return TRUE;
}
/* Do not call while under the GL lock. */
static ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
......@@ -1062,6 +1063,7 @@ static ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface)
IWineD3DSurface IWineD3DResource parts follow
**************************************************** */
/* Do not call while under the GL lock. */
void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srgb)
{
IWineD3DDeviceImpl *device = surface->resource.device;
......@@ -1161,6 +1163,7 @@ BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface)
return TRUE;
}
/* Do not call while under the GL lock. */
static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
......
......@@ -33,7 +33,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(fps);
/*IWineD3DSwapChain parts follow: */
/* Do not call while under the GL lock. */
static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface)
{
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
......@@ -621,6 +621,7 @@ void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain)
}
/* Do not call while under the GL lock. */
HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type,
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, void *parent)
{
......@@ -917,6 +918,7 @@ err:
return hr;
}
/* Do not call while under the GL lock. */
struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChain *iface)
{
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *) iface;
......
......@@ -53,7 +53,9 @@ ULONG WINAPI IWineD3DBaseSwapChainImpl_AddRef(IWineD3DSwapChain *iface) {
return refCount;
}
ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) {
/* Do not call while under the GL lock. */
ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface)
{
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
DWORD refCount;
refCount = InterlockedDecrement(&This->ref);
......
......@@ -27,6 +27,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
/* Do not call while under the GL lock. */
static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb)
{
/* Override the IWineD3DResource PreLoad method. */
......@@ -155,6 +156,7 @@ static ULONG WINAPI IWineD3DTextureImpl_AddRef(IWineD3DTexture *iface) {
return InterlockedIncrement(&This->resource.ref);
}
/* Do not call while under the GL lock. */
static ULONG WINAPI IWineD3DTextureImpl_Release(IWineD3DTexture *iface) {
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
ULONG ref;
......@@ -193,10 +195,12 @@ static DWORD WINAPI IWineD3DTextureImpl_GetPriority(IWineD3DTexture *iface) {
return resource_get_priority((IWineD3DResource *)iface);
}
/* Do not call while under the GL lock. */
static void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface) {
texture_internal_preload((IWineD3DBaseTexture *) iface, SRGB_ANY);
}
/* Do not call while under the GL lock. */
static void WINAPI IWineD3DTextureImpl_UnLoad(IWineD3DTexture *iface) {
unsigned int i;
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
......
......@@ -123,6 +123,7 @@ static ULONG WINAPI IWineD3DVolumeImpl_AddRef(IWineD3DVolume *iface) {
return InterlockedIncrement(&This->resource.ref);
}
/* Do not call while under the GL lock. */
static ULONG WINAPI IWineD3DVolumeImpl_Release(IWineD3DVolume *iface) {
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
ULONG ref;
......@@ -166,10 +167,12 @@ static DWORD WINAPI IWineD3DVolumeImpl_GetPriority(IWineD3DVolume *iface) {
return resource_get_priority((IWineD3DResource *)iface);
}
/* Do not call while under the GL lock. */
static void WINAPI IWineD3DVolumeImpl_PreLoad(IWineD3DVolume *iface) {
FIXME("iface %p stub!\n", iface);
}
/* Do not call while under the GL lock. */
static void WINAPI IWineD3DVolumeImpl_UnLoad(IWineD3DVolume *iface)
{
TRACE("iface %p.\n", iface);
......
......@@ -26,6 +26,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
/* Do not call while under the GL lock. */
static void volumetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb)
{
/* Override the IWineD3DResource Preload method. */
......@@ -124,6 +125,7 @@ static ULONG WINAPI IWineD3DVolumeTextureImpl_AddRef(IWineD3DVolumeTexture *ifac
return InterlockedIncrement(&This->resource.ref);
}
/* Do not call while under the GL lock. */
static ULONG WINAPI IWineD3DVolumeTextureImpl_Release(IWineD3DVolumeTexture *iface) {
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
ULONG ref;
......@@ -165,6 +167,7 @@ static void WINAPI IWineD3DVolumeTextureImpl_PreLoad(IWineD3DVolumeTexture *ifac
volumetexture_internal_preload((IWineD3DBaseTexture *) iface, SRGB_ANY);
}
/* Do not call while under the GL lock. */
static void WINAPI IWineD3DVolumeTextureImpl_UnLoad(IWineD3DVolumeTexture *iface) {
unsigned int i;
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
......
......@@ -76,6 +76,7 @@ wined3d_settings_t wined3d_settings =
FALSE, /* No strict draw ordering. */
};
/* Do not call while under the GL lock. */
IWineD3D * WINAPI WineDirect3DCreate(UINT version, void *parent)
{
IWineD3DImpl *object;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment