mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +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 "gl/shaders/gl_shadowmapshader.h"
|
||||||
#include "r_state.h"
|
#include "r_state.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
|
#include "stats.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The 1D shadow maps are stored in a 1024x1024 texture as float depth values (R32F).
|
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.
|
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()
|
void FShadowMap::Update()
|
||||||
{
|
{
|
||||||
|
UpdateCycles.Reset();
|
||||||
|
LightsProcessed = 0;
|
||||||
|
LightsShadowmapped = 0;
|
||||||
|
|
||||||
if (!IsEnabled())
|
if (!IsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
UpdateCycles.Clock();
|
||||||
|
|
||||||
UploadAABBTree();
|
UploadAABBTree();
|
||||||
UploadLights();
|
UploadLights();
|
||||||
|
|
||||||
|
@ -98,6 +119,8 @@ void FShadowMap::Update()
|
||||||
GLRenderer->mBuffers->BindShadowMapTexture(16);
|
GLRenderer->mBuffers->BindShadowMapTexture(16);
|
||||||
|
|
||||||
FGLDebug::PopGroup();
|
FGLDebug::PopGroup();
|
||||||
|
|
||||||
|
UpdateCycles.Unclock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FShadowMap::ShadowTest(ADynamicLight *light, const DVector3 &pos)
|
bool FShadowMap::ShadowTest(ADynamicLight *light, const DVector3 &pos)
|
||||||
|
@ -133,8 +156,11 @@ void FShadowMap::UploadLights()
|
||||||
TThinkerIterator<ADynamicLight> it(STAT_DLIGHT);
|
TThinkerIterator<ADynamicLight> it(STAT_DLIGHT);
|
||||||
while (auto light = it.Next())
|
while (auto light = it.Next())
|
||||||
{
|
{
|
||||||
|
LightsProcessed++;
|
||||||
if (light->shadowmapped)
|
if (light->shadowmapped)
|
||||||
{
|
{
|
||||||
|
LightsShadowmapped++;
|
||||||
|
|
||||||
mLightToShadowmap[light] = lightindex >> 2;
|
mLightToShadowmap[light] = lightindex >> 2;
|
||||||
|
|
||||||
mLights[lightindex] = light->X();
|
mLights[lightindex] = light->X();
|
||||||
|
|
Loading…
Reference in a new issue