[PATCH 3/7] d3dx9_36/tests: Added order of operations test to HLSL test suite
Travis Athougies
iammisc at gmail.com
Wed Aug 25 02:59:34 CDT 2010
---
dlls/d3dx9_36/tests/hlsl.c | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx9_36/tests/hlsl.c b/dlls/d3dx9_36/tests/hlsl.c
index 69b1823..a80c8ba 100644
--- a/dlls/d3dx9_36/tests/hlsl.c
+++ b/dlls/d3dx9_36/tests/hlsl.c
@@ -285,6 +285,44 @@ static void test_swizzle(IDirect3DDevice9* device)
}
}
+static void test_math(IDirect3DDevice9* device)
+{
+ static const char *order_of_operations_shader =
+ "float4 test(uniform float u, uniform float v, uniform float w, uniform float x, \
+ uniform float y, uniform float z): COLOR \
+ { \
+ return float4(x * y - z / w + --u / -v, 0, 0, 0); \
+ }";
+
+ const float u = 2.5, v = 0.3, w = 0.2, x = 0.7, y = 0.1, z = 1.0;
+ const float expected_value = (x * y) - (z / w) + ( (u - 1) / (-v));
+
+ ID3DXConstantTable *constants;
+ IDirect3DPixelShader9 *pshader;
+ void *data;
+ float actual_value;
+
+ pshader = compile_pixel_shader(device, order_of_operations_shader, "ps_2_0", &constants);
+ if(pshader != NULL)
+ {
+ ID3DXConstantTable_SetFloat(constants, device, "$u", u);
+ ID3DXConstantTable_SetFloat(constants, device, "$v", v);
+ ID3DXConstantTable_SetFloat(constants, device, "$w", w);
+ ID3DXConstantTable_SetFloat(constants, device, "$x", x);
+ ID3DXConstantTable_SetFloat(constants, device, "$y", y);
+ ID3DXConstantTable_SetFloat(constants, device, "$z", z);
+
+ data = compute_shader_fullscreen(device, pshader, D3DFMT_R32F, 1, 1);
+ actual_value = *(float*) data;
+
+ ok(abs(actual_value - expected_value) < 0.00001, "order_of_operations_test: Got %f expected %f\n",
+ actual_value, expected_value);
+
+ IUnknown_Release(constants);
+ IUnknown_Release(pshader);
+ }
+}
+
/* The heart of our little testing framework */
START_TEST(hlsl)
{
@@ -300,6 +338,7 @@ START_TEST(hlsl)
if(caps.PixelShaderVersion >= 0xffff0200) {
todo_wine {
test_swizzle(device);
+ test_math(device);
}
} else skip("no pixel shader support\n");
--
1.7.0.4
More information about the wine-patches
mailing list