Finally fixing it for real for real

This commit is contained in:
Dynamitos
2024-09-07 11:15:47 +02:00
parent e5c3918989
commit 9d2b890d72
15 changed files with 154 additions and 170 deletions
+15 -10
View File
@@ -8,6 +8,7 @@ using namespace Seele;
PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo& createInfo, std::string dllPath, bool useMeshCulling)
: GameView(graphics, window, createInfo, dllPath) {
getGlobals().useDepthCulling = useMeshCulling;
renderTimestamp = graphics->createTimestampQuery(2, "RenderTimestamp");
queryThread = std::thread([&]() {
PRenderGraphResources res = renderGraph.getResources();
Gfx::PPipelineStatisticsQuery cachedQuery = res->requestQuery("CACHED_QUERY");
@@ -23,21 +24,23 @@ PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreate
<< "DepthIAV,DepthIAP,DepthVS,DepthClipInv,DepthClipPrim,DepthFS,DepthCS,DepthTS,DepthMS,"
<< "BaseIAV,BaseIAP,BaseVS,BaseClipInv,BaseClipPrim,BaseFS,BaseCS,BaseTS,BaseMS,"
<< "LightCullIAV,LightCullIAP,LightCullVS,LightCullClipInv,LightCullClipPrim,LightCullFS,LightCullCS,LightCullTS,LightCullMS,"
<< "VisibilityIAV,VisibilityIAP,VisibilityVS,VisibilityClipInv,VisibilityClipPrim,VisibilityFS,VisibilityCS,VisibilityMS,VisibilityMS," << std::endl;
<< "VisibilityIAV,VisibilityIAP,VisibilityVS,VisibilityClipInv,VisibilityClipPrim,VisibilityFS,VisibilityCS,VisibilityMS,"
"VisibilityMS,"
<< std::endl;
uint64 start = 0;
uint64 prevBegin = 0;
std::this_thread::sleep_for(std::chrono::milliseconds(500));
stats << std::fixed << std::setprecision(0);
while (getGlobals().running) {
auto cachedResults = cachedQuery->getResults();
auto depthResults = depthQuery->getResults();
auto baseResults = baseQuery->getResults();
auto lightCullResults = lightCullQuery->getResults();
auto visiblityResults = visibilityQuery->getResults();
int64 renderBegin = renderTimestamp->getResult().time;
int64 renderEnd = renderTimestamp->getResult().time;
Map<std::string, uint64> results;
for (uint32 i = 0; i < 11; ++i)
{
for (uint32 i = 0; i < 11; ++i) {
auto ts = timestamps->getResult();
results[ts.name] = ts.time;
}
@@ -53,12 +56,10 @@ PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreate
int64 visibilityTime = results.at("VisibilityEnd") - results.at("VisibilityBegin");
int64 frameTime = cachedTime + mipTime + depthTime + baseTime + lightCullTime + visibilityTime;
stats << relTime << "," << cachedTime << "," << mipTime << "," << depthTime << ","
<< visibilityTime
<< "," << lightCullTime << "," << baseTime << ","
<< frameTime << "," << cachedResults << depthResults << baseResults << lightCullResults << visiblityResults << std::endl;
stats << relTime << "," << cachedTime << "," << mipTime << "," << depthTime << "," << visibilityTime << "," << lightCullTime
<< "," << baseTime << "," << frameTime << "," << cachedResults << depthResults << baseResults << lightCullResults
<< visiblityResults << std::endl;
stats.flush();
// std::cout << "Writing " << timestamps[0].time << std::endl;
}
});
}
@@ -73,6 +74,10 @@ void PlayView::commitUpdate() { GameView::commitUpdate(); }
void PlayView::prepareRender() { GameView::prepareRender(); }
void PlayView::render() { GameView::render(); }
void PlayView::render() {
renderTimestamp->write(Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT, "RenderBegin");
GameView::render();
renderTimestamp->write(Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT, "RenderEnd");
}
void PlayView::keyCallback(KeyCode code, InputAction action, KeyModifier modifier) { GameView::keyCallback(code, action, modifier); }
+1
View File
@@ -17,6 +17,7 @@ class PlayView : public GameView {
private:
std::thread queryThread;
Gfx::OTimestampQuery renderTimestamp;
};
DECLARE_REF(PlayView)
} // namespace Seele