mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +00:00
- Add stat shadowmap to get performance for the upload part of the shadow maps
This commit is contained in:
parent
7edb75d299
commit
797cb94b4f
1 changed files with 26 additions and 0 deletions
|
@ -33,6 +33,7 @@
|
|||
#include "gl/shaders/gl_shadowmapshader.h"
|
||||
#include "r_state.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "stats.h"
|
||||
|
||||
/*
|
||||
The 1D shadow maps are stored in a 1024x1024 texture as float depth values (R32F).
|
||||
|
@ -67,11 +68,31 @@
|
|||
as on the CPU, except everything uses indexes as pointers are not allowed in GLSL.
|
||||
*/
|
||||
|
||||
namespace
|
||||
{
|
||||
cycle_t UpdateCycles;
|
||||
int LightsProcessed;
|
||||
int LightsShadowmapped;
|
||||
}
|
||||
|
||||
ADD_STAT(shadowmap)
|
||||
{
|
||||
FString out;
|
||||
out.Format("upload=%04.2f ms lights=%d shadowmapped=%d", UpdateCycles.TimeMS(), LightsProcessed, LightsShadowmapped);
|
||||
return out;
|
||||
}
|
||||
|
||||
void FShadowMap::Update()
|
||||
{
|
||||
UpdateCycles.Reset();
|
||||
LightsProcessed = 0;
|
||||
LightsShadowmapped = 0;
|
||||
|
||||
if (!IsEnabled())
|
||||
return;
|
||||
|
||||
UpdateCycles.Clock();
|
||||
|
||||
UploadAABBTree();
|
||||
UploadLights();
|
||||
|
||||
|
@ -98,6 +119,8 @@ void FShadowMap::Update()
|
|||
GLRenderer->mBuffers->BindShadowMapTexture(16);
|
||||
|
||||
FGLDebug::PopGroup();
|
||||
|
||||
UpdateCycles.Unclock();
|
||||
}
|
||||
|
||||
bool FShadowMap::ShadowTest(ADynamicLight *light, const DVector3 &pos)
|
||||
|
@ -133,8 +156,11 @@ void FShadowMap::UploadLights()
|
|||
TThinkerIterator<ADynamicLight> it(STAT_DLIGHT);
|
||||
while (auto light = it.Next())
|
||||
{
|
||||
LightsProcessed++;
|
||||
if (light->shadowmapped)
|
||||
{
|
||||
LightsShadowmapped++;
|
||||
|
||||
mLightToShadowmap[light] = lightindex >> 2;
|
||||
|
||||
mLights[lightindex] = light->X();
|
||||
|
|
Loading…
Reference in a new issue