[PATCH 4/5] d3dcompiler_43/tests: Added float vector tests to HLSL test suite
Travis Athougies
iammisc at gmail.com
Thu Oct 7 12:49:54 CDT 2010
---
dlls/d3dcompiler_43/tests/hlsl.c | 62 ++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/hlsl.c b/dlls/d3dcompiler_43/tests/hlsl.c
index 647f711..1d17df6 100644
--- a/dlls/d3dcompiler_43/tests/hlsl.c
+++ b/dlls/d3dcompiler_43/tests/hlsl.c
@@ -430,6 +430,67 @@ static void test_conditionals(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *
}
}
+static void test_float_vectors(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *quad_geometry,
+ IDirect3DVertexShader9 *vshader_passthru)
+{
+ static struct hlsl_probe_info vec4_indexing_test1_probes[] =
+ {
+ {0, 0, {0.020f, 0.245f, 0.351f, 1.000f}, 0.0001f, "vec4 indexing test 1 failed"}
+ };
+
+ static const char *vec4_indexing_test1_shader =
+ "float4 test(): COLOR \
+ { \
+ float4 color; \
+ color[0] = 0.020; \
+ color[1] = 0.245; \
+ color[2] = 0.351; \
+ color[3] = 1.0; \
+ return color; \
+ }";
+
+ static struct hlsl_probe_info vec4_indexing_test2_probes[] =
+ {
+ {0, 0, {0.5f, 0.3f, 0.8f, 0.2f}, 0.0001f, "vec4 indexing test 2 failed"}
+ };
+
+ /* 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.5, 0.4, 0.3, 0.2); \
+ color.g = color[i]; \
+ color.b = 0.8; \
+ return color; \
+ }";
+
+ ID3DXConstantTable *constants;
+ IDirect3DPixelShader9 *pshader;
+
+ pshader = compile_pixel_shader9(device, vec4_indexing_test1_shader, "ps_2_0", &constants);
+ if (pshader != NULL)
+ {
+ compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry,
+ vec4_indexing_test1_probes, 1, 1, 1, __LINE__);
+
+ IUnknown_Release(constants);
+ IUnknown_Release(pshader);
+ }
+
+ pshader = compile_pixel_shader9(device, vec4_indexing_test2_shader, "ps_2_0", &constants);
+ if (pshader != NULL)
+ {
+ ID3DXConstantTable_SetInt(constants, device, "i", 2);
+
+ compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry,
+ vec4_indexing_test2_probes, 1, 32, 1, __LINE__);
+
+ IUnknown_Release(constants);
+ IUnknown_Release(pshader);
+ }
+}
+
START_TEST(hlsl)
{
D3DCAPS9 caps;
@@ -452,6 +513,7 @@ START_TEST(hlsl)
test_swizzle(device, quad_geometry, vshader_passthru);
test_math(device, quad_geometry, vshader_passthru);
test_conditionals(device, quad_geometry, vshader_passthru);
+ test_float_vectors(device, quad_geometry, vshader_passthru);
}
} else skip("no pixel shader support\n");
--
1.7.0.4
More information about the wine-patches
mailing list