diff --git a/src/gpgmm/BUILD.gn b/src/gpgmm/BUILD.gn index 3d956a1b..7b8046c1 100644 --- a/src/gpgmm/BUILD.gn +++ b/src/gpgmm/BUILD.gn @@ -124,6 +124,7 @@ source_set("gpgmm_sources") { "d3d12/DebugObjectD3D12.h", "d3d12/ErrorD3D12.cpp", "d3d12/ErrorD3D12.h", + "d3d12/EventMessageD3D12.h", "d3d12/FenceD3D12.cpp", "d3d12/FenceD3D12.h", "d3d12/JSONSerializerD3D12.cpp", diff --git a/src/gpgmm/CMakeLists.txt b/src/gpgmm/CMakeLists.txt index ab8ad459..8df19dbc 100644 --- a/src/gpgmm/CMakeLists.txt +++ b/src/gpgmm/CMakeLists.txt @@ -67,6 +67,7 @@ if (GPGMM_ENABLE_D3D12) "d3d12/CapsD3D12.h" "d3d12/ErrorD3D12.cpp" "d3d12/ErrorD3D12.h" + "d3d12/EventMessageD3D12.h" "d3d12/FenceD3D12.cpp" "d3d12/FenceD3D12.h" "d3d12/ResidencyHeapD3D12.cpp" diff --git a/src/gpgmm/d3d12/EventMessageD3D12.h b/src/gpgmm/d3d12/EventMessageD3D12.h new file mode 100644 index 00000000..97798118 --- /dev/null +++ b/src/gpgmm/d3d12/EventMessageD3D12.h @@ -0,0 +1,49 @@ +// Copyright 2022 The GPGMM Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_GPGMM_D3D12_EVENTMESSAGED3D12_H_ +#define SRC_GPGMM_D3D12_EVENTMESSAGED3D12_H_ + +#include "gpgmm/common/EventMessage.h" +#include "gpgmm/utils/WindowsUtils.h" + +namespace gpgmm::d3d12 { + + template + EventMessage DebugEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) { + return gpgmm::DebugEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), + object); + } + + template + EventMessage InfoEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) { + return gpgmm::InfoEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), + object); + } + + template + EventMessage WarnEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) { + return gpgmm::WarnEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), + object); + } + + template + EventMessage ErrorEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) { + return gpgmm::ErrorEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), + object); + } + +} // namespace gpgmm::d3d12 + +#endif // SRC_GPGMM_D3D12_EVENTMESSAGED3D12_H_ diff --git a/src/gpgmm/d3d12/LogD3D12.h b/src/gpgmm/d3d12/LogD3D12.h index 126d561f..56a4c398 100644 --- a/src/gpgmm/d3d12/LogD3D12.h +++ b/src/gpgmm/d3d12/LogD3D12.h @@ -15,7 +15,7 @@ #ifndef SRC_GPGMM_D3D12_LOGD3D12_H_ #define SRC_GPGMM_D3D12_LOGD3D12_H_ -#include "gpgmm/common/EventMessage.h" +#include "gpgmm/utils/Log.h" #include "gpgmm/utils/WindowsUtils.h" namespace gpgmm::d3d12 { @@ -40,30 +40,6 @@ namespace gpgmm::d3d12 { return gpgmm::ErrorLog(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), object); } - template - EventMessage DebugEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) { - return gpgmm::DebugEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), - object); - } - - template - EventMessage InfoEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) { - return gpgmm::InfoEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), - object); - } - - template - EventMessage WarnEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) { - return gpgmm::WarnEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), - object); - } - - template - EventMessage ErrorEvent(const BackendT* object, MessageId messageId = MessageId::kUnknown) { - return gpgmm::ErrorEvent(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), - object); - } - } // namespace gpgmm::d3d12 #endif // SRC_GPGMM_D3D12_LOGD3D12_H_ diff --git a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp index 0bd29d77..05eaca95 100644 --- a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp +++ b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp @@ -20,6 +20,7 @@ #include "gpgmm/d3d12/BudgetUpdateD3D12.h" #include "gpgmm/d3d12/CapsD3D12.h" #include "gpgmm/d3d12/ErrorD3D12.h" +#include "gpgmm/d3d12/EventMessageD3D12.h" #include "gpgmm/d3d12/FenceD3D12.h" #include "gpgmm/d3d12/JSONSerializerD3D12.h" #include "gpgmm/d3d12/LogD3D12.h" diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index a796a059..1ef9c029 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -27,6 +27,7 @@ #include "gpgmm/d3d12/BufferAllocatorD3D12.h" #include "gpgmm/d3d12/CapsD3D12.h" #include "gpgmm/d3d12/ErrorD3D12.h" +#include "gpgmm/d3d12/EventMessageD3D12.h" #include "gpgmm/d3d12/JSONSerializerD3D12.h" #include "gpgmm/d3d12/LogD3D12.h" #include "gpgmm/d3d12/ResidencyHeapD3D12.h"