mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Depth Z: Add a stat for Z-culling, correctly distinguish the small/backface stats
This commit is contained in:
parent
449e3e1360
commit
8b10ee3937
3 changed files with 11 additions and 3 deletions
|
@ -149,11 +149,11 @@ TriangleResult DepthRasterTriangle(uint16_t *depthBuf, int stride, int x1, int y
|
|||
|
||||
// TODO: Cull really small triangles here - we can increase the threshold a bit probably.
|
||||
int triArea = (v1y - v2y) * v0x + (v2x - v1x) * v0y + (v1x * v2y - v2x * v1y);
|
||||
if (triArea <= 0) {
|
||||
if (triArea < 0) {
|
||||
return TriangleResult::Backface;
|
||||
}
|
||||
if (triArea < MIN_TRI_AREA) {
|
||||
return TriangleResult::TooSmall;
|
||||
return TriangleResult::TooSmall; // Or zero area.
|
||||
}
|
||||
|
||||
float oneOverTriArea = 1.0f / (float)triArea;
|
||||
|
@ -344,6 +344,7 @@ int DepthRasterClipIndexedTriangles(int *tx, int *ty, float *tz, const float *tr
|
|||
static const float zerovec[4] = {};
|
||||
|
||||
int collected = 0;
|
||||
int planeCulled = 0;
|
||||
const float *verts[12]; // four triangles at a time!
|
||||
for (int i = 0; i < count; i += 3) {
|
||||
// Collect valid triangles into buffer.
|
||||
|
@ -356,6 +357,8 @@ int DepthRasterClipIndexedTriangles(int *tx, int *ty, float *tz, const float *tr
|
|||
verts[collected + 1] = v1;
|
||||
verts[collected + 2] = v2;
|
||||
collected += 3;
|
||||
} else {
|
||||
planeCulled++;
|
||||
}
|
||||
|
||||
if (i >= count - 3 && collected != 12) {
|
||||
|
@ -433,6 +436,8 @@ int DepthRasterClipIndexedTriangles(int *tx, int *ty, float *tz, const float *tr
|
|||
outCount += 12;
|
||||
}
|
||||
}
|
||||
|
||||
gpuStats.numDepthRasterZCulled += planeCulled;
|
||||
return outCount;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ struct GPUStatistics {
|
|||
numDepthRasterBackface = 0;
|
||||
numDepthRasterNoPixels = 0;
|
||||
numDepthRasterTooSmall = 0;
|
||||
numDepthRasterZCulled = 0;
|
||||
vertexGPUCycles = 0;
|
||||
otherGPUCycles = 0;
|
||||
}
|
||||
|
@ -159,6 +160,7 @@ struct GPUStatistics {
|
|||
int numDepthRasterBackface;
|
||||
int numDepthRasterNoPixels;
|
||||
int numDepthRasterTooSmall;
|
||||
int numDepthRasterZCulled;
|
||||
// Flip count. Doesn't really belong here.
|
||||
int numFlips;
|
||||
};
|
||||
|
|
|
@ -1776,7 +1776,7 @@ size_t GPUCommonHW::FormatGPUStatsCommon(char *buffer, size_t size) {
|
|||
"replacer: tracks %d references, %d unique textures\n"
|
||||
"Cpy: depth %d, color %d, reint %d, blend %d, self %d\n"
|
||||
"GPU cycles: %d (%0.1f per vertex)\n"
|
||||
"Depth raster: %0.2f ms, %d prim, %d nopix, %d small, %d backface\n%s",
|
||||
"Depth raster: %0.2f ms, %d prim, %d nopix, %d small, %d back, %d zcull\n%s",
|
||||
gpuStats.msProcessingDisplayLists * 1000.0f,
|
||||
gpuStats.numDrawSyncs,
|
||||
gpuStats.numListSyncs,
|
||||
|
@ -1818,6 +1818,7 @@ size_t GPUCommonHW::FormatGPUStatsCommon(char *buffer, size_t size) {
|
|||
gpuStats.numDepthRasterNoPixels,
|
||||
gpuStats.numDepthRasterTooSmall,
|
||||
gpuStats.numDepthRasterBackface,
|
||||
gpuStats.numDepthRasterZCulled,
|
||||
debugRecording_ ? "(debug-recording)" : ""
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue