From d366620818760060093e1108904bdcb22a8f5308 Mon Sep 17 00:00:00 2001 From: bosnichd Date: Fri, 10 Sep 2021 09:08:07 -0600 Subject: [PATCH] More PAL related changes required for restricted platforms. (#4037) Signed-off-by: bosnichd --- .../WinAPI/AzCore/std/parallel/internal/thread_WinAPI.cpp | 6 ++---- .../Windows/AzCore/std/parallel/internal/thread_Windows.cpp | 3 ++- .../Code/Source/Platform/Windows/RHI/Device_Windows.cpp | 5 +++++ Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp | 5 ----- Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLibrary.cpp | 4 ++++ 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/std/parallel/internal/thread_WinAPI.cpp b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/std/parallel/internal/thread_WinAPI.cpp index dfe265aaa5..c84b4ecd98 100644 --- a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/std/parallel/internal/thread_WinAPI.cpp +++ b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/std/parallel/internal/thread_WinAPI.cpp @@ -15,7 +15,7 @@ namespace AZStd { namespace Platform { - void PostThreadRun(); + unsigned __stdcall PostThreadRun(); HANDLE CreateThread(unsigned stackSize, unsigned (__stdcall* threadRunFunction)(void*), AZStd::Internal::thread_info* ti, unsigned int* id); unsigned HardwareConcurrency(); void SetThreadName(HANDLE hThread, const char* threadName); @@ -40,9 +40,7 @@ namespace AZStd ThreadEventBus::Broadcast(&ThreadEventBus::Events::OnThreadExit, this_thread::get_id()); // goes to client listeners ThreadDrillerEventBus::Broadcast(&ThreadDrillerEventBus::Events::OnThreadExit, this_thread::get_id()); // goes to the profiler. - Platform::PostThreadRun(); - - return 0; + return Platform::PostThreadRun(); } /** diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/std/parallel/internal/thread_Windows.cpp b/Code/Framework/AzCore/Platform/Windows/AzCore/std/parallel/internal/thread_Windows.cpp index 246181334a..fd6e81e536 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/std/parallel/internal/thread_Windows.cpp +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/std/parallel/internal/thread_Windows.cpp @@ -16,9 +16,10 @@ namespace AZStd { namespace Platform { - void PostThreadRun() + unsigned __stdcall PostThreadRun() { _endthreadex(0); + return 0; } HANDLE CreateThread(unsigned stackSize, unsigned (__stdcall* threadRunFunction)(void*), AZStd::Internal::thread_info* ti, unsigned int* id) diff --git a/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/RHI/Device_Windows.cpp b/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/RHI/Device_Windows.cpp index 51272f3488..cb2b8d4ef8 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/RHI/Device_Windows.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/RHI/Device_Windows.cpp @@ -325,5 +325,10 @@ namespace AZ return formatsList; } + + void Device::BeginFrameInternal() + { + m_commandQueueContext.Begin(); + } } } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp index 371aa20a84..82e4aba57c 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp @@ -189,11 +189,6 @@ namespace AZ m_commandQueueContext.UpdateCpuTimingStatistics(cpuTimingStatistics); } - void Device::BeginFrameInternal() - { - m_commandQueueContext.Begin(); - } - void Device::EndFrameInternal() { AZ_TRACE_METHOD(); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLibrary.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLibrary.cpp index 182edb1298..66b3f9623a 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLibrary.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLibrary.cpp @@ -262,7 +262,11 @@ namespace AZ bool PipelineLibrary::IsMergeRequired() const { +#if defined (AZ_DX12_USE_PIPELINE_LIBRARY) return !m_pipelineStates.empty(); +#else + return false; +#endif } } }