Module: wine
Branch: master
Commit: 1e0b1e5487953858dfc0abfff58880ec9a3b000f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1e0b1e5487953858dfc0abfff…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Fri Jun 19 11:04:34 2009 +0200
d3d9: Use color_match() in the fog test.
---
dlls/d3d9/tests/visual.c | 34 ++++++++++++++--------------------
1 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index fff1f88..44ae50e 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -774,8 +774,7 @@ struct sVertexT {
static void fog_test(IDirect3DDevice9 *device)
{
HRESULT hr;
- DWORD color;
- BYTE r, g, b;
+ D3DCOLOR color;
float start = 0.0f, end = 1.0f;
D3DCAPS9 caps;
int i;
@@ -909,13 +908,13 @@ static void fog_test(IDirect3DDevice9 *device)
color = getPixelColor(device, 160, 360);
ok(color == 0x00FF0000, "Untransformed vertex with no table or vertex fog has color %08x\n", color);
color = getPixelColor(device, 160, 120);
- ok(color == 0x0000FF00 || color == 0x0000FE00, "Untransformed vertex with linear vertex fog has color %08x\n", color);
+ ok(color_match(color, 0x0000ff00, 1), "Untransformed vertex with linear vertex fog has color %08x\n", color);
color = getPixelColor(device, 480, 120);
ok(color == 0x00FFFF00, "Transformed vertex with linear vertex fog has color %08x\n", color);
if(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE)
{
color = getPixelColor(device, 480, 360);
- ok(color == 0x0000FF00 || color == 0x0000FE00, "Transformed vertex with linear table fog has color %08x\n", color);
+ ok(color_match(color, 0x0000ff00, 1), "Transformed vertex with linear table fog has color %08x\n", color);
}
else
{
@@ -979,9 +978,9 @@ static void fog_test(IDirect3DDevice9 *device)
}
IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
color = getPixelColor(device, 160, 360);
- ok(color == 0x0000FF00 || color == 0x0000FE00, "Untransformed vertex with vertex fog and z = 0.1 has color %08x\n", color);
+ ok(color_match(color, 0x0000ff00, 1), "Untransformed vertex with vertex fog and z = 0.1 has color %08x\n", color);
color = getPixelColor(device, 160, 120);
- ok(color == 0x0000FF00 || color == 0x0000FE00, "Untransformed vertex with vertex fog and z = 1.0 has color %08x\n", color);
+ ok(color_match(color, 0x0000ff00, 1), "Untransformed vertex with vertex fog and z = 1.0 has color %08x\n", color);
color = getPixelColor(device, 480, 120);
ok(color == 0x00FFFF00, "Transformed vertex with linear vertex fog has color %08x\n", color);
@@ -1026,21 +1025,16 @@ static void fog_test(IDirect3DDevice9 *device)
}
IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
color = getPixelColor(device, 160, 360);
- ok(color == 0x0000FF00 || color == 0x0000FE00, "Reversed %s fog: z=0.1 has color 0x%08x, expected 0x0000ff00 or 0x0000fe00\n", mode, color);
+ ok(color_match(color, 0x0000ff00, 1),
+ "Reversed %s fog: z=0.1 has color 0x%08x, expected 0x0000ff00 or 0x0000fe00\n", mode, color);
color = getPixelColor(device, 160, 120);
- r = (color & 0x00ff0000) >> 16;
- g = (color & 0x0000ff00) >> 8;
- b = (color & 0x000000ff);
- ok(r == 0x00 && g >= 0x29 && g <= 0x2d && b >= 0xd2 && b <= 0xd6,
- "Reversed %s fog: z=0.7 has color 0x%08x\n", mode, color);
+ ok(color_match(color, D3DCOLOR_ARGB(0x00, 0x00, 0x2b, 0xd4), 2),
+ "Reversed %s fog: z=0.7 has color 0x%08x\n", mode, color);
color = getPixelColor(device, 480, 120);
- r = (color & 0x00ff0000) >> 16;
- g = (color & 0x0000ff00) >> 8;
- b = (color & 0x000000ff);
- ok(r == 0x00 && g >= 0xa8 && g <= 0xac && b >= 0x53 && b <= 0x57,
- "Reversed %s fog: z=0.4 has color 0x%08x\n", mode, color);
+ ok(color_match(color, D3DCOLOR_ARGB(0x00, 0x00, 0xaa, 0x55), 2),
+ "Reversed %s fog: z=0.4 has color 0x%08x\n", mode, color);
color = getPixelColor(device, 480, 360);
ok(color == 0x000000ff, "Reversed %s fog: z=0.9 has color 0x%08x, expected 0x000000ff\n", mode, color);
@@ -6679,7 +6673,7 @@ static void fog_srgbwrite_test(IDirect3DDevice9 *device)
1.0, 1.0, 0.1
};
HRESULT hr;
- DWORD color;
+ D3DCOLOR color;
IDirect3DDevice9_GetDirect3D(device, &d3d);
/* Ask for srgb writing on D3DRTYPE_TEXTURE. Some Windows drivers do not report it on surfaces.
@@ -6747,8 +6741,8 @@ static void fog_srgbwrite_test(IDirect3DDevice9 *device)
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr);
color = getPixelColor(device, 160, 360);
- ok(color == 0x00808080 || color == 0x007f7f7f || color == 0x00818181,
- "Fog with D3DRS_SRGBWRITEENABLE returned color 0x%08x, expected 0x00808080\n", color);
+ ok(color_match(color, 0x00808080, 1),
+ "Fog with D3DRS_SRGBWRITEENABLE returned color 0x%08x, expected 0x00808080\n", color);
}
static void alpha_test(IDirect3DDevice9 *device)
Module: wine
Branch: master
Commit: dcc490e82ff47ae178353927e2ba28d213f3e090
URL: http://source.winehq.org/git/wine.git/?a=commit;h=dcc490e82ff47ae178353927e…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Fri Jun 19 11:04:31 2009 +0200
wined3d: Don't load a rendertarget just because alpha test is enabled.
Unlike the depth test, the alpha test doesn't compare to the existing fragment
but against a reference value.
---
dlls/wined3d/drawprim.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 5ff7477..c644aa2 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -554,22 +554,21 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT numberOfVertice
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSurfaceImpl *target;
- BOOL load_rt, modify_rt;
unsigned int i;
if (!index_count) return;
- load_rt = This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE]
- || This->stateBlock->renderState[WINED3DRS_ALPHATESTENABLE]
- || This->stateBlock->renderState[WINED3DRS_COLORKEYENABLE];
- modify_rt = This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE];
-
- /* Invalidate the back buffer memory so LockRect will read it the next time */
- for(i = 0; i < GL_LIMITS(buffers); i++) {
- target = (IWineD3DSurfaceImpl *) This->render_targets[i];
- if (target) {
- if (load_rt) IWineD3DSurface_LoadLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, NULL);
- if (modify_rt) IWineD3DSurface_ModifyLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, TRUE);
+ if (This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE])
+ {
+ /* Invalidate the back buffer memory so LockRect will read it the next time */
+ for (i = 0; i < GL_LIMITS(buffers); ++i)
+ {
+ target = (IWineD3DSurfaceImpl *)This->render_targets[i];
+ if (target)
+ {
+ IWineD3DSurface_LoadLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, NULL);
+ IWineD3DSurface_ModifyLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, TRUE);
+ }
}
}