Skip to content

Commit b3a8824

Browse files
committed
Adds more trace scopes to get a better look at the internals of render_frame
1 parent 36c134f commit b3a8824

File tree

8 files changed

+51
-0
lines changed

8 files changed

+51
-0
lines changed

code/nebula/neb.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "ship/ship.h"
2525
#include "starfield/starfield.h"
2626
#include "tgautils/tgautils.h"
27+
#include "tracing/tracing.h"
2728

2829

2930
// --------------------------------------------------------------------------------------------------------
@@ -455,6 +456,9 @@ void neb2_level_close()
455456
// call before beginning all rendering
456457
void neb2_render_setup(camid cid)
457458
{
459+
GR_DEBUG_SCOPE("Nebula Setup");
460+
TRACE_SCOPE(tracing::SetupNebula);
461+
458462
// standalone servers can bail here
459463
if (Game_mode & GM_STANDALONE_SERVER) {
460464
return;

code/particle/particle.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ namespace particle
340340

341341
void render_all()
342342
{
343+
GR_DEBUG_SCOPE("Render Particles");
343344
TRACE_SCOPE(tracing::ParticlesRenderAll);
344345

345346
ubyte flags;

code/ship/shield.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "ship/ship.h"
2525
#include "species_defs/species_defs.h"
2626
#include "tracing/Monitor.h"
27+
#include "tracing/tracing.h"
2728

2829
int Show_shield_mesh = 0;
2930

@@ -523,6 +524,9 @@ void render_shield(int shield_num)
523524
*/
524525
void render_shields()
525526
{
527+
GR_DEBUG_SCOPE("Render Shields");
528+
TRACE_SCOPE(tracing::DrawShields);
529+
526530
int i;
527531

528532
if (Detail.shield_effects == 0){

code/starfield/starfield.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "starfield/nebula.h"
2929
#include "starfield/starfield.h"
3030
#include "starfield/supernova.h"
31+
#include "tracing/tracing.h"
3132

3233
#define MAX_DEBRIS_VCLIPS 4
3334
#define DEBRIS_ROT_MIN 10000
@@ -1038,6 +1039,9 @@ void stars_get_sun_pos(int sun_n, vec3d *pos)
10381039
// draw sun
10391040
void stars_draw_sun(int show_sun)
10401041
{
1042+
GR_DEBUG_SCOPE("Draw Suns");
1043+
TRACE_SCOPE(tracing::DrawSuns);
1044+
10411045
int idx;
10421046
vec3d sun_pos;
10431047
vec3d sun_dir;
@@ -1248,6 +1252,9 @@ void stars_draw_sun_glow(int sun_n)
12481252

12491253
void stars_draw_bitmaps(int show_bitmaps)
12501254
{
1255+
GR_DEBUG_SCOPE("Draw Bitmaps");
1256+
TRACE_SCOPE(tracing::DrawBitmaps);
1257+
12511258
int idx;
12521259
int star_index;
12531260

@@ -1504,6 +1511,9 @@ void subspace_render()
15041511

15051512
void stars_draw_stars()
15061513
{
1514+
GR_DEBUG_SCOPE("Draw Starfield");
1515+
TRACE_SCOPE(tracing::DrawStarfield);
1516+
15071517
int i;
15081518
star *sp;
15091519
float dist = 0.0f;
@@ -1608,6 +1618,9 @@ void stars_draw_stars()
16081618

16091619
void stars_draw_debris()
16101620
{
1621+
GR_DEBUG_SCOPE("Draw motion debris");
1622+
TRACE_SCOPE(tracing::DrawMotionDebris);
1623+
16111624
int i;
16121625
float vdist;
16131626
vec3d tmp;
@@ -1688,6 +1701,9 @@ void stars_draw_debris()
16881701

16891702
void stars_draw(int show_stars, int show_suns, int show_nebulas, int show_subspace, int env)
16901703
{
1704+
GR_DEBUG_SCOPE("Draw Stars");
1705+
TRACE_SCOPE(tracing::DrawStars);
1706+
16911707
int gr_zbuffering_save = gr_zbuffer_get();
16921708
gr_zbuffer_set(GR_ZBUFF_NONE);
16931709

@@ -2028,6 +2044,9 @@ void stars_page_in()
20282044
// background nebula models and planets
20292045
void stars_draw_background()
20302046
{
2047+
GR_DEBUG_SCOPE("Draw Background");
2048+
TRACE_SCOPE(tracing::DrawBackground);
2049+
20312050
if (Nmodel_num < 0)
20322051
return;
20332052

code/tracing/categories.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ Category QueueRender("Queue Render", false);
5050
Category SubmitDraws("Submit Draws", true);
5151
Category ApplyLights("Apply Lights", true);
5252
Category DrawEffects("Draw Effects", true);
53+
Category SetupNebula("Setup Nebula", true);
54+
Category DrawStars("Draw Stars", true);
55+
Category DrawShields("Draw Shields", true);
56+
Category DrawBeams("Draw Beams", true);
57+
Category DrawStarfield("Draw Starfield", true);
58+
Category DrawMotionDebris("Draw Motion debris", true);
59+
Category DrawBackground("Draw Background", true);
60+
Category DrawSuns("Draw Suns", true);
61+
Category DrawBitmaps("Draw Bitmaps", true);
5362

5463
Category RepeatingEvents("Repeating events", false);
5564
Category NonrepeatingEvents("Nonrepeating events", false);

code/tracing/categories.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ extern Category QueueRender;
6262
extern Category SubmitDraws;
6363
extern Category ApplyLights;
6464
extern Category DrawEffects;
65+
extern Category SetupNebula;
66+
extern Category DrawStars;
67+
extern Category DrawShields;
68+
extern Category DrawBeams;
69+
extern Category DrawStarfield;
70+
extern Category DrawMotionDebris;
71+
extern Category DrawBackground;
72+
extern Category DrawSuns;
73+
extern Category DrawBitmaps;
6574

6675
extern Category RepeatingEvents;
6776
extern Category NonrepeatingEvents;

code/weapon/beam.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "weapon/beam.h"
4141
#include "weapon/weapon.h"
4242
#include "globalincs/globals.h"
43+
#include "tracing/tracing.h"
4344

4445
// ------------------------------------------------------------------------------------------------
4546
// BEAM WEAPON DEFINES/VARS
@@ -1517,6 +1518,9 @@ void beam_render_muzzle_glow(beam *b)
15171518
// render all beam weapons
15181519
void beam_render_all()
15191520
{
1521+
GR_DEBUG_SCOPE("Render Beams");
1522+
TRACE_SCOPE(tracing::DrawBeams);
1523+
15201524
beam *moveup;
15211525

15221526
// moves the U value of texture coods in beams if desired-Bobboau

code/weapon/trails.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ void trail_object_died( trail *trailp )
383383

384384
void trail_render_all()
385385
{
386+
GR_DEBUG_SCOPE("Render trails");
386387
TRACE_SCOPE(tracing::RenderTrails);
387388

388389
// No trails at slot 0

0 commit comments

Comments
 (0)