Skip to content

Commit

Permalink
Fix exception on inverted time range of command list execution on GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Gorodetsky committed Apr 26, 2021
1 parent 167152a commit 3e3781b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ class CommandListDX
{
META_CHECK_ARG_EQUAL_DESCR(GetState(), CommandListBase::State::Pending, "can not get GPU time range of encoding, executing or not committed command list");
return in_cpu_nanoseconds
? Data::TimeRange(m_begin_timestamp_query_ptr->GetCpuNanoseconds(), m_end_timestamp_query_ptr->GetCpuNanoseconds())
: Data::TimeRange(m_begin_timestamp_query_ptr->GetGpuTimestamp(), m_end_timestamp_query_ptr->GetGpuTimestamp());
? GetNormalTimeRange(m_begin_timestamp_query_ptr->GetCpuNanoseconds(), m_end_timestamp_query_ptr->GetCpuNanoseconds())
: GetNormalTimeRange(m_begin_timestamp_query_ptr->GetGpuTimestamp(), m_end_timestamp_query_ptr->GetGpuTimestamp());
}
return CommandListBase::GetGpuTimeRange(in_cpu_nanoseconds);
}
Expand Down Expand Up @@ -240,6 +240,11 @@ class CommandListDX
}

private:
static Data::TimeRange GetNormalTimeRange(Timestamp start, Timestamp end)
{
return Data::TimeRange(std::min(start, end), std::max(start, end));
}

Ptr<TimestampQueryBuffer::TimestampQuery> m_begin_timestamp_query_ptr;
Ptr<TimestampQueryBuffer::TimestampQuery> m_end_timestamp_query_ptr;
wrl::ComPtr<ID3D12CommandAllocator> m_cp_command_allocator;
Expand Down

0 comments on commit 3e3781b

Please sign in to comment.