-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathTimeline.h
More file actions
61 lines (51 loc) · 1.56 KB
/
Timeline.h
File metadata and controls
61 lines (51 loc) · 1.56 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//--------------------------------------------------------------------------------------
// Timeline.h
//
// Advanced Technology Group (ATG)
// Copyright (C) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#pragma once
#include <list>
#include <directxmath.h>
#include <d3d12_x.h>
#include <pix.h>
struct Timeline
{
public:
Timeline(uint32_t _colorPix, DirectX::XMVECTOR _color, const wchar_t* _name)
: colorPix(_colorPix)
, color(_color)
, name(_name)
, start(0)
{
}
void Start()
{
PIXBeginEvent(colorPix, name);
assert(start == 0);
start = __rdtsc() + 1;
}
void End()
{
intervals.push_front(Interval(start, __rdtsc()));
intervals.resize(1023);
assert(start != 0);
start = 0;
PIXEndEvent();
}
void Render(_In_ ID3D12GraphicsCommandList* commandList,
_In_ DirectX::BasicEffect* effect,
_In_ DirectX::PrimitiveBatch<DirectX::VertexPositionColor>* primitiveBatch,
_In_ DirectX::SpriteBatch* spriteBatch,
_In_ DirectX::SpriteFont* font,
_In_ const D3D12_VIEWPORT& viewport,
DirectX::XMFLOAT2 position,
uint64_t Latest) const;
DirectX::XMVECTOR color;
uint32_t colorPix;
const wchar_t* name;
typedef std::pair<uint64_t, uint64_t> Interval;
typedef std::list<Interval> ListOfIntervals;
ListOfIntervals intervals;
uint64_t start;
};