On 20 August 2013 12:07, Stefan Dösinger stefan@codeweavers.com wrote:
+void *wined3d_alloc_resource_mem(SIZE_T size) +{
- void **p;
- SIZE_T align = RESOURCE_ALIGNMENT - 1 + sizeof(*p);
- void *mem;
- if (!(mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + align)))
return NULL;
- p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1;
- *p = mem;
- return ++p;
+}
I think this should either be called wined3d_resource_allocate_sysmem() and live in resource.c, or accept any np2 alignment and be called something along the lines of wined3d_memalign(). The former probably makes the most sense at this point.
Somewhat related, I don't think there's really a reason to have both "allocatedMemory" and "heap_memory" anymore. It should probably just be called "sysmem". That's a cleanup that doesn't necessarily belong in this patch though.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2013-08-20 13:12, schrieb Henri Verbeet:
I think this should either be called wined3d_resource_allocate_sysmem() and live in resource.c, or accept any np2 alignment and be called something along the lines of wined3d_memalign(). The former probably makes the most sense at this point.
Ok.
Somewhat related, I don't think there's really a reason to have both "allocatedMemory" and "heap_memory" anymore. It should probably just be called "sysmem". That's a cleanup that doesn't necessarily belong in this patch though.
Surfaces can still have DIBs. We're also assigning memory returned by glMapBuffer[Range] to resource.allocatedMemory, although that should probably be changed. The main problem with the latter is that buffers can be mapped multiple times.
Stefan
On 20 August 2013 13:16, Stefan Dösinger stefan@codeweavers.com wrote:
Am 2013-08-20 13:12, schrieb Henri Verbeet:
Somewhat related, I don't think there's really a reason to have both "allocatedMemory" and "heap_memory" anymore. It should probably just be called "sysmem". That's a cleanup that doesn't necessarily belong in this patch though.
Surfaces can still have DIBs. We're also assigning memory returned by glMapBuffer[Range] to resource.allocatedMemory,
Yeah, but you should be able to tell what kind of memory "sysmem" is from the resource flags, you don't need the extra pointer for that.