From c625969b2cacc6f34583ff9b14adcefcb45c5737 Mon Sep 17 00:00:00 2001 From: Kjell Rune Skaaraas Date: Mon, 29 Sep 2008 19:52:18 +0200 Subject: Implements IWineD3DResourceImpl_GetPriority and IWineD3DResourceImpl_SetPriority for resource management. According to the D3D spec It manages what resources should be removed first from memory, but since WINE doesn't use it I guess this implementation doesn't do that. So this shouldn't change any functionality, but leaves room for more advanced memeory management in the future. And it removes some more FIXMEs from my logs. --- dlls/wined3d/device.c | 1 + dlls/wined3d/resource.c | 12 +++++++----- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 409c7a1..7cf374c 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -90,6 +90,7 @@ static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3 object->resource.format = Format; \ object->resource.usage = Usage; \ object->resource.size = _size; \ + object->resource.priority = 0; \ list_init(&object->resource.privateData); \ /* Check that we have enough video ram left */ \ if (Pool == WINED3DPOOL_DEFAULT) { \ diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 17e540b..c75e09d 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -217,16 +217,18 @@ HRESULT WINAPI IWineD3DResourceImpl_FreePrivateData(IWineD3DResource *iface, REF return WINED3D_OK; } -/* Priority support is not implemented yet */ DWORD WINAPI IWineD3DResourceImpl_SetPriority(IWineD3DResource *iface, DWORD PriorityNew) { IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; - FIXME("(%p) : stub\n", This); - return 0; + DWORD PriorityOld = This->resource.priority; + This->resource.priority = PriorityNew; + TRACE("(%p) : new priority %d, returning old priority %d\n", This, PriorityNew, PriorityOld ); + return PriorityOld; } + DWORD WINAPI IWineD3DResourceImpl_GetPriority(IWineD3DResource *iface) { IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; - FIXME("(%p) : stub\n", This); - return 0; + TRACE("(%p) : returning %d\n", This, This->resource.priority ); + return This->resource.priority; } /* Preloading of resources is not supported yet */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d4c6273..bc6a1cb 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1096,6 +1096,7 @@ typedef struct IWineD3DResourceClass UINT size; DWORD usage; WINED3DFORMAT format; + DWORD priority; BYTE *allocatedMemory; /* Pointer to the real data location */ BYTE *heapMemory; /* Pointer to the HeapAlloced block of memory */ struct list privateData; -- 1.5.4.3