tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DebugAnnotator9.cpp (1528B)


      1 //
      2 // Copyright 2015 The ANGLE Project Authors. All rights reserved.
      3 // Use of this source code is governed by a BSD-style license that can be
      4 // found in the LICENSE file.
      5 //
      6 // DebugAnnotator9.h: D3D9 helpers for adding trace annotations.
      7 //
      8 
      9 #include "libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h"
     10 
     11 #include "common/platform.h"
     12 
     13 namespace rx
     14 {
     15 
     16 void DebugAnnotator9::beginEvent(gl::Context *context,
     17                                 angle::EntryPoint entryPoint,
     18                                 const char *eventName,
     19                                 const char *eventMessage)
     20 {
     21    angle::LoggingAnnotator::beginEvent(context, entryPoint, eventName, eventMessage);
     22    std::mbstate_t state = std::mbstate_t();
     23    std::mbsrtowcs(mWCharMessage, &eventMessage, kMaxMessageLength, &state);
     24    D3DPERF_BeginEvent(0, mWCharMessage);
     25 }
     26 
     27 void DebugAnnotator9::endEvent(gl::Context *context,
     28                               const char *eventName,
     29                               angle::EntryPoint entryPoint)
     30 {
     31    angle::LoggingAnnotator::endEvent(context, eventName, entryPoint);
     32    D3DPERF_EndEvent();
     33 }
     34 
     35 void DebugAnnotator9::setMarker(gl::Context *context, const char *markerName)
     36 {
     37    angle::LoggingAnnotator::setMarker(context, markerName);
     38    std::mbstate_t state = std::mbstate_t();
     39    std::mbsrtowcs(mWCharMessage, &markerName, kMaxMessageLength, &state);
     40    D3DPERF_SetMarker(0, mWCharMessage);
     41 }
     42 
     43 bool DebugAnnotator9::getStatus(const gl::Context *context)
     44 {
     45    return !!D3DPERF_GetStatus();
     46 }
     47 
     48 }  // namespace rx