Commit 89b0c843 authored by Rico Schüller's avatar Rico Schüller Committed by Alexandre Julliard

d3d10/tests: Add ID3D10Effect::GetVariableBy*() test.

parent b0b9897f
......@@ -3441,6 +3441,131 @@ static void test_effect_local_shader(ID3D10Device *device)
effect->lpVtbl->Release(effect);
}
/*
* test_effect_get_variable_by
*/
#if 0
cbuffer cb
{
float f1 : SV_POSITION;
float f2 : COLOR0;
};
cbuffer cb2
{
float f3 : SV_POSITION;
float f4 : COLOR1;
};
Texture1D tex1 : COLOR2;
Texture1D tex2 : COLOR1;
#endif
static DWORD fx_test_egvb[] = {
0x43425844, 0x63d60ede, 0xf75a09d1, 0x47da5604, 0x7ef6e331, 0x00000001, 0x000001ca, 0x00000001,
0x00000024, 0x30315846, 0x0000019e, 0xfeff1001, 0x00000002, 0x00000004, 0x00000002, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x0000008a, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x66006263,
0x74616f6c, 0x00000700, 0x00000100, 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900,
0x00316600, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43003266, 0x524f4c4f, 0x62630030, 0x33660032,
0x00346600, 0x4f4c4f43, 0x54003152, 0x75747865, 0x44316572, 0x00005300, 0x00000200, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000a00, 0x78657400, 0x4f430031, 0x32524f4c, 0x78657400,
0x00040032, 0x00100000, 0x00000000, 0x00020000, 0xffff0000, 0x0000ffff, 0x00290000, 0x000d0000,
0x002c0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00380000, 0x000d0000, 0x003b0000,
0x00040000, 0x00000000, 0x00000000, 0x00000000, 0x00420000, 0x00100000, 0x00000000, 0x00020000,
0xffff0000, 0x0000ffff, 0x00460000, 0x000d0000, 0x002c0000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00490000, 0x000d0000, 0x004c0000, 0x00040000, 0x00000000, 0x00000000, 0x00000000,
0x00790000, 0x005d0000, 0x007e0000, 0xffff0000, 0x0000ffff, 0x00850000, 0x005d0000, 0x004c0000,
0xffff0000, 0x0000ffff, 0x00000000,
};
static void test_effect_get_variable_by(ID3D10Device *device)
{
ID3D10Effect *effect;
ID3D10EffectVariable *variable_by_index, *variable, *null_variable;
HRESULT hr;
hr = create_effect(fx_test_egvb, 0, device, NULL, &effect);
ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr);
/* get the null variable */
null_variable = effect->lpVtbl->GetVariableByIndex(effect, 0xffffffff);
/* check for invalid arguments */
variable = effect->lpVtbl->GetVariableByName(effect, NULL);
ok(null_variable == variable, "GetVariableByName got %p, expected %p\n", variable, null_variable);
variable = effect->lpVtbl->GetVariableBySemantic(effect, NULL);
ok(null_variable == variable, "GetVariableBySemantic got %p, expected %p\n", variable, null_variable);
variable = effect->lpVtbl->GetVariableByName(effect, "invalid");
ok(null_variable == variable, "GetVariableByName got %p, expected %p\n", variable, null_variable);
variable = effect->lpVtbl->GetVariableBySemantic(effect, "invalid");
ok(null_variable == variable, "GetVariableBySemantic got %p, expected %p\n", variable, null_variable);
/* variable f1 */
variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 0);
ok(null_variable != variable_by_index, "GetVariableByIndex failed %p", variable_by_index);
variable = effect->lpVtbl->GetVariableByName(effect, "f1");
ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
variable = effect->lpVtbl->GetVariableBySemantic(effect, "SV_POSITION");
ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
/* variable f2 */
variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 1);
ok(null_variable != variable_by_index, "GetVariableByIndex failed %p", variable_by_index);
variable = effect->lpVtbl->GetVariableByName(effect, "f2");
ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
variable = effect->lpVtbl->GetVariableBySemantic(effect, "COLOR0");
ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
/* variable f3 */
variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 2);
ok(null_variable != variable_by_index, "GetVariableByIndex failed %p", variable_by_index);
variable = effect->lpVtbl->GetVariableByName(effect, "f3");
ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
variable = effect->lpVtbl->GetVariableBySemantic(effect, "SV_POSITION");
ok(variable != null_variable, "GetVariableBySemantic failed %p", variable);
ok(variable != variable_by_index, "GetVariableBySemantic failed %p", variable);
/* variable f4 */
variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 3);
ok(null_variable != variable_by_index, "GetVariableByIndex failed %p", variable_by_index);
variable = effect->lpVtbl->GetVariableByName(effect, "f4");
ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
variable = effect->lpVtbl->GetVariableBySemantic(effect, "COLOR1");
ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
/* variable tex1 */
variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 4);
ok(null_variable != variable_by_index, "GetVariableByIndex failed %p", variable_by_index);
variable = effect->lpVtbl->GetVariableByName(effect, "tex1");
ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
variable = effect->lpVtbl->GetVariableBySemantic(effect, "COLOR2");
ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
/* variable tex2 */
variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 5);
ok(null_variable != variable_by_index, "GetVariableByIndex failed %p", variable_by_index);
variable = effect->lpVtbl->GetVariableByName(effect, "tex2");
ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
variable = effect->lpVtbl->GetVariableBySemantic(effect, "COLOR1");
ok(variable != null_variable, "GetVariableBySemantic failed %p", variable);
ok(variable != variable_by_index, "GetVariableBySemantic failed %p", variable);
effect->lpVtbl->Release(effect);
}
START_TEST(effect)
{
ID3D10Device *device;
......@@ -3460,6 +3585,7 @@ START_TEST(effect)
test_effect_variable_type_class(device);
test_effect_constant_buffer_stride(device);
test_effect_local_shader(device);
test_effect_get_variable_by(device);
refcount = ID3D10Device_Release(device);
ok(!refcount, "Device has %u references left\n", refcount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment