forked from microsoft/Xbox-ATG-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PIXHelpers.h
33 lines (28 loc) · 813 Bytes
/
PIXHelpers.h
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
//--------------------------------------------------------------------------------------
// PIXHelpers.h
//
// Advanced Technology Group (ATG)
// Copyright (C) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#pragma once
// Scoped PIX event.
class ScopedPixEvent
{
public:
ScopedPixEvent(_In_ ID3D11DeviceContextX* context, UINT64 /*metadata*/, PCWSTR pFormat)
: mContext(context)
{
PIXBeginEvent(mContext, 0, pFormat);
}
ScopedPixEvent(UINT64 metadata, PCWSTR pFormat)
: mContext(nullptr)
{
PIXBeginEvent(metadata, pFormat);
}
~ScopedPixEvent()
{
mContext ? PIXEndEvent(mContext) : PIXEndEvent();
}
private:
ID3D11DeviceContextX* mContext;
};