1 // Copyright 2020 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 #include <stdint.h>
17 
18 // The purpose of the OpenGL logger is to log
19 // information about such things as EGL initialization
20 // and possibly miscellanous OpenGL commands,
21 // in order to get a better idea of what is going on
22 // in crash reports.
23 
24 // Flags for controlling fine logging and printing to stdout.
25 typedef enum {
26     // Default logging settings
27     // (coarse log active, sent to crash server, no fine logging)
28     OPENGL_LOGGER_NONE = 0,
29 
30     // Log GL API calls and timestamps at fine grained level.
31     OPENGL_LOGGER_DO_FINE_LOGGING = (1 << 0),
32 
33     // Print GL logs to stdout. For fine logs, do not print to storage if this flag is active.
34     OPENGL_LOGGER_PRINT_TO_STDOUT = (1 << 1),
35 } AndroidOpenglLoggerFlags;
36 
37 // C interface for android-emugl
38 void android_init_opengl_logger();
39 void android_opengl_logger_set_flags(AndroidOpenglLoggerFlags flags);
40 void android_opengl_logger_write(char severity,
41                                  const char* file,
42                                  unsigned int line,
43                                  int64_t timestamp_us,
44                                  const char* message);
45 void android_stop_opengl_logger();
46