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 namespace rx 15 { 16 17 // Note: To avoid any race conditions between threads, this class has no private data; 18 // DebugAnnotatorContext11 will be retrieved from Context11. 19 class DebugAnnotator11 : public angle::LoggingAnnotator 20 { 21 public: 22 DebugAnnotator11(); 23 ~DebugAnnotator11() override; 24 void beginEvent(gl::Context *context, 25 angle::EntryPoint entryPoint, 26 const char *eventName, 27 const char *eventMessage) override; 28 void endEvent(gl::Context *context, 29 const char *eventName, 30 angle::EntryPoint entryPoint) override; 31 void setMarker(gl::Context *context, const char *markerName) override; 32 bool getStatus(const gl::Context *context) override; 33 }; 34 35 class DebugAnnotatorContext11 36 { 37 public: 38 DebugAnnotatorContext11(); 39 ~DebugAnnotatorContext11(); 40 void initialize(ID3D11DeviceContext *context); 41 void release(); 42 void beginEvent(angle::EntryPoint entryPoint, const char *eventName, const char *eventMessage); 43 void endEvent(const char *eventName, angle::EntryPoint entryPoint); 44 void setMarker(const char *markerName); 45 bool getStatus() const; 46 47 private: 48 bool loggingEnabledForThisThread() const; 49 50 angle::ComPtr<ID3DUserDefinedAnnotation> mUserDefinedAnnotation; 51 static constexpr size_t kMaxMessageLength = 256; 52 wchar_t mWCharMessage[kMaxMessageLength]; 53 54 // Only log annotations from the thread used to initialize the debug annotator 55 uint64_t mAnnotationThread; 56 }; 57 58 } // namespace rx 59 60 #endif // LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_ 61