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 
17 // The purpose of the OpenGL logger is to log
18 // information about such things as EGL initialization
19 // and possibly miscellanous OpenGL commands,
20 // in order to get a better idea of what is going on
21 // in crash reports.
22 
23 // Flags for controlling fine logging and printing to stdout.
24 typedef enum {
25     // Default logging settings
26     // (coarse log active, sent to crash server, no fine logging)
27     OPENGL_LOGGER_NONE = 0,
28 
29     // Log GL API calls and timestamps at fine grained level.
30     OPENGL_LOGGER_DO_FINE_LOGGING = (1 << 0),
31 
32     // Print GL logs to stdout. For fine logs, do not print to storage if this flag is active.
33     OPENGL_LOGGER_PRINT_TO_STDOUT = (1 << 1),
34 } AndroidOpenglLoggerFlags;
35 
36 // C interface for android-emugl
37 void android_init_opengl_logger();
38 void android_opengl_logger_set_flags(AndroidOpenglLoggerFlags flags);
39 void android_opengl_logger_write(const char* fmt, ...);
40 void android_stop_opengl_logger();
41 
42 // This is for logging what goes on in individual OpenGL
43 // contexts (cxts). Only called when emugl is compiled
44 // with -DOPENGL_DEBUG_PRINTOUT.
45 void android_opengl_cxt_logger_write(const char* fmt, ...);
46