Skip to content

Commit f8921f6

Browse files
authored
Move event messages into cpp. (#867)
1 parent def5be8 commit f8921f6

File tree

6 files changed

+54
-25
lines changed

6 files changed

+54
-25
lines changed

src/gpgmm/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ source_set("gpgmm_sources") {
124124
"d3d12/DebugObjectD3D12.h",
125125
"d3d12/ErrorD3D12.cpp",
126126
"d3d12/ErrorD3D12.h",
127+
"d3d12/EventMessageD3D12.h",
127128
"d3d12/FenceD3D12.cpp",
128129
"d3d12/FenceD3D12.h",
129130
"d3d12/JSONSerializerD3D12.cpp",

src/gpgmm/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ if (GPGMM_ENABLE_D3D12)
6767
"d3d12/CapsD3D12.h"
6868
"d3d12/ErrorD3D12.cpp"
6969
"d3d12/ErrorD3D12.h"
70+
"d3d12/EventMessageD3D12.h"
7071
"d3d12/FenceD3D12.cpp"
7172
"d3d12/FenceD3D12.h"
7273
"d3d12/ResidencyHeapD3D12.cpp"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright 2022 The GPGMM Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef SRC_GPGMM_D3D12_EVENTMESSAGED3D12_H_
16+
#define SRC_GPGMM_D3D12_EVENTMESSAGED3D12_H_
17+
18+
#include "gpgmm/common/EventMessage.h"
19+
#include "gpgmm/utils/WindowsUtils.h"
20+
21+
namespace gpgmm::d3d12 {
22+
23+
template <typename BackendT>
24+
EventMessage DebugEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) {
25+
return gpgmm::DebugEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()),
26+
object);
27+
}
28+
29+
template <typename BackendT>
30+
EventMessage InfoEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) {
31+
return gpgmm::InfoEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()),
32+
object);
33+
}
34+
35+
template <typename BackendT>
36+
EventMessage WarnEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) {
37+
return gpgmm::WarnEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()),
38+
object);
39+
}
40+
41+
template <typename BackendT>
42+
EventMessage ErrorEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) {
43+
return gpgmm::ErrorEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()),
44+
object);
45+
}
46+
47+
} // namespace gpgmm::d3d12
48+
49+
#endif // SRC_GPGMM_D3D12_EVENTMESSAGED3D12_H_

src/gpgmm/d3d12/LogD3D12.h

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#ifndef SRC_GPGMM_D3D12_LOGD3D12_H_
1616
#define SRC_GPGMM_D3D12_LOGD3D12_H_
1717

18-
#include "gpgmm/common/EventMessage.h"
18+
#include "gpgmm/utils/Log.h"
1919
#include "gpgmm/utils/WindowsUtils.h"
2020

2121
namespace gpgmm::d3d12 {
@@ -40,30 +40,6 @@ namespace gpgmm::d3d12 {
4040
return gpgmm::ErrorLog(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), object);
4141
}
4242

43-
template <typename BackendT>
44-
EventMessage DebugEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) {
45-
return gpgmm::DebugEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()),
46-
object);
47-
}
48-
49-
template <typename BackendT>
50-
EventMessage InfoEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) {
51-
return gpgmm::InfoEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()),
52-
object);
53-
}
54-
55-
template <typename BackendT>
56-
EventMessage WarnEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) {
57-
return gpgmm::WarnEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()),
58-
object);
59-
}
60-
61-
template <typename BackendT>
62-
EventMessage ErrorEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) {
63-
return gpgmm::ErrorEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()),
64-
object);
65-
}
66-
6743
} // namespace gpgmm::d3d12
6844

6945
#endif // SRC_GPGMM_D3D12_LOGD3D12_H_

src/gpgmm/d3d12/ResidencyManagerD3D12.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "gpgmm/d3d12/BudgetUpdateD3D12.h"
2121
#include "gpgmm/d3d12/CapsD3D12.h"
2222
#include "gpgmm/d3d12/ErrorD3D12.h"
23+
#include "gpgmm/d3d12/EventMessageD3D12.h"
2324
#include "gpgmm/d3d12/FenceD3D12.h"
2425
#include "gpgmm/d3d12/JSONSerializerD3D12.h"
2526
#include "gpgmm/d3d12/LogD3D12.h"

src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "gpgmm/d3d12/BufferAllocatorD3D12.h"
2828
#include "gpgmm/d3d12/CapsD3D12.h"
2929
#include "gpgmm/d3d12/ErrorD3D12.h"
30+
#include "gpgmm/d3d12/EventMessageD3D12.h"
3031
#include "gpgmm/d3d12/JSONSerializerD3D12.h"
3132
#include "gpgmm/d3d12/LogD3D12.h"
3233
#include "gpgmm/d3d12/ResidencyHeapD3D12.h"

0 commit comments

Comments
 (0)