• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // DebugAnnotator11.h: D3D11 helpers for adding trace annotations.
7 //
8 
9 #ifndef LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
10 #define LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
11 
12 #include "libANGLE/LoggingAnnotator.h"
13 
14 #include <thread>
15 
16 namespace rx
17 {
18 
19 class DebugAnnotator11 : public angle::LoggingAnnotator
20 {
21   public:
22     DebugAnnotator11();
23     ~DebugAnnotator11() override;
24     void initialize(ID3D11DeviceContext *context);
25     void release();
26     void beginEvent(gl::Context *context,
27                     angle::EntryPoint entryPoint,
28                     const char *eventName,
29                     const char *eventMessage) override;
30     void endEvent(gl::Context *context,
31                   const char *eventName,
32                   angle::EntryPoint entryPoint) override;
33     void setMarker(const char *markerName) override;
34     bool getStatus() override;
35 
36   private:
37     bool loggingEnabledForThisThread() const;
38 
39     angle::ComPtr<ID3DUserDefinedAnnotation> mUserDefinedAnnotation;
40     static constexpr size_t kMaxMessageLength = 256;
41     wchar_t mWCharMessage[kMaxMessageLength];
42 
43     // Only log annotations from the thread used to initialize the debug annotator
44     std::thread::id mAnnotationThread;
45 };
46 
47 }  // namespace rx
48 
49 #endif  // LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
50