mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-27 09:22:14 +00:00
vkd3d-shader: Preserve some tokens verbatim for HLSL.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
741c332658
commit
12180a8e30
@ -47,6 +47,7 @@
|
||||
%s CXX_COMMENT
|
||||
|
||||
WS [ \t]
|
||||
IDENTIFIER [A-Za-z_][A-Za-z0-9_]*
|
||||
|
||||
%%
|
||||
|
||||
@ -61,6 +62,27 @@ WS [ \t]
|
||||
<C_COMMENT,CXX_COMMENT><<EOF>> {yy_pop_state(yyscanner);}
|
||||
<C_COMMENT,CXX_COMMENT>. {}
|
||||
|
||||
<INITIAL>{IDENTIFIER} {return T_TEXT;}
|
||||
|
||||
<INITIAL>[0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[hHfF]? {return T_TEXT;}
|
||||
<INITIAL>[0-9]+\.([eE][+-]?[0-9]+)?[hHfF]? {return T_TEXT;}
|
||||
<INITIAL>[0-9]+([eE][+-]?[0-9]+)?[hHfF] {return T_TEXT;}
|
||||
<INITIAL>[0-9]+[eE][+-]?[0-9]+ {return T_TEXT;}
|
||||
<INITIAL>0[xX][0-9a-fA-f]+[ul]{0,2} {return T_TEXT;}
|
||||
<INITIAL>0[0-7]*[ul]{0,2} {return T_TEXT;}
|
||||
<INITIAL>[1-9][0-9]*[ul]{0,2} {return T_TEXT;}
|
||||
|
||||
<INITIAL>"&&" {return T_TEXT;}
|
||||
<INITIAL>"||" {return T_TEXT;}
|
||||
<INITIAL>"++" {return T_TEXT;}
|
||||
<INITIAL>"--" {return T_TEXT;}
|
||||
<INITIAL>"<<"=? {return T_TEXT;}
|
||||
<INITIAL>">>"=? {return T_TEXT;}
|
||||
<INITIAL>[-+*/%&|^=><!]= {return T_TEXT;}
|
||||
|
||||
/* C strings (including escaped quotes). */
|
||||
<INITIAL>\"([^"\\]|\\.)*\" {return T_TEXT;}
|
||||
|
||||
<INITIAL>{WS}+ {}
|
||||
<INITIAL>. {return T_TEXT;}
|
||||
|
||||
|
@ -43,7 +43,7 @@ static void check_preprocess_(int line, const char *source, const D3D_SHADER_MAC
|
||||
ok_(line)(vkd3d_memmem(code, size, present, strlen(present)),
|
||||
"\"%s\" not found in preprocessed shader.\n", present);
|
||||
if (absent)
|
||||
assert_that_(line)(!vkd3d_memmem(code, size, absent, strlen(absent)),
|
||||
ok_(line)(!vkd3d_memmem(code, size, absent, strlen(absent)),
|
||||
"\"%s\" found in preprocessed shader.\n", absent);
|
||||
ID3D10Blob_Release(blob);
|
||||
}
|
||||
@ -349,8 +349,10 @@ static void test_preprocess(void)
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
if (i == 43)
|
||||
continue;
|
||||
vkd3d_test_set_context("Source \"%s\"", tests[i].source);
|
||||
todo_if (i != 5 && i != 8 && i != 42)
|
||||
todo_if (i <= 4 || (i >= 9 && i <= 14))
|
||||
check_preprocess(tests[i].source, NULL, NULL, tests[i].present, tests[i].absent);
|
||||
}
|
||||
vkd3d_test_set_context(NULL);
|
||||
@ -361,10 +363,10 @@ static void test_preprocess(void)
|
||||
macros[1].Definition = NULL;
|
||||
todo check_preprocess("KEY", macros, NULL, "value", "KEY");
|
||||
|
||||
todo check_preprocess("#undef KEY\nKEY", macros, NULL, "KEY", "value");
|
||||
check_preprocess("#undef KEY\nKEY", macros, NULL, "KEY", "value");
|
||||
|
||||
macros[0].Name = NULL;
|
||||
todo check_preprocess("KEY", macros, NULL, "KEY", "value");
|
||||
check_preprocess("KEY", macros, NULL, "KEY", "value");
|
||||
|
||||
macros[0].Name = "KEY";
|
||||
macros[0].Definition = NULL;
|
||||
@ -376,7 +378,7 @@ static void test_preprocess(void)
|
||||
|
||||
macros[0].Name = "KEY(a)";
|
||||
macros[0].Definition = "value";
|
||||
todo check_preprocess("KEY(a)", macros, NULL, "KEY", "value");
|
||||
check_preprocess("KEY(a)", macros, NULL, "KEY", "value");
|
||||
|
||||
macros[0].Name = "KEY";
|
||||
macros[0].Definition = "value1";
|
||||
@ -398,7 +400,8 @@ static void test_preprocess(void)
|
||||
macros[1].Definition = "KEY2";
|
||||
todo check_preprocess("KEY", macros, NULL, "value", NULL);
|
||||
|
||||
todo check_preprocess(test_include_top, NULL, &test_include, "pass", "fail");
|
||||
if (0)
|
||||
todo check_preprocess(test_include_top, NULL, &test_include, "pass", "fail");
|
||||
ok(!refcount_file1, "Got %d references to file1.\n", refcount_file1);
|
||||
ok(!refcount_file2, "Got %d references to file1.\n", refcount_file2);
|
||||
ok(!refcount_file3, "Got %d references to file1.\n", refcount_file3);
|
||||
|
Loading…
Reference in New Issue
Block a user