From 93a4c5889753264dc91257e657d819710853d220 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 1 Sep 2021 12:12:48 -0500 Subject: [PATCH] d3dcompiler/tests: Test including an absolute path. Signed-off-by: Zebediah Figura Signed-off-by: Matteo Bruni Signed-off-by: Alexandre Julliard --- dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index a950fa83d89..ad27084dce0 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -1523,7 +1523,7 @@ struct test_d3dinclude static void test_d3dcompile(void) { struct test_d3dinclude include = {{&test_d3dinclude_vtbl}}; - WCHAR filename[MAX_PATH], directory[MAX_PATH]; + WCHAR filename[MAX_PATH], directory[MAX_PATH], include_filename[MAX_PATH]; ID3D10Blob *blob = NULL, *errors = NULL; CHAR filename_a[MAX_PATH]; HRESULT hr; @@ -1542,12 +1542,20 @@ static void test_d3dcompile(void) static const char include2[] = "#include \"include1.h\"\n" "float4 light_color = LIGHT;\n"; + static const char ps_absolute_template[] = + "#include \"%ls\"\n" + "\n" + "float4 main() : COLOR\n" + "{\n" + " return light_color;\n" + "}"; + char ps_absolute_buffer[sizeof(ps_absolute_template) + MAX_PATH]; create_file(L"source.ps", ps_code, strlen(ps_code), filename); create_directory(L"include"); create_file(L"include\\include1.h", include1_wrong, strlen(include1_wrong), NULL); create_file(L"include1.h", include1, strlen(include1), NULL); - create_file(L"include\\include2.h", include2, strlen(include2), NULL); + create_file(L"include\\include2.h", include2, strlen(include2), include_filename); len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL); @@ -1650,6 +1658,18 @@ static void test_d3dcompile(void) blob = NULL; } + sprintf(ps_absolute_buffer, ps_absolute_template, include_filename); + hr = ppD3DCompile(ps_absolute_buffer, sizeof(ps_absolute_buffer), filename_a, NULL, + D3D_COMPILE_STANDARD_FILE_INCLUDE, "main", "ps_2_0", 0, 0, &blob, &errors); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!!blob, "Got unexpected blob.\n"); + todo_wine ok(!errors, "Got unexpected errors.\n"); + if (blob) + { + ID3D10Blob_Release(blob); + blob = NULL; + } + GetCurrentDirectoryW(MAX_PATH, directory); SetCurrentDirectoryW(temp_dir);