Skip to content

Commit f777440

Browse files
Removing waiting on MultiDeviceFences.
Should only be done on specific devices. Signed-off-by: Joerg H. Mueller <[email protected]>
1 parent ae19572 commit f777440

File tree

2 files changed

+1
-64
lines changed

2 files changed

+1
-64
lines changed

Gems/Atom/RHI/Code/Include/Atom/RHI/MultiDeviceFence.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,18 @@ namespace AZ::RHI
2929
//! passes on the initial FenceState to each Fence
3030
ResultCode Init(MultiDevice::DeviceMask deviceMask, FenceState initialState);
3131

32-
//! Waits on m_waitThread and shuts down all device-specific fences.
32+
//! Shuts down all device-specific fences.
3333
void Shutdown() override final;
3434

3535
//! Signals the device-specific fences managed by this class
3636
RHI::ResultCode SignalOnCpu();
3737

38-
//! Waits (blocks) for all device-specific fences managed by this class
39-
RHI::ResultCode WaitOnCpu() const;
40-
4138
//! Resets the device-specific fences.
4239
RHI::ResultCode Reset();
4340

4441
using SignalCallback = AZStd::function<void()>;
4542

46-
//! Spawns a dedicated thread to wait on all device-specific fences. The provided callback
47-
//! is invoked when the fences complete.
48-
ResultCode WaitOnCpuAsync(SignalCallback callback);
49-
5043
protected:
5144
bool ValidateIsInitialized() const;
52-
53-
//! This can be used to asynchronously wait on all fences by calling WaitOnCpuAsync
54-
AZStd::thread m_waitThread;
5545
};
5646
} // namespace AZ::RHI

Gems/Atom/RHI/Code/Source/RHI/MultiDeviceFence.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ namespace AZ::RHI
6969
{
7070
if (IsInitialized())
7171
{
72-
if (m_waitThread.joinable())
73-
{
74-
m_waitThread.join();
75-
}
76-
7772
IterateObjects<Fence>([]([[maybe_unused]] auto deviceIndex, auto deviceFence)
7873
{
7974
deviceFence->Shutdown();
@@ -96,54 +91,6 @@ namespace AZ::RHI
9691
});
9792
}
9893

99-
ResultCode MultiDeviceFence::WaitOnCpu() const
100-
{
101-
if (!ValidateIsInitialized())
102-
{
103-
return ResultCode::InvalidOperation;
104-
}
105-
106-
return IterateObjects<Fence>([]([[maybe_unused]] auto deviceIndex, auto deviceFence)
107-
{
108-
return deviceFence->WaitOnCpu();
109-
});
110-
}
111-
112-
ResultCode MultiDeviceFence::WaitOnCpuAsync(SignalCallback callback)
113-
{
114-
if (!ValidateIsInitialized())
115-
{
116-
return ResultCode::InvalidOperation;
117-
}
118-
119-
if (!callback)
120-
{
121-
AZ_Error("MultiDeviceFence", false, "Callback is null.");
122-
return ResultCode::InvalidOperation;
123-
}
124-
125-
if (m_waitThread.joinable())
126-
{
127-
m_waitThread.join();
128-
}
129-
130-
AZStd::thread_desc threadDesc{ "MultiDeviceFence WaitOnCpu Thread" };
131-
132-
m_waitThread = AZStd::thread(
133-
threadDesc,
134-
[this, callback]()
135-
{
136-
ResultCode resultCode = WaitOnCpu();
137-
if (resultCode != ResultCode::Success)
138-
{
139-
AZ_Error("MultiDeviceFence", false, "Failed to call WaitOnCpu in async thread.");
140-
}
141-
callback();
142-
});
143-
144-
return ResultCode::Success;
145-
}
146-
14794
ResultCode MultiDeviceFence::Reset()
14895
{
14996
if (!ValidateIsInitialized())

0 commit comments

Comments
 (0)