OK, I'll see what I can do with the test. Speaking of tests, I submitted test
for zero vertex rhw case (as suggested by H.Verbeet to avoid future
regressions), but I think it didn't get accepted. Perhaps, you can look through
it and provide some feedback? Would be good to hear the bad news now, before I
submit more wrong stuff (esp. considering that I'm also trying to write a test
for another issue with Aliens vs Predator 1 that I want to fix). I'm attaching
the zero rhw test.
Stefan Dösinger wrote:
Am Montag, 31. Dezember 2007 12:43:37 schrieb Alexander Dorofeyev:
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?
I suspect that we shouldn't copy the palette at all, I think Texture::Load and
friends just copy the bytes over. A test could verify / falsify that. As for
the docs, there were older dx docs available on some websites, but I lost the
link. I'll see if I can find it.
diff --git a/dlls/ddraw/tests/visual.c b/dlls/ddraw/tests/visual.c
index c9a3147..2269d70 100644
--- a/dlls/ddraw/tests/visual.c
+++ b/dlls/ddraw/tests/visual.c
@@ -761,6 +761,66 @@ static void alpha_test(IDirect3DDevice7 *device)
if(backbuffer) IDirectDrawSurface7_Release(backbuffer);
}
+static void rhw_zero_test(IDirect3DDevice7 *device)
+{
+/* Test if it will render a quad correctly when vertex rhw = 0 */
+ HRESULT hr;
+ DWORD color;
+
+ struct {
+ float x, y, z;
+ float rhw;
+ DWORD diffuse;
+ } quad1[] =
+ {
+ {0, 100, 0, 0, 0xffffffff},
+ {0, 0, 0, 0, 0xffffffff},
+ {100, 100, 0, 0, 0xffffffff},
+ {100, 0, 0, 0, 0xffffffff},
+ };
+
+ /* Clear to black */
+ hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0, 0.0, 0);
+ ok(hr == D3D_OK, "Clear failed, hr = %08x\n", hr);
+
+ /* Setup some states that may cause issues */
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_CLIPPING,
FALSE);
+ ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderState returned %08x\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE,
FALSE);
+ ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderState returned %08x\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE,
FALSE);
+ ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderState returned %08x\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_STENCILENABLE,
FALSE);
+ ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderState returned %08x\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device,
D3DRENDERSTATE_ALPHATESTENABLE, FALSE);
+ ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderState returned %08x\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device,
D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
+ ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderState returned %08x\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_CULLMODE,
D3DCULL_NONE);
+ ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderState failed with %08x\n", hr);
+ hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_COLORARG1,
D3DTA_CURRENT);
+ ok(hr == D3D_OK, "SetTextureStageState failed, hr = %08x\n", hr);
+ hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_COLOROP,
D3DTOP_SELECTARG1);
+ ok(hr == D3D_OK, "SetTextureStageState failed, hr = %08x\n", hr);
+
+ hr = IDirect3DDevice7_BeginScene(device);
+ ok(hr == D3D_OK, "IDirect3DDevice7_BeginScene failed with %08x\n", hr);
+
+ if (hr == D3D_OK) {
+ hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP,
D3DFVF_XYZRHW | D3DFVF_DIFFUSE, quad1, 4, 0);
+ ok(hr == D3D_OK, "DrawPrimitive failed, hr = %08x\n", hr);
+
+ hr = IDirect3DDevice7_EndScene(device);
+ ok(hr == D3D_OK, "IDirect3DDevice7_EndScene failed, hr = %08x\n", hr);
+
+ color = (getPixelColor(device, 0, 0)) & 0xffffff;
+ ok(color == 0xffffff, "Got color %08x, expected 00ffffff\n", color);
+
+ color = (getPixelColor(device, 101, 101)) & 0xffffff;
+ ok(color == 0, "Got color %08x, expected 00000000\n", color);
+ }
+}
+
START_TEST(visual)
{
HRESULT hr;
@@ -806,6 +866,7 @@ START_TEST(visual)
fog_test(Direct3DDevice);
offscreen_test(Direct3DDevice);
alpha_test(Direct3DDevice);
+ rhw_zero_test(Direct3DDevice);
cleanup:
releaseObjects();