Remove dos-style line-endings (EOL changes only)

git-svn-id: https://angleproject.googlecode.com/svn/trunk@1218 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 9fba10e9
// //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// debug.cpp: Debugging utilities. // debug.cpp: Debugging utilities.
#include "common/debug.h" #include "common/debug.h"
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <d3d9.h> #include <d3d9.h>
#include <windows.h> #include <windows.h>
namespace gl namespace gl
{ {
typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR); typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);
static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg) static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
{ {
#if !defined(ANGLE_DISABLE_PERF) #if !defined(ANGLE_DISABLE_PERF)
if (perfActive()) if (perfActive())
{ {
char message[32768]; char message[32768];
int len = vsprintf_s(message, format, vararg); int len = vsprintf_s(message, format, vararg);
if (len < 0) if (len < 0)
{ {
return; return;
} }
// There are no ASCII variants of these D3DPERF functions. // There are no ASCII variants of these D3DPERF functions.
wchar_t wideMessage[32768]; wchar_t wideMessage[32768];
for (int i = 0; i < len; ++i) for (int i = 0; i < len; ++i)
{ {
wideMessage[i] = message[i]; wideMessage[i] = message[i];
} }
wideMessage[len] = 0; wideMessage[len] = 0;
perfFunc(0, wideMessage); perfFunc(0, wideMessage);
} }
#endif #endif
#if !defined(ANGLE_DISABLE_TRACE) #if !defined(ANGLE_DISABLE_TRACE)
#if defined(NDEBUG) #if defined(NDEBUG)
if (traceFileDebugOnly) if (traceFileDebugOnly)
{ {
return; return;
} }
#endif #endif
FILE* file = fopen(TRACE_OUTPUT_FILE, "a"); FILE* file = fopen(TRACE_OUTPUT_FILE, "a");
if (file) if (file)
{ {
vfprintf(file, format, vararg); vfprintf(file, format, vararg);
fclose(file); fclose(file);
} }
#endif #endif
} }
void trace(bool traceFileDebugOnly, const char *format, ...) void trace(bool traceFileDebugOnly, const char *format, ...)
{ {
va_list vararg; va_list vararg;
va_start(vararg, format); va_start(vararg, format);
#if defined(ANGLE_DISABLE_PERF) #if defined(ANGLE_DISABLE_PERF)
output(traceFileDebugOnly, NULL, format, vararg); output(traceFileDebugOnly, NULL, format, vararg);
#else #else
output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg); output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg);
#endif #endif
va_end(vararg); va_end(vararg);
} }
bool perfActive() bool perfActive()
{ {
#if defined(ANGLE_DISABLE_PERF) #if defined(ANGLE_DISABLE_PERF)
return false; return false;
#else #else
static bool active = D3DPERF_GetStatus() != 0; static bool active = D3DPERF_GetStatus() != 0;
return active; return active;
#endif #endif
} }
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...) ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
{ {
#if !defined(ANGLE_DISABLE_PERF) #if !defined(ANGLE_DISABLE_PERF)
va_list vararg; va_list vararg;
va_start(vararg, format); va_start(vararg, format);
output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg); output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
va_end(vararg); va_end(vararg);
#endif #endif
} }
ScopedPerfEventHelper::~ScopedPerfEventHelper() ScopedPerfEventHelper::~ScopedPerfEventHelper()
{ {
#if !defined(ANGLE_DISABLE_PERF) #if !defined(ANGLE_DISABLE_PERF)
if (perfActive()) if (perfActive())
{ {
D3DPERF_EndEvent(); D3DPERF_EndEvent();
} }
#endif #endif
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment