Stefan Dösinger : wined3d: Add a (nested) loop test.
Alexandre Julliard
julliard at winehq.org
Fri Oct 12 05:22:59 CDT 2007
Module: wine
Branch: master
Commit: a022e8b40287885172ede6b3a152dacdfa149983
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a022e8b40287885172ede6b3a152dacdfa149983
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Tue Oct 9 22:12:59 2007 +0200
wined3d: Add a (nested) loop test.
---
dlls/d3d9/tests/visual.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 0 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 5ebd061..49f8782 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -3572,6 +3572,61 @@ static void cnd_test(IDirect3DDevice9 *device)
IDirect3DPixelShader9_Release(shader_11);
}
+static void nested_loop_test(IDirect3DDevice9 *device) {
+ const DWORD shader_code[] = {
+ 0xffff0300, /* ps_3_0 */
+ 0x05000051, 0xa00f0000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, /* def c0, 0, 0, 0, 1 */
+ 0x05000051, 0xa00f0001, 0x3d000000, 0x00000000, 0x00000000, 0x00000000, /* def c1, 1/32, 0, 0, 0*/
+ 0x05000030, 0xf00f0000, 0x00000004, 0x00000000, 0x00000002, 0x00000000, /* defi i0, 4, 0, 2, 0 */
+ 0x02000001, 0x800f0000, 0xa0e40000, /* mov r0, c0 */
+ 0x0200001b, 0xf0e40800, 0xf0e40000, /* loop aL, i0 */
+ 0x0200001b, 0xf0e40800, 0xf0e40000, /* loop aL, i0 */
+ 0x03000002, 0x800f0000, 0x80e40000, 0xa0e40001, /* add r0, r0, c1 */
+ 0x0000001d, /* endloop */
+ 0x0000001d, /* endloop */
+ 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */
+ 0x0000ffff /* end */
+ };
+ IDirect3DPixelShader9 *shader;
+ HRESULT hr;
+ DWORD color;
+ const float quad[] = {
+ -1.0, -1.0, 0.1,
+ 1.0, -1.0, 0.1,
+ -1.0, 1.0, 0.1,
+ 1.0, 1.0, 0.1
+ };
+
+ hr = IDirect3DDevice9_CreatePixelShader(device, shader_code, &shader);
+ ok(hr == D3D_OK, "IDirect3DDevice9_CreatePixelShader failed with %s\n", DXGetErrorString9(hr));
+ hr = IDirect3DDevice9_SetPixelShader(device, shader);
+ ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader failed with %s\n", DXGetErrorString9(hr));
+ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ);
+ ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF failed with %s\n", DXGetErrorString9(hr));
+ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x0000ff00, 0.0, 0);
+ ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %s\n", DXGetErrorString9(hr));
+
+ hr = IDirect3DDevice9_BeginScene(device);
+ ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene returned %s\n", DXGetErrorString9(hr));
+ if(SUCCEEDED(hr))
+ {
+ hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, 3 * sizeof(float));
+ ok(hr == D3D_OK, "DrawPrimitiveUP failed (%08x)\n", hr);
+ hr = IDirect3DDevice9_EndScene(device);
+ ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %s\n", DXGetErrorString9(hr));
+ }
+ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
+ ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %s\n", DXGetErrorString9(hr));
+
+ color = getPixelColor(device, 360, 240);
+ ok(color == 0x007f0000 || color == 0x00800000 || color == 0x00810000,
+ "Nested loop test returned color 0x%08x, expected 0x00800000\n", color);
+
+ hr = IDirect3DDevice9_SetPixelShader(device, NULL);
+ ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader failed with %s\n", DXGetErrorString9(hr));
+ IDirect3DPixelShader9_Release(shader);
+}
+
START_TEST(visual)
{
IDirect3DDevice9 *device_ptr;
@@ -3679,6 +3734,11 @@ START_TEST(visual)
if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 4)) {
constant_clamp_ps_test(device_ptr);
cnd_test(device_ptr);
+ if (caps.PixelShaderVersion >= D3DPS_VERSION(3, 0)) {
+ nested_loop_test(device_ptr);
+ } else {
+ skip("No ps_3_0 support\n");
+ }
}
}
else skip("No ps_1_1 support\n");
More information about the wine-cvs
mailing list