blob: bb59ba075bd33bb49338ccd257cedb6b6d0f2ef1 [file] [log] [blame]
David Li28ca2ab2011-03-01 16:08:10 -08001/*
2 ** Copyright 2011, The Android Open Source Project
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16
17#include <stdlib.h>
18#include <ctype.h>
19#include <string.h>
20#include <errno.h>
21
David Li28ca2ab2011-03-01 16:08:10 -080022#include <GLES2/gl2.h>
23#include <GLES2/gl2ext.h>
24
25#include <cutils/log.h>
David Li55c94cc2011-03-04 17:50:48 -080026#include <utils/Timers.h>
David Li28ca2ab2011-03-01 16:08:10 -080027#include <../../../libcore/include/StaticAssert.h>
28
29#define EGL_TRACE 1
30#include "hooks.h"
31
32#define GL_ENTRY(_r, _api, ...) _r Debug_##_api ( __VA_ARGS__ );
33#include "../include/glesv2_dbg.h"
34
David Li55c94cc2011-03-04 17:50:48 -080035#include "debugger_message.pb.h"
David Li28ca2ab2011-03-01 16:08:10 -080036
37using namespace android;
David Li55c94cc2011-03-04 17:50:48 -080038using namespace com::android;
David Li28ca2ab2011-03-01 16:08:10 -080039
40#define API_ENTRY(_api) Debug_##_api
41
42#ifndef __location__
43#define __HIERALLOC_STRING_0__(s) #s
44#define __HIERALLOC_STRING_1__(s) __HIERALLOC_STRING_0__(s)
45#define __HIERALLOC_STRING_2__ __HIERALLOC_STRING_1__(__LINE__)
46#define __location__ __FILE__ ":" __HIERALLOC_STRING_2__
47#endif
48
49#define ASSERT(expr) if (!(expr)) { LOGD("\n*\n*\n* ASSERT FAILED: %s at %s \n*\n*", #expr, __location__); exit(1); }
50#undef assert
51#define assert(expr) ASSERT(expr)
52//#undef LOGD
53//#define LOGD(...)
54
55namespace android
56{
David Li55c94cc2011-03-04 17:50:48 -080057struct FunctionCall {
58 virtual const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) = 0;
59 virtual ~FunctionCall() {}
60};
David Li28ca2ab2011-03-01 16:08:10 -080061
David Li55c94cc2011-03-04 17:50:48 -080062extern bool capture;
63extern int timeMode; // SYSTEM_TIME_
64
65extern int clientSock, serverSock;
66
67unsigned GetBytesPerPixel(const GLenum format, const GLenum type);
68
69int * MessageLoop(FunctionCall & functionCall, glesv2debugger::Message & msg,
70 const bool expectResponse, const glesv2debugger::Message_Function function);
71void Receive(glesv2debugger::Message & cmd);
72float Send(const glesv2debugger::Message & msg, glesv2debugger::Message & cmd);
73void SetProp(const glesv2debugger::Message & cmd);
David Li28ca2ab2011-03-01 16:08:10 -080074}; // namespace android {