callback) {
43 | int permutations = 1;
44 | for (int i = 0; i < length; i++) {
45 | permutations *= symbolCount;
46 | }
47 | var sb = new StringBuilder();
48 | for (int i = 0; i < permutations; i++) {
49 | sb.setLength(0);
50 | int current = i;
51 | for (int x = 0; x < length; x++) {
52 | sb.append(symbols[current % symbolCount]);
53 | current /= symbolCount;
54 | }
55 | sb.reverse();
56 | callback.accept(sb.toString());
57 | }
58 | }
59 |
60 | private static void generateStruct(String[] type, PrintWriter out) {
61 | var vec = type[1];
62 | var scalar = type[2];
63 | for (int source = 2; source <= 4; source++) {
64 | out.printf("struct %s%d {\n", type[0], source);
65 | for (int target = 1; target <= 4; target++) {
66 | String pfx = target == 1 ? scalar : vec + target;
67 | for (var group: groups) {
68 | permute(group, source, target, (str) -> {
69 | out.printf(" %s %s;\n", pfx, str);
70 | });
71 | }
72 | }
73 | out.println("};\n");
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/test/kotlin/GlslDocumentationTest.kt:
--------------------------------------------------------------------------------
1 |
2 | import com.intellij.codeInsight.documentation.DocumentationManager
3 | import com.intellij.testFramework.fixtures.BasePlatformTestCase
4 | import glsl.psi.interfaces.GlslFunctionCall
5 | import glsl.psi.interfaces.GlslSingleDeclaration
6 | import glsl.psi.interfaces.GlslUnaryExpr
7 |
8 |
9 | class GlslDocumentationTest : BasePlatformTestCase() {
10 |
11 | override fun getTestDataPath(): String {
12 | return "src/test/testData/documentation"
13 | }
14 |
15 | fun testDocumentationFile1() {
16 | myFixture.configureByFile("DocumentationFile1.glsl")
17 | val originalElement = myFixture.elementAtCaret as GlslSingleDeclaration
18 | val glslPostfixExpr = originalElement.exprNoAssignmentList.first() as GlslUnaryExpr
19 | val variableIdentifier = (glslPostfixExpr.postfixExpr as GlslFunctionCall).variableIdentifier
20 | val element = DocumentationManager
21 | .getInstance(project)
22 | .findTargetElement(myFixture.editor, variableIdentifier?.containingFile, variableIdentifier)
23 | val documentationProvider = DocumentationManager.getProviderFromElement(element)
24 | val doc = documentationProvider.generateDoc(element, originalElement)
25 | assertNotNull(doc)
26 | assertTrue(doc!!.contains(""))
27 | }
28 |
29 | // fun testDocumentationFile2() {
30 | // myFixture.configureByFile("DocumentationFile2.glsl")
31 | // val originalElement = myFixture.elementAtCaret
32 | // val element = DocumentationManager
33 | // .getInstance(project)
34 | // .findTargetElement(myFixture.editor, originalElement.containingFile, originalElement)
35 | // val documentationProvider = DocumentationManager.getProviderFromElement(element)
36 | // val doc = documentationProvider.generateDoc(element, originalElement)
37 | // assertNotNull(doc)
38 | // assertTrue(doc!!.contains("Function documentation"))
39 | // }
40 | }
--------------------------------------------------------------------------------
/src/test/kotlin/GlslDummyTest.kt:
--------------------------------------------------------------------------------
1 | import com.intellij.testFramework.fixtures.BasePlatformTestCase
2 | import glsl.plugin.inspections.*
3 |
4 | class GlslDummyTest : BasePlatformTestCase() {
5 |
6 | override fun setUp() {
7 | super.setUp()
8 | myFixture.enableInspections(
9 | GlslInspectionTooFewArguments(),
10 | GlslInspectionTooManyArguments(),
11 | GlslInspectionIncompatibleType(),
12 | GlslInspectionMissingReturn(),
13 | // GlslInspectionNoMatchingFunction(),
14 | GlslInspectionOperatorDoesNotOperate(),
15 | )
16 | }
17 |
18 | override fun getTestDataPath(): String {
19 | return "src/test/testData/dummy"
20 | }
21 |
22 | fun testDummy() {
23 | // myFixture.configureByFiles("dummy.glsl")
24 | // myFixture.testHighlighting(false, false, false)
25 | // val reference = myFixture.getReferenceAtCaretPosition("dummy.glsl")
26 | // val resolve = reference?.resolve()
27 | // assertInstanceOf(resolve, GlslSingleDeclaration::class.java)
28 | // assertEquals("dummy", (resolve as GlslSingleDeclaration).name)
29 | }
30 | }
--------------------------------------------------------------------------------
/src/test/kotlin/GlslFormatterTest.kt:
--------------------------------------------------------------------------------
1 | import com.intellij.openapi.command.WriteCommandAction
2 | import com.intellij.psi.codeStyle.CodeStyleManager
3 | import com.intellij.testFramework.fixtures.BasePlatformTestCase
4 | import com.intellij.util.containers.ContainerUtil
5 |
6 | class GlslFormatterTest : BasePlatformTestCase() {
7 |
8 | override fun getTestDataPath(): String {
9 | return "src/test/testData/formatter"
10 | }
11 |
12 | fun testFormatter() {
13 | myFixture.configureByFile("formatterFile.glsl")
14 | WriteCommandAction.writeCommandAction(project).run {
15 | val codeStyleManager = CodeStyleManager.getInstance(project)
16 | codeStyleManager.reformatText(myFixture.file, listOf(myFixture.file.textRange))
17 | }
18 | myFixture.checkResultByFile("formatterFileExpected.glsl")
19 | }
20 | }
--------------------------------------------------------------------------------
/src/test/kotlin/GlslIncludeTest.kt:
--------------------------------------------------------------------------------
1 | import com.intellij.testFramework.fixtures.BasePlatformTestCase
2 | import glsl.psi.interfaces.GlslSingleDeclaration
3 | import glsl.psi.interfaces.GlslStructSpecifier
4 |
5 | class GlslIncludeTest : BasePlatformTestCase() {
6 |
7 | override fun getTestDataPath(): String {
8 | return "src/test/testData/include"
9 | }
10 |
11 | fun testInclude1() {
12 | myFixture.configureByFiles("IncludeFile2.glsl")
13 | val reference = myFixture.getReferenceAtCaretPosition("IncludeFile1.glsl")
14 | val resolve = reference?.resolve()
15 | assertInstanceOf(resolve, GlslSingleDeclaration::class.java)
16 | assertEquals("b", (resolve as GlslSingleDeclaration).name)
17 | }
18 |
19 | fun testImportCyclesDoNotThrowErrors() {
20 | myFixture.configureByFile("IncludeFile3.glsl")
21 | myFixture.checkHighlighting()
22 | val reference = myFixture.getReferenceAtCaretPosition("IncludeFile3.glsl")
23 | assertNoThrowable { reference?.resolve() }
24 | }
25 |
26 | fun testImportCyclesDontThrowErrorsNested() {
27 | val reference = myFixture.getReferenceAtCaretPosition("IncludeFile6.glsl")
28 | assertNoThrowable { reference?.resolve() }
29 | }
30 |
31 | fun testInclude4() {
32 | myFixture.configureByFiles("shaders/shaders2/IncludeFile7.glsl", "shaders/IncludeFile7.glsl")
33 | val reference = myFixture.getReferenceAtCaretPosition("shaders/IncludeFile8.glsl")
34 | val resolve = reference?.resolve()
35 | assertNull(resolve)
36 | }
37 |
38 | fun testInclude5() {
39 | myFixture.configureByFiles("shaders/shaders2/IncludeFile7.glsl", "shaders/IncludeFile7.glsl")
40 | val reference = myFixture.getReferenceAtCaretPosition("shaders/IncludeFile9.glsl")
41 | val resolve = reference?.resolve()
42 | assertInstanceOf(resolve, GlslSingleDeclaration::class.java)
43 | assertEquals("a", (resolve as GlslSingleDeclaration).name)
44 | }
45 |
46 | fun testInclude6() {
47 | myFixture.configureByFiles("shaders/shaders2/IncludeFile7.glsl", "shaders/IncludeFile7.glsl")
48 | val reference = myFixture.getReferenceAtCaretPosition("shaders/IncludeFile10.glsl")
49 | val resolve = reference?.resolve()
50 | assertInstanceOf(resolve, GlslSingleDeclaration::class.java)
51 | assertEquals("b", (resolve as GlslSingleDeclaration).name)
52 | }
53 |
54 | fun testInclude7() {
55 | myFixture.configureByFiles("IncludeFile8.glsl")
56 | val reference = myFixture.getReferenceAtCaretPosition("IncludeFile7.glsl")
57 | val resolve = reference?.resolve()
58 | assertInstanceOf(resolve, GlslStructSpecifier::class.java)
59 | assertEquals("A", (resolve as GlslStructSpecifier).name)
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/test/kotlin/GlslInspectionsTest.kt:
--------------------------------------------------------------------------------
1 | import com.intellij.testFramework.fixtures.BasePlatformTestCase
2 | import glsl.plugin.inspections.*
3 |
4 | class GlslInspectionsTest : BasePlatformTestCase() {
5 |
6 | override fun getTestDataPath(): String {
7 | return "src/test/testData/inspections"
8 | }
9 |
10 | fun testDoesNotOperate() {
11 | myFixture.enableInspections(GlslInspectionOperatorDoesNotOperate())
12 | myFixture.configureByFiles("InspectionsTestDoesNotOperate.glsl")
13 | myFixture.checkHighlighting(false, false, false)
14 | }
15 |
16 | fun testIncompatibleTypes() {
17 | myFixture.enableInspections(GlslInspectionIncompatibleType())
18 | myFixture.configureByFiles("InspectionsTestIncompatibleTypes.glsl")
19 | myFixture.checkHighlighting(false, false, false)
20 | }
21 |
22 | fun testNoMatchingFunction() {
23 | // myFixture.enableInspections(GlslInspectionNoMatchingFunction())
24 | // myFixture.configureByFiles("InspectionsNoMatchingFunction.glsl", "InspectionsNoMatchingFunction2.glsl")
25 | // myFixture.checkHighlighting(false, false, false)
26 | }
27 |
28 | fun testMissingReturn() {
29 | myFixture.enableInspections(GlslInspectionMissingReturn())
30 | myFixture.configureByFiles("InspectionsTestMissingReturn.glsl")
31 | myFixture.checkHighlighting(false, false, false)
32 | }
33 |
34 | fun testPrimitiveConstructorZeroArguments() {
35 | myFixture.enableInspections(GlslInspectionConstructorNoArguments())
36 | myFixture.configureByFiles("InspectionPrimitiveConstructorNoArguments.glsl")
37 | myFixture.checkHighlighting(false, false, false)
38 | }
39 | }
--------------------------------------------------------------------------------
/src/test/kotlin/GlslLanguageInjectionTest.kt:
--------------------------------------------------------------------------------
1 | import com.intellij.testFramework.fixtures.BasePlatformTestCase
2 | import glsl.psi.interfaces.GlslSingleDeclaration
3 | import glsl.psi.interfaces.GlslStructDeclarator
4 | import junit.framework.TestCase
5 | import junit.framework.TestCase.assertNull
6 | import org.junit.Test
7 |
8 | class GlslLanguageInjectionTest : BasePlatformTestCase() {
9 |
10 | override fun getTestDataPath(): String {
11 | return "src/test/testData/languageInjection"
12 | }
13 |
14 | fun testLanguageInjection1() {
15 | val reference = myFixture.getReferenceAtCaretPosition("LanguageInjectionHtml.html")
16 | val resolve = reference?.resolve()
17 | assertInstanceOf(resolve, GlslSingleDeclaration::class.java)
18 | assertEquals("projMatrix", (resolve as GlslSingleDeclaration).name)
19 | }
20 | }
--------------------------------------------------------------------------------
/src/test/kotlin/GlslParserTest.kt:
--------------------------------------------------------------------------------
1 | import com.intellij.testFramework.ParsingTestCase
2 | import glsl.plugin.language.GlslParserDefinition
3 |
4 |
5 | class GlslParserTest : ParsingTestCase("", "test", GlslParserDefinition()) {
6 |
7 | override fun getTestDataPath(): String {
8 | return "src/test/testData/parser"
9 | }
10 |
11 | override fun skipSpaces(): Boolean {
12 | return true
13 | }
14 |
15 | override fun includeRanges(): Boolean {
16 | return true
17 | }
18 |
19 | fun testParserFile() {
20 | doTest(true)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/test/kotlin/GlslRenamingTest.kt:
--------------------------------------------------------------------------------
1 | import com.intellij.testFramework.fixtures.BasePlatformTestCase
2 |
3 | class GlslRenamingTest : BasePlatformTestCase() {
4 |
5 | override fun getTestDataPath(): String {
6 | return "src/test/testData/renaming"
7 | }
8 |
9 | fun testRenamingIdentifier1() {
10 | myFixture.configureByFile("RenamingIdentifierFile1.glsl")
11 | myFixture.renameElementAtCaret("newName")
12 | myFixture.checkResultByFile("RenamingIdentifierFile1Expected.glsl")
13 | }
14 |
15 | fun testRenamingIdentifier2() {
16 | myFixture.configureByFile("RenamingIdentifierFile2.glsl")
17 | assertThrows(RuntimeException::class.java) { myFixture.renameElementAtCaret("newName") }
18 | }
19 |
20 | fun testRenamingIdentifier3() {
21 | myFixture.configureByFile("RenamingIdentifierFile3.glsl")
22 | myFixture.renameElementAtCaret("f_updated")
23 | myFixture.checkResultByFile("RenamingIdentifierFile3Expected.glsl")
24 | }
25 |
26 | fun testRenamingIdentifier4() {
27 | myFixture.configureByFile("RenamingIdentifierFile4.glsl")
28 | myFixture.renameElementAtCaret("VAR_UPDATED")
29 | myFixture.checkResultByFile("RenamingIdentifierFile4Expected.glsl")
30 | }
31 |
32 | fun testRenamingIdentifier5() {
33 | myFixture.configureByFile("RenamingIdentifierFile5.glsl")
34 | myFixture.renameElementAtCaret("NewName")
35 | myFixture.checkResultByFile("RenamingIdentifierFile5Expected.glsl")
36 | }
37 |
38 | fun testRenamingIdentifier6() {
39 | myFixture.configureByFile("RenamingIdentifierFile6.glsl")
40 | myFixture.renameElementAtCaret("TexCoordUpdated")
41 | myFixture.checkResultByFile("RenamingIdentifierFile6Expected.glsl")
42 | }
43 |
44 | fun testRenamingIdentifier7() {
45 | myFixture.configureByFile("RenamingIdentifierFile7.glsl")
46 | myFixture.renameElementAtCaret("func_updated")
47 | myFixture.checkResultByFile("RenamingIdentifierFile7Expected.glsl")
48 | }
49 |
50 | fun testRenamingIdentifier8() {
51 | myFixture.configureByFile("RenamingIdentifierFile8.html")
52 | myFixture.renameElementAtCaret("func_updated")
53 | myFixture.checkResultByFile("RenamingIdentifierFile8Expected.html")
54 | }
55 |
56 | fun testRenamingIdentifier9() {
57 | myFixture.configureByFile("RenamingIdentifierFile9.glsl")
58 | myFixture.renameElementAtCaret("func_updated")
59 | myFixture.checkResultByFile("RenamingIdentifierFile9Expected.glsl")
60 | }
61 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile1.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | int a = ab
3 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile10.glsl:
--------------------------------------------------------------------------------
1 | struct A {
2 | vec4 v;
3 | } a;
4 |
5 | struct B {
6 | vec4 first;
7 | } b;
8 |
9 | int main() {
10 | int b = b.first.xy.;
11 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile11.glsl:
--------------------------------------------------------------------------------
1 | struct A {
2 | vec4 v;
3 | } a;
4 |
5 | struct B {
6 | A first;
7 | } b;
8 |
9 | int main() {
10 | int b = b.first.v.rgb.;
11 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile12.glsl:
--------------------------------------------------------------------------------
1 | struct A {
2 | vec4 v;
3 | } a;
4 |
5 | struct B {
6 | A first;
7 | } b;
8 |
9 | int main() {
10 | int b = b.first.v.;
11 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile13.glsl:
--------------------------------------------------------------------------------
1 | #version 100
2 |
3 | void main() {
4 | in
5 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile14.glsl:
--------------------------------------------------------------------------------
1 | in fl
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile15.glsl:
--------------------------------------------------------------------------------
1 | float in
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile16.glsl:
--------------------------------------------------------------------------------
1 | int a = in
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile17.glsl:
--------------------------------------------------------------------------------
1 | int main(in int a, i)
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile18.glsl:
--------------------------------------------------------------------------------
1 | in
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile19.comp:
--------------------------------------------------------------------------------
1 | int a = gl_Max;
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile2.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | int a = ma
3 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile20.comp:
--------------------------------------------------------------------------------
1 | int a = gl_LocalInvocationID.;
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile21.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | a = gl_LocalInvocationID.;
3 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile22.glsl:
--------------------------------------------------------------------------------
1 | struct A {
2 | vec3 vec;
3 | } a;
4 |
5 | void main() {
6 | vec3 dummy = a.;
7 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile23.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | vec3 dummy = 1;
3 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile24a.glsl:
--------------------------------------------------------------------------------
1 | #include ""
2 |
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile3.geom:
--------------------------------------------------------------------------------
1 | int main() {
2 | ver;
3 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile4.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | int a = em;
3 | w
4 | int a = main();
5 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile5.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | int a = em;
3 | while (a) {
4 | if (a) {
5 | s
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile6.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | for (int a = 1; s)
3 | int a = em;
4 | int a = main();
5 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile7.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | int a = em;
3 | int a = w;
4 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile8.glsl:
--------------------------------------------------------------------------------
1 | #
2 | int main() {
3 | int a = 1;
4 | int a = 2;
5 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/CompletionFile9.glsl:
--------------------------------------------------------------------------------
1 | #version 3
2 | int main() {
3 | int a = 1;
4 | int a = 2;
5 | }
--------------------------------------------------------------------------------
/src/test/testData/completion/include-test/include-test2/CompletionFile24b.glsl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rmordechay/glsl-plugin-idea/3057cd24014a123109fafe4be16438d2133934f9/src/test/testData/completion/include-test/include-test2/CompletionFile24b.glsl
--------------------------------------------------------------------------------
/src/test/testData/completion/include-test/include-test3/CompletionFile24c.glsl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rmordechay/glsl-plugin-idea/3057cd24014a123109fafe4be16438d2133934f9/src/test/testData/completion/include-test/include-test3/CompletionFile24c.glsl
--------------------------------------------------------------------------------
/src/test/testData/documentation/DocumentationFile1.glsl:
--------------------------------------------------------------------------------
1 | int absCall = abs();
--------------------------------------------------------------------------------
/src/test/testData/documentation/DocumentationFile2.glsl:
--------------------------------------------------------------------------------
1 | /*
2 | * Function documentation
3 | */
4 | int func() {}
5 | int absCall = func();
--------------------------------------------------------------------------------
/src/test/testData/dummy/dummy.glsl:
--------------------------------------------------------------------------------
1 | struct Test {
2 | uvec3 A;
3 | } test;
4 |
5 | uint a = test.A[0];
--------------------------------------------------------------------------------
/src/test/testData/formatter/formatterFile.glsl:
--------------------------------------------------------------------------------
1 | #define VAR void a;
2 | #define VAR2( a , b ) a + b;
3 |
4 | int c = VAR2( 1 , 2 )
5 | #version 330
6 | // One line comment
7 | /*
8 | * Multi line comment
9 | */
10 |
11 | int mouse2 = vec2( - iTime / 148. , cos( iTime ) / 24.);
12 | int mouse3 = vec2 ( - iTime ) ;
13 |
14 | #define DEF void f(int aa, float a);
15 | #define DEF2(roi, roi2) void f(int roi, float roi2);
16 | #define DEF3 if (a > 2) { a = 2; a = 2; a = 2; }
17 | #define DEF4 (a > 2)
18 | void main() {
19 | DEF
20 | DEF2( a , b )
21 | DEF3
22 | }
23 |
24 |
25 | #define FUN(a, b) a + b;
26 | #define DEF4 int a = 2;
27 | #define PI 3.14
28 |
29 | void main( ) {
30 | DEF
31 | FUN(1, 2)
32 | float a = normalize( a * PI );
33 | }
34 |
35 | #define BINDLESS_TEX(ty, name) \
36 | layout (set = BINDLESS_SET, binding = BINDLESS_TEX_BINDING) \
37 | uniform ty name[BINDLESS_TEX_COUNT];
38 |
39 | #include "file.h"
40 | __LINE__ 10
41 |
42 | #include < shaders/func.frag >
43 |
44 | #define f(a, b) a + \
45 | b
46 |
47 | int dummy = f( 1, 2 ) ;
48 |
49 | // One line comment
50 | struct DummyStruct {
51 | // One line comment
52 | int struct_declarator1 ;
53 | int struct_declarator2[ ] ;
54 | int struct_declarator3 [ ] [] ;
55 | int struct_declarator4, struct_declarator5;
56 | } dummyStruct ;
57 |
58 | void func(int a, int a, int a, int a, int a);
59 |
60 | void func(int a, int a, int a,
61 | int a, int a);
62 |
63 | void func(int a,
64 | int a,
65 | int a,
66 | int a,
67 | int a);
68 |
69 | void func(
70 | int a,
71 | int a,
72 | int a,
73 | int a,
74 | int a
75 | );
76 |
77 | void func(
78 | int a,
79 | int a,
80 | int a,
81 | int a,
82 | int a);
83 |
84 | int a = func(
85 | vec2(0.0, 0.8),
86 | vec2(-0.6, -0.8),
87 | vec2(0.6, -0.8)
88 | );
89 |
90 | const float CONSTANT_DECLRATION = 0.2 ;
91 | float singl_declration[ ] = {1, 2 , 3 };
92 | float singl_declration [ 2] = 0.2;
93 | int a = a.b.c.i;
94 |
95 | // One line comment
96 | float a[1 ] [2][3], b [2] [1] = 2 ;
97 |
98 | int a = a;
99 | int a = a [1] ;
100 | int a = a [1] [2];
101 | int a = a [1] [2][3];
102 |
103 |
104 | float _a = { 1.0, 2.0, 3.0, 4.0 };
105 | float _a = { 1.0 + 2, 2.0 * 2, 3.0 / 2, 4.0 - 2.0 };
106 |
107 | float[] a = float[]( 1, 2, 3);
108 | float[] a = float[3 ]( 1, 2, 3 );
109 |
110 | int a = - (-1);
111 | int a = - 1;
112 | int a = - 1u + -1 - 1 - -2;
113 | int a = - dot(vec4(), vec4());
114 | int a = - a [ 0 ];
115 | int a = - a ++ ;
116 | int a = - a.a ;
117 | int a = 1 - 1u;
118 | int a = 1;
119 | int a = 1 + 2 / (2 + 2) + 1 * 2 ;
120 |
121 | int a = a( ) ;
122 |
123 | layout (location) in vec2 layout_declration;
124 | layout (location = 2) in vec2 layout_declration;
125 | layout (location = 1, max_vertices ) in vec4 layout_declration ;
126 | layout (location = 1, max_vertices = 2 > a) in vec4 layout_declration ;
127 | layout (triangles_strip, max_vertices = 3) out ;
128 | layout (triangles_strip, max_vertices = 3) ;
129 |
130 | layout (location = 3 ) centroid out float layout_declration;
131 | layout ( location) uniform UniformType {
132 | mat3 a ;
133 | mat4 b ;
134 | } uni ;
135 |
136 |
137 | void main( UserType a , UserType b) {}
138 | UserType main () {}
139 |
140 |
141 | noperspective centroid out vec2 a ;
142 | centroid out vec2 a;
143 | smooth out vec2 a[];
144 | // One line comment
145 | int function_definition ( float x , float y );
146 | int function_definition( DummyBlock x , float y ) {
147 | int a = 2 == b ? b : abs() ;
148 | void main();
149 | expr_statement();
150 | // One line comment
151 | if ( selection_statement == 1 ) {
152 | // One line comment
153 | if ( inner_id < 6 ) {
154 | dummy ;
155 | }
156 | } else if ( selection_statement_else ) {
157 | dummy;
158 | } else {
159 | dummy;
160 | }
161 |
162 | if (_x % int(a.x / 2) == 0 || _y % int(b.y / 2) == 0 ) {
163 | a = vec4 ( 0, 0, 1, 1);
164 | a = abs ( 0, 0, 1, 1);
165 | }
166 |
167 | for ( int i; i > 20; i++ ) {
168 | int a = i ;
169 | a = i + 2;
170 | }
171 |
172 | while (shouldRun) {
173 | if (!shouldRun) {
174 | call() ;
175 | } else {
176 | call();
177 | continue ;
178 | }
179 | shouldRun = 1;
180 | }
181 |
182 | do {
183 | int shouldRun = 1;
184 | shouldRun = 0;
185 | } while ( shouldRun);
186 |
187 | switch ( switch_statement ) {
188 | case 1 :
189 | int a = 1;
190 | return 1 ;
191 | case 2 :
192 | if ( true ) {
193 | doSomthing() ;
194 | }
195 | return 2;
196 | default :
197 | int a ;
198 | return 3 ;
199 | }
200 |
201 | float declaration_statement [ 2 ] = func( g ( h(x, y), z));
202 |
203 | demote ;
204 | continue ;
205 | break ;
206 | return jump_statement ;
207 | EmitVertex();
208 | gl_Position = a.b * vec4( ( x * vec3( 5.0, 5.0, 0.0) ) + y[0].xyz, 1.0);
209 | }
210 |
211 |
--------------------------------------------------------------------------------
/src/test/testData/formatter/formatterFileExpected.glsl:
--------------------------------------------------------------------------------
1 | #define VAR void a;
2 | #define VAR2(a, b) a + b;
3 |
4 | int c = VAR2(1, 2)
5 | #version 330
6 | // One line comment
7 | /*
8 | * Multi line comment
9 | */
10 |
11 | int mouse2 = vec2(-iTime / 148., cos(iTime) / 24.);
12 | int mouse3 = vec2(-iTime);
13 |
14 | #define DEF void f(int aa, float a);
15 | #define DEF2(roi, roi2) void f(int roi, float roi2);
16 | #define DEF3 if (a > 2) { a = 2; a = 2; a = 2; }
17 | #define DEF4 (a > 2)
18 | void main() {
19 | DEF
20 | DEF2(a, b)
21 | DEF3
22 | }
23 |
24 |
25 | #define FUN(a, b) a + b;
26 | #define DEF4 int a = 2;
27 | #define PI 3.14
28 |
29 | void main() {
30 | DEF
31 | FUN(1, 2)
32 | float a = normalize(a * PI);
33 | }
34 |
35 | #define BINDLESS_TEX(ty, name) \
36 | layout (set = BINDLESS_SET, binding = BINDLESS_TEX_BINDING) \
37 | uniform ty name[BINDLESS_TEX_COUNT];
38 |
39 | #include "file.h"
40 | __LINE__ 10
41 |
42 | #include
43 |
44 | #define f(a, b) a + \
45 | b
46 |
47 | int dummy = f(1, 2);
48 |
49 | // One line comment
50 | struct DummyStruct {
51 | // One line comment
52 | int struct_declarator1;
53 | int struct_declarator2[];
54 | int struct_declarator3[][];
55 | int struct_declarator4, struct_declarator5;
56 | } dummyStruct;
57 |
58 | void func(int a, int a, int a, int a, int a);
59 |
60 | void func(int a, int a, int a,
61 | int a, int a);
62 |
63 | void func(int a,
64 | int a,
65 | int a,
66 | int a,
67 | int a);
68 |
69 | void func(
70 | int a,
71 | int a,
72 | int a,
73 | int a,
74 | int a
75 | );
76 |
77 | void func(
78 | int a,
79 | int a,
80 | int a,
81 | int a,
82 | int a);
83 |
84 | int a = func(
85 | vec2(0.0, 0.8),
86 | vec2(-0.6, -0.8),
87 | vec2(0.6, -0.8)
88 | );
89 |
90 | const float CONSTANT_DECLRATION = 0.2;
91 | float singl_declration[] = { 1, 2, 3 };
92 | float singl_declration[2] = 0.2;
93 | int a = a.b.c.i;
94 |
95 | // One line comment
96 | float a[1][2][3], b[2][1] = 2;
97 |
98 | int a = a;
99 | int a = a[1];
100 | int a = a[1][2];
101 | int a = a[1][2][3];
102 |
103 |
104 | float _a = { 1.0, 2.0, 3.0, 4.0 };
105 | float _a = { 1.0 + 2, 2.0 * 2, 3.0 / 2, 4.0 - 2.0 };
106 |
107 | float[] a = float[](1, 2, 3);
108 | float[] a = float[3](1, 2, 3);
109 |
110 | int a = -(-1);
111 | int a = -1;
112 | int a = -1u + -1 - 1 - -2;
113 | int a = -dot(vec4(), vec4());
114 | int a = -a[0];
115 | int a = -a++;
116 | int a = -a.a;
117 | int a = 1 - 1u;
118 | int a = 1;
119 | int a = 1 + 2 / (2 + 2) + 1 * 2;
120 |
121 | int a = a();
122 |
123 | layout (location) in vec2 layout_declration;
124 | layout (location = 2) in vec2 layout_declration;
125 | layout (location = 1, max_vertices) in vec4 layout_declration;
126 | layout (location = 1, max_vertices = 2 > a) in vec4 layout_declration;
127 | layout (triangles_strip, max_vertices = 3) out;
128 | layout (triangles_strip, max_vertices = 3);
129 |
130 | layout (location = 3) centroid out float layout_declration;
131 | layout (location) uniform UniformType {
132 | mat3 a;
133 | mat4 b;
134 | } uni;
135 |
136 |
137 | void main(UserType a, UserType b) {}
138 | UserType main() {}
139 |
140 |
141 | noperspective centroid out vec2 a;
142 | centroid out vec2 a;
143 | smooth out vec2 a[];
144 | // One line comment
145 | int function_definition(float x, float y);
146 | int function_definition(DummyBlock x, float y) {
147 | int a = 2 == b ? b : abs();
148 | void main();
149 | expr_statement();
150 | // One line comment
151 | if (selection_statement == 1) {
152 | // One line comment
153 | if (inner_id < 6) {
154 | dummy;
155 | }
156 | } else if (selection_statement_else) {
157 | dummy;
158 | } else {
159 | dummy;
160 | }
161 |
162 | if (_x % int(a.x / 2) == 0 || _y % int(b.y / 2) == 0) {
163 | a = vec4(0, 0, 1, 1);
164 | a = abs(0, 0, 1, 1);
165 | }
166 |
167 | for (int i; i > 20; i++) {
168 | int a = i;
169 | a = i + 2;
170 | }
171 |
172 | while (shouldRun) {
173 | if (!shouldRun) {
174 | call();
175 | } else {
176 | call();
177 | continue;
178 | }
179 | shouldRun = 1;
180 | }
181 |
182 | do {
183 | int shouldRun = 1;
184 | shouldRun = 0;
185 | } while (shouldRun);
186 |
187 | switch (switch_statement) {
188 | case 1:
189 | int a = 1;
190 | return 1;
191 | case 2:
192 | if (true) {
193 | doSomthing();
194 | }
195 | return 2;
196 | default:
197 | int a;
198 | return 3;
199 | }
200 |
201 | float declaration_statement[2] = func(g(h(x, y), z));
202 |
203 | demote;
204 | continue;
205 | break;
206 | return jump_statement;
207 | EmitVertex();
208 | gl_Position = a.b * vec4((x * vec3(5.0, 5.0, 0.0)) + y[0].xyz, 1.0);
209 | }
210 |
211 |
--------------------------------------------------------------------------------
/src/test/testData/include/IncludeFile1.glsl:
--------------------------------------------------------------------------------
1 | #include "IncludeFile2.glsl"
2 | void main() {
3 | int a = b;
4 | }
5 |
--------------------------------------------------------------------------------
/src/test/testData/include/IncludeFile2.glsl:
--------------------------------------------------------------------------------
1 | int b = 2;
--------------------------------------------------------------------------------
/src/test/testData/include/IncludeFile3.glsl:
--------------------------------------------------------------------------------
1 | #include "IncludeFile3.glsl"
2 | int a = b;
--------------------------------------------------------------------------------
/src/test/testData/include/IncludeFile4.glsl:
--------------------------------------------------------------------------------
1 | #include "IncludeFile5.glsl"
2 |
--------------------------------------------------------------------------------
/src/test/testData/include/IncludeFile5.glsl:
--------------------------------------------------------------------------------
1 | #include "IncludeFile6.glsl"
2 |
--------------------------------------------------------------------------------
/src/test/testData/include/IncludeFile6.glsl:
--------------------------------------------------------------------------------
1 | #include "IncludeFile4.glsl"
2 | int a = b;
3 |
--------------------------------------------------------------------------------
/src/test/testData/include/IncludeFile7.glsl:
--------------------------------------------------------------------------------
1 | #include "IncludeFile8.glsl"
2 |
3 | void main() {
4 | A a = A();
5 | }
--------------------------------------------------------------------------------
/src/test/testData/include/IncludeFile8.glsl:
--------------------------------------------------------------------------------
1 | struct A {
2 | int a;
3 | };
--------------------------------------------------------------------------------
/src/test/testData/include/shaders/IncludeFile10.glsl:
--------------------------------------------------------------------------------
1 | #include "IncludeFile7.glsl"
2 |
3 | int c = b;
--------------------------------------------------------------------------------
/src/test/testData/include/shaders/IncludeFile7.glsl:
--------------------------------------------------------------------------------
1 | int b = 2;
2 |
--------------------------------------------------------------------------------
/src/test/testData/include/shaders/IncludeFile8.glsl:
--------------------------------------------------------------------------------
1 | #include "IncludeFile7.glsl"
2 |
3 | int c = a;
--------------------------------------------------------------------------------
/src/test/testData/include/shaders/IncludeFile9.glsl:
--------------------------------------------------------------------------------
1 | #include "shaders2/IncludeFile7.glsl"
2 |
3 | int c = a;
--------------------------------------------------------------------------------
/src/test/testData/include/shaders/shaders2/IncludeFile7.glsl:
--------------------------------------------------------------------------------
1 | int a = 2;
2 |
--------------------------------------------------------------------------------
/src/test/testData/inspections/InspectionPrimitiveConstructorNoArguments.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | int a = int();
3 | int a = int(1);
4 | mat3 a = mat3();
5 | mat3 a = mat3(1);
6 | vec3 a = vec3();
7 | vec3 a = vec3(1);
8 | }
--------------------------------------------------------------------------------
/src/test/testData/inspections/InspectionsNoMatchingFunction.glsl:
--------------------------------------------------------------------------------
1 | #include "InspectionsNoMatchingFunction2.glsl"
2 |
3 | float a = normalize(2, 2);
4 |
5 | float smoothFunc(float a, float b, float x) {
6 | float a = smoothFunc(2, 2);
7 | return smoothFunc(2);
8 | }
--------------------------------------------------------------------------------
/src/test/testData/inspections/InspectionsNoMatchingFunction2.glsl:
--------------------------------------------------------------------------------
1 | float smoothFunc(float a) {
2 | return 2;
3 | }
--------------------------------------------------------------------------------
/src/test/testData/inspections/InspectionsTestDoesNotOperate.glsl:
--------------------------------------------------------------------------------
1 | // Scalar-Scalar
2 | float a0 = 1 + 1;
3 | float a1 = 1 - 1;
4 | float a2 = 1 * 1;
5 | float a3 = 1 / 1;
6 | // Scalar-Vector
7 | vec3 a12 = 1 + vec3(1);
8 | vec3 a13 = 1 - vec3(1);
9 | vec3 a14 = 1 * vec3(1);
10 | vec3 a15 = 1 / vec3(1);
11 | // Scalar-Matrix
12 | mat3 a20 = 1 + mat3(1);
13 | mat3 a21 = 1 - mat3(1);
14 | mat3 a22 = 1 * mat3(1);
15 | mat3 a23 = 1 / mat3(1);
16 | // Vector-Scalar
17 | vec3 a16 = vec3(1) + 1;
18 | vec3 a17 = vec3(1) - 1;
19 | vec3 a18 = vec3(1) * 1;
20 | vec3 a19 = vec3(1) / 1;
21 | // Vector-Vector
22 | vec3 a4 = vec3(1) + vec3(1);
23 | vec3 a5 = vec3(1) - vec3(1);
24 | vec3 a6 = vec3(1) * vec3(1);
25 | vec3 a7 = vec3(1) / vec3(1);
26 | // Vector-Matrix
27 | mat3 a28 = vec3(1) + mat3(1);
28 | mat3 a29 = vec3(1) - mat3(1);
29 | vec3 a30 = vec3(1) * mat3(1);
30 | mat3 a31 = vec3(1) / mat3(1);
31 | // Matrix-Scalar
32 | mat3 a24 = mat3(1) + 1;
33 | mat3 a25 = mat3(1) - 1;
34 | mat3 a26 = mat3(1) * 1;
35 | mat3 a27 = mat3(1) / 1;
36 | // Matrix-Vector
37 | mat3 a32 = mat3(1) + vec3(1);
38 | mat3 a33 = mat3(1) - vec3(1);
39 | vec3 a34 = mat3(1) * vec3(1);
40 | mat3 a35 = mat3(1) / vec3(1);
41 | // Matrix-Matrix
42 | mat3 a8 = mat3(1) + mat3(1);
43 | mat3 a9 = mat3(1) - mat3(1);
44 | mat3 a10 = mat3(1) * mat3(1);
45 | mat3 a11 = mat3(1) / mat3(1);
--------------------------------------------------------------------------------
/src/test/testData/inspections/InspectionsTestIncompatibleTypes.glsl:
--------------------------------------------------------------------------------
1 | int a = normalize(2.0);
2 | int a = normalize(2);
3 | float a = normalize(2);
4 | float a = normalize(2.0f);
5 | float a = normalize(2.f);
6 | float a = normalize(2);
7 | int b, c = a;
8 | int b, c = 2.0f;
9 |
--------------------------------------------------------------------------------
/src/test/testData/inspections/InspectionsTestMissingReturn.glsl:
--------------------------------------------------------------------------------
1 | int f() {}
2 | int f() {return 0;}
3 | int f() {if (true) { return 0; }}
4 | void f() {}
5 | void f() {if (true) { }}
6 |
--------------------------------------------------------------------------------
/src/test/testData/languageInjection/LanguageInjectionHtml.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Title
6 |
7 |
8 |
20 |
21 |
--------------------------------------------------------------------------------
/src/test/testData/reference/FindUsageFile1.glsl:
--------------------------------------------------------------------------------
1 | int a;
2 | int b = a;
3 | int main() {
4 | int b = abs(a);
5 | if (b) {
6 | a;
7 | }
8 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/FindUsageFile2.glsl:
--------------------------------------------------------------------------------
1 | #define VAR 10
2 |
3 | void main() {
4 | int a = VAR + 10;
5 | int b = abs(VAR);
6 | }
7 |
--------------------------------------------------------------------------------
/src/test/testData/reference/FindUsageFile3.glsl:
--------------------------------------------------------------------------------
1 | #define EPSILON_NRM iResolution
2 |
3 | void main() {
4 | vec3 p;
5 | heightMapTracing(p);
6 | vec3 dist = p - ori;
7 | vec3 n = getNormal(p, dot(dist,dist) * EPSILON_NRM);
8 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile1.glsl:
--------------------------------------------------------------------------------
1 | int a = 2;
2 | int b = a + 2;
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile10.glsl:
--------------------------------------------------------------------------------
1 | void f1(int param1, int param2) {
2 |
3 | }
4 |
5 | void f2() {
6 | int a = param1;
7 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile11.glsl:
--------------------------------------------------------------------------------
1 | void f1(int param1, int param2) {
2 | int a = param1;
3 | }
4 |
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile12.glsl:
--------------------------------------------------------------------------------
1 | void f1(int param1, int param2) {
2 | if (param2 == 1) {
3 | while (true) {
4 | int a = param1;
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile13.glsl:
--------------------------------------------------------------------------------
1 | struct A {
2 | int a;
3 | };
4 |
5 | A c = A(1);
6 |
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile14.glsl:
--------------------------------------------------------------------------------
1 | int main(int param) {
2 | int a = param;
3 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile15.glsl:
--------------------------------------------------------------------------------
1 | struct Inner
2 | {
3 | vec4 pos;
4 | vec4 vel;
5 | };
6 |
7 | layout (location) buffer Pos
8 | {
9 | Inner inner[];
10 | };
11 |
12 | void main() {
13 | int index = 1;
14 | inner[index].vel.xyz += 1;
15 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile16.glsl:
--------------------------------------------------------------------------------
1 | struct Inner {
2 | vec4 pos;
3 | vec4 vel;
4 | };
5 |
6 | layout (location) buffer Pos {
7 | Inner inner[];
8 | };
9 |
10 | void main() {
11 | int index = 1;
12 | inner[index].vel.xyz += 1;
13 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile17.comp:
--------------------------------------------------------------------------------
1 | int a = gl_LocalInvocationID;
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile18.comp:
--------------------------------------------------------------------------------
1 | uint a = gl_LocalInvocationID.x;
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile19.frag:
--------------------------------------------------------------------------------
1 | void main() {
2 | gl_FragCoord = vec4();
3 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile2.glsl:
--------------------------------------------------------------------------------
1 | struct A {
2 | int structMember;
3 | } a;
4 |
5 | int dummy = a.structMember;
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile20.frag:
--------------------------------------------------------------------------------
1 | void main() {
2 | int a = gl_MaxGeometryInputComponents;
3 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile21.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | vec4 a = normalize(vec3()).xy;
3 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile22.glsl:
--------------------------------------------------------------------------------
1 | struct A {
2 | vec4 vec;
3 | };
4 |
5 | in B {
6 | A a[];
7 | } b;
8 |
9 |
10 | void main() {
11 | b.a[0].vec.w;
12 | }
13 |
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile23.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | mat4 m;
3 | vec3 a = m[0].xyz;
4 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile24.glsl:
--------------------------------------------------------------------------------
1 | struct A {
2 | int a;
3 | };
4 |
5 | void main() {
6 | int b = a;
7 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile25.glsl:
--------------------------------------------------------------------------------
1 | layout (location) in Pos {
2 | vec4 vec;
3 | } a;
4 |
5 | void main() {
6 | vec4 dummy = vec;
7 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile26.glsl:
--------------------------------------------------------------------------------
1 | layout (location) in Pos {
2 | vec4 vec;
3 | };
4 |
5 | void main() {
6 | vec4 dummy = vec;
7 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile27.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | int a = normalize(vec4(2.0, 2, 2, 2)).xz;
3 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile28.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | float arr[10];
3 | abs(arr[1]);
4 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile29.glsl:
--------------------------------------------------------------------------------
1 | void main() {
2 | int a = 0;
3 | a++;
4 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile3.glsl:
--------------------------------------------------------------------------------
1 | struct A {
2 | int c;
3 | } a;
4 |
5 | struct B {
6 | A a;
7 | } b;
8 |
9 | int dummy = b.a.c;
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile30.glsl:
--------------------------------------------------------------------------------
1 | #define PI 3.14
2 | int n = PI;
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile31.glsl:
--------------------------------------------------------------------------------
1 | #define f(a, b) a + b + 2
2 |
3 | int dummy = f(1, 2);
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile32.glsl:
--------------------------------------------------------------------------------
1 | #define VAR 10
2 |
3 | void main() {
4 | int a = VAR + 10;
5 | }
6 |
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile33.glsl:
--------------------------------------------------------------------------------
1 | #define X 2
2 | #define YY X
3 | #define ZZZ YY
4 | int a = ZZZ;
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile34.glsl:
--------------------------------------------------------------------------------
1 | int a, b, c = 1;
2 | int d = a;
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile35.glsl:
--------------------------------------------------------------------------------
1 | int a, b, c = 1;
2 | int d = b;
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile36.glsl:
--------------------------------------------------------------------------------
1 | int a, b, c = 1;
2 | int d = c;
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile37.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | for (int i = 1; i > 10; i++) {
3 | int dummy = i;
4 | }
5 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile4.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | int dummy = dummy;
3 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile5.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | for (int i = 1; i > 10; i++) {
3 | int dummy = i;
4 | }
5 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile6.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | for (int i = 1; i > 10; i++) {
3 | int dummy = i;
4 | }
5 | i;
6 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile7.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | if (true) {
3 | int a = 1;
4 | }
5 | int dummy = a;
6 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile8.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | int dummy = dummy;
3 | }
--------------------------------------------------------------------------------
/src/test/testData/reference/ReferenceFile9.glsl:
--------------------------------------------------------------------------------
1 | int main() {
2 | int dummy = 1;
3 | dummy = dummy + 1;
4 | }
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile1.glsl:
--------------------------------------------------------------------------------
1 | struct Third {
2 | int i;
3 | } third;
4 |
5 | struct Second {
6 | Third third;
7 | } second;
8 |
9 | struct First {
10 | Second second;
11 | } first;
12 |
13 | int dummy = first.second.third;
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile1Expected.glsl:
--------------------------------------------------------------------------------
1 | struct Third {
2 | int i;
3 | } third;
4 |
5 | struct Second {
6 | Third newName;
7 | } second;
8 |
9 | struct First {
10 | Second second;
11 | } first;
12 |
13 | int dummy = first.second.newName;
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile2.glsl:
--------------------------------------------------------------------------------
1 | struct Third {
2 | vec4 v;
3 | } third;
4 |
5 | struct Second {
6 | Third third;
7 | } second;
8 |
9 | struct First {
10 | Second second;
11 | } first;
12 |
13 | int dummy = first.second.third.v.xyz;
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile2Expected.glsl:
--------------------------------------------------------------------------------
1 | struct Third {
2 | vec4 v;
3 | } third;
4 |
5 | struct Second {
6 | Third third;
7 | } second;
8 |
9 | struct First {
10 | Second second;
11 | } first;
12 |
13 | int dummy = first.second.third.v.xyz;
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile3.glsl:
--------------------------------------------------------------------------------
1 | #define f(a, b) 10
2 |
3 | void main() {
4 | int a = f(1, 2) + 10;
5 | int b = abs(f(1, 2));
6 | }
7 |
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile3Expected.glsl:
--------------------------------------------------------------------------------
1 | #define f_updated(a, b) 10
2 |
3 | void main() {
4 | int a = f_updated(1, 2) + 10;
5 | int b = abs(f_updated(1, 2));
6 | }
7 |
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile4.glsl:
--------------------------------------------------------------------------------
1 | #define VAR 10
2 |
3 | void main() {
4 | int a = VAR + 10;
5 | int b = abs(VAR);
6 | }
7 |
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile4Expected.glsl:
--------------------------------------------------------------------------------
1 | #define VAR_UPDATED 10
2 |
3 | void main() {
4 | int a = VAR_UPDATED + 10;
5 | int b = abs(VAR_UPDATED);
6 | }
7 |
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile5.glsl:
--------------------------------------------------------------------------------
1 | struct Third {
2 | int i;
3 | } third;
4 |
5 | struct Second {
6 | Third third;
7 | } second;
8 |
9 | struct First {
10 | Second second;
11 | } first;
12 |
13 | Third dummy = first.second.third;
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile5Expected.glsl:
--------------------------------------------------------------------------------
1 | struct NewName {
2 | int i;
3 | } third;
4 |
5 | struct Second {
6 | NewName third;
7 | } second;
8 |
9 | struct First {
10 | Second second;
11 | } first;
12 |
13 | NewName dummy = first.second.third;
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile6.glsl:
--------------------------------------------------------------------------------
1 | #version 330 core
2 | #define PI 3.14
3 | #define func(a, b) if (a > b) { int num = 2; }
4 | #include "different/file.glsl"
5 |
6 | precision mediump float;
7 | layout (location = 0) in vec3 aPos;
8 | layout (location = 1) in vec2 aTexCoord;
9 |
10 | out vec2 TexCoord;
11 |
12 | uniform mat4 model;
13 | uniform mat4 view;
14 | uniform mat4 projection2;
15 |
16 | void main() {
17 | TexCoord = vec2(1, 1);
18 | }
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile6Expected.glsl:
--------------------------------------------------------------------------------
1 | #version 330 core
2 | #define PI 3.14
3 | #define func(a, b) if (a > b) { int num = 2; }
4 | #include "different/file.glsl"
5 |
6 | precision mediump float;
7 | layout (location = 0) in vec3 aPos;
8 | layout (location = 1) in vec2 aTexCoord;
9 |
10 | out vec2 TexCoordUpdated;
11 |
12 | uniform mat4 model;
13 | uniform mat4 view;
14 | uniform mat4 projection2;
15 |
16 | void main() {
17 | TexCoordUpdated = vec2(1, 1);
18 | }
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile7.glsl:
--------------------------------------------------------------------------------
1 | #version 330 core
2 | #define PI 3.14
3 | #define func(a, b) if (a > b) { int num = 2; }
4 | #include "different/file.glsl"
5 |
6 | precision mediump float;
7 | layout (location = 0) in vec3 aPos;
8 | layout (location = 1) in vec2 aTexCoord;
9 |
10 | out vec2 TexCoord;
11 |
12 | uniform mat4 model;
13 | uniform mat4 view;
14 | uniform mat4 projection2;
15 |
16 | /**
17 | *
18 | */
19 | int addd2(int a, int b) {
20 | func(1, 2)
21 | float v = normalize(a * PI);
22 | return a + b;
23 | }
24 |
25 | void main() {
26 | gl_Position = projection * view * model * vec4(abs(aPos), 1.0f);
27 | TexCoord = vec2(aTexCoord.x, aTexCoord.y);
28 | }
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile7Expected.glsl:
--------------------------------------------------------------------------------
1 | #version 330 core
2 | #define PI 3.14
3 | #define func_updated(a, b) if (a > b) { int num = 2; }
4 | #include "different/file.glsl"
5 |
6 | precision mediump float;
7 | layout (location = 0) in vec3 aPos;
8 | layout (location = 1) in vec2 aTexCoord;
9 |
10 | out vec2 TexCoord;
11 |
12 | uniform mat4 model;
13 | uniform mat4 view;
14 | uniform mat4 projection2;
15 |
16 | /**
17 | *
18 | */
19 | int addd2(int a, int b) {
20 | func_updated(1, 2)
21 | float v = normalize(a * PI);
22 | return a + b;
23 | }
24 |
25 | void main() {
26 | gl_Position = projection * view * model * vec4(abs(aPos), 1.0f);
27 | TexCoord = vec2(aTexCoord.x, aTexCoord.y);
28 | }
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile8.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
40 |
41 |
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile8Expected.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
40 |
41 |
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile9.glsl:
--------------------------------------------------------------------------------
1 | int a = 2;
--------------------------------------------------------------------------------
/src/test/testData/renaming/RenamingIdentifierFile9Expected.glsl:
--------------------------------------------------------------------------------
1 | int a = 2;
--------------------------------------------------------------------------------