<div dir="auto">Hi Axel,<div dir="auto"><br></div><div dir="auto">Thanks for testing with 3dmark06. I tried to run it without luck yesterday, apparently there is some winetrick that i am missing...</div><div dir="auto"><br></div><div dir="auto">Regarding the linear sampler state. I havent seen any case where setting the filters to LINEAR disables fetch4. From the tests, it only changes slightly the results on R500 AMD by changing the 0.5 texel offset.</div><div dir="auto"><br></div><div dir="auto">My guess, is that all apps that use fetch4 have that into account, and disable it with LODBIAS explicitly.</div><div dir="auto">Sampling a 1x1 L8 texture with fetch4 will return the same value on RGBA, which is similar to a normal sample.</div><div dir="auto"><br></div><div dir="auto">Regarding 3D textures, all implementations behave differently. Since 3D textures have 8 texels, returning the 4 texels used for linear sampling is quite ambiguous.</div><div dir="auto">Intel decides to sample at .xy0 and ignore the Z axis.</div><div dir="auto">Some AMD devices disable fetch4, some others sample at the nearest z coordinate.</div><div dir="auto"><br></div><div dir="auto">In my opinion, we are hitting implementation bugs/corner cases. It is simpler to just keep fetch4 off there. Especially since implementing it is quite difficult.</div><div dir="auto"><br></div><div dir="auto">The tests of 3D textures in wine are just testing that fetch4 is off (no todo, it should be always off).</div><div dir="auto">But on windows, it tests that some of the 4 possibles cases seen on AMD and intel is obtained.</div><div dir="auto">How useful those tests are, i am not sure. I just left them there for reference.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Maybe we should remove those tests on windows, or even add todo in some of the cases for 3d. But in that case, what implementation do we want to follow?</div><div dir="auto"><br></div><div dir="auto">Best regards,</div><div dir="auto">Daniel</div><br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Sat, 2 Feb 2019, 19:14 Axel Davy <<a href="mailto:davyaxel0@gmail.com">davyaxel0@gmail.com</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Apparently 3DMark06 believes somehow that LINEAR disables FETCH4.<br>
It sets MIPFILTER, MINFILTER and MAGFILTER to LINEAR,<br>
and resets ADDRESSV, ADDRESSU and MIPMAPLODBIAS (1, 1, 0 respectively)<br>
then behaves as if FETCH4 was disabled (it later disables it definitely <br>
with the MIPMAPLODBIAS setting).<br>
<br>
I don't see any obvious visual glitch, though. The texture sampled with <br>
FETCH4 which isn't meant to be sampled with it (looking at how the <br>
shader values are used) is a D3DFMT_L8 of size 1x1...<br>
<br>
I think all this points out that one has to be very careful about FETCH4 <br>
corner cases.<br>
<br>
Thus I would suggest adding more formats and checks to your code, like <br>
for example INTZ, ATI1, ATI2 ?<br>
<br>
<br>
For the part "Currently unimplemented on wine due to lack of GL <br>
functionality to cast 3D->2DArray",<br>
shouldn't the test be with a wine_todo rather than a isWin check ?<br>
<br>
<br>
Axel<br>
<br>
On 01/02/2019 01:56, Daniel Ansorregui wrote:<br>
> - Test texld/texldp/texldd/texldb/texldl in PS and FFP<br>
> - Test supported/unsupported texture formats on FFP/texld/texldp<br>
> - Test 3dtextures (Disabled, each platform has different results)<br>
> - Test depth textures DF16/DF24 with fetch4 on PS (FFP is broken on windows)<br>
><br>
> Signed-off-by: Daniel Ansorregui <<a href="mailto:mailszeros@gmail.com" target="_blank" rel="noreferrer">mailszeros@gmail.com</a>><br>
> ---<br>
> dlls/d3d9/tests/visual.c | 644 +++++++++++++++++++++++++++++++++++++++<br>
> 1 file changed, 644 insertions(+)<br>
><br>
> diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c<br>
> index c06acb77d4..028fc23078 100644<br>
> --- a/dlls/d3d9/tests/visual.c<br>
> +++ b/dlls/d3d9/tests/visual.c<br>
> @@ -15234,6 +15234,649 @@ done:<br>
> DestroyWindow(window);<br>
> }<br>
> <br>
> +static void fetch4_test(void)<br>
> +{<br>
> + static const DWORD vs_code[] =<br>
> + {<br>
> + 0xfffe0300, /* vs_3_0 */<br>
> + 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position v0 */<br>
> + 0x0200001f, 0x80000005, 0x900f0001, /* dcl_texcoord v1 */<br>
> + 0x0200001f, 0x80000000, 0xe00f0000, /* dcl_position o0 */<br>
> + 0x0200001f, 0x80000005, 0xe00f0001, /* dcl_texcoord o1 */<br>
> + 0x02000001, 0xe00f0000, 0x90e40000, /* mov o0, v0 */<br>
> + 0x02000001, 0xe00f0001, 0x90e40001, /* mov o1, v1 */<br>
> + 0x0000ffff<br>
> + };<br>
> + static const DWORD ps_code_texld[] =<br>
> + {<br>
> + /* Test texld */<br>
> + 0xffff0300, /* ps_3_0 */<br>
> + 0x0200001f, 0x80000005, 0x900f0000, /* dcl_texcoord v0 */<br>
> + 0x0200001f, 0x90000000, 0xa00f0800, /* dcl_2d s0 */<br>
> + 0x03000042, 0x800f0000, 0x90e40000, 0xa0e40800, /* texld r0, v0, s0 */<br>
> + 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */<br>
> + 0x0000ffff /* end */<br>
> + };<br>
> + static const DWORD ps_code_texldp[] =<br>
> + {<br>
> + /* Test texldp : AMD and Wine uses the projection on Fetch4, Intel UHD 620 does not apply it */<br>
> + 0xffff0300, /* ps_3_0 */<br>
> + 0x0200001f, 0x80000005, 0x900f0000, /* dcl_texcoord v0 */<br>
> + 0x0200001f, 0x90000000, 0xa00f0800, /* dcl_2d s0 */<br>
> + 0x05000051, 0xa00f0000, 0x00000000, 0x00000000, 0x00000000, 0x40000000, /* def c0, 0.0, 0.0, 0.0, 2.0 */<br>
> + 0x02000001, 0x80030000, 0x90540000, /* mov r0.xy, v0.xyyy */<br>
> + 0x02000001, 0x800c0000, 0xa0fe0000, /* mov <a href="http://r0.zw" rel="noreferrer noreferrer" target="_blank">r0.zw</a>, c0.zwww */<br>
> + 0x03010042, 0x800f0000, 0x80e40000, 0xa0e40800, /* texldp r0, r0, s0 */<br>
> + 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */<br>
> + 0x0000ffff, /* end */<br>
> + };<br>
> + static const DWORD ps_code_texldd[] =<br>
> + {<br>
> + /* Test texldd : Fetch4 uses the same D3D state as LOD bias, therefore disables LOD.<br>
> + * Sampling LOD gradient should be ignored. Same result as texld */<br>
> + /* NOTE: Radeon HD 5700 driver 8.17.10.1404 disables Fetch4 on texldb */<br>
> + 0xffff0300, /* ps_3_0 */<br>
> + 0x0200001f, 0x80000005, 0x900f0000, /* dcl_texcoord v0 */<br>
> + 0x0200001f, 0x90000000, 0xa00f0800, /* dcl_2d s0 */<br>
> + 0x05000051, 0xa00f0000, 0x3f000000, 0x3f000000, 0x3f000000, 0x3f000000, /* def c0, 0.5, 0.5, 0.5, 0.5 */<br>
> + 0x05000051, 0xa00f0001, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, /* def c0, 1.0, 1.0, 1.0, 1.0 */<br>
> + 0x02000001, 0x800f0002, 0xa0e40000, /* mov r2, c0 */<br>
> + 0x0500005d, 0x800f0000, 0x90e40000, 0xa0e40800, 0xa0e40000, 0x80e40002, /* texldd r0, v0, s0, c0, r2 */<br>
> + 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */<br>
> + 0x0000ffff, /* end */<br>
> + };<br>
> + static const DWORD ps_code_texldb[] =<br>
> + {<br>
> + /* Test texldb : Fetch4 uses the same D3D state as LOD bias, therefore disables LOD.<br>
> + * Same result as texld */<br>
> + /* NOTE: Radeon HD 5700 driver 8.17.10.1404 disables Fetch4 on texldb */<br>
> + 0xffff0300, /* ps_3_0 */<br>
> + 0x0200001f, 0x80000005, 0x900f0000, /* dcl_texcoord v0 */<br>
> + 0x0200001f, 0x90000000, 0xa00f0800, /* dcl_2d s0 */<br>
> + 0x05000051, 0xa00f0000, 0x00000000, 0x00000000, 0x40a00000, 0x40a00000, /* def c0, 0.0, 0.0, 5.0, 5.0 */<br>
> + 0x03000002, 0x800f0000, 0x90e40000, 0xa0e40000, /* add r0, v0, c0 */<br>
> + 0x03020042, 0x800f0000, 0x80e40000, 0xa0e40800, /* texldb r0, r0, s0 */<br>
> + 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */<br>
> + 0x0000ffff, /* end */<br>
> + };<br>
> + static const DWORD ps_code_texldl[] =<br>
> + {<br>
> + /* Test texldl : Fetch4 uses the same D3D state as LOD bias, therefore disables LOD.<br>
> + * The explicit LOD level is then ignored. Same result as texld */<br>
> + /* NOTE: Radeon HD 5700 driver 8.17.10.1404 disables Fetch4 on texldl */<br>
> + 0xffff0300, /* ps_3_0 */<br>
> + 0x0200001f, 0x80000005, 0x900f0000, /* dcl_texcoord v0 */<br>
> + 0x0200001f, 0x90000000, 0xa00f0800, /* dcl_2d s0 */<br>
> + 0x05000051, 0xa00f0000, 0x00000000, 0x00000000, 0x3f000000, 0x3f000000, /* def c0, 0.0, 0.0, 0.5, 0.5 */<br>
> + 0x03000002, 0x800f0000, 0x90e40000, 0xa0e40000, /* add r0, v0, c0 */<br>
> + 0x0300005f, 0x800f0000, 0x80e40000, 0xa0e40800, /* texldl r0, r0, s0 */<br>
> + 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */<br>
> + 0x0000ffff, /* end */<br>
> + };<br>
> + static const DWORD ps_code_3d[] =<br>
> + {<br>
> + 0xffff0300, /* ps_3_0 */<br>
> + 0x0200001f, 0x80000005, 0x900f0000, /* dcl_texcoord v0 */<br>
> + 0x0200001f, 0xa0000000, 0xa00f0800, /* dcl_volume s0 */<br>
> + 0x03000042, 0x800f0000, 0x90e40000, 0xa0e40800, /* texld r0, v0, s0 */<br>
> + 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */<br>
> + 0x0000ffff /* end */<br>
> + };<br>
> +<br>
> + static const struct<br>
> + {<br>
> + struct vec3 position;<br>
> + struct vec3 texcoord;<br>
> + }<br>
> + quad[] =<br>
> + {<br>
> + /* Tilted on Z axis to get a depth gradient in the depth test */<br>
> + /* NOTE: Using 0.55f-0.6f to avoid rounding errors on depth tests */<br>
> + {{-1.0f, 1.0f, 1.0f}, {0.0f,0.0f,0.6f} },<br>
> + {{ 1.0f, 1.0f, 0.0f}, {1.0f,0.0f,0.6f} },<br>
> + {{-1.0f,-1.0f, 0.0f}, {0.0f,1.0f,0.6f} },<br>
> + {{ 1.0f,-1.0f, 0.0f}, {1.0f,1.0f,0.6f} }<br>
> + };<br>
> +<br>
> + static const struct<br>
> + {<br>
> + UINT x[4], y[4]; /* Matrix Sampling positions */<br>
> + D3DCOLOR color_amd[16]; /* AMD original implementation swizzle with -0.5 texel coord */<br>
> + D3DCOLOR color_intel[16]; /* Intel UHD 620 implementation swizzle with no texel coord correction */<br>
> + /* Wine follows the AMD immplementation, and consider an error the Intel one results<br>
> + * However, the test will accept as valid the intel only if running on windows */<br>
> + D3DCOLOR color_3d_fetch4_off[16];<br>
> + D3DCOLOR color_fetch4_off[16];<br>
> + }<br>
> + expected_colors =<br>
> + {<br>
> + { 40, 200, 360, 520},<br>
> + { 30, 150, 270, 390},<br>
> + /* AMD implementation - Wine implementation */<br>
> + {0x131202f2, 0x1211f2f1, 0x1110f101, 0x10130102,<br>
> + 0x02f204f4, 0xf2f1f4f3, 0xf101f303, 0x01020304,<br>
> + 0x04f42322, 0xf4f32221, 0xf3032120, 0x03042023,<br>
> + 0x23221312, 0x22211211, 0x21201110, 0x20231013},<br>
> + /* Intel UHD 620 implementation */<br>
> + {0x23102013, 0x22132312, 0x21122211, 0x20112110,<br>
> + 0x13011002, 0x120213f2, 0x11f212f1, 0x10f11101,<br>
> + 0x02030104, 0xf20402f4, 0xf1f4f2f3, 0x01f3f103,<br>
> + 0x04200323, 0xf4230422, 0xf322f421, 0x0321f320},<br>
> + /* Fetch4 off on 3D textures */<br>
> + {0xff020202, 0xfff2f2f2, 0xfff1f1f1, 0xff010101,<br>
> + 0xff050505, 0xfff4f4f4, 0xfff3f3f3, 0xff030303,<br>
> + 0xff232323, 0xff222222, 0xff212121, 0xff202020,<br>
> + 0xff131313, 0xff121212, 0xff111111, 0xff101010},<br>
> + /* Fetch4 off on 2D texture */<br>
> + {0x13131313, 0x12121212, 0x11111111, 0x10101010,<br>
> + 0x02020202, 0xf2f2f2f2, 0xf1f1f1f1, 0x01010101,<br>
> + 0x04040404, 0xf4f4f4f4, 0xf3f3f3f3, 0x03030303,<br>
> + 0x23232323, 0x22222222, 0x21212121, 0x20202020}<br>
> + };<br>
> +<br>
> + static const DWORD fetch4_data[] = {0x10111213,<br>
> + 0x01f1f202,<br>
> + 0x03f3f404,<br>
> + 0x20212223};<br>
> +<br>
> + static struct<br>
> + {<br>
> + IDirect3DVertexShader9 *vs;<br>
> + IDirect3DPixelShader9 *ps;<br>
> + const DWORD *ps_code;<br>
> + const char *name;<br>
> + BOOL projection; /* The results should be projected (zoomed by 2) */<br>
> + BOOL allow_off; /* Do not enforce Fetch4 enabled on this one on Windows */<br>
> + }<br>
> + shaders[] =<br>
> + {<br>
> + {NULL, NULL, NULL, "FFP", FALSE, FALSE},<br>
> + {NULL, NULL, ps_code_texld, "texld", FALSE, FALSE},<br>
> + {NULL, NULL, ps_code_texldp, "texldp", TRUE, FALSE},<br>
> + {NULL, NULL, ps_code_texldd, "texldd", FALSE, TRUE},<br>
> + {NULL, NULL, ps_code_texldb, "texldb", FALSE, TRUE},<br>
> + {NULL, NULL, ps_code_texldl, "texldl", FALSE, TRUE},<br>
> + };<br>
> +<br>
> + static const struct<br>
> + {<br>
> + D3DFORMAT format; /* The format of the texture */<br>
> + DWORD data; /* The data we will write to the first line */<br>
> + UINT x, y; /* Where we expect the color to be */<br>
> + BOOL broken_wine; /* Do not check it on wine because is known ot be broken */<br>
> + D3DCOLOR color_amd[3]; /* Wine results. Results on AMD swizzle + texture offset */<br>
> + D3DCOLOR color_intel[3]; /* Results with intel UHD 620, intel swizzle + no texel offset */<br>
> + }<br>
> + format_tests[] =<br>
> + {<br>
> + /* Enabled formats */<br>
> + {D3DFMT_L8, 0xff804010, 360, 270, FALSE,<br>
> + {0x00004010, 0x00004010, 0x10400000},<br>
> + {0x40001000, 0x40001000, 0x40001000}<br>
> + },<br>
> + {D3DFMT_L16, 0xff804010, 360, 270, FALSE,<br>
> + {0x0000ff40, 0x0000ff40, 0x40ff0000},<br>
> + {0xff004000, 0xff004000, 0xff004000}<br>
> + },<br>
> + {D3DFMT_R16F, 0x38003c00, 360, 270, FALSE,<br>
> + {0x000080ff, 0x000080ff, 0xff800000},<br>
> + {0x8000ff00, 0x8000ff00, 0x8000ff00}<br>
> + },<br>
> + {D3DFMT_R32F, 0x3f000000, 360, 270, FALSE,<br>
> + {0x00000080, 0x00000080, 0x80000000},<br>
> + {0x00008000, 0x00008000, 0x00008000}<br>
> + },<br>
> +<br>
> + /* Disabled format on Intel, enabled on AMD, broken on wine<br>
> + * since it is implemented with GL_ALPHA, and fetch4 will fetch RED value */<br>
> + {D3DFMT_A8, 0xff804010, 360, 270, TRUE,<br>
> + {0x00004010, 0x00004010, 0x10400000},<br>
> + {0x00000000, 0x00000000, 0x00000000}<br>
> + },<br>
> +<br>
> + /* Disabled format */<br>
> + {D3DFMT_A8R8G8B8, 0xff804010, 360, 270, FALSE,<br>
> + {0x00000000, 0x00000000, 0xff804010},<br>
> + {0x00000000, 0x00000000, 0xff804010}<br>
> + },<br>
> + };<br>
> +<br>
> + static const struct<br>
> + {<br>
> + D3DCOLOR color_off, color_amd, color_intel;<br>
> + UINT x, y;<br>
> + }<br>
> + expected_depth[][4] =<br>
> + {<br>
> + {<br>
> + /* This is the expected result for shadow samplers */<br>
> + {0xffffffff,0xffffffff,0xffffffff, 20, 15},<br>
> + {0xffffffff,0xffffffff,0xffffffff,260, 15},<br>
> + {0x00000000,0x00000000,0x00000000, 20,255},<br>
> + {0x00000000,0x00000000,0x00000000,260,135},<br>
> + },<br>
> + {<br>
> + /* This is the expected result with DF16 */<br>
> + {0xfffe0000,0xfedfdfbf,0x202000ff, 20, 15},<br>
> + {0xff9f0000,0x9f7f7f5f,0x00bf009f,260, 15},<br>
> + {0xff800000,0x7f5f5f3f,0x9f000080, 20,255},<br>
> + {0xff600000,0x5f3f3f1f,0x80809f60,260,135},<br>
> + },<br>
> + {<br>
> + /* This is the expected result with DF24 */<br>
> + {0xffff0000,0xffdfdfbf,0x202000ff, 20, 15},<br>
> + {0xff9f0000,0x9f7f7f5f,0x00bf009f,260, 15},<br>
> + {0xff800000,0x7f5f5f3f,0x9f000080, 20,255},<br>
> + {0xff600000,0x5f3f3f1f,0x80809f60,260,135},<br>
> + }<br>
> + };<br>
> +<br>
> + static const struct<br>
> + {<br>
> + D3DFORMAT format;<br>
> + const char *name;<br>
> + UINT index;<br>
> + }<br>
> + depth_tests[] =<br>
> + {<br>
> + {D3DFMT_D16_LOCKABLE, "D16_LOCKABLE", 0},<br>
> + {D3DFMT_D32, "D32", 0},<br>
> + {D3DFMT_D15S1, "D15S1", 0},<br>
> + {D3DFMT_D24S8, "D24S8", 0},<br>
> + {D3DFMT_D24X8, "D24X8", 0},<br>
> + {D3DFMT_D24X4S4, "D24X4S4", 0},<br>
> + {D3DFMT_D16, "D16", 0},<br>
> + {D3DFMT_D32F_LOCKABLE, "D32F_LOCKABLE", 0},<br>
> + {D3DFMT_D24FS8, "D24FS8", 0},<br>
> + {MAKEFOURCC('D','F','1','6'), "DF16", 1},<br>
> + {MAKEFOURCC('D','F','2','4'), "DF24", 2},<br>
> + };<br>
> +<br>
> + const BOOL isWin = strcmp(winetest_platform, "wine");<br>
> +<br>
> + IDirect3DSurface9 *original_ds, *original_rt, *rt;<br>
> + IDirect3DVolumeTexture9 *texture3D;<br>
> + IDirect3DPixelShader9 *ps_3d;<br>
> + struct surface_readback rb;<br>
> + IDirect3DVertexShader9 *vs;<br>
> + IDirect3DTexture9 *texture;<br>
> + IDirect3DDevice9 *device;<br>
> + D3DLOCKED_RECT lr;<br>
> + D3DLOCKED_BOX lb;<br>
> + IDirect3D9 *d3d;<br>
> + ULONG refcount;<br>
> + D3DCAPS9 caps;<br>
> + UINT i, j, k;<br>
> + HWND window;<br>
> + HRESULT hr;<br>
> +<br>
> + window = create_window();<br>
> + d3d = Direct3DCreate9(D3D_SDK_VERSION);<br>
> + ok(!!d3d, "Failed to create a D3D object.\n");<br>
> + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,<br>
> + D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, MAKEFOURCC('D','F','2','4'))))<br>
> + {<br>
> + skip("No DF24 support, skipping FETCH4 test.\n");<br>
> + goto done;<br>
> + }<br>
> + if (!(device = create_device(d3d, window, window, TRUE)))<br>
> + {<br>
> + skip("Failed to create a D3D device, skipping tests.\n");<br>
> + goto done;<br>
> + }<br>
> +<br>
> + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);<br>
> + ok(SUCCEEDED(hr), "GetDeviceCaps failed, hr %#x.\n", hr);<br>
> + if (caps.PixelShaderVersion < D3DPS_VERSION(3, 0))<br>
> + {<br>
> + skip("No pixel shader 3.0 support, skipping FETCH4 test.\n");<br>
> + IDirect3DDevice9_Release(device);<br>
> + goto done;<br>
> + }<br>
> + hr = IDirect3DDevice9_GetRenderTarget(device, 0, &original_rt);<br>
> + ok(SUCCEEDED(hr), "GetRenderTarget failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_GetDepthStencilSurface(device, &original_ds);<br>
> + ok(SUCCEEDED(hr), "GetDepthStencilSurface failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_CreateRenderTarget(device, 8, 8, D3DFMT_A8R8G8B8,<br>
> + D3DMULTISAMPLE_NONE, 0, FALSE, &rt, NULL);<br>
> + ok(SUCCEEDED(hr), "CreateRenderTarget failed, hr %#x.\n", hr);<br>
> +<br>
> + /* Create our texture for FETCH4 shader testing */<br>
> + hr = IDirect3DDevice9_CreateTexture(device, 4, 4, 1, 0, D3DFMT_L8, D3DPOOL_MANAGED, &texture, NULL);<br>
> + ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr);<br>
> + hr = IDirect3DTexture9_LockRect(texture, 0, &lr, NULL, 0);<br>
> + ok(hr == D3D_OK, "Failed to lock texture, hr %#x.\n", hr);<br>
> + for (i = 0; i < ARRAY_SIZE(fetch4_data); ++i)<br>
> + memcpy((BYTE *)lr.pBits + i*lr.Pitch, &fetch4_data[i], sizeof(fetch4_data[i]));<br>
> + hr = IDirect3DTexture9_UnlockRect(texture, 0);<br>
> + ok(hr == D3D_OK, "Failed to unlock texture, hr %#x.\n", hr);<br>
> +<br>
> + /* Create vertex shader */<br>
> + hr = IDirect3DDevice9_CreateVertexShader(device, vs_code, &vs);<br>
> + ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexShader returned %08x\n", hr);<br>
> + /* Prepare the pixel shaders */<br>
> + for (i = 0; i < ARRAY_SIZE(shaders); ++i)<br>
> + {<br>
> + if (shaders[i].ps_code)<br>
> + {<br>
> + hr = IDirect3DDevice9_CreatePixelShader(device, shaders[i].ps_code, &shaders[i].ps);<br>
> + ok(SUCCEEDED(hr), "CreatePixelShader failed, hr %#x.\n", hr);<br>
> + /* Copy vertex shader pointer if a PS is present */<br>
> + shaders[i].vs = vs;<br>
> + }<br>
> + }<br>
> + hr = IDirect3DDevice9_CreatePixelShader(device, ps_code_3d, &ps_3d);<br>
> + ok(SUCCEEDED(hr), "CreatePixelShader failed, hr %#x.\n", hr);<br>
> +<br>
> + hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0));<br>
> + ok(SUCCEEDED(hr), "SetFVF failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_TRUE);<br>
> + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZFUNC, D3DCMP_ALWAYS);<br>
> + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZWRITEENABLE, TRUE);<br>
> + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE);<br>
> + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture);<br>
> + ok(hr == D3D_OK, "Failed to set texture, hr %#x.\n", hr);<br>
> +<br>
> + /* According to the spec, FETCH4 is enabled when D3DSAMP_MIPMAPLODBIAS == GET4 and also<br>
> + * D3DSAMP_MAGFILTER == D3DTEXF_POINT. But apparently only GET4 is needed for it to get active.<br>
> + * However, AMD HW r500 samples always as if POINT (nearest filtering) is selected with FETCH4<br>
> + * the driver later on corrected this by adding -0.5 texel coord. */<br>
> + hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPMAPLODBIAS, MAKEFOURCC('G','E','T','4'));<br>
> + ok(SUCCEEDED(hr), "SetSamplerState failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);<br>
> + ok(SUCCEEDED(hr), "SetSamplerState failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MINFILTER, D3DTEXF_POINT);<br>
> + ok(SUCCEEDED(hr), "SetSamplerState failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);<br>
> + ok(SUCCEEDED(hr), "SetSamplerState failed, hr %#x.\n", hr);<br>
> +<br>
> + /***********************************************************************<br>
> + * Tests for FFP/PS correctness when using L8 texture with fetch4. *<br>
> + ***********************************************************************/<br>
> +<br>
> + /* Render with fetch4 and test if we obtain proper results for all sampler FFP/PS instructions */<br>
> + for (i = 0; i < ARRAY_SIZE(shaders); ++i)<br>
> + {<br>
> + hr = IDirect3DDevice9_SetVertexShader(device, shaders[i].vs);<br>
> + ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetPixelShader(device, shaders[i].ps);<br>
> + ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr);<br>
> +<br>
> + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 0.0f, 0);<br>
> + ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_BeginScene(device);<br>
> + ok(SUCCEEDED(hr), "BeginScene failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));<br>
> + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_EndScene(device);<br>
> + ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);<br>
> +<br>
> + get_rt_readback(original_rt, &rb);<br>
> + for (j = 0; j < ARRAY_SIZE(expected_colors.color_amd); ++j)<br>
> + {<br>
> + UINT x = expected_colors.x[j % 4];<br>
> + UINT y = expected_colors.y[j / 4];<br>
> + D3DCOLOR color = get_readback_color(&rb, x, y);<br>
> + D3DCOLOR color_amd = expected_colors.color_amd[shaders[i].projection ? (j/4/2*4 + (j%4)/2) : j];<br>
> + D3DCOLOR color_intel = expected_colors.color_intel[j];<br>
> + ok(color_match(color, color_amd, 1)<br>
> + || (isWin && (color_match(color, color_intel, 1) || shaders[i].allow_off)),<br>
> + "Test %s Expected color 0x%08x at (%u, %u), got 0x%08x.\n", shaders[i].name,<br>
> + color_amd, x, y, color);<br>
> + }<br>
> + release_surface_readback(&rb);<br>
> +<br>
> + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);<br>
> + ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);<br>
> + }<br>
> +<br>
> + /***************************************************************************<br>
> + * Tests for fetch4 enable/disable with different texture formats in FFP/PS. *<br>
> + ***************************************************************************/<br>
> +<br>
> + /* Create the textures to test FETCH4 does work/not work there as expected */<br>
> + for (i = 0; i < ARRAY_SIZE(format_tests); ++i)<br>
> + {<br>
> + IDirect3DTexture9 *tex;<br>
> + hr = IDirect3DDevice9_CreateTexture(device, 2, 2, 1, 0, format_tests[i].format,<br>
> + D3DPOOL_MANAGED, &tex, NULL);<br>
> + ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr);<br>
> + hr = IDirect3DTexture9_LockRect(tex, 0, &lr, NULL, 0);<br>
> + ok(hr == D3D_OK, "Failed to lock texture, hr %#x.\n", hr);<br>
> + memcpy(lr.pBits, &format_tests[i].data, 4);<br>
> + hr = IDirect3DTexture9_UnlockRect(tex, 0);<br>
> + ok(hr == D3D_OK, "Failed to unlock texture, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)tex);<br>
> + ok(hr == D3D_OK, "Failed to set texture, hr %#x.\n", hr);<br>
> +<br>
> + /* Test if FETCH4 is enabled/disabled when different textures are used with FFP/texld/texldp */<br>
> + for (j = 0; j < ARRAY_SIZE(format_tests[i].color_amd); ++j)<br>
> + {<br>
> + hr = IDirect3DDevice9_SetVertexShader(device, shaders[j].vs);<br>
> + ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetPixelShader(device, shaders[j].ps);<br>
> + ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr);<br>
> +<br>
> + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 0.0f, 0);<br>
> + ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_BeginScene(device);<br>
> + ok(SUCCEEDED(hr), "BeginScene failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));<br>
> + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_EndScene(device);<br>
> + ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);<br>
> +<br>
> + get_rt_readback(original_rt, &rb);<br>
> + D3DCOLOR color = get_readback_color(&rb, format_tests[i].x, format_tests[i].y);<br>
> + D3DCOLOR color_amd = format_tests[i].color_amd[j];<br>
> + D3DCOLOR color_intel = format_tests[i].color_intel[j];<br>
> + todo_wine_if(format_tests[i].broken_wine) ok(color_match(color, color_amd, 1)<br>
> + || (isWin && color_match(color, color_intel, 1)),<br>
> + "Test %d,%s expected color 0x%08x at (%u, %u), got 0x%08x.\n", i, shaders[j].name,<br>
> + color_amd, format_tests[i].x, format_tests[i].y, color);<br>
> + release_surface_readback(&rb);<br>
> +<br>
> + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);<br>
> + ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);<br>
> + }<br>
> + IDirect3DTexture9_Release(tex);<br>
> + }<br>
> +<br>
> + /**************************************************<br>
> + * Tests that fetch4 works with 3D textures. *<br>
> + **************************************************/<br>
> +<br>
> + /* Create volume (3D) texture */<br>
> + IDirect3DDevice9_CreateVolumeTexture(device, 4, 4, 2, 1, 0, D3DFMT_L8, D3DPOOL_MANAGED, &texture3D, NULL );<br>
> + ok(hr == D3D_OK, "Failed to create volume texture, hr %#x.\n", hr);<br>
> + hr = IDirect3DVolumeTexture9_LockBox(texture3D, 0, &lb, NULL, 0);<br>
> + ok(hr == D3D_OK, "Failed to lock texture3D, hr %#x.\n", hr);<br>
> + for (i = 0; i < ARRAY_SIZE(fetch4_data); ++i)<br>
> + {<br>
> + memcpy((BYTE *)lb.pBits + i*lb.RowPitch, &fetch4_data[i], sizeof(fetch4_data[i]));<br>
> + /* Shift the lower level, to keep it different */<br>
> + memcpy((BYTE *)lb.pBits + i*lb.RowPitch + lb.SlicePitch, &fetch4_data[(i+1)%4], sizeof(fetch4_data[i]));<br>
> + }<br>
> + hr = IDirect3DVolumeTexture9_UnlockBox(texture3D, 0);<br>
> + ok(hr == D3D_OK, "Failed to unlock texture3D, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture3D);<br>
> + ok(hr == D3D_OK, "Failed to set texture3D, hr %#x.\n", hr);<br>
> +<br>
> + /* Test FFP and texld with dcl_volume (ps_3d) */<br>
> + for (i = 0; i < 2; ++i)<br>
> + {<br>
> + hr = IDirect3DDevice9_SetVertexShader(device, i ? vs : NULL);<br>
> + ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetPixelShader(device, i ? ps_3d : NULL);<br>
> + ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr);<br>
> +<br>
> + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 0.0f, 0);<br>
> + ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_BeginScene(device);<br>
> + ok(SUCCEEDED(hr), "BeginScene failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));<br>
> + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_EndScene(device);<br>
> + ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);<br>
> + get_rt_readback(original_rt, &rb);<br>
> + for (j = 0; j < ARRAY_SIZE(expected_colors.color_amd); ++j)<br>
> + {<br>
> + UINT x = expected_colors.x[j % 4];<br>
> + UINT y = expected_colors.y[j / 4];<br>
> + D3DCOLOR color = get_readback_color(&rb, x, y);<br>
> + D3DCOLOR color_amd = expected_colors.color_amd[j];<br>
> + D3DCOLOR color_intel = expected_colors.color_intel[j];<br>
> + D3DCOLOR color_off = expected_colors.color_3d_fetch4_off[j];<br>
> + D3DCOLOR color_zround = expected_colors.color_amd[(j+4) % ARRAY_SIZE(expected_colors.color_amd)];<br>
> + /* FIXME: Fetch4 on 3D textures have different results based on the vendor/driver<br>
> + * - AMD "HD 5700" rounds to nearest "z" texel, and does fetch4 normally on .xy<br>
> + * - AMD "R500" has fetch4 disabled<br>
> + * - AMD "R580" has fetch4 enabled sampling at .xy0<br>
> + * - Intel UHD 620 sample with fetch4 at .xy0<br>
> + * Currently unimplemented on wine due to lack of GL functionality to cast 3D->2DArray<br>
> + * Wine produces same results as if fetch4 is not enabled (which probably is better)<br>
> + * Test will pass on windows if either one of the allowed results is returned */<br>
> + if(isWin)<br>
> + ok(color_match(color, color_zround, 2) || color_match(color, color_off, 2)<br>
> + || color_match(color, color_intel, 2) || color_match(color, color_amd, 2),<br>
> + "Test 3D %s Expected colors 0x%08x || 0x%08x || 0x%08x || 0x%08x at (%u, %u), got 0x%08x.\n",<br>
> + shaders[i].name, color_amd, color_zround, color_off, color_intel, x, y, color);<br>
> + else<br>
> + ok(color_match(color, color_off, 2),<br>
> + "Test 3D %s Expected color 0x%08x at (%u, %u), got 0x%08x.\n", shaders[i].name,<br>
> + color_off, x, y, color);<br>
> + }<br>
> + release_surface_readback(&rb);<br>
> + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);<br>
> + ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);<br>
> + }<br>
> +<br>
> + /********************************************************<br>
> + * Tests for fetch4 enable/disable with depth textures. *<br>
> + ********************************************************/<br>
> +<br>
> + for (i = 0; i < ARRAY_SIZE(depth_tests); ++i)<br>
> + {<br>
> + D3DFORMAT format = depth_tests[i].format;<br>
> + IDirect3DTexture9 *depth_texture;<br>
> + IDirect3DSurface9 *ds;<br>
> +<br>
> + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,<br>
> + D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, format)))<br>
> + continue;<br>
> +<br>
> + hr = IDirect3DDevice9_CreateTexture(device, 8, 8, 1,<br>
> + D3DUSAGE_DEPTHSTENCIL, format, D3DPOOL_DEFAULT, &depth_texture, NULL);<br>
> + ok(SUCCEEDED(hr), "CreateTexture failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DTexture9_GetSurfaceLevel(depth_texture, 0, &ds);<br>
> + ok(SUCCEEDED(hr), "GetSurfaceLevel failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetDepthStencilSurface(device, ds);<br>
> + ok(SUCCEEDED(hr), "SetDepthStencilSurface failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetRenderTarget(device, 0, rt);<br>
> + ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetVertexShader(device, NULL);<br>
> + ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetPixelShader(device, NULL);<br>
> + ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture);<br>
> + ok(hr == D3D_OK, "Failed to set texture3D, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetSamplerState(device, 0,<br>
> + D3DSAMP_MIPMAPLODBIAS, MAKEFOURCC('G','E','T','1'));<br>
> + ok(SUCCEEDED(hr), "SetSamplerState failed, hr %#x.\n", hr);<br>
> +<br>
> + /* Setup the depth/stencil surface. */<br>
> + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_ZBUFFER, 0, 0.0f, 0);<br>
> + ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr);<br>
> +<br>
> + /* Render to the depth surface */<br>
> + hr = IDirect3DDevice9_BeginScene(device);<br>
> + ok(SUCCEEDED(hr), "BeginScene failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));<br>
> + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_EndScene(device);<br>
> + ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);<br>
> +<br>
> + hr = IDirect3DDevice9_SetDepthStencilSurface(device, NULL);<br>
> + ok(SUCCEEDED(hr), "SetDepthStencilSurface failed, hr %#x.\n", hr);<br>
> + IDirect3DSurface9_Release(ds);<br>
> + hr = IDirect3DDevice9_SetRenderTarget(device, 0, original_rt);<br>
> + ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)depth_texture);<br>
> + ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);<br>
> +<br>
> + /* Set a shader for depth sampling, otherwise windows does not show anything */<br>
> + hr = IDirect3DDevice9_SetVertexShader(device, vs);<br>
> + ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_SetPixelShader(device, shaders[1].ps); /* same as texld */<br>
> + ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr);<br>
> +<br>
> + for (j = 0; j < 2; ++j){<br>
> + hr = IDirect3DDevice9_SetSamplerState(device, 0,<br>
> + D3DSAMP_MIPMAPLODBIAS, MAKEFOURCC('G','E','T', j ? '4' : '1' ));<br>
> + ok(SUCCEEDED(hr), "SetSamplerState failed, hr %#x.\n", hr);<br>
> +<br>
> + /* Do the actual shadow mapping. */<br>
> + hr = IDirect3DDevice9_BeginScene(device);<br>
> + ok(SUCCEEDED(hr), "BeginScene failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));<br>
> + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#x.\n", hr);<br>
> + hr = IDirect3DDevice9_EndScene(device);<br>
> + ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);<br>
> +<br>
> + get_rt_readback(original_rt, &rb);<br>
> + for (k = 0; k < ARRAY_SIZE(expected_depth[depth_tests[i].index]); ++k)<br>
> + {<br>
> + UINT x = expected_depth[depth_tests[i].index][k].x;<br>
> + UINT y = expected_depth[depth_tests[i].index][k].y;<br>
> + D3DCOLOR color_off = expected_depth[depth_tests[i].index][k].color_off;<br>
> + D3DCOLOR color_amd = expected_depth[depth_tests[i].index][k].color_amd;<br>
> + D3DCOLOR color_intel = expected_depth[depth_tests[i].index][k].color_intel;<br>
> + D3DCOLOR color = get_readback_color(&rb, x, y);<br>
> + /* When Fetch4 is OFF, ignore G and B channels on windows.<br>
> + * Some implementations will copy R=G=B, some will set them to 0 */<br>
> + if(j == 0)<br>
> + ok((isWin && color_match(color & 0xffff0000, color_off & 0xffff0000, 2))<br>
> + || color_match(color, color_off, 2),<br>
> + "Test OFF Expected color 0x%08x at (%u, %u) for format %s, got 0x%08x.\n",<br>
> + color_off, x, y, depth_tests[i].name, color);<br>
> + else<br>
> + ok(color_match(color, color_amd, 2)<br>
> + || (isWin && color_match(color, color_intel, 2)),<br>
> + "Test ON Expected colors 0x%08x || 0x%08x at (%u, %u) for format %s, got 0x%08x.\n",<br>
> + color_amd, color_intel, x, y, depth_tests[i].name, color);<br>
> + }<br>
> + release_surface_readback(&rb);<br>
> +<br>
> + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);<br>
> + ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);<br>
> + }<br>
> +<br>
> + hr = IDirect3DDevice9_SetTexture(device, 0, NULL);<br>
> + ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);<br>
> + IDirect3DTexture9_Release(depth_texture);<br>
> + }<br>
> +<br>
> + IDirect3DVolumeTexture9_Release(texture3D);<br>
> + IDirect3DTexture9_Release(texture);<br>
> + for (i = 0; i < ARRAY_SIZE(shaders); ++i)<br>
> + if (shaders[i].ps)<br>
> + IDirect3DPixelShader9_Release(shaders[i].ps);<br>
> + IDirect3DPixelShader9_Release(ps_3d);<br>
> + IDirect3DVertexShader9_Release(vs);<br>
> + IDirect3DSurface9_Release(rt);<br>
> + IDirect3DSurface9_Release(original_ds);<br>
> + IDirect3DSurface9_Release(original_rt);<br>
> + refcount = IDirect3DDevice9_Release(device);<br>
> + ok(!refcount, "Device has %u references left.\n", refcount);<br>
> +done:<br>
> + IDirect3D9_Release(d3d);<br>
> + DestroyWindow(window);<br>
> +}<br>
> +<br>
> static void shadow_test(void)<br>
> {<br>
> static const DWORD ps_code[] =<br>
> @@ -24660,6 +25303,7 @@ START_TEST(visual)<br>
> depth_buffer2_test();<br>
> depth_blit_test();<br>
> intz_test();<br>
> + fetch4_test();<br>
> shadow_test();<br>
> fp_special_test();<br>
> depth_bounds_test();<br>
<br>
<br>
<br>
<br>
</blockquote></div></div>