- Merge from trunk up to r45543
[reactos.git] / dll / directx / wine / wined3d / texture.c
index 36d8316..1e27214 100644 (file)
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
 
-#define GLINFO_LOCATION (*gl_info)
-
 static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb)
 {
     /* Override the IWineD3DResource PreLoad method. */
     IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
-    IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
+    IWineD3DDeviceImpl *device = This->resource.device;
+    struct wined3d_context *context = NULL;
     unsigned int i;
     BOOL srgb_mode;
     BOOL *dirty;
@@ -62,9 +61,9 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
 
     if (!device->isInDraw)
     {
-        /* ActivateContext sets isInDraw to TRUE when loading a pbuffer into a texture,
+        /* context_acquire() sets isInDraw to TRUE when loading a pbuffer into a texture,
          * thus no danger of recursive calls. */
-        ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
+        context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);
     }
 
     if (This->resource.format_desc->format == WINED3DFMT_P8_UINT
@@ -97,6 +96,8 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
         TRACE("(%p) Texture not dirty, nothing to do.\n", iface);
     }
 
+    if (context) context_release(context);
+
     /* No longer dirty. */
     *dirty = FALSE;
 }
@@ -125,14 +126,10 @@ static void texture_cleanup(IWineD3DTextureImpl *This)
     basetexture_cleanup((IWineD3DBaseTexture *)This);
 }
 
-#undef GLINFO_LOCATION
-
 /* *******************************************
    IWineD3DTexture IUnknown parts follow
    ******************************************* */
 
-#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
-
 static HRESULT WINAPI IWineD3DTextureImpl_QueryInterface(IWineD3DTexture *iface, REFIID riid, LPVOID *ppobj)
 {
     IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
@@ -174,10 +171,6 @@ static ULONG WINAPI IWineD3DTextureImpl_Release(IWineD3DTexture *iface) {
 /* ****************************************************
    IWineD3DTexture IWineD3DResource parts follow
    **************************************************** */
-static HRESULT WINAPI IWineD3DTextureImpl_GetDevice(IWineD3DTexture *iface, IWineD3DDevice** ppDevice) {
-    return resource_get_device((IWineD3DResource *)iface, ppDevice);
-}
-
 static HRESULT WINAPI IWineD3DTextureImpl_SetPrivateData(IWineD3DTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
     return resource_set_private_data((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags);
 }
@@ -408,7 +401,6 @@ static const IWineD3DTextureVtbl IWineD3DTexture_Vtbl =
     IWineD3DTextureImpl_Release,
     /* IWineD3DResource */
     IWineD3DTextureImpl_GetParent,
-    IWineD3DTextureImpl_GetDevice,
     IWineD3DTextureImpl_SetPrivateData,
     IWineD3DTextureImpl_GetPrivateData,
     IWineD3DTextureImpl_FreePrivateData,