Trying to add water

This commit is contained in:
Dynamitos
2024-08-13 22:44:04 +02:00
parent 97244e87c1
commit 252a241208
43 changed files with 1408 additions and 219 deletions
+34 -23
View File
@@ -15,41 +15,52 @@ PlayView::PlayView(Gfx::PGraphics graphics, PWindow window, const ViewportCreate
Gfx::PPipelineStatisticsQuery baseQuery = res->requestQuery("BASEPASS_QUERY");
Gfx::PPipelineStatisticsQuery lightCullQuery = res->requestQuery("LIGHTCULL_QUERY");
Gfx::PPipelineStatisticsQuery visibilityQuery = res->requestQuery("VISIBILITY_QUERY");
Gfx::PTimestampQuery timeQuery = res->requestTimestampQuery("TIMESTAMP");
Gfx::PTimestampQuery cachedTS = res->requestTimestampQuery("CACHED_TS");
Gfx::PTimestampQuery depthTS = res->requestTimestampQuery("DEPTH_TS");
Gfx::PTimestampQuery lightCullTS = res->requestTimestampQuery("LIGHTCULL_TS");
Gfx::PTimestampQuery visibilityTS = res->requestTimestampQuery("VISIBILITY_TS");
Gfx::PTimestampQuery baseTS = res->requestTimestampQuery("BASE_TS");
std::ofstream stats(fmt::format("stats{}.csv", useMeshCulling ? "" : "NOCULL"));
stats << std::fixed << std::setprecision(0);
stats << "RelTime,"
<< "CachedIAV,CachedIAP,CachedVS,CachedClipInv,CachedClipPrim,CachedFS,CachedCS,CachedTS,CachedMS,"
<< "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,VisibilityTS,"
"VisibilityMS,"
<< "CACHED,MIPGEN,DEPTHCULL,VISIBILITY,LIGHTCULL,BASE,FrameTime" << std::endl;
float start = 0;
<< "CACHED,MIPGEN,DEPTHCULL,VISIBILITY,LIGHTCULL,BASE,FrameTime,"
<< "CachedIAV,CachedIAP,CachedVS,CachedClipInv,CachedClipPrim,CachedFS,CachedCS,"
<< "DepthIAV,DepthIAP,DepthVS,DepthClipInv,DepthClipPrim,DepthFS,DepthCS,"
<< "BaseIAV,BaseIAP,BaseVS,BaseClipInv,BaseClipPrim,BaseFS,BaseCS,"
<< "LightCullIAV,LightCullIAP,LightCullVS,LightCullClipInv,LightCullClipPrim,LightCullFS,LightCullCS,"
<< "VisibilityIAV,VisibilityIAP,VisibilityVS,VisibilityClipInv,VisibilityClipPrim,VisibilityFS,VisibilityCS" << 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 timestamps = timeQuery->getResults();
auto cached = cachedTS->getResults();
auto depth = depthTS->getResults();
auto lightCull = lightCullTS->getResults();
auto visibility = visibilityTS->getResults();
auto base = baseTS->getResults();
auto cachedResults = cachedQuery->getResults();
auto depthResults = depthQuery->getResults();
auto baseResults = baseQuery->getResults();
auto lightCullResults = lightCullQuery->getResults();
auto visiblityResults = visibilityQuery->getResults();
if (start == 0) {
start = timestamps[0].time;
start = cached[0].time;
}
uint64 t0 = timestamps[0].time;
uint64 t1 = timestamps[1].time;
uint64 t2 = timestamps[2].time;
uint64 t3 = timestamps[3].time;
uint64 t4 = timestamps[4].time;
uint64 t5 = timestamps[5].time;
uint64 t6 = timestamps[6].time;
if (t1 < t0 || t2 < t1 || t3 < t2 || t4 < t3 || t5 < t4 || t6 < t5)
continue;
stats << t0 - start << "," << cachedResults << depthResults << baseResults << lightCullResults << visiblityResults << t1 - t0
<< "," << t2 - t1 << "," << t3 - t2 << "," << t4 - t3 << "," << t5 - t4 << "," << t6 - t5 << "," << t6 - t0 << std::endl;
int64 relTime = cached[0].time - start;
int64 cachedTime = cached[1].time - cached[0].time;
int64 mipTime = depth[1].time - depth[0].time;
int64 depthTime = depth[2].time - depth[0].time;
int64 baseTime = base[1].time - base[0].time;
int64 lightCullTime = lightCull[1].time - lightCull[0].time;
int64 visibilityTime = visibility[1].time - visibility[0].time;
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.flush();
// std::cout << "Writing " << timestamps[0].time << std::endl;
}
});
}