mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 23:41:26 +12:00
d3d12: Measure time spent uploading texture and vertex
This commit is contained in:
parent
3f495689c0
commit
03a84cb208
2 changed files with 23 additions and 0 deletions
|
@ -730,6 +730,8 @@ void D3D12GSRender::ExecCMD()
|
||||||
m_device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, getCurrentResourceStorage().m_commandAllocator, nullptr, IID_PPV_ARGS(&commandList));
|
m_device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, getCurrentResourceStorage().m_commandAllocator, nullptr, IID_PPV_ARGS(&commandList));
|
||||||
getCurrentResourceStorage().m_inflightCommandList.push_back(commandList);
|
getCurrentResourceStorage().m_inflightCommandList.push_back(commandList);
|
||||||
|
|
||||||
|
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> startVertexTime = std::chrono::system_clock::now();
|
||||||
if (m_indexed_array.m_count || m_draw_array_count)
|
if (m_indexed_array.m_count || m_draw_array_count)
|
||||||
{
|
{
|
||||||
const std::pair<std::vector<D3D12_VERTEX_BUFFER_VIEW>, D3D12_INDEX_BUFFER_VIEW> &vertexIndexBufferViews = UploadVertexBuffers(m_indexed_array.m_count ? true : false);
|
const std::pair<std::vector<D3D12_VERTEX_BUFFER_VIEW>, D3D12_INDEX_BUFFER_VIEW> &vertexIndexBufferViews = UploadVertexBuffers(m_indexed_array.m_count ? true : false);
|
||||||
|
@ -737,6 +739,8 @@ void D3D12GSRender::ExecCMD()
|
||||||
if (m_forcedIndexBuffer || m_indexed_array.m_count)
|
if (m_forcedIndexBuffer || m_indexed_array.m_count)
|
||||||
commandList->IASetIndexBuffer(&vertexIndexBufferViews.second);
|
commandList->IASetIndexBuffer(&vertexIndexBufferViews.second);
|
||||||
}
|
}
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> endVertexTime = std::chrono::system_clock::now();
|
||||||
|
m_timers.m_vertexUploadDuration += std::chrono::duration_cast<std::chrono::microseconds>(endVertexTime - startVertexTime).count();
|
||||||
|
|
||||||
if (!LoadProgram())
|
if (!LoadProgram())
|
||||||
{
|
{
|
||||||
|
@ -770,6 +774,7 @@ void D3D12GSRender::ExecCMD()
|
||||||
|
|
||||||
if (m_PSO->second > 0)
|
if (m_PSO->second > 0)
|
||||||
{
|
{
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> startTextureTime = std::chrono::system_clock::now();
|
||||||
size_t usedTexture = UploadTextures();
|
size_t usedTexture = UploadTextures();
|
||||||
|
|
||||||
// Fill empty slots
|
// Fill empty slots
|
||||||
|
@ -809,6 +814,8 @@ void D3D12GSRender::ExecCMD()
|
||||||
commandList->SetGraphicsRootDescriptorTable(3, Handle);
|
commandList->SetGraphicsRootDescriptorTable(3, Handle);
|
||||||
|
|
||||||
getCurrentResourceStorage().m_currentTextureIndex += usedTexture;
|
getCurrentResourceStorage().m_currentTextureIndex += usedTexture;
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> endTextureTime = std::chrono::system_clock::now();
|
||||||
|
m_timers.m_textureUploadDuration += std::chrono::duration_cast<std::chrono::microseconds>(endTextureTime - startTextureTime).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t numRTT;
|
size_t numRTT;
|
||||||
|
@ -1042,6 +1049,14 @@ void D3D12GSRender::Flip()
|
||||||
while (getCurrentResourceStorage().m_frameFinishedHandle)
|
while (getCurrentResourceStorage().m_frameFinishedHandle)
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
m_frame->Flip(nullptr);
|
m_frame->Flip(nullptr);
|
||||||
|
|
||||||
|
ResetTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void D3D12GSRender::ResetTimer()
|
||||||
|
{
|
||||||
|
m_timers.m_textureUploadDuration = 0;
|
||||||
|
m_timers.m_vertexUploadDuration = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D12GSRender::ResourceStorage& D3D12GSRender::getCurrentResourceStorage()
|
D3D12GSRender::ResourceStorage& D3D12GSRender::getCurrentResourceStorage()
|
||||||
|
|
|
@ -214,6 +214,14 @@ private:
|
||||||
// m_rootSignatures[N] is RS with N texture/sample
|
// m_rootSignatures[N] is RS with N texture/sample
|
||||||
ID3D12RootSignature *m_rootSignatures[17];
|
ID3D12RootSignature *m_rootSignatures[17];
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
size_t m_vertexUploadDuration;
|
||||||
|
size_t m_textureUploadDuration;
|
||||||
|
} m_timers;
|
||||||
|
|
||||||
|
void ResetTimer();
|
||||||
|
|
||||||
struct Shader
|
struct Shader
|
||||||
{
|
{
|
||||||
ID3D12PipelineState *m_PSO;
|
ID3D12PipelineState *m_PSO;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue