gpu timings
This commit is contained in:
@@ -257,8 +257,10 @@ public class VoxyRenderSystem {
|
|||||||
TimingStatistics.E.stop();
|
TimingStatistics.E.stop();
|
||||||
|
|
||||||
|
|
||||||
|
GPUTiming.INSTANCE.marker();
|
||||||
//The entire rendering pipeline (excluding the chunkbound thing)
|
//The entire rendering pipeline (excluding the chunkbound thing)
|
||||||
this.pipeline.runPipeline(viewport, boundFB, dims[2], dims[3]);
|
this.pipeline.runPipeline(viewport, boundFB, dims[2], dims[3]);
|
||||||
|
GPUTiming.INSTANCE.marker();
|
||||||
|
|
||||||
|
|
||||||
TimingStatistics.main.stop();
|
TimingStatistics.main.stop();
|
||||||
@@ -431,6 +433,7 @@ public class VoxyRenderSystem {
|
|||||||
debug.add("Extra time: " + TimingStatistics.A.pVal() + ", " + TimingStatistics.B.pVal() + ", " + TimingStatistics.C.pVal() + ", " + TimingStatistics.D.pVal());
|
debug.add("Extra time: " + TimingStatistics.A.pVal() + ", " + TimingStatistics.B.pVal() + ", " + TimingStatistics.C.pVal() + ", " + TimingStatistics.D.pVal());
|
||||||
debug.add("Extra 2 time: " + TimingStatistics.E.pVal() + ", " + TimingStatistics.F.pVal() + ", " + TimingStatistics.G.pVal() + ", " + TimingStatistics.H.pVal() + ", " + TimingStatistics.I.pVal());
|
debug.add("Extra 2 time: " + TimingStatistics.E.pVal() + ", " + TimingStatistics.F.pVal() + ", " + TimingStatistics.G.pVal() + ", " + TimingStatistics.H.pVal() + ", " + TimingStatistics.I.pVal());
|
||||||
}
|
}
|
||||||
|
debug.add(GPUTiming.INSTANCE.getDebug());
|
||||||
PrintfDebugUtil.addToOut(debug);
|
PrintfDebugUtil.addToOut(debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,17 +30,37 @@ public class GPUTiming {
|
|||||||
|
|
||||||
private final GlTimestampQuerySet timingSet = new GlTimestampQuerySet();
|
private final GlTimestampQuerySet timingSet = new GlTimestampQuerySet();
|
||||||
|
|
||||||
|
private float[] timings = new float[0];
|
||||||
|
|
||||||
public void marker() {
|
public void marker() {
|
||||||
this.timingSet.capture(0);
|
this.timingSet.capture(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDebug() {
|
||||||
|
StringBuilder str = new StringBuilder("GpuTime: [");
|
||||||
|
for (int i = 0; i < this.timings.length; i++) {
|
||||||
|
str.append(String.format("%.2f", this.timings[i]));
|
||||||
|
if (i!=this.timings.length-1) {
|
||||||
|
str.append(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str.append(']');
|
||||||
|
return str.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public void tick() {
|
public void tick() {
|
||||||
this.timingSet.download((meta,data)->{
|
this.timingSet.download((meta,data)->{
|
||||||
long current = data[0];
|
long current = data[0];
|
||||||
|
|
||||||
|
if (data.length-1!=this.timings.length) {
|
||||||
|
this.timings = new float[data.length-1];
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 1; i < meta.length; i++) {
|
for (int i = 1; i < meta.length; i++) {
|
||||||
long next = data[i];
|
long next = data[i];
|
||||||
long delta = next - current;
|
long delta = next - current;
|
||||||
//System.out.println(delta);
|
float time = (float) (((double)delta)/1_000_000);
|
||||||
|
this.timings[i-1] = Math.max(this.timings[i-1]*0.99f+time*0.01f, time);
|
||||||
current = next;
|
current = next;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user