[PATCH 4/6] wined3d: Make code safe if there are no device palettes.
thunderbird2k at gmx.net
Sun Mar 9 11:09:35 CDT 2008
> There are two types of palettes in wined3d: directx <= 7 style palettes as
> separate interface and d3d >= 8 style device palettes. Some code was
> to device palettes in several places if there's no "old" style palette and
> device palettes to store ddraw primary surface's palette. This patch
> avoids use
> of device palettes for anything else than their direct purpose. It is a
> necessary preparation for making device palettes dynamically allocated as
> (next patch), that prevents ddraw apps from crashing with the latter.
> dlls/wined3d/palette.c | 11 ----
> dlls/wined3d/surface.c | 109
> dlls/wined3d/surface_base.c | 20 ++------
> dlls/wined3d/surface_gdi.c | 51 ++++++++------------
> 4 files changed, 82 insertions(+), 109 deletions(-)
First of all it appears that this patch contains multiple patches (e.g. the direct3d9 getdc p8 check is one). I'll mention some others below. The p8 code is very sensitive to bugs and those are most of the time very hard to fix, so I'm quite strict. Various things need to be tested using testcases before this patch (cut in pieces) can make it in.
In case of read_from_framebuffer when there is no palette set, just return directly instead of adding an if(pal) check. The function won't do anything useful without a palette. Further read_from_framebuffer shouldn't get called from d3d8/9 games anyway as there aren't p8 render targets.
I wonder if we need SetDibColorTable at all in case of GetDC as the data the app will receive in the hdc is 8bit. It wants to draw in it by hand, so I would say that the palette won't matter. It might require a testcase.
The removal of the device palette code from RealizePalette can be done in a separate patch.
I'm not sure if change in SetColorKey is correct in the case a surface doesn't have a palette and uses the primary surface its palette. It doesn't feel right. I think it should fail but this requires a testcase.
Second even if the call to SetDibColorTable is needed I wonder what should happen on surfaces which don't have a palette set. It might be correct to use the palette of the primary surface but it might also just be an illegal situation.
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
More information about the wine-devel