Module: wine
Branch: master
Commit: 35e0bb8225bb9c9b654f19b21560756f4e455da1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=35e0bb8225bb9c9b654f19b21…
Author: Roderick Colenbrander <thunderbird2k(a)gmx.net>
Date: Tue Feb 5 13:25:18 2008 +0100
wined3d: Redownload the surface data in case of a palette change. This fixes a lot of redrawing problems in Red Alert.
---
dlls/wined3d/surface_base.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index 8a6f546..d733852 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -297,8 +297,9 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_RealizePalette(IWineD3DSurface *iface) {
if(This->resource.format == WINED3DFMT_P8 ||
This->resource.format == WINED3DFMT_A8P8)
{
- if(!This->Flags & SFLAG_INSYSMEM) {
- FIXME("Palette changed with surface that does not have an up to date system memory copy\n");
+ if(!(This->Flags & SFLAG_INSYSMEM)) {
+ TRACE("Palette changed with surface that does not have an up to date system memory copy\n");
+ IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL);
}
TRACE("Dirtifying surface\n");
IWineD3DSurface_ModifyLocation(iface, SFLAG_INSYSMEM, TRUE);
Module: wine
Branch: master
Commit: f84589ea1fd7aae9a2c2c70a6124951aada9e889
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f84589ea1fd7aae9a2c2c70a6…
Author: Roderick Colenbrander <thunderbird2k(a)gmx.net>
Date: Tue Jan 29 22:42:32 2008 +0100
wined3d: Reload the palette on a color key change. This fixes the ddex4/ddex5 samples from the dx7 sdk.
---
dlls/wined3d/surface.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index a34c0cf..6cc3b5a 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2102,11 +2102,18 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BO
/* To perform the color key conversion we need a sysmem copy of
* the surface. Make sure we have it
*/
+
IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL);
+ /* Make sure the texture is reloaded because of the color key change, this kills performance though :( */
+ /* TODO: This is not necessarily needed with hw palettized texture support */
+ This->Flags &= ~SFLAG_INTEXTURE;
} else if(palette9_changed(This)) {
TRACE("Reloading surface because the d3d8/9 palette was changed\n");
/* TODO: This is not necessarily needed with hw palettized texture support */
IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL);
+
+ /* Make sure the texture is reloaded because of the color key change, this kills performance though :( */
+ This->Flags &= ~SFLAG_INTEXTURE;
} else {
TRACE("surface is already in texture\n");
return WINED3D_OK;
Module: wine
Branch: master
Commit: 1b78457bc6b27c9c781de314c06dad392f17e941
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1b78457bc6b27c9c781de314c…
Author: Roderick Colenbrander <thunderbird2k(a)gmx.net>
Date: Tue Jan 29 20:08:25 2008 +0100
wined3d: Make sure to set the color key when it is needed including for index_in_alpha.
---
dlls/wined3d/surface.c | 31 ++++++++++++++-----------------
1 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 44507e7..a34c0cf 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1930,15 +1930,14 @@ static void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4]
table[i][1] = device->palettes[device->currentPalette][i].peGreen;
table[i][2] = device->palettes[device->currentPalette][i].peBlue;
- if(index_in_alpha) {
+ /* BltOverride uses a GL_ALPHA_TEST based on GL_NOT_EQUAL 0, so the alpha component
+ of pixels that should be masked away should be 0. When inde_in_alpha is set,
+ we will store the palette index (the glReadPixels code reads GL_ALPHA back)
+ or else we store 0xff. */
+ if(colorkey && (i >= This->SrcBltCKey.dwColorSpaceLowValue) && (i <= This->SrcBltCKey.dwColorSpaceHighValue)) {
+ table[i][3] = 0;
+ } else if(index_in_alpha) {
table[i][3] = i;
- } else if (colorkey &&
- (i >= This->SrcBltCKey.dwColorSpaceLowValue) &&
- (i <= This->SrcBltCKey.dwColorSpaceHighValue)) {
- /* We should maybe here put a more 'neutral' color than the standard bright purple
- one often used by application to prevent the nice purple borders when bi-linear
- filtering is on */
- table[i][3] = 0x00;
} else {
table[i][3] = 0xFF;
}
@@ -1951,16 +1950,14 @@ static void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4]
table[i][1] = pal->palents[i].peGreen;
table[i][2] = pal->palents[i].peBlue;
- if(index_in_alpha) {
- table[i][3] = i;
- }
- else if (colorkey &&
- (i >= This->SrcBltCKey.dwColorSpaceLowValue) &&
- (i <= This->SrcBltCKey.dwColorSpaceHighValue)) {
- /* We should maybe here put a more 'neutral' color than the standard bright purple
- one often used by application to prevent the nice purple borders when bi-linear
- filtering is on */
+ /* BltOverride uses a GL_ALPHA_TEST based on GL_NOT_EQUAL 0, so the alpha component
+ of pixels that should be masked away should be 0. When inde_in_alpha is set,
+ we will store the palette index (the glReadPixels code reads GL_ALPHA back)
+ or else we store 0xff. */
+ if(colorkey && (i >= This->SrcBltCKey.dwColorSpaceLowValue) && (i <= This->SrcBltCKey.dwColorSpaceHighValue)) {
table[i][3] = 0x00;
+ } else if(index_in_alpha) {
+ table[i][3] = i;
} else if(pal->Flags & WINEDDPCAPS_ALPHA) {
table[i][3] = pal->palents[i].peFlags;
} else {