1 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "common/event_tracer.h"
6
7 namespace gl
8 {
9
10 GetCategoryEnabledFlagFunc g_getCategoryEnabledFlag;
11 AddTraceEventFunc g_addTraceEvent;
12
13 } // namespace gl
14
15 extern "C" {
16
SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,AddTraceEventFunc addTraceEvent)17 void __stdcall SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
18 AddTraceEventFunc addTraceEvent)
19 {
20 gl::g_getCategoryEnabledFlag = getCategoryEnabledFlag;
21 gl::g_addTraceEvent = addTraceEvent;
22 }
23
24 } // extern "C"
25
26 namespace gl
27 {
28
TraceGetTraceCategoryEnabledFlag(const char * name)29 const unsigned char* TraceGetTraceCategoryEnabledFlag(const char* name)
30 {
31 if (g_getCategoryEnabledFlag)
32 {
33 return g_getCategoryEnabledFlag(name);
34 }
35 static unsigned char disabled = 0;
36 return &disabled;
37 }
38
TraceAddTraceEvent(char phase,const unsigned char * categoryGroupEnabled,const char * name,unsigned long long id,int numArgs,const char ** argNames,const unsigned char * argTypes,const unsigned long long * argValues,unsigned char flags)39 void TraceAddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
40 int numArgs, const char** argNames, const unsigned char* argTypes,
41 const unsigned long long* argValues, unsigned char flags)
42 {
43 if (g_addTraceEvent)
44 {
45 g_addTraceEvent(phase, categoryGroupEnabled, name, id, numArgs, argNames, argTypes, argValues, flags);
46 }
47 }
48
49 } // namespace gl
50