Add some more gpu timer.
This commit is contained in:
parent
3e6ab6d7b6
commit
59f586c5ee
@ -77,9 +77,13 @@ enum STKRenderingPass
|
|||||||
enum QueryPerf
|
enum QueryPerf
|
||||||
{
|
{
|
||||||
Q_SOLID_PASS1,
|
Q_SOLID_PASS1,
|
||||||
Q_SOLID_PASS2,
|
|
||||||
Q_LIGHT,
|
|
||||||
Q_SHADOWS,
|
Q_SHADOWS,
|
||||||
|
Q_LIGHT,
|
||||||
|
Q_SSAO,
|
||||||
|
Q_SOLID_PASS2,
|
||||||
|
Q_TRANSPARENT,
|
||||||
|
Q_PARTICLES,
|
||||||
|
Q_DISPLACEMENT,
|
||||||
Q_LAST
|
Q_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -216,26 +216,32 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, std::vector
|
|||||||
|
|
||||||
const core::aabbox3df cambox = camnode->getViewFrustum()->getBoundingBox();
|
const core::aabbox3df cambox = camnode->getViewFrustum()->getBoundingBox();
|
||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("- Shadow", 0x30, 0x6F, 0x90);
|
|
||||||
// Shadows
|
// Shadows
|
||||||
if (!m_mipviz && !m_wireframe && UserConfigParams::m_dynamic_lights &&
|
|
||||||
UserConfigParams::m_shadows && hasShadow)
|
|
||||||
{
|
{
|
||||||
renderShadows();
|
PROFILER_PUSH_CPU_MARKER("- Shadow", 0x30, 0x6F, 0x90);
|
||||||
|
ScopedGPUTimer Timer(getGPUTimer(Q_SHADOWS));
|
||||||
|
if (!m_mipviz && !m_wireframe && UserConfigParams::m_dynamic_lights &&
|
||||||
|
UserConfigParams::m_shadows && hasShadow)
|
||||||
|
renderShadows();
|
||||||
|
PROFILER_POP_CPU_MARKER();
|
||||||
}
|
}
|
||||||
PROFILER_POP_CPU_MARKER();
|
|
||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("- Light", 0x00, 0xFF, 0x00);
|
|
||||||
|
|
||||||
// Lights
|
// Lights
|
||||||
renderLights(dt);
|
{
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_PUSH_CPU_MARKER("- Light", 0x00, 0xFF, 0x00);
|
||||||
|
ScopedGPUTimer Timer(getGPUTimer(Q_LIGHT));
|
||||||
|
renderLights(dt);
|
||||||
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
}
|
||||||
|
|
||||||
// Handle SSAO
|
// Handle SSAO
|
||||||
PROFILER_PUSH_CPU_MARKER("- SSAO", 0xFF, 0xFF, 0x00);
|
{
|
||||||
if (UserConfigParams::m_ssao)
|
PROFILER_PUSH_CPU_MARKER("- SSAO", 0xFF, 0xFF, 0x00);
|
||||||
renderSSAO();
|
ScopedGPUTimer Timer(getGPUTimer(Q_SSAO));
|
||||||
PROFILER_POP_CPU_MARKER();
|
if (UserConfigParams::m_ssao)
|
||||||
|
renderSSAO();
|
||||||
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
}
|
||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("- Solid Pass 2", 0x00, 0x00, 0xFF);
|
PROFILER_PUSH_CPU_MARKER("- Solid Pass 2", 0x00, 0x00, 0xFF);
|
||||||
if (!UserConfigParams::m_dynamic_lights)
|
if (!UserConfigParams::m_dynamic_lights)
|
||||||
@ -274,18 +280,29 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, std::vector
|
|||||||
computeSunVisibility();
|
computeSunVisibility();
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
|
||||||
// We need to re-render camera due to the per-cam-node hack.
|
// Render transparent
|
||||||
PROFILER_PUSH_CPU_MARKER("- Transparent Pass", 0xFF, 0x00, 0x00);
|
{
|
||||||
renderTransparent();
|
PROFILER_PUSH_CPU_MARKER("- Transparent Pass", 0xFF, 0x00, 0x00);
|
||||||
PROFILER_POP_CPU_MARKER();
|
ScopedGPUTimer Timer(getGPUTimer(Q_TRANSPARENT));
|
||||||
|
renderTransparent();
|
||||||
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
}
|
||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("- Particles", 0xFF, 0xFF, 0x00);
|
// Render particles
|
||||||
renderParticles();
|
{
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_PUSH_CPU_MARKER("- Particles", 0xFF, 0xFF, 0x00);
|
||||||
|
ScopedGPUTimer Timer(getGPUTimer(Q_PARTICLES));
|
||||||
|
renderParticles();
|
||||||
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
}
|
||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("- Displacement", 0x00, 0x00, 0xFF);
|
// Render displacement
|
||||||
renderDisplacement();
|
{
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_PUSH_CPU_MARKER("- Displacement", 0x00, 0x00, 0xFF);
|
||||||
|
ScopedGPUTimer Timer(getGPUTimer(Q_DISPLACEMENT));
|
||||||
|
renderDisplacement();
|
||||||
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
@ -638,13 +655,9 @@ void IrrDriver::renderShadows()
|
|||||||
glDrawBuffer(GL_NONE);
|
glDrawBuffer(GL_NONE);
|
||||||
|
|
||||||
glBindBufferBase(GL_UNIFORM_BUFFER, 0, SharedObject::ViewProjectionMatrixesUBO);
|
glBindBufferBase(GL_UNIFORM_BUFFER, 0, SharedObject::ViewProjectionMatrixesUBO);
|
||||||
{
|
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
||||||
ScopedGPUTimer Timer(getGPUTimer(Q_SHADOWS));
|
|
||||||
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
|
||||||
}
|
|
||||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
|
|
||||||
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
|
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,75 +779,71 @@ void IrrDriver::renderLights(float dt)
|
|||||||
const core::vector3df &campos =
|
const core::vector3df &campos =
|
||||||
irr_driver->getSceneManager()->getActiveCamera()->getAbsolutePosition();
|
irr_driver->getSceneManager()->getActiveCamera()->getAbsolutePosition();
|
||||||
|
|
||||||
|
std::vector<LightNode *> BucketedLN[15];
|
||||||
|
for (unsigned int i = 0; i < lightcount; i++)
|
||||||
{
|
{
|
||||||
ScopedGPUTimer Timer(getGPUTimer(Q_LIGHT));
|
if (!m_lights[i]->isPointLight())
|
||||||
|
|
||||||
std::vector<LightNode *> BucketedLN[15];
|
|
||||||
for (unsigned int i = 0; i < lightcount; i++)
|
|
||||||
{
|
{
|
||||||
if (!m_lights[i]->isPointLight())
|
m_lights[i]->render();
|
||||||
{
|
if (UserConfigParams::m_shadows && World::getWorld()->getTrack()->hasShadows())
|
||||||
m_lights[i]->render();
|
m_post_processing->renderShadowedSunlight(sun_ortho_matrix, m_rtts->getShadowDepthTex());
|
||||||
if (UserConfigParams::m_shadows && World::getWorld()->getTrack()->hasShadows())
|
else
|
||||||
m_post_processing->renderShadowedSunlight(sun_ortho_matrix, m_rtts->getShadowDepthTex());
|
m_post_processing->renderSunlight();
|
||||||
else
|
continue;
|
||||||
m_post_processing->renderSunlight();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const core::vector3df &lightpos = (m_lights[i]->getAbsolutePosition() - campos);
|
|
||||||
unsigned idx = (unsigned)(lightpos.getLength() / 10);
|
|
||||||
if (idx > 14)
|
|
||||||
idx = 14;
|
|
||||||
BucketedLN[idx].push_back(m_lights[i]);
|
|
||||||
}
|
}
|
||||||
|
const core::vector3df &lightpos = (m_lights[i]->getAbsolutePosition() - campos);
|
||||||
unsigned lightnum = 0;
|
unsigned idx = (unsigned)(lightpos.getLength() / 10);
|
||||||
|
if (idx > 14)
|
||||||
for (unsigned i = 0; i < 15; i++)
|
idx = 14;
|
||||||
{
|
BucketedLN[idx].push_back(m_lights[i]);
|
||||||
for (unsigned j = 0; j < BucketedLN[i].size(); j++)
|
|
||||||
{
|
|
||||||
if (++lightnum >= MAXLIGHT)
|
|
||||||
{
|
|
||||||
LightNode* light_node = BucketedLN[i].at(j);
|
|
||||||
light_node->setEnergyMultiplier(0.0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LightNode* light_node = BucketedLN[i].at(j);
|
|
||||||
|
|
||||||
float em = light_node->getEnergyMultiplier();
|
|
||||||
if (em < 1.0f)
|
|
||||||
{
|
|
||||||
light_node->setEnergyMultiplier(std::min(1.0f, em + dt));
|
|
||||||
}
|
|
||||||
|
|
||||||
const core::vector3df &pos = light_node->getAbsolutePosition();
|
|
||||||
PointLightsInfo[lightnum].posX = pos.X;
|
|
||||||
PointLightsInfo[lightnum].posY = pos.Y;
|
|
||||||
PointLightsInfo[lightnum].posZ = pos.Z;
|
|
||||||
|
|
||||||
PointLightsInfo[lightnum].energy = light_node->getEffectiveEnergy();
|
|
||||||
|
|
||||||
const core::vector3df &col = light_node->getColor();
|
|
||||||
PointLightsInfo[lightnum].red = col.X;
|
|
||||||
PointLightsInfo[lightnum].green = col.Y;
|
|
||||||
PointLightsInfo[lightnum].blue = col.Z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (lightnum > MAXLIGHT)
|
|
||||||
{
|
|
||||||
irr_driver->setLastLightBucketDistance(i * 10);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lightnum++;
|
|
||||||
|
|
||||||
renderPointLights(MIN2(lightnum, MAXLIGHT));
|
|
||||||
if (SkyboxCubeMap)
|
|
||||||
m_post_processing->renderDiffuseEnvMap(blueSHCoeff, greenSHCoeff, redSHCoeff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned lightnum = 0;
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
for (unsigned j = 0; j < BucketedLN[i].size(); j++)
|
||||||
|
{
|
||||||
|
if (++lightnum >= MAXLIGHT)
|
||||||
|
{
|
||||||
|
LightNode* light_node = BucketedLN[i].at(j);
|
||||||
|
light_node->setEnergyMultiplier(0.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LightNode* light_node = BucketedLN[i].at(j);
|
||||||
|
|
||||||
|
float em = light_node->getEnergyMultiplier();
|
||||||
|
if (em < 1.0f)
|
||||||
|
{
|
||||||
|
light_node->setEnergyMultiplier(std::min(1.0f, em + dt));
|
||||||
|
}
|
||||||
|
|
||||||
|
const core::vector3df &pos = light_node->getAbsolutePosition();
|
||||||
|
PointLightsInfo[lightnum].posX = pos.X;
|
||||||
|
PointLightsInfo[lightnum].posY = pos.Y;
|
||||||
|
PointLightsInfo[lightnum].posZ = pos.Z;
|
||||||
|
|
||||||
|
PointLightsInfo[lightnum].energy = light_node->getEffectiveEnergy();
|
||||||
|
|
||||||
|
const core::vector3df &col = light_node->getColor();
|
||||||
|
PointLightsInfo[lightnum].red = col.X;
|
||||||
|
PointLightsInfo[lightnum].green = col.Y;
|
||||||
|
PointLightsInfo[lightnum].blue = col.Z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lightnum > MAXLIGHT)
|
||||||
|
{
|
||||||
|
irr_driver->setLastLightBucketDistance(i * 10);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lightnum++;
|
||||||
|
|
||||||
|
renderPointLights(MIN2(lightnum, MAXLIGHT));
|
||||||
|
if (SkyboxCubeMap)
|
||||||
|
m_post_processing->renderDiffuseEnvMap(blueSHCoeff, greenSHCoeff, redSHCoeff);
|
||||||
gl_driver->extGlDrawBuffers(1, bufs);
|
gl_driver->extGlDrawBuffers(1, bufs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user