• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1group custom "Custom loop tests"
2
3	case continue_in_fragment_for_loop
4		version 300 es
5		vertex ""
6			#version 300 es
7			${VERTEX_DECLARATIONS}
8			void main()
9			{
10				${VERTEX_OUTPUT}
11			}
12		""
13		fragment ""
14			#version 300 es
15			${FRAGMENT_DECLARATIONS}
16			void main()
17			{
18				int count1 = 0;
19				for(int i=0;i<4;i++)
20				{
21					if (count1 == 2)
22						continue;
23				}
24				${FRAG_COLOR} = vec4(1.0);
25			}
26		""
27	end
28
29end # custom
30
31# https://github.com/KhronosGroup/WebGL/blob/master/sdk/tests/conformance2/glsl3/short-circuiting-in-loop-condition.html
32group short_circuit "Short-circuiting operator in a loop using a function call with side effects"
33
34	case while
35		version 300 es
36		values
37		{
38			input bool in0 = [ false | true ];
39			output int sideEffectCounter = [ 0 | 10 ];
40		}
41
42		both ""
43			#version 300 es
44			precision mediump float;
45			precision mediump int;
46
47			${DECLARATIONS}
48
49			bool foo() {
50				++sideEffectCounter;
51				return true;
52			}
53
54			void main()
55			{
56				${SETUP}
57				sideEffectCounter = 0;
58				int iterations = 0;
59				while (in0 && foo()) {
60					++iterations;
61					if (iterations >= 10) {
62						break;
63					}
64				}
65				${OUTPUT}
66			}
67		""
68	end
69
70	case for
71		version 300 es
72		values
73		{
74			input bool in0 = [ false | true ];
75			output int sideEffectCounter = [ 0 | 10 ];
76		}
77
78		both ""
79			#version 300 es
80			precision mediump float;
81			precision mediump int;
82
83			${DECLARATIONS}
84
85			bool foo() {
86				++sideEffectCounter;
87				return true;
88			}
89
90			void main()
91			{
92				${SETUP}
93				sideEffectCounter = 0;
94				for (int iterations = 0; true; in0 && foo()) {
95					++iterations;
96					if (iterations > 10) {
97						break;
98					}
99				}
100				${OUTPUT}
101			}
102		""
103	end
104
105	case do_while
106		version 300 es
107		values
108		{
109			input bool in0 = [ false | true ];
110			output int sideEffectCounter = [ 0 | 10 ];
111		}
112
113		both ""
114			#version 300 es
115			precision mediump float;
116			precision mediump int;
117
118			${DECLARATIONS}
119
120			bool foo() {
121				++sideEffectCounter;
122				return true;
123			}
124
125			void main()
126			{
127				${SETUP}
128				sideEffectCounter = 0;
129				int iterations = 0;
130				do {
131					++iterations;
132					if (iterations > 10) {
133						break;
134					}
135				} while (in0 && foo());
136				${OUTPUT}
137			}
138		""
139	end
140
141	case while_sequence
142		version 300 es
143		values
144		{
145			input bool in0 = [ false | true ];
146			output int sideEffectCounter = [ 0 | 10 ];
147		}
148
149		both ""
150			#version 300 es
151			precision mediump float;
152			precision mediump int;
153
154			${DECLARATIONS}
155
156			bool foo() {
157				++sideEffectCounter;
158				return true;
159			}
160
161			void main()
162			{
163				${SETUP}
164				sideEffectCounter = 0;
165				int iterations = 0;
166				while ((in0, in0 && foo())) {
167					++iterations;
168					if (iterations >= 10) {
169						break;
170					}
171				}
172				${OUTPUT}
173			}
174		""
175	end
176
177end # short_circuit
178