vkd3d-shader/preproc: Store EOF state per buffer.

We may immediately push a new file or expansion.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43481
This commit is contained in:
Elizabeth Figura
2025-06-03 14:07:54 -05:00
committed by Henri Verbeet
parent d768ea6709
commit 5e6def0843
Notes: Henri Verbeet 2025-06-05 16:19:09 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1538
3 changed files with 47 additions and 9 deletions

View File

@@ -84,7 +84,15 @@ static const char test_include2_top[] =
"#include \"file4\"\n"
",ss)";
/* Test #include immediately followed by EOF. */
static const char test_include2_file4[] =
"#include \"file5\"";
/* Test #include immediately followed by comment immediately followed by EOF. */
static const char test_include2_file5[] =
"#include \"file6\"/*";
static const char test_include2_file6[] =
"FUNC(pa";
static unsigned int refcount_file1, refcount_file2, refcount_file3, include_count_file2;
@@ -128,6 +136,20 @@ static HRESULT WINAPI test_include_Open(ID3DInclude *iface, D3D_INCLUDE_TYPE typ
*code = test_include2_file4;
*size = strlen(test_include2_file4);
}
else if (!strcmp(filename, "file5"))
{
ok(type == D3D_INCLUDE_LOCAL, "Got type %#x.\n", type);
ok(parent_data == test_include2_file4, "Got parent data %p.\n", parent_data);
*code = test_include2_file5;
*size = strlen(test_include2_file5);
}
else if (!strcmp(filename, "file6"))
{
ok(type == D3D_INCLUDE_LOCAL, "Got type %#x.\n", type);
ok(parent_data == test_include2_file5, "Got parent data %p.\n", parent_data);
*code = test_include2_file6;
*size = strlen(test_include2_file6);
}
else
{
ok(0, "Unexpected filename \"%s\".\n", filename);
@@ -392,7 +414,13 @@ static void test_preprocess(void)
"pass",
"fail",
}
},
/* Make sure we handle the empty-file case without breaking. */
{
"",
"",
},
};
for (i = 0; i < ARRAY_SIZE(tests); ++i)