[PATCH 2/2] d3dx9_36/tests: Added tests for constant table samplers
Travis Athougies
iammisc at gmail.com
Wed Mar 16 15:04:04 CDT 2011
---
dlls/d3dx9_36/tests/shader.c | 46 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index a4bbc22..2669bcf 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -160,6 +160,25 @@ static const D3DXCONSTANT_DESC ctab_arrays_expected[] = {
{"bvecarray", D3DXRS_FLOAT4, 16, 2, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 3, 3, 0, 36, 0},
{"ivecarray", D3DXRS_FLOAT4, 18, 1, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 1, 0, 16, 0}};
+static const DWORD ctab_samplers[] = { /* 0123456789ABCDEF */
+ 0xffff0300, 0x002efffe, 0x42415443, 0x0000001c, /* ........CTAB.... */
+ 0x00000083, 0xffff0300, 0x00000002, 0x0000001c, /* ................ */
+ 0x20000100, 0x0000007c, 0x00000044, 0x00000003, /* ....|...D....... */
+ 0x00000001, 0x00000050, 0x00000000, 0x00000060, /* ....P.......`... */
+ 0x00010003, 0x00000001, 0x0000006c, 0x00000000, /* ........l....... */
+ 0x706d6173, 0x3172656c, 0xababab00, 0x000c0004, /* sampler1........ */
+ 0x00010001, 0x00000001, 0x00000000, 0x706d6173, /* ............samp */
+ 0x3272656c, 0xababab00, 0x000d0004, 0x00010001, /* ler2............ */
+ 0x00000001, 0x00000000, 0x335f7370, 0x4d00305f, /* ........ps_3_0.M */
+ 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, /* icrosoft.(R).HLS */
+ 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, /* L.Shader.Compile */
+ 0x2e392072, 0x392e3931, 0x322e3934, 0x00313131, /* r.9.19.949.2111. */
+ 0x0000ffff}; /* END */
+
+static const D3DXCONSTANT_DESC ctab_samplers_expected[] = {
+ {"sampler1", D3DXRS_SAMPLER, 0, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER2D, 1, 1, 1, 0, 4, 0},
+ {"sampler2", D3DXRS_SAMPLER, 1, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER3D, 1, 1, 1, 0, 4, 0}};
+
static void test_get_shader_size(void)
{
UINT shader_size, expected;
@@ -421,8 +440,34 @@ static void test_constant_tables(void)
sizeof(ctab_matrices_expected)/sizeof(*ctab_matrices_expected));
test_constant_table("test_arrays", ctab_arrays, ctab_arrays_expected,
sizeof(ctab_arrays_expected)/sizeof(*ctab_arrays_expected));
+ test_constant_table("test_samplers", ctab_samplers, ctab_samplers_expected,
+ sizeof(ctab_samplers_expected)/sizeof(*ctab_samplers_expected));
+}
+
+static void test_get_sampler_index(void)
+{
+ ID3DXConstantTable *ctable;
+
+ HRESULT res;
+ UINT index;
+
+ res = D3DXGetShaderConstantTable(ctab_samplers, &ctable);
+ ok(res == D3D_OK, "D3DXGetShaderConstantTable failed on ctab_samplers: got %08x\n", res);
+
+ index = ID3DXConstantTable_GetSamplerIndex(ctable, "sampler1");
+ ok(index == 0, "ID3DXConstantTable_GetSamplerIndex returned wrong index: Got %d, expected 0\n", index);
+
+ index = ID3DXConstantTable_GetSamplerIndex(ctable, "sampler2");
+ ok(index == 1, "ID3DXConstantTable_GetSamplerIndex returned wrong index: Got %d, expected 1\n", index);
+
+ index = ID3DXConstantTable_GetSamplerIndex(ctable, "nonexistent");
+ ok(index == -1, "ID3DXConstantTable_GetSamplerIndex found non-existent sampler: Got %d\n",
+ index);
+
+ ID3DXConstantTable_Release(ctable);
}
+
START_TEST(shader)
{
test_get_shader_size();
@@ -430,4 +475,5 @@ START_TEST(shader)
test_find_shader_comment();
test_get_shader_constant_table_ex();
test_constant_tables();
+ test_get_sampler_index();
}
--
1.7.0.4
More information about the wine-patches
mailing list