http://bugs.winehq.org/show_bug.cgi?id=9878
--- Comment #28 from Stefan Dösinger stefandoesinger@gmx.at 2007-10-20 05:58:39 --- Hmm, let me make sure I understand this correctly:
When the vertex buffer is HeapAlloced, the memory is directly after the subheap structure, and doesn't start at a multiple of 16 bytes:
(1) [ SH ][ BUFFER ][SOMETHINGELSE] |
This causes a crash, propably because HL2 overwrites SH or SOMETHINGELSE.
Now with the padding, you get the start address to a multiple of 16 bytes:
(2) [ SH ][PAD][ BUFFER ][SOMETHINGELSE] |
And this works. Now if you pad a bit more, it crashes again
(3) [ SH ][ PAD ][ BUFFER ][SOMETHINGELSE] |
So since (2) works, but (3) fails, this can't be because HL2 overwrites the subheap header. ie it is really the alignment of the start address, not the distance from some other structure. Some SSE instructions work on 16 byte blocks as far as I know, but do they require 16 byte alignment? But HL2 itself could assume alignment in some internal calculations.