[Scummvm-git-logs] scummvm master -> 4919f8eda16fcd6f2a714d89df24d27babc081ef

sev- noreply at scummvm.org
Mon Aug 28 21:02:33 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4919f8eda1 ULTIMA8: Add debugger command to benchmark shape frame painting


Commit: 4919f8eda16fcd6f2a714d89df24d27babc081ef
    https://github.com/scummvm/scummvm/commit/4919f8eda16fcd6f2a714d89df24d27babc081ef
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-08-28T23:02:29+02:00

Commit Message:
ULTIMA8: Add debugger command to benchmark shape frame painting

Changed paths:
    engines/ultima/ultima8/misc/debugger.cpp
    engines/ultima/ultima8/misc/debugger.h


diff --git a/engines/ultima/ultima8/misc/debugger.cpp b/engines/ultima/ultima8/misc/debugger.cpp
index 63e7c7a6b96..3c1184b912f 100644
--- a/engines/ultima/ultima8/misc/debugger.cpp
+++ b/engines/ultima/ultima8/misc/debugger.cpp
@@ -27,7 +27,9 @@
 #include "ultima/ultima8/audio/audio_process.h"
 #include "ultima/ultima8/audio/music_process.h"
 #include "ultima/ultima8/filesys/file_system.h"
+#include "ultima/ultima8/games/game_data.h"
 #include "ultima/ultima8/graphics/inverter_process.h"
+#include "ultima/ultima8/graphics/main_shape_archive.h"
 #include "ultima/ultima8/graphics/render_surface.h"
 #include "ultima/ultima8/gumps/fast_area_vis_gump.h"
 #include "ultima/ultima8/gumps/game_map_gump.h"
@@ -201,6 +203,7 @@ Debugger::Debugger() : GUI::Debugger() {
 	registerCmd("MusicProcess::playMusic", WRAP_METHOD(Debugger, cmdPlayMusic));
 	registerCmd("QuitGump::verifyQuit", WRAP_METHOD(Debugger, cmdVerifyQuit));
 	registerCmd("ShapeViewerGump::U8ShapeViewer", WRAP_METHOD(Debugger, cmdU8ShapeViewer));
+	registerCmd("RenderSurface::benchmark", WRAP_METHOD(Debugger, cmdBenchmarkRenderSurface));
 
 #ifdef DEBUG
 	registerCmd("Pathfinder::visualDebug", WRAP_METHOD(Debugger, cmdVisualDebugPathfinder));
@@ -1807,6 +1810,79 @@ bool Debugger::cmdClearMinimap(int argc, const char **argv) {
 	return false;
 }
 
+bool Debugger::cmdBenchmarkRenderSurface(int argc, const char **argv) {
+	if (argc != 4) {
+		debugPrintf("usage: RenderSurface::benchmark shapenum framenum iterations\n");
+		return true;
+	}
+
+	int shapenum = atoi(argv[1]);
+	int frame = atoi(argv[2]);
+	int count = atoi(argv[3]);
+
+	GameData *gamedata = GameData::get_instance();
+	Shape *s = gamedata->getMainShapes()->getShape(shapenum);
+
+	RenderSurface *surface = RenderSurface::CreateSecondaryRenderSurface(320, 200);
+	surface->BeginPainting();
+
+	uint32 start, end;
+
+	start = g_system->getMillis();
+	for (int i = 0; i < count; i++) {
+		surface->Paint(s, frame, 160, 100);
+	}
+	end = g_system->getMillis();
+	debugPrintf("Paint: %d\n", end - start);
+
+	start = g_system->getMillis();
+	for (int i = 0; i < count; i++) {
+		surface->PaintNoClip(s, frame, 160, 100);
+	}
+	end = g_system->getMillis();
+	debugPrintf("PaintNoClip: %d\n", end - start);
+
+	start = g_system->getMillis();
+	for (int i = 0; i < count; i++) {
+		surface->PaintTranslucent(s, frame, 160, 100);
+	}
+	end = g_system->getMillis();
+	debugPrintf("PaintTranslucent: %d\n", end - start);
+
+	start = g_system->getMillis();
+	for (int i = 0; i < count; i++) {
+		surface->PaintMirrored(s, frame, 160, 100);
+	}
+	end = g_system->getMillis();
+	debugPrintf("PaintMirrored: %d\n", end - start);
+
+	start = g_system->getMillis();
+	for (int i = 0; i < count; i++) {
+		surface->PaintInvisible(s, frame, 160, 100, false, false);
+	}
+	end = g_system->getMillis();
+	debugPrintf("PaintInvisible: %d\n", end - start);
+
+	start = g_system->getMillis();
+	for (int i = 0; i < count; i++) {
+		surface->PaintHighlight(s, frame, 160, 100, false, false, 0x7F00007F);
+	}
+	end = g_system->getMillis();
+	debugPrintf("PaintHighlight: %d\n", end - start);
+
+	start = g_system->getMillis();
+	for (int i = 0; i < count; i++) {
+		surface->PaintHighlightInvis(s, frame, 160, 100, false, false, 0x7F00007F);
+	}
+	end = g_system->getMillis();
+	debugPrintf("PaintHighlightInvis: %d\n", end - start);
+
+	surface->EndPainting();
+	delete surface;
+
+	return true;
+}
+
 #ifdef DEBUG
 bool Debugger::cmdVisualDebugPathfinder(int argc, const char **argv) {
 	if (argc != 2) {
diff --git a/engines/ultima/ultima8/misc/debugger.h b/engines/ultima/ultima8/misc/debugger.h
index bf268e58a52..86d543d9edd 100644
--- a/engines/ultima/ultima8/misc/debugger.h
+++ b/engines/ultima/ultima8/misc/debugger.h
@@ -183,6 +183,7 @@ private:
 	bool cmdInvertScreen(int argc, const char **argv);
 	bool cmdPlayMovie(int argc, const char **argv);
 	bool cmdPlayMusic(int argc, const char **argv);
+	bool cmdBenchmarkRenderSurface(int argc, const char **argv);
 
 #ifdef DEBUG
 	bool cmdVisualDebugPathfinder(int argc, const char **argv);




More information about the Scummvm-git-logs mailing list