Magic vectors in GPU children list.

This commit is contained in:
Bartosz Taudul 2019-11-10 02:03:31 +01:00
parent c65d524725
commit 226a7b7cfb
2 changed files with 194 additions and 178 deletions

View File

@ -6678,6 +6678,31 @@ void View::DrawGpuInfoWindow()
ImGui::TextDisabled( "(%s)", RealToString( children.size(), true ) );
if( expand )
{
if( children.is_magic() )
{
DrawGpuInfoChildren<VectorAdapterDirect<GpuEvent>>( *(Vector<GpuEvent>*)( &children ), ztime );
}
else
{
DrawGpuInfoChildren<VectorAdapterPointer<GpuEvent>>( children, ztime );
}
}
}
ImGui::EndChild();
ImGui::End();
if( !show )
{
m_gpuInfoWindow = nullptr;
m_gpuInfoStack.clear();
}
}
template<typename Adapter, typename V>
void View::DrawGpuInfoChildren( const V& children, int64_t ztime )
{
Adapter a;
const auto rztime = 1.0 / ztime;
const auto ty = ImGui::GetTextLineHeight();
@ -6697,7 +6722,7 @@ void View::DrawGpuInfoWindow()
cmap.reserve( 128 );
for( size_t i=0; i<children.size(); i++ )
{
const auto& child = *children[i];
const auto& child = a(children[i]);
const auto cend = m_worker.GetZoneEnd( child );
const auto ct = cend - child.GpuStart();
const auto srcloc = child.SrcLoc();
@ -6736,7 +6761,7 @@ void View::DrawGpuInfoWindow()
const auto txt = m_worker.GetZoneName( srcloc );
if( cgr.v.size() == 1 )
{
auto& cev = *children[cgr.v.front()];
auto& cev = a(children[cgr.v.front()]);
const auto txt = m_worker.GetZoneName( cev );
bool b = false;
ImGui::PushID( (int)cgr.v.front() );
@ -6787,7 +6812,7 @@ void View::DrawGpuInfoWindow()
auto cti = std::make_unique<uint32_t[]>( cgr.v.size() );
for( size_t i=0; i<cgr.v.size(); i++ )
{
const auto& child = *children[cgr.v[i]];
const auto& child = a(children[cgr.v[i]]);
const auto cend = m_worker.GetZoneEnd( child );
const auto ct = cend - child.GpuStart();
ctt[i] = ct;
@ -6798,7 +6823,7 @@ void View::DrawGpuInfoWindow()
for( size_t i=0; i<cgr.v.size(); i++ )
{
auto& cev = *children[cgr.v[cti[i]]];
auto& cev = a(children[cgr.v[cti[i]]]);
const auto txt = m_worker.GetZoneName( cev );
bool b = false;
ImGui::Indent();
@ -6837,7 +6862,7 @@ void View::DrawGpuInfoWindow()
uint64_t ctime = 0;
for( size_t i=0; i<children.size(); i++ )
{
const auto& child = *children[i];
const auto& child = a(children[i]);
const auto cend = m_worker.GetZoneEnd( child );
const auto ct = cend - child.GpuStart();
ctime += ct;
@ -6857,7 +6882,7 @@ void View::DrawGpuInfoWindow()
ImGui::NextColumn();
for( size_t i=0; i<children.size(); i++ )
{
auto& cev = *children[cti[i]];
auto& cev = a(children[cti[i]]);
bool b = false;
ImGui::PushID( (int)i );
if( ImGui::Selectable( m_worker.GetZoneName( cev ), &b, ImGuiSelectableFlags_SpanAllColumns ) )
@ -6885,17 +6910,6 @@ void View::DrawGpuInfoWindow()
ImGui::TreePop();
}
}
}
ImGui::EndChild();
ImGui::End();
if( !show )
{
m_gpuInfoWindow = nullptr;
m_gpuInfoStack.clear();
}
}
void View::DrawOptions()
{

View File

@ -168,6 +168,8 @@ private:
template<typename Adapter, typename V>
void DrawZoneInfoChildren( const V& children, int64_t ztime );
template<typename Adapter, typename V>
void DrawGpuInfoChildren( const V& children, int64_t ztime );
void HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns );