Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add new statistics for gpu buffer streaming
  • Loading branch information
degasus committed May 23, 2013
1 parent 6a5e7d7 commit a51d6a6
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/Core/VideoCommon/Src/Statistics.cpp
Expand Up @@ -55,6 +55,9 @@ char *Statistics::ToString(char *ptr)
ptr+=sprintf(ptr,"CP loads (DL): %i\n",stats.thisFrame.numCPLoadsInDL);
ptr+=sprintf(ptr,"BP loads: %i\n",stats.thisFrame.numBPLoads);
ptr+=sprintf(ptr,"BP loads (DL): %i\n",stats.thisFrame.numBPLoadsInDL);
ptr+=sprintf(ptr,"Vertex streamed: %i kB\n",stats.thisFrame.bytesVertexStreamed/1024);
ptr+=sprintf(ptr,"Index streamed: %i kB\n",stats.thisFrame.bytesIndexStreamed/1024);
ptr+=sprintf(ptr,"Uniform streamed: %i kB\n",stats.thisFrame.bytesUniformStreamed/1024);
ptr+=sprintf(ptr,"Vertex Loaders: %i\n",stats.numVertexLoaders);

std::string text1;
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/VideoCommon/Src/Statistics.h
Expand Up @@ -60,6 +60,10 @@ struct Statistics
int numBufferSplits;

int numDListsCalled;

int bytesVertexStreamed;
int bytesIndexStreamed;
int bytesUniformStreamed;
};
ThisFrame thisFrame;
void ResetFrame();
Expand Down
2 changes: 2 additions & 0 deletions Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp
Expand Up @@ -345,6 +345,8 @@ ID3D11Buffer* &PixelShaderCache::GetConstantBuffer()
memcpy(map.pData, psconstants, sizeof(psconstants));
D3D::context->Unmap(pscbuf, 0);
pscbufchanged = false;

ADDSTAT(stats.thisFrame.bytesUniformStreamed, sizeof(psconstants));
}
return pscbuf;
}
Expand Down
3 changes: 3 additions & 0 deletions Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp
Expand Up @@ -128,6 +128,9 @@ void VertexManager::PrepareDrawBuffers()
memcpy((u16*)map.pData + m_point_draw_index, GetPointIndexBuffer(), sizeof(u16) * IndexGenerator::GetPointindexLen());
D3D::context->Unmap(m_index_buffers[m_current_index_buffer], 0);
m_index_buffer_cursor += iCount;

ADDSTAT(stats.thisFrame.bytesVertexStreamed, vSize);
ADDSTAT(stats.thisFrame.bytesIndexStreamed, iCount*sizeof(u16));
}

static const float LINE_PT_TEX_OFFSETS[8] = {
Expand Down
2 changes: 2 additions & 0 deletions Source/Plugins/Plugin_VideoDX11/Src/VertexShaderCache.cpp
Expand Up @@ -50,6 +50,8 @@ ID3D11Buffer* &VertexShaderCache::GetConstantBuffer()
memcpy(map.pData, vsconstants, sizeof(vsconstants));
D3D::context->Unmap(vscbuf, 0);
vscbufchanged = false;

ADDSTAT(stats.thisFrame.bytesUniformStreamed, sizeof(vsconstants));
}
return vscbuf;
}
Expand Down
2 changes: 2 additions & 0 deletions Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp
Expand Up @@ -197,6 +197,8 @@ void VertexManager::PrepareDrawBuffers(u32 stride)
D3D::SetIndices(m_index_buffers[m_current_index_buffer]);
}

ADDSTAT(stats.thisFrame.bytesVertexStreamed, datasize);
ADDSTAT(stats.thisFrame.bytesIndexStreamed, IndexDataSize);
}

void VertexManager::DrawVertexBuffer(int stride)
Expand Down
2 changes: 2 additions & 0 deletions Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
Expand Up @@ -171,6 +171,8 @@ void ProgramShaderCache::UploadConstants()
glBindBufferRange(GL_UNIFORM_BUFFER, 1, s_buffer->getBuffer(), offset, s_ps_data_size);
glBindBufferRange(GL_UNIFORM_BUFFER, 2, s_buffer->getBuffer(), offset + s_vs_data_offset, s_vs_data_size);
s_ubo_dirty = false;

ADDSTAT(stats.thisFrame.bytesUniformStreamed, s_ubo_buffer_size);
}
}

Expand Down
3 changes: 3 additions & 0 deletions Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp
Expand Up @@ -104,6 +104,9 @@ void VertexManager::PrepareDrawBuffers(u32 stride)
{
s_offset[2] = s_indexBuffer->Upload((u8*)GetPointIndexBuffer(), point_index_size * sizeof(u16));
}

ADDSTAT(stats.thisFrame.bytesVertexStreamed, vertex_data_size);
ADDSTAT(stats.thisFrame.bytesIndexStreamed, index_size);
}

void VertexManager::Draw(u32 stride)
Expand Down

0 comments on commit a51d6a6

Please sign in to comment.