[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: wined3d: Take abs() of vertex z coordinate as FFP fog coordinate and remove oFog clamp for verte
From:       Stefan Dösinger <stefandoesinger () gmail ! com>
Date:       2014-10-27 13:24:26
Message-ID: 544E478A.40407 () gmail ! com
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 2014-10-27 13:25, schrieb Stefan Dösinger:
>> Testing the oFog clamp behavior is a nice extra -- I wouldn't be
>>  unhappy if a version of the patch that leaves that out could be
>>  committed.
> I'll do some investigation regarding vertex fog + a fragment 
> processing setup that just replaces the color, but otherwise I
> agree.
The attached test combined with your test should show that fixed
function vertex fog indeed output a fog coordinate of abs(z) and does
not merge the fog color into the diffuse color prior to fragment
processing. (no d3d8 and ddraw versions yet)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJUTkeHAAoJEN0/YqbEcdMw4fYP/intJBx+BZem3ev9vMk+ytVw
ok7+rLvWgLCB0+otKqTtcz4C1wXcna07BC4HYMExRclmZKRj3jf2rN6nwLfXzN2n
4ETIXpj9gHP8S4XFM98LXlf43FsmNcNdgJ1RxaA1vIk8IfXSo+knVs6pxSXGUcuL
FPkR7VE1WTkHybNTrseWbNg3vkAmgZBZGiXKvEVbVvrcsS45vC0bI0/L8bHk6tOc
+68/58JDxo+kEee14CrrFarezqxtloNTK3U/jek1hZCje407PG+RL2C++sVBHAQe
unZaXAr7YYkWj5APrSY7xl0aoSV7eeAD3nD7Zv7BMwOiwT2KW1MVTN5txAdaFh54
90qDmSgjm9p5ogXrFh6SOMsEU1+lT6RRDyNmKdRTlpqMWy/dydEJmhE2ncaGZag+
m5MbhSnB123YkihOdmP4/ntUgRHeleeqXMJHhI+FNatoUIVfVueS4RN+x/qkZDq+
9yDENZYt2RC8lP6rxo9JM0RpuehDuYr/8wOKkWVcYNhf9pGOjmF+gR7XF+e5f+fP
hKMfGsBFmPhyEX5Xw2TYYY8iipt8bWZvgJjg1PEUBRQSl4UhRAqNC5PCM+eSVlUW
z2J/2APenE4hRDPxKt2WFKyTTd1M/qdaKA9bq/8pezeXQK10O8LQeO2lYA6nvA72
eAx+qaN90LxFVbcrPsuz
=haWb
-----END PGP SIGNATURE-----

["0022-d3d9-tests-Vertex-fog-is-calculated-after-fragment-p.patch" (text/x-diff)]

From a1e8cf684b77533facb9f719a6cb1250a76df87c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan Dösinger?= <stefan@codeweavers.com>
Date: Mon, 27 Oct 2014 14:11:39 +0100
Subject: [PATCH 22/22] d3d9/tests: Vertex fog is calculated after fragment
 processing.
Reply-To: wine-devel <wine-devel@winehq.org>

This test checks if vertex fog merges the fog color into the vertices'
diffuse color after vertex processing or if it merges the fog color with
the result of the fragment processing setup.
---
 dlls/d3d9/tests/visual.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 117c8eb..e19aa8d 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -16660,6 +16660,82 @@ done:
     DestroyWindow(window);
 }

+static void vertex_fog_test(void)
+{
+    HRESULT hr;
+    IDirect3DDevice9 *device;
+    IDirect3D9 *d3d;
+    ULONG refcount;
+    HWND window;
+    DWORD color;
+    static const struct
+    {
+        struct vec3 position;
+        D3DCOLOR diffuse;
+    }
+    quad[] +    {
+        {{-1.0f, -1.0f, 0.5f}, 0xffff0000},
+        {{-1.0f,  1.0f, 0.5f}, 0xffff0000},
+        {{ 1.0f, -1.0f, 0.5f}, 0xffff0000},
+        {{ 1.0f,  1.0f, 0.5f}, 0xffff0000},
+    };
+
+    window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+            0, 0, 640, 480, NULL, NULL, NULL, NULL);
+    d3d = Direct3DCreate9(D3D_SDK_VERSION);
+    ok(!!d3d, "Failed to create a D3D object.\n");
+    if (!(device = create_device(d3d, window, window, TRUE)))
+    {
+        skip("Failed to create a D3D device, skipping tests.\n");
+        IDirect3D9_Release(d3d);
+        DestroyWindow(window);
+        return;
+    }
+
+    hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00808080, 0.0f, 0);
+    ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
+
+    hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE);
+    ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+    hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, FALSE);
+    ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+    hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE);
+    ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+    hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00);
+    ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+    hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR);
+    ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+    hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+    ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr);
+    hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
+    ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr);
+    hr = IDirect3DDevice9_SetRenderState(device, D3DRS_TEXTUREFACTOR, 0x000000ff);
+    ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+    hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
+    ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr);
+
+    hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE);
+    ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr);
+    hr = IDirect3DDevice9_BeginScene(device);
+    ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+    hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));
+    ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+    hr = IDirect3DDevice9_EndScene(device);
+    ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+    color = getPixelColor(device, 320, 240);
+    ok(color_match(color, 0x0008080, 1), "Got unexpected color 0x%08x.\n", color);
+    hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
+    ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
+
+    refcount = IDirect3DDevice9_Release(device);
+    ok(!refcount, "Device has %u references left.\n", refcount);
+    IDirect3D9_Release(d3d);
+    DestroyWindow(window);
+}
+
 START_TEST(visual)
 {
     D3DADAPTER_IDENTIFIER9 identifier;
@@ -16767,4 +16843,5 @@ START_TEST(visual)
     resz_test();
     stencil_cull_test();
     test_per_stage_constant();
+    vertex_fog_test();
 }
--
2.0.4


["0022-d3d9-tests-Vertex-fog-is-calculated-after-fragment-p.patch.sig" (application/pgp-signature)]



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic