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(const char *eventName, const char *eventMessage) override;
27     void endEvent(const char *eventName) override;
28     void setMarker(const char *markerName) override;
29     bool getStatus() override;
30 
31   private:
32     bool loggingEnabledForThisThread() const;
33 
34     angle::ComPtr<ID3DUserDefinedAnnotation> mUserDefinedAnnotation;
35     static constexpr size_t kMaxMessageLength = 256;
36     wchar_t mWCharMessage[kMaxMessageLength];
37 
38     // Only log annotations from the thread used to initialize the debug annotator
39     std::thread::id mAnnotationThread;
40 };
41 
42 }  // namespace rx
43 
44 #endif  // LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
45