3
3
// University of Illinois/NCSA Open Source License. Both these licenses can be
4
4
// found in the LICENSE file.
5
5
6
- #include < cassert>
7
- #include < cstdlib>
8
- #include < cstdio>
9
- #include < cstring>
6
+ #include <assert.h>
7
+ #include <stdlib.h>
8
+ #include <stdbool.h>
9
+ #include <stdio.h>
10
+ #include <string.h>
10
11
#include <emscripten.h>
11
12
#include <emscripten/html5.h>
12
13
22
23
int result = 0 ;
23
24
GLuint timerQuery = 0 ;
24
25
25
- #define GL_CALL ( x ) \
26
- { \
27
- x; \
28
- GLenum error = glGetError (); \
29
- if ( error != GL_NO_ERROR ) { \
30
- printf ( " GL ERROR: %d, %s\n " , (int )error, #x ); \
31
- result = 1 ; \
32
- } \
33
- } \
34
-
35
- void getQueryResult ()
36
- {
26
+ #define GL_CALL (x ) \
27
+ { \
28
+ x; \
29
+ GLenum error = glGetError(); \
30
+ if (error != GL_NO_ERROR) { \
31
+ printf("GL ERROR: %d, %s\n", (int)error, #x); \
32
+ result = 1; \
33
+ } \
34
+ }
35
+
36
+ void getQueryResult () {
37
37
/* Get the result. It should be nonzero. */
38
38
GLuint64 time = 0 ;
39
39
#ifdef TEST_WEBGL2
@@ -42,7 +42,7 @@ void getQueryResult()
42
42
GL_CALL (glGetQueryObjectui64vEXT (timerQuery , GL_QUERY_RESULT_EXT , & time ));
43
43
#endif
44
44
45
- if (!time) return ;
45
+ if (!time ) return ;
46
46
47
47
printf ("queried time: %llu\n" , time );
48
48
emscripten_cancel_main_loop ();
@@ -56,8 +56,7 @@ void getQueryResult()
56
56
exit (result );
57
57
}
58
58
59
- int main ()
60
- {
59
+ int main () {
61
60
EmscriptenWebGLContextAttributes attrs ;
62
61
emscripten_webgl_init_context_attributes (& attrs );
63
62
@@ -78,8 +77,7 @@ int main()
78
77
/* Skip WebGL 2 tests if not supported */
79
78
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context ( "#canvas" , & attrs );
80
79
#ifdef TEST_WEBGL2
81
- if (!context)
82
- {
80
+ if (!context ) {
83
81
printf ("Skipped: WebGL 2 is not supported.\n" );
84
82
return 0 ;
85
83
}
@@ -88,8 +86,7 @@ int main()
88
86
89
87
/* Check if the extension is actually supported. Firefox reports
90
88
EXT_disjoint_timer_query on WebGL 2 as well. */
91
- if (!std::strstr (reinterpret_cast <const char *>(glGetString (GL_EXTENSIONS)), " EXT_disjoint_timer_query" ))
92
- {
89
+ if (!strstr (glGetString (GL_EXTENSIONS ), "EXT_disjoint_timer_query" )) {
93
90
printf ("EXT_disjoint_timer_query[_webgl2] not supported\n" );
94
91
return 0 ;
95
92
}
0 commit comments