Skip to content

Commit b549e37

Browse files
committed
[rend2] Better debugging
Added debug group annotations and better shader names for captures with debug software like renderdoc.
1 parent 5af18ae commit b549e37

7 files changed

Lines changed: 190 additions & 33 deletions

File tree

code/rd-rend2/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ set(SPRend2Files
3232
"${SharedDir}/rd-rend2/tr_cache.h"
3333
"${SharedDir}/rd-rend2/tr_cmds.cpp"
3434
"${SharedDir}/rd-rend2/tr_curve.cpp"
35+
"${SharedDir}/rd-rend2/tr_debug.cpp"
3536
"${SharedDir}/rd-rend2/tr_decals.cpp"
3637
"${SPDir}/rd-rend2/tr_draw.cpp"
3738
"${SharedDir}/rd-rend2/tr_extensions.cpp"

codemp/rd-rend2/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ set(MPRend2Files
3232
"${SharedDir}/rd-rend2/tr_cache.h"
3333
"${SharedDir}/rd-rend2/tr_cmds.cpp"
3434
"${SharedDir}/rd-rend2/tr_curve.cpp"
35+
"${SharedDir}/rd-rend2/tr_debug.cpp"
3536
"${SharedDir}/rd-rend2/tr_decals.cpp"
3637
"${SharedDir}/rd-rend2/tr_extensions.cpp"
3738
"${SharedDir}/rd-rend2/tr_extramath.cpp"

shared/rd-rend2/tr_backend.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,10 +1489,12 @@ static void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs )
14891489

14901490
if ( backEnd.depthFill )
14911491
{
1492+
R_PushDebugGroup(AL_STAGE, "Depthpass");
14921493
RB_SubmitDrawSurfsForDepthFill(drawSurfs, numDrawSurfs, originalTime);
14931494
}
14941495
else
14951496
{
1497+
R_PushDebugGroup(AL_STAGE, "Mainpass");
14961498
RB_SubmitDrawSurfs(drawSurfs, numDrawSurfs, originalTime);
14971499

14981500
// TODO: Find a better place to add the fog cap surface

shared/rd-rend2/tr_debug.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
===========================================================================
3+
Copyright (C) 2016, OpenJK contributors
4+
5+
This file is part of the OpenJK source code.
6+
7+
OpenJK is free software; you can redistribute it and/or modify it
8+
under the terms of the GNU General Public License version 2 as
9+
published by the Free Software Foundation.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program; if not, see <http://www.gnu.org/licenses/>.
18+
===========================================================================
19+
*/
20+
#include "tr_local.h"
21+
22+
void R_PushDebugGroup(annotationLayer_t layer, const char* name)
23+
{
24+
static GLuint currentLayer = (GLuint)AL_NONE;
25+
assert(layer - currentLayer =< 1);
26+
while (layer <= currentLayer)
27+
{
28+
qglPopDebugGroupKHR();
29+
currentLayer--;
30+
}
31+
currentLayer = (GLuint)layer;
32+
qglPushDebugGroupKHR(GL_DEBUG_SOURCE_APPLICATION, currentLayer - 1, -1, name);
33+
}

0 commit comments

Comments
 (0)