gfx/angle/src/compiler/compiler_debug.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/angle/src/compiler/compiler_debug.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +//
     1.5 +// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
     1.6 +// Use of this source code is governed by a BSD-style license that can be
     1.7 +// found in the LICENSE file.
     1.8 +//
     1.9 +
    1.10 +// compiler_debug.cpp: Debugging utilities.
    1.11 +
    1.12 +#include "compiler/compiler_debug.h"
    1.13 +
    1.14 +#include <stdarg.h>
    1.15 +#include <stdio.h>
    1.16 +
    1.17 +#include "compiler/InitializeParseContext.h"
    1.18 +#include "compiler/ParseHelper.h"
    1.19 +
    1.20 +static const int kTraceBufferLen = 1024;
    1.21 +
    1.22 +#ifdef TRACE_ENABLED
    1.23 +extern "C" {
    1.24 +void Trace(const char *format, ...) {
    1.25 +    if (!format) return;
    1.26 +
    1.27 +    TParseContext* parseContext = GetGlobalParseContext();
    1.28 +    if (parseContext) {
    1.29 +        char buf[kTraceBufferLen];
    1.30 +        va_list args;
    1.31 +        va_start(args, format);
    1.32 +        vsnprintf(buf, kTraceBufferLen, format, args);
    1.33 +        va_end(args);
    1.34 +
    1.35 +        parseContext->trace(buf);
    1.36 +    }
    1.37 +}
    1.38 +}  // extern "C"
    1.39 +#endif  // TRACE_ENABLED
    1.40 +

mercurial