mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 17:56:43 +02:00
Adding more counters to understand the cullign bug
This commit is contained in:
parent
56eb322b7d
commit
ac54533433
3 changed files with 41 additions and 13 deletions
|
@ -311,7 +311,7 @@ uint32_t scanLightVolumeSphere(FrustumGrid& grid, const FrustumGrid::Planes plan
|
||||||
return numClustersTouched;
|
return numClustersTouched;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t LightClusters::updateClusters() {
|
glm::ivec3 LightClusters::updateClusters() {
|
||||||
// Clean up last info
|
// Clean up last info
|
||||||
std::vector< std::vector< LightIndex > > clusterGridPoint(_numClusters);
|
std::vector< std::vector< LightIndex > > clusterGridPoint(_numClusters);
|
||||||
std::vector< std::vector< LightIndex > > clusterGridSpot(_numClusters);
|
std::vector< std::vector< LightIndex > > clusterGridSpot(_numClusters);
|
||||||
|
@ -327,11 +327,14 @@ uint32_t LightClusters::updateClusters() {
|
||||||
glm::ivec3 gridPosToOffset(1, theFrustumGrid.dims.x, theFrustumGrid.dims.x * theFrustumGrid.dims.y);
|
glm::ivec3 gridPosToOffset(1, theFrustumGrid.dims.x, theFrustumGrid.dims.x * theFrustumGrid.dims.y);
|
||||||
|
|
||||||
uint32_t numClusterTouched = 0;
|
uint32_t numClusterTouched = 0;
|
||||||
|
uint32_t numLightsIn = _visibleLightIndices[0];
|
||||||
|
uint32_t numClusteredLights = 0;
|
||||||
for (size_t lightNum = 1; lightNum < _visibleLightIndices.size(); ++lightNum) {
|
for (size_t lightNum = 1; lightNum < _visibleLightIndices.size(); ++lightNum) {
|
||||||
auto lightId = _visibleLightIndices[lightNum];
|
auto lightId = _visibleLightIndices[lightNum];
|
||||||
auto light = _lightStage->getLight(lightId);
|
auto light = _lightStage->getLight(lightId);
|
||||||
if (!light)
|
if (!light) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto worldOri = light->getPosition();
|
auto worldOri = light->getPosition();
|
||||||
auto radius = light->getMaximumRadius();
|
auto radius = light->getMaximumRadius();
|
||||||
|
@ -460,6 +463,8 @@ uint32_t LightClusters::updateClusters() {
|
||||||
} else {
|
} else {
|
||||||
numClusterTouched += scanLightVolumeSphere(theFrustumGrid, _gridPlanes, zMin, zMax, yMin, yMax, xMin, xMax, lightId, glm::vec4(glm::vec3(eyeOri), radius), clusterGrid);
|
numClusterTouched += scanLightVolumeSphere(theFrustumGrid, _gridPlanes, zMin, zMax, yMin, yMax, xMin, xMax, lightId, glm::vec4(glm::vec3(eyeOri), radius), clusterGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
numClusteredLights++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lights have been gathered now reexpress in terms of 2 sequential buffers
|
// Lights have been gathered now reexpress in terms of 2 sequential buffers
|
||||||
|
@ -502,7 +507,7 @@ uint32_t LightClusters::updateClusters() {
|
||||||
_clusterGridBuffer._buffer->setData(_clusterGridBuffer._size, (gpu::Byte*) _clusterGrid.data());
|
_clusterGridBuffer._buffer->setData(_clusterGridBuffer._size, (gpu::Byte*) _clusterGrid.data());
|
||||||
_clusterContentBuffer._buffer->setSubData(0, indexOffset * sizeof(LightIndex), (gpu::Byte*) _clusterContent.data());
|
_clusterContentBuffer._buffer->setSubData(0, indexOffset * sizeof(LightIndex), (gpu::Byte*) _clusterContent.data());
|
||||||
|
|
||||||
return numClusterTouched;
|
return glm::ivec3(numLightsIn, numClusteredLights, numClusterTouched);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -543,12 +548,14 @@ void LightClusteringPass::run(const render::SceneContextPointer& sceneContext, c
|
||||||
_lightClusters->updateLightStage(lightStage);
|
_lightClusters->updateLightStage(lightStage);
|
||||||
_lightClusters->updateLightFrame(lightStage->_currentFrame, lightingModel->isPointLightEnabled(), lightingModel->isSpotLightEnabled());
|
_lightClusters->updateLightFrame(lightStage->_currentFrame, lightingModel->isPointLightEnabled(), lightingModel->isSpotLightEnabled());
|
||||||
|
|
||||||
auto numClusterdLights = _lightClusters->updateClusters();
|
auto clusteringStats = _lightClusters->updateClusters();
|
||||||
|
|
||||||
output = _lightClusters;
|
output = _lightClusters;
|
||||||
|
|
||||||
auto config = std::static_pointer_cast<Config>(renderContext->jobConfig);
|
auto config = std::static_pointer_cast<Config>(renderContext->jobConfig);
|
||||||
config->setNumClusteredLights(numClusterdLights);
|
config->setNumInputLights(clusteringStats.x);
|
||||||
|
config->setNumClusteredLights(clusteringStats.y);
|
||||||
|
config->setNumClusteredLightReferences(clusteringStats.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugLightClusters::DebugLightClusters() {
|
DebugLightClusters::DebugLightClusters() {
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
|
|
||||||
void updateLightFrame(const LightStage::Frame& lightFrame, bool points = true, bool spots = true);
|
void updateLightFrame(const LightStage::Frame& lightFrame, bool points = true, bool spots = true);
|
||||||
|
|
||||||
uint32_t updateClusters();
|
glm::ivec3 updateClusters();
|
||||||
|
|
||||||
ViewFrustum _frustum;
|
ViewFrustum _frustum;
|
||||||
|
|
||||||
|
@ -117,6 +117,8 @@ class LightClusteringPassConfig : public render::Job::Config {
|
||||||
|
|
||||||
Q_PROPERTY(bool freeze MEMBER freeze NOTIFY dirty)
|
Q_PROPERTY(bool freeze MEMBER freeze NOTIFY dirty)
|
||||||
|
|
||||||
|
Q_PROPERTY(int numClusteredLightReferences MEMBER numClusteredLightReferences NOTIFY dirty)
|
||||||
|
Q_PROPERTY(int numInputLights MEMBER numInputLights NOTIFY dirty)
|
||||||
Q_PROPERTY(int numClusteredLights MEMBER numClusteredLights NOTIFY dirty)
|
Q_PROPERTY(int numClusteredLights MEMBER numClusteredLights NOTIFY dirty)
|
||||||
public:
|
public:
|
||||||
LightClusteringPassConfig() : render::Job::Config(true){}
|
LightClusteringPassConfig() : render::Job::Config(true){}
|
||||||
|
@ -130,6 +132,11 @@ public:
|
||||||
|
|
||||||
bool freeze{ false };
|
bool freeze{ false };
|
||||||
|
|
||||||
|
void setNumClusteredLightReferences(int numRefs) { numClusteredLightReferences = numRefs; emit dirty(); }
|
||||||
|
int numClusteredLightReferences { 0 };
|
||||||
|
|
||||||
|
void setNumInputLights(int numLights) { numInputLights = numLights; emit dirty(); }
|
||||||
|
int numInputLights { 0 };
|
||||||
void setNumClusteredLights(int numLights) { numClusteredLights = numLights; emit dirty(); }
|
void setNumClusteredLights(int numLights) { numClusteredLights = numLights; emit dirty(); }
|
||||||
int numClusteredLights { 0 };
|
int numClusteredLights { 0 };
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -33,14 +33,28 @@ Column {
|
||||||
label: "time",
|
label: "time",
|
||||||
scale: 1,
|
scale: 1,
|
||||||
color: "#FFFFFF"
|
color: "#FFFFFF"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
PlotPerf {
|
||||||
|
title: "Lights"
|
||||||
|
height: 50
|
||||||
|
object: Render.getConfig("LightClustering")
|
||||||
|
valueUnit: ""
|
||||||
|
valueScale: 1
|
||||||
|
valueNumDigits: "0"
|
||||||
|
plots: [
|
||||||
|
{
|
||||||
|
object: Render.getConfig("LightClustering"),
|
||||||
|
prop: "numClusteredLights",
|
||||||
|
label: "visible",
|
||||||
|
color: "#D959FE"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: Render.getConfig("DrawLight"),
|
object: Render.getConfig("LightClustering"),
|
||||||
prop: "numDrawn",
|
prop: "numInputLights",
|
||||||
unit: "",
|
label: "input",
|
||||||
scale: 0.01,
|
|
||||||
numDigits: 0,
|
|
||||||
label: "Lights",
|
|
||||||
color: "#FED959"
|
color: "#FED959"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -107,7 +121,7 @@ Column {
|
||||||
onCheckedChanged: { Render.getConfig("DebugLightClusters")["doDrawContent"] = checked }
|
onCheckedChanged: { Render.getConfig("DebugLightClusters")["doDrawContent"] = checked }
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
text: "Num Cluster Items = " + Render.getConfig("LightClustering")["numClusteredLights"].toFixed(0)
|
text: "Num Cluster Items = " + Render.getConfig("LightClustering")["numClusteredLightReferences"].toFixed(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue