Hash :
0aa11026
Author :
Date :
2019-08-23T13:13:33
Only log D3D11 annotations from the thread used to initialize the annotator. Chrome makes some ANGLE calls from multiple threads for initializing WebXR buffers which breaks the assumption that DebugAnnotator11 is only called from a single thread. Work around this by only allowing DebugAnnotator11 to log annotations from the thread used to initialize it. BUG=995888 BUG=972914 Change-Id: I2241e078031633cafea470f85b7b1ecf1fba8466 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1769057 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
//
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// DebugAnnotator11.h: D3D11 helpers for adding trace annotations.
//
#ifndef LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
#define LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
#include "libANGLE/LoggingAnnotator.h"
#include <thread>
namespace rx
{
class DebugAnnotator11 : public angle::LoggingAnnotator
{
public:
DebugAnnotator11();
~DebugAnnotator11() override;
void initialize(ID3D11DeviceContext *context);
void release();
void beginEvent(const char *eventName, const char *eventMessage) override;
void endEvent(const char *eventName) override;
void setMarker(const char *markerName) override;
bool getStatus() override;
private:
bool loggingEnabledForThisThread() const;
angle::ComPtr<ID3DUserDefinedAnnotation> mUserDefinedAnnotation;
static constexpr size_t kMaxMessageLength = 256;
wchar_t mWCharMessage[kMaxMessageLength];
// Only log annotations from the thread used to initialize the debug annotator
std::thread::id mAnnotationThread;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_