[PATCH 2/5] wined3d: Wrap resource->heapMemory into a structure

Stefan Dösinger stefan at codeweavers.com
Mon Aug 19 06:38:33 CDT 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 2013-08-19 12:29, schrieb Henri Verbeet:
> I don't think this is a good idea. How about something like the 
> following? The corresponding free function would be trivial.
I guess this works for the purposes of this patchset. However, in my
command stream patches I am using a structure similar to this to cache
allocated blocks of memory to handle WINED3D_MAP_DISCARD buffer maps.
In that case the structure had additional size information and a
struct list entry.

I guess in theory any kind of payload could be added to your
implementation, but growing this larger than RESOURCE_ALIGNMENT(=16)
bytes moots the point I guess. I'm not yet sure though if my cache is
an actual improvement over just freeing and allocating new blocks of
memory.

The other unknown is that some ddraw games write past the allocated
surface memory. The extra 16 bytes took care of this, and before we
aligned the memory we just allocated 4 extra bytes. I don't know which
games are affected by this (it was from a comment in old ddraw), and I
don't know if the problem only happened if the memory block wasn't
properly aligned. Your code and mine differ when HeapAlloc happens to
return an aligned pointer.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSEgO5AAoJEN0/YqbEcdMwmiIP/iVETzzMWT/yDSmFNSOAD3o5
59TXEer+KeWUH/tVUr+WA6vxnT3CR18hV7LZl9fPWt9d3pRS12zyYSIz5i/5f9eJ
BgK15qFFrZhzFu8c1hzYIhM76nUtInPMVi3zd/7xkgUI3aemuP0dUkJIYd+wrUcz
4S50ppMIgJhqGReFIdTiOz57OPQWUFUoBKDxFlv3WSKgV8b1it99IwXgX/IPuvbQ
cP6REIW1WtI6dLvOjoT6D8v2yUSmNmSDAMVBx4D7LEBhVTmxPMuFjbn4t5UJ1+wY
wpr2mBNGdiwaLU+XQA5X1UrHDTYPDEQS0pJ9hub8sotwl+QiXWrcTNtw5avai3Xy
uztAF7kkCNQpbHopp2GjHXQaGxGoKyXQTI1okFd/R1C/9q8TOCA1gG8c/Ntx9Vhd
ORG+HCUr+x+coPfRBwgxdl/22zLHSotVXhmT+2r4uoklnZN+0TX0AKtctwIGBMpR
0Kw9fnBPngpmEHheTDhr94nqZL3FIBLyqRDrdWxiy0zmDu1hShcC5/ox8MutevaR
G4bXHlLc4BbW+PN6/wJDNCG3Nt/avdwU0rj4Ix6c7X/Cns+kmyWECiCjRkYo4xQK
nlr8wDZC307fcrIH6jfh7DqdPhcMKA17LeKRm6ygpDp5sYqpsTb4r7NOZXJA6h63
nK3qN+FJ4PEbK90d+tg4
=sh5J
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list