perf tuning + perf graph implentation

master
Sylvain PILLOT 6 months ago
parent 52c96249c0
commit 271b95880e
  1. 1
      CMakeLists.txt
  2. 108
      CppOutRun.layout
  3. 4
      TODO.txt
  4. BIN
      assets-cg/backgrnd/dunes.png
  5. 60
      src/main.cc
  6. 4
      src/parameters.h
  7. 6
      src/src/circuit.cc

@ -71,6 +71,7 @@ set(ASSETS_cg
assets-cg/backgrnd/treeline.png
assets-cg/backgrnd/canyon.png
assets-cg/backgrnd/rockline.png
assets-cg/backgrnd/dunes.png
assets-cg/backgrnd/snowmount.png
assets-cg/backgrnd/treelinesnow.png
assets-cg/backgrnd/kilimandjaro.png

@ -2,55 +2,44 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="src/main.cc" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/camera.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="25" topLine="123" />
<Cursor1 position="221" topLine="0" />
</Cursor>
<Folding>
<Collapse line="175" />
<Collapse line="181" />
<Collapse line="187" />
<Collapse line="193" />
</Folding>
</File>
<File name="src/parameters.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/main.cc" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="339" topLine="0" />
<Cursor1 position="21243" topLine="603" />
</Cursor>
</File>
<File name="src/src/drawstuff.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/circuit.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2516" topLine="0" />
<Cursor1 position="1291" topLine="57" />
</Cursor>
<Folding>
<Collapse line="33" />
<Collapse line="40" />
<Collapse line="76" />
</Folding>
</File>
<File name="src/colors.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="35" topLine="0" />
</Cursor>
</File>
<File name="src/fixed.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/clouds.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="778" topLine="0" />
<Cursor1 position="203" topLine="0" />
</Cursor>
</File>
<File name="src/src/menus.cc" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/drawstuff.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="14167" topLine="333" />
<Cursor1 position="622" topLine="0" />
</Cursor>
</File>
<File name="CMakeLists.txt" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2715" topLine="65" />
</Cursor>
<Folding>
<Collapse line="32" />
<Collapse line="96" />
<Collapse line="330" />
</Folding>
</File>
<File name="src/src/circuit.cc" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/circuit.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="28190" topLine="721" />
<Cursor1 position="3969" topLine="137" />
</Cursor>
<Folding>
<Collapse line="433" />
@ -64,69 +53,74 @@
<Collapse line="1119" />
</Folding>
</File>
<File name="src/include/segment.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="210" topLine="0" />
</Cursor>
</File>
<File name="src/include/circuit.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/menus.cc" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1291" topLine="57" />
<Cursor1 position="14167" topLine="333" />
</Cursor>
<Folding>
<Collapse line="32" />
<Collapse line="96" />
<Collapse line="330" />
</Folding>
</File>
<File name="src/include/menus.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/cars.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="251" topLine="0" />
<Cursor1 position="1019" topLine="8" />
</Cursor>
</File>
<File name="src/include/camera.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/camera.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="221" topLine="0" />
<Cursor1 position="370" topLine="0" />
</Cursor>
</File>
<File name="src/src/camera.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/clouds.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="370" topLine="0" />
<Cursor1 position="306" topLine="0" />
</Cursor>
</File>
<File name="src/include/cars.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/fixed.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="332" topLine="0" />
<Cursor1 position="778" topLine="0" />
</Cursor>
</File>
<File name="TODO.txt" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/segment.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="251" topLine="0" />
<Cursor1 position="210" topLine="0" />
</Cursor>
</File>
<File name="src/include/drawstuff.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/segment.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<Cursor>
<Cursor1 position="622" topLine="0" />
<Cursor1 position="230" topLine="30" />
</Cursor>
</File>
<File name="CMakeLists.txt" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/menus.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2715" topLine="65" />
<Cursor1 position="251" topLine="0" />
</Cursor>
</File>
<File name="src/src/segment.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<File name="src/include/cars.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="230" topLine="30" />
<Cursor1 position="332" topLine="0" />
</Cursor>
</File>
<File name="src/src/clouds.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/parameters.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="203" topLine="0" />
<Cursor1 position="327" topLine="0" />
</Cursor>
</File>
<File name="src/src/cars.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/drawstuff.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1019" topLine="8" />
<Cursor1 position="2516" topLine="0" />
</Cursor>
<Folding>
<Collapse line="33" />
<Collapse line="40" />
<Collapse line="76" />
</Folding>
</File>
<File name="src/include/clouds.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="TODO.txt" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="306" topLine="0" />
<Cursor1 position="251" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

@ -1,10 +1,10 @@
Add Start line with green/orange/red lights for start
Add Finish line
Add Checkpoints
DONE : Add Checkpoints
Menus and Options
DONE : Menus and Options

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

@ -39,6 +39,18 @@ int MAX_SEGMENT=0;
camera *cam;
struct DataPerf
{
uint8_t update=0;
uint8_t project=0;
uint8_t render=0;
};
#define MAXDATA 120
DataPerf GraphPerf[ MAXDATA ];
unsigned int DataIndex=0;
bool stop = false;
bool record = false;
bool screenshot = false;
@ -50,7 +62,7 @@ bool ShowDebug3 = false;
bool BDrawDeco = true;
bool BDrawClds = true;
bool BDrawCars = true;
bool BDrawRoad = true;
bool BDrawFPS = false;
uint16_t currentcurve=0;
@ -200,7 +212,7 @@ static void get_inputs( float dt, int index )
if(keydown(KEY_F1)) BDrawDeco = !BDrawDeco;
if(keydown(KEY_F2)) BDrawClds = !BDrawClds;
if(keydown(KEY_F3)) BDrawCars = !BDrawCars;
if(keydown(KEY_F4)) BDrawRoad = !BDrawRoad;
if(keydown(KEY_F4)) BDrawFPS = !BDrawFPS;
if(keydown(KEY_F5)) screenshot = true;
if(keydown(KEY_F6)) record = !record;
@ -360,9 +372,12 @@ int main(void)
uint16_t l=0;
uint32_t remaining_time;
DataIndex = 0;
while (!stop)
{
perf_update = prof_make();
prof_enter(perf_update);
@ -484,8 +499,7 @@ int main(void)
{
currentcurve = circuit[k]->CumulatedCurve;
if (BDrawRoad)
drawCircuitSegment( k );
drawCircuitSegment( k );
if (BDrawDeco)
drawDecoration( k );
@ -588,8 +602,42 @@ int main(void)
//dprint( 3, 202, C_BLACK, "%.0f", dt );
//dprint( 1, 200, C_WHITE, "%.0f", dt );
dprint_opt(42,202, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%.0f <", (float) (1000.0f/dt) ); // the '>' symbol corresponds to "fps"
dprint_opt(40,200, C_RGB(255,255,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%.0f <", (float) (1000.0f/dt) );
if (BDrawFPS)
{
dprint_opt(42,202, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%.0f <", (float) (1000.0f/dt) ); // the '>' symbol corresponds to "fps"
dprint_opt(40,200, C_RGB(255,255,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%.0f <", (float) (1000.0f/dt) );
GraphPerf[DataIndex].update = (uint8_t) (time_update/1000);
GraphPerf[DataIndex].project = (uint8_t) (time_project/1000);
GraphPerf[DataIndex].render = (uint8_t) (time_render/1000);
DataIndex++;
DataIndex = DataIndex % MAXDATA;
dline( 249, 201, 375, 201, C_BLACK );
dline( 249, 202, 375, 202, C_BLACK );
dline( 249, 200-33, 375, 200-33, C_BLACK );
dline( 249, 200-40, 375, 200-40, C_BLACK );
dline( 249, 200-50, 375, 200-50, C_BLACK );
dline( 249, 201, 249, 100, C_BLACK );
dline( 248, 201, 248, 100, C_BLACK );
for( unsigned int k=0; k<MAXDATA-1; k++)
{
dpixel( 250+k, 200-GraphPerf[k].update, C_RGB(255,0,0) );
dpixel( 250+k, 201-GraphPerf[k].update, C_RGB(255,0,0) );
dpixel( 250+k, 200-GraphPerf[k].update-GraphPerf[k].project, C_RGB(0,255,0) );
dpixel( 250+k, 201-GraphPerf[k].update-GraphPerf[k].project, C_RGB(0,255,0) );
dpixel( 250+k, 200-GraphPerf[k].update-GraphPerf[k].project-GraphPerf[k].render, C_RGB(0,0,255) );
dpixel( 250+k, 201-GraphPerf[k].update-GraphPerf[k].project-GraphPerf[k].render, C_RGB(0,0,255) );
}
}
r61524_display(gint_vram, 0, DHEIGHT, R61524_DMA_WAIT);

@ -8,14 +8,14 @@
#define SCREEN_CX 198
#define SCREEN_CY 112
#define SEGMENT_LENGTH 250
#define SEGMENT_LENGTH 300 // 250 before
#define ROAD_WIDTH 700
#define ASPECT_RATIO 1.767
#define DISTANCE_SCREEN 0.83444
#define MAX_RENDER_DISTANCE 3000
#define MAX_RENDER_DISTANCE 3600 // 3000 BEFORE
#define NB_CLOUDS_SKY 10

@ -31,7 +31,7 @@ extern bopti_image_t pl_tree1, pl_tree2, pl_tree3, pl_tree4, dt_tree1, dt_tree2,
extern bopti_image_t cc_void, us_bigleaf, us_smallleaf, cc_bigleaf, cc_smallleaf, cc_rocks, af_bigleaf, dt_smallleaf, fi_rocks;
extern bopti_image_t sky1, sky2, sky3;
extern bopti_image_t mountain, canyon, snowmount, kilimandjaro;
extern bopti_image_t mountain, canyon, snowmount, kilimandjaro, dunes;
extern bopti_image_t treeline, rockline, treelinesnow;
extern bopti_image_t leftturn, rightturn, uphill, downhill;
extern bopti_image_t checkpoint, startlights, stoplights, waitlights;
@ -142,7 +142,7 @@ void initData( void )
cam = new camera();
cam->cX = fixdouble(0.0f);
cam->cY = fixdouble(300.0f);
cam->cZ = fixdouble(0.0f);
cam->cZ = fixdouble(100.0f);
}
@ -1304,7 +1304,7 @@ void drawFarBackground( int offset, int currentbiome )
bopti_image_t *image;
if (currentbiome==PLAINS) image=&mountain;
else if (currentbiome==DESERT) image=&cc_void;
else if (currentbiome==DESERT) image=&dunes;
else if (currentbiome==USA) image=&canyon;
else if (currentbiome==FINLAND) image=&snowmount;
else if (currentbiome==AFRICA) image=&kilimandjaro;

Loading…
Cancel
Save