[5/6] ddraw: fix palette copying when destination palette is NULL

Alexander Dorofeyev alexd4 at inbox.lv
Mon Dec 31 05:43:37 CST 2007


Hi, Stefan.

Well, I think at least it has to be more correct than existing code. The 
existing code would probably lead to a leak, if that codepath is entered 
(doesn't enter it in AVP1 though) - unless I'm missing something, it will break 
the reference count of "parent" ddraw palette (pal_src) which is maintained as a 
count of how many wined3d surfaces hold its "child" wined3d palette (plus of 
course any temporary references or references held by user). And all surrounding 
code suggests that what it is attempting to do is copy palette from the source 
to target texture.

The thing that it tries this copy palette thing at all (AVP1 doesn't depend on 
that BTW, it does SetPalette on both source and target) - that shouldn't be 
difficult to test, I think I could write it. Beyond that, I don't know, the 
documentation on these old interfaces seems non-existant. Is there a way to 
obtain DX6 docs?

Stefan Dösinger wrote:
> Am Montag, 31. Dezember 2007 03:04:02 schrieb Alexander Dorofeyev:
>> I think there's a bug here. If pal == NULL that implies (because of
>> preceding code) that wine_pal == NULL. So it's setting a NULL wined3d
>> palette to the destination wined3d surface, yet increases reference counter
>> on source palette. I guess it should pass source wined3d palette here, to
>> make any sense. ---
>>     dlls/ddraw/texture.c |    2 +-
>>     1 files changed, 1 insertions(+), 1 deletions(-)
> I am not sure about this, but honestly I don't really know much about 
> IDirect3DTexture2::Load is supposed to work. When I ported ddraw.dll to use 
> wined3d I only did routine adjustments to the code to cope with the wined3d 
> objects. I think Lionel Ulmer wrote the original code, maybe he can comment 
> on it?
> 
> I think we really need a few unit tests for this method. From the docs, it 
> seems that this method is related to IDirect3DDevice9::LoadTexture, maybe we 
> can map it to WineD3D's loadtexture.




More information about the wine-devel mailing list