-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per tile stats #5188
Per tile stats #5188
Conversation
Yes this is on the right track. I didn't look too deeply at the code yet, but just a few things:
|
Hey @lilleyse , I redid my changes to reflect Hannah's recent refactoring of the inspector and addressed all the things you mentioned above (except the picking, which I'm working on). How should the tile info stats changes I've made so far be tested? Just follow the template of the debugShowGeometricError tests in the Cesium3DTilesetSpec? |
Those tests can be renamed to Then a separate test can check how the labels change when new debug settings are toggled. Setting |
Ah, as per discussion with @lilleyse , going to refactor the debug label assembly to happen in the inspector view model instead of in the tileset. |
Ah, sorry about that @lilleyse -- I still had the original labels drawing for debugging purposes. Here is my properly broken code. XD |
The problem is that the update is pushing commands after the render loop, and so they just get ignored. The same would happen with |
Ah, thanks for explaining, @lilleyse . So shall I just revert to the previous version? |
Yeah, that's best for now. |
Ready for another look @lilleyse |
Just to summarize the PR breakdown... This one should be ready soon. Then open a 2nd PR to fix picking for tilesets that don't use a batch table. And then a 3rd PR to add this feature:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Some of these new options will be super helpful.
Source/Scene/Cesium3DTile.js
Outdated
applyDebugSettings(this, tileset, frameState); | ||
this._content.update(tileset, frameState); | ||
this._transformDirty = false; | ||
this._content.commandsLength = frameState.commandList.length - initCommandLength; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be simpler if Cesium3DTile
holds onto this._commandsLength
instead of the contents.
Source/Scene/Cesium3DTileset.js
Outdated
*/ | ||
this.debugShowNumberOfPoints = defaultValue(options.debugShowNumberOfPoints, false); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty line.
Source/Scene/Cesium3DTileset.js
Outdated
text: tile.geometricError.toString(), | ||
position: position | ||
|
||
var labelString = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: Use single quotes instead double quotes throughout.
Source/Scene/Cesium3DTileset.js
Outdated
position: position | ||
|
||
var labelString = ""; | ||
var attribCounter = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: avoid abbreviations.
Source/Scene/Cesium3DTileset.js
Outdated
var attribCounter = 0; | ||
|
||
if (tileset.debugShowGeometricError) { | ||
labelString += "\nGeometric error: " + tile.geometricError.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toString()
for these isn't needed.
*/ | ||
this.tileInfoVisible = false; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty line.
* @type {Boolean} | ||
* @default false | ||
*/ | ||
this.textureMemory = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place the showGeometricError
stuff closer to these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it would be better to arrange these in the order they are shown in the UI.
get : function() { | ||
return numberOfTriangles(); | ||
}, | ||
set : function(val) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change all val
to value
.
Specs/Scene/Cesium3DTilesetSpec.js
Outdated
expect(tileset._tileInfoLabels.length).toEqual(5); | ||
|
||
var root = tileset._root; | ||
expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove uses of toString()
throughout this file.
Specs/Scene/Cesium3DTilesetSpec.js
Outdated
'Points: ' + content.pointsLength.toString() + '\n' + | ||
'Triangles: ' + content.trianglesLength.toString() + '\n' + | ||
'Texture Memory: ' + content.textureMemorySizeInBytes.toString() + '\n' + | ||
'Vertex Memory: ' + content.vertexMemorySizeInBytes.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the large indentation, create a var for the string.
Sure! I'll do that now. |
Ok @lilleyse, I added feature counts and updated according to your review. Ready for another look. |
Source/Scene/Cesium3DTileset.js
Outdated
var attributes = 0; | ||
|
||
if (tileset.debugShowGeometricError) { | ||
labelString += "\nGeometric error: " + tile.geometricError; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use single-quotes for these.
Source/Scene/Cesium3DTileset.js
Outdated
// Destroy debug labels | ||
if (defined(this._tileInfoLabels)) { | ||
this._tileInfoLabels.destroy(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The destroy convention usually looks like:
tileset._tileInfoLabels = tileset._tileInfoLabels && tileset._tileInfoLabels.destroy();
initialize(this, arrayBuffer, byteOffset); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty line.
@@ -132,6 +132,7 @@ define([ | |||
var updatePanelContents = document.createElement('div'); | |||
var loggingPanelContents = document.createElement('div'); | |||
var stylePanelContents = document.createElement('div'); | |||
var tileInfoPanelContents = document.createElement('div'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also place this before stylePanel for consistency.
this.freezeFrame = false; | ||
this.textureMemory = false; | ||
|
||
var vertexMemory = knockout.observable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this from before. Can you rename all the new properties to showTextureMemory
to follow the showGeometricError
convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't miss it! I accidentally reverted it along with the labels-to-view-model commits. XD
@@ -681,7 +817,13 @@ define([ | |||
'showContentBoundingVolumes', | |||
'showRequestVolumes', | |||
'showGeometricError', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move showGeometricError
below near the others.
'vertexMemory', | ||
'numberOfPoints', | ||
'numberOfTriangles', | ||
'numberOfCommands']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing numberOfFeatures
.
@@ -681,7 +817,13 @@ define([ | |||
'showContentBoundingVolumes', | |||
'showRequestVolumes', | |||
'showGeometricError', | |||
'freezeFrame']; | |||
'freezeFrame', | |||
'onlyPickedTileInfo', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
Source/Scene/Cesium3DTileset.js
Outdated
attributes++; | ||
} | ||
if (tileset.debugShowVertexMemoryUsage) { | ||
labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late suggestion, but can this and texture memory usage show it in megabytes like in the stats panel in the inspector?
Thanks for the review @lilleyse ! Comments addressed. |
Source/Scene/Cesium3DTileset.js
Outdated
@@ -2221,7 +2221,7 @@ define([ | |||
Cesium3DTileset.prototype.destroy = function() { | |||
// Destroy debug labels | |||
if (defined(this._tileInfoLabels)) { | |||
this._tileInfoLabels.destroy(); | |||
this._tileInfoLabels = this._tileInfoLabels && this._tileInfoLabels.destroy(); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the if (defined(this._tileInfoLabels)) {
wrapper, it is unnecessary now.
@@ -196,17 +196,27 @@ define([ | |||
errorBox.setAttribute('data-bind', 'text: editorError'); | |||
stylePanelContents.appendChild(errorBox); | |||
|
|||
tileInfoPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); | |||
tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfCommands', 'Number of Commands')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to Number Of Commands
'dynamicScreenSpaceErrorDensity', 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive']; | ||
'showContentBoundingVolumes', 'showRequestVolumes', 'freezeFrame', 'maximumScreenSpaceError', 'dynamicScreenSpaceErrorDensity', | ||
'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive', 'showGeometricError', | ||
'showTextureMemory', 'showVertexMemory', 'showNumberOfCommands', 'showNumberOfPoints', 'showNumberOfTriangles', 'showNumberOfFeatures']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also reorder them here to match.
Source/Scene/Cesium3DTileset.js
Outdated
* @type {Boolean} | ||
* @default false | ||
*/ | ||
this.debugShowVertexMemoryUsage = defaultValue(options.debugShowVertexMemoryUsage, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add these debugShow
options to the doc in the constructor?
Ok I think these are the last points, almost ready! |
Done, @lilleyse! |
@@ -121,7 +121,13 @@ define([ | |||
* @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. When true, renders the bounding volume for each tile. | |||
* @param {Boolean} [options.debugShowContentBoundingVolume=false] For debugging only. When true, renders the bounding volume for each tile's content. | |||
* @param {Boolean} [options.debugShowViewerRequestVolume=false] For debugging only. When true, renders the viewer request volume for each tile. | |||
* @param {Boolean} [options.debugShowGeometricError=false] For debugging only. When true, draws labels to indicate the geometric error of each tile | |||
* @param {Boolean} [options.debugShowGeometricError=false] For debugging only. When true, draws labels to indicate the geometric error of each tile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are probably too fine-grained. Consider:
- Combine
debugShowNumberOfCommands
,debugShowNumberOfPoints
,debugShowNumberOfTriangles
, anddebugShowNumberOfFeatures
intodebugShowRenderingStatistics
- Combine
debugShowTextureMemoryUsage
anddebugShowVertexMemoryUsage
intodebugShowMemoryUsage
This will be a lot less code and is inline with how I expect folks will want to use these hopefully without cluttering the display.
If clutter is a problem, try a smaller font that is still readable or a slightly less coarse-grained separation for the rendering stats.
Source/Scene/Cesium3DTileset.js
Outdated
/** | ||
* This property is for debugging only; it is not optimized for production use. | ||
* <p> | ||
* When true, draws labels to indicate the number of commands used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"commands used" -> "commands executed for this tile"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"each tile"
If going with the combined approach, it would make sense to hide |
Source/Scene/Cesium3DTileset.js
Outdated
} | ||
|
||
labelString += '\nFeatures: ' + tile.content.featuresLength; | ||
attributes += 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be ++ now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops! Fixed @lilleyse
Nice work @rahwang. |
@@ -142,6 +142,8 @@ define([ | |||
} | |||
this._viewerRequestVolume = viewerRequestVolume; | |||
|
|||
this._commandsLength = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have a readonly property getter.
Up to you, but this and the other "length" properties for rendering debugging output could be prefixed like _debugCommandsLength
@@ -1838,10 +1862,10 @@ define([ | |||
|
|||
var scratchCartesian2 = new Cartesian3(); | |||
|
|||
function updateGeometricErrorLabels(tileset, frameState) { | |||
function updateTileInfoLabels(tileset, frameState) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TileInfo
is very generic; we try to avoid names like "info." Perhaps updateTileDebugLabels
.
Same for the _tileInfoLabels
naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tileInfoVisible
, etc.
For #5156. Not ready yet! Is this on the right track, @lilleyse ? Seems wrong to just be using the tileset._statistics for draw command, texture memory and vertex memory numbers, but I'm not sure how to compute these per tile.