Hi,
When calling CreateSurface, a power of 2 surface is created and then the necessary memory is allocated. If we try to get the DC with GetDC, a DIB section is created with the original size of the surface and data from the surface is copied to the DIB section The power of 2 surface being greater than the DIB section, this makes Wine crashes.
I haven't followed power of 2 texture/surface development. Is there someone having a idea on this.
Bye, Christian
On 10/07/06, Christian Costa titan.costa@wanadoo.fr wrote:
Hi,
When calling CreateSurface, a power of 2 surface is created and then the necessary memory is allocated. If we try to get the DC with GetDC, a DIB section is created with the original size of the surface and data from the surface is copied to the DIB section The power of 2 surface being greater than the DIB section, this makes Wine crashes.
I haven't followed power of 2 texture/surface development. Is there someone having a idea on this.
You probably want to ask Stefan. I assume you're talking about the case where the card doesn't support NPOT textures and we fixup the texture size?
Am Montag 10 Juli 2006 22:10 schrieb Christian Costa:
Hi,
When calling CreateSurface, a power of 2 surface is created and then the necessary memory is allocated. If we try to get the DC with GetDC, a DIB section is created with the original size of the surface and data from the surface is copied to the DIB section The power of 2 surface being greater than the DIB section, this makes Wine crashes.
I got nonpower of 2 dib sections working for some games here, and as far as I remember I create the dib section with the full pow2 size.
My idea is to switch to using np2 repacking by default and dropping the other np2 mode. To avoid the performance loss we can just keep the texture copy in local ram if the app locks it regularily, so we don't have to call glGetTexImage nor repack the texture :-). This should be done for pow2 textures too. I've started that already by defining some surface flags, but there is no code yet for that.
Stefan
Stefan Dösinger a écrit :
Am Montag 10 Juli 2006 22:10 schrieb Christian Costa:
Hi,
When calling CreateSurface, a power of 2 surface is created and then the necessary memory is allocated. If we try to get the DC with GetDC, a DIB section is created with the original size of the surface and data from the surface is copied to the DIB section The power of 2 surface being greater than the DIB section, this makes Wine crashes.
I got nonpower of 2 dib sections working for some games here, and as far as I remember I create the dib section with the full pow2 size.
The problem is that a render target surface is created, CreateSurface always computes the size using power of 2 width and height. But in GetDC the original size is used in the case of the render target. This mismatch is the source of the problem. I guess we should compute the size in CreateSurface using the original size in the case of the render target. If this is the right fix, I will send a patch.
Christian