[PATCH 4/6] d3dx9_36/tests: Added float vector tests to HLSL test suite
Travis Athougies
iammisc at gmail.com
Wed Aug 4 17:07:03 CDT 2010
---
dlls/d3dx9_36/tests/hlsl.c | 57 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx9_36/tests/hlsl.c b/dlls/d3dx9_36/tests/hlsl.c
index 97f00b6..ce206f9 100644
--- a/dlls/d3dx9_36/tests/hlsl.c
+++ b/dlls/d3dx9_36/tests/hlsl.c
@@ -370,6 +370,62 @@ static void test_conditionals(void)
}
}
+static void test_float_vectors(void)
+{
+ static const char *vec4_indexing_test1_shader =
+ "float4 test(): COLOR \
+ { \
+ float4 color; \
+ color[0] = 0.0; \
+ color[1] = 1.0; \
+ color[2] = 0.0; \
+ color[3] = 1.0; \
+ return color; \
+ }";
+
+ /* We have this uniform i here so the compiler can't optimize */
+ static const char *vec4_indexing_test2_shader =
+ "uniform int i; \
+ float4 test(): COLOR \
+ { \
+ float4 color = float4(0, 0, 1, 1); \
+ color.g = color[i]; \
+ color.b = 0; \
+ return color; \
+ }";
+
+ ID3DXConstantTable *constants;
+ IDirect3DPixelShader9 *pshader;
+ DWORD* data;
+
+ pshader = compile_pixel_shader(vec4_indexing_test1_shader, "ps_2_0", &constants);
+ if(pshader != NULL) {
+ data = (DWORD*) compute_shader_fullscreen(pshader, D3DFMT_A8R8G8B8, 32, 1);
+
+ ok(data[10] == D3DCOLOR_ARGB(255, 0, 255, 0), "vec4_indexing_test1: Got color %08x (should be 0xff00ff00)\n", data[10]);
+ ok(data[16] == D3DCOLOR_ARGB(255, 0, 255, 0), "vec4_indexing_test1: Got color %08x (should be 0xff00ff00)\n", data[16]);
+ ok(data[22] == D3DCOLOR_ARGB(255, 0, 255, 0), "vec4_indexing_test1: Got color %08x (should be 0xff00ff00)\n", data[22]);
+
+ IUnknown_Release(constants);
+ IUnknown_Release(pshader);
+ }
+
+ pshader = compile_pixel_shader(vec4_indexing_test2_shader, "ps_2_0", &constants);
+ if(pshader != NULL)
+ {
+ ID3DXConstantTable_SetInt(constants, device, "i", 2);
+
+ data = (DWORD*) compute_shader_fullscreen(pshader, D3DFMT_A8R8G8B8, 32, 1);
+
+ ok(data[10] == D3DCOLOR_ARGB(255, 0, 255, 0), "vec4_indexing_test2: Got color %08x (should be 0xff00ff00)\n", data[10]);
+ ok(data[16] == D3DCOLOR_ARGB(255, 0, 255, 0), "vec4_indexing_test2: Got color %08x (should be 0xff00ff00)\n", data[16]);
+ ok(data[22] == D3DCOLOR_ARGB(255, 0, 255, 0), "vec4_indexing_test2: Got color %08x (should be 0xff00ff00)\n", data[22]);
+
+ IUnknown_Release(constants);
+ IUnknown_Release(pshader);
+ }
+}
+
/* The heart of our little testing framework */
START_TEST(hlsl)
{
@@ -386,6 +442,7 @@ START_TEST(hlsl)
test_swizzle();
test_math();
test_conditionals();
+ test_float_vectors();
}
} else skip("no pixel shader support\n");
--
1.6.4.4
More information about the wine-patches
mailing list