add new statistics for gpu buffer streaming

This commit is contained in:
degasus 2013-05-23 21:07:01 +02:00
parent 6a5e7d7be4
commit a51d6a6ddd
8 changed files with 21 additions and 0 deletions

View File

@ -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;

View File

@ -60,6 +60,10 @@ struct Statistics
int numBufferSplits;
int numDListsCalled;
int bytesVertexStreamed;
int bytesIndexStreamed;
int bytesUniformStreamed;
};
ThisFrame thisFrame;
void ResetFrame();

View File

@ -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;
}

View File

@ -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] = {

View File

@ -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;
}

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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)