Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
59 pj 1
#ifdef MESA_TRACE
2
 
3
#include "glheader.h"
4
#include "glapi.h"
5
#include "glapitable.h"
6
#include "context.h"
7
#include "tr_context.h"
8
 
9
 
10
/* Full precision on floats/double, else human readable. */
11
#define  TR_FULL_PRECISION  0x000000001
12
 
13
 
14
void trInitContext( trace_context_t * tr_context )
15
{
16
        int i;
17
 
18
        if (!tr_context)
19
                return;
20
 
21
        tr_context->traceEnabled = GL_FALSE;
22
        tr_context->logFP = stdout;      
23
        tr_context->traceName = NULL;
24
 
25
        tr_context->traceAttribLogBits = GL_ALL_ATTRIB_BITS;
26
        tr_context->traceEnableLogBits = GL_TRACE_ALL_BITS_MESA;
27
 
28
        tr_context->betweenBeginEnd = GL_FALSE;
29
 
30
        tr_context->framecounter = 0;
31
 
32
        tr_context->trDoPrint = GL_TRUE;
33
        tr_context->doExec = GL_TRUE;
34
        tr_context->check_errors = GL_TRUE;
35
 
36
        tr_context->head_errors = 0;
37
        tr_context->tail_errors = 0;
38
 
39
        for( i = 0; i < TR_MAX_QUEUED_ERRORS; i++ ) {
40
                tr_context->cached_errors[i] = GL_NO_ERROR;
41
        }
42
 
43
#if 0
44
        tr_context->doAsserts    = GL_TRUE;
45
        tr_context->clientStateValid = GL_FALSE;
46
#endif
47
}
48
 
49
 
50
/**
51
 * Get the current context.
52
 */
53
trace_context_t* trCtx() {
54
        GLcontext * ctx;
55
        ctx = (GLcontext *)_glapi_get_context();
56
 
57
        assert(ctx);
58
        assert(ctx->TraceCtx);
59
        if( (!ctx) || !(ctx->TraceCtx) ) {
60
                _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__ );
61
                return NULL;
62
        }
63
 
64
        return ctx->TraceCtx;
65
}
66
 
67
 
68
/**
69
 * Get the current, real dispatch table pointer.
70
 */
71
struct _glapi_table* trGetDispatch() {
72
        return _glapi_get_dispatch();
73
}
74
 
75
 
76
void trSetTraceDispatch( void ) {
77
        GLcontext * ctx;
78
        ctx = (GLcontext *)_glapi_get_context();
79
 
80
        assert( ctx );
81
        assert( ctx->TraceCtx );
82
        assert( ctx->TraceDispatch );
83
 
84
        ctx->TraceCtx->traceEnabled = GL_TRUE;
85
 
86
        /* XXX save returned value */
87
        (void) _glapi_begin_dispatch_override(ctx->TraceDispatch);
88
}
89
 
90
 
91
void trSetOriginalDispatch( void ) {
92
        GLcontext * ctx;
93
        ctx = (GLcontext *)_glapi_get_context();
94
 
95
        assert( ctx );
96
        assert( ctx->TraceCtx );
97
        assert( ctx->TraceDispatch );
98
 
99
        ctx->TraceCtx->traceEnabled = GL_FALSE;
100
 
101
        /* XXX pass value we got from _glapi_begin_dispatch_override() */
102
        _glapi_end_dispatch_override(1);
103
}
104
 
105
 
106
/**
107
 * Is error checking enabled?
108
 */
109
GLboolean trDoErrorCheck() {
110
  return trCtx()->check_errors;
111
}
112
 
113
#else
114
extern void tr_context_dummy_func(void);
115
void tr_context_dummy_func(void)
116
{
117
}
118
#endif