[Scummvm-git-logs] scummvm branch-2-7 -> e417d5a3ef43802def1991ba6f3c462c35918096

aquadran noreply at scummvm.org
Sun Feb 12 16:11:25 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:
e417d5a3ef TINYGL: Allow parametrize DrawCallMemory size while creating context


Commit: e417d5a3ef43802def1991ba6f3c462c35918096
    https://github.com/scummvm/scummvm/commit/e417d5a3ef43802def1991ba6f3c462c35918096
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2023-02-12T17:09:27+01:00

Commit Message:
TINYGL: Allow parametrize DrawCallMemory size while creating context

Changed paths:
    engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
    graphics/tinygl/init.cpp
    graphics/tinygl/tinygl.h
    graphics/tinygl/zgl.h


diff --git a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
index 31125b6422d..1307c1dc0de 100644
--- a/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
+++ b/engines/hpl1/engine/impl/low_level_graphics_tgl.cpp
@@ -354,7 +354,7 @@ bool LowLevelGraphicsTGL::Init(int alWidth, int alHeight, int alBpp, int abFulls
 
 	mlMultisampling = alMultisampling;
 	initGraphics(alWidth, alHeight, nullptr);
-	TinyGL::createContext(alWidth, alHeight, mpPixelFormat, 256, false);
+	TinyGL::createContext(alWidth, alHeight, mpPixelFormat, 256, false, 60 * 1024 * 1024);
 	SetupGL();
 	ShowCursor(false);
 	g_system->updateScreen();
diff --git a/graphics/tinygl/init.cpp b/graphics/tinygl/init.cpp
index dafcb8f5156..d26f97fbc47 100644
--- a/graphics/tinygl/init.cpp
+++ b/graphics/tinygl/init.cpp
@@ -50,13 +50,15 @@ void GLContext::endSharedState() {
 	gl_free(s->texture_hash_table);
 }
 
-void createContext(int screenW, int screenH, Graphics::PixelFormat pixelFormat, int textureSize, bool enableStencilBuffer, bool dirtyRectsEnable) {
+void createContext(int screenW, int screenH, Graphics::PixelFormat pixelFormat, int textureSize,
+	           bool enableStencilBuffer, bool dirtyRectsEnable, uint32 drawCallMemorySize) {
 	assert(gl_ctx == nullptr);
 	gl_ctx = new GLContext();
-	gl_ctx->init(screenW, screenH, pixelFormat, textureSize, enableStencilBuffer, dirtyRectsEnable);
+	gl_ctx->init(screenW, screenH, pixelFormat, textureSize, enableStencilBuffer, dirtyRectsEnable, drawCallMemorySize);
 }
 
-void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat, int textureSize, bool enableStencilBuffer, bool dirtyRectsEnable) {
+void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat, int textureSize,
+	             bool enableStencilBuffer, bool dirtyRectsEnable, uint32 drawCallMemorySize) {
 	GLViewport *v;
 
 	_enableDirtyRectangles = dirtyRectsEnable;
@@ -257,11 +259,9 @@ void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat
 	// color mask
 	color_mask_red = color_mask_green = color_mask_blue = color_mask_alpha = true;
 
-	const size_t kDrawCallMemory = 60ULL * 1024ULL * 1024ULL;
-
 	_currentAllocatorIndex = 0;
-	_drawCallAllocator[0].initialize(kDrawCallMemory);
-	_drawCallAllocator[1].initialize(kDrawCallMemory);
+	_drawCallAllocator[0].initialize(drawCallMemorySize);
+	_drawCallAllocator[1].initialize(drawCallMemorySize);
 	_debugRectsEnabled = false;
 	_profilingEnabled = false;
 
diff --git a/graphics/tinygl/tinygl.h b/graphics/tinygl/tinygl.h
index bb95620e6e8..2507e3a4560 100644
--- a/graphics/tinygl/tinygl.h
+++ b/graphics/tinygl/tinygl.h
@@ -30,7 +30,8 @@
 namespace TinyGL {
 
 void createContext(int screenW, int screenH, Graphics::PixelFormat pixelFormat,
-                   int textureSize, bool enableStencilBuffer, bool dirtyRectsEnable = true);
+                   int textureSize, bool enableStencilBuffer, bool dirtyRectsEnable,
+                   uint32 drawCallMemorySize = 6 * 1024 * 1024);
 void destroyContext();
 void presentBuffer();
 void presentBuffer(Common::List<Common::Rect> &dirtyAreas);
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index e4c2f4d49c8..50b286898bb 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -511,7 +511,8 @@ public:
 	void initSharedState();
 	void endSharedState();
 
-	void init(int screenW, int screenH, Graphics::PixelFormat pixelFormat, int textureSize, bool enableStencilBuffer, bool dirtyRectsEnable = true);
+	void init(int screenW, int screenH, Graphics::PixelFormat pixelFormat, int textureSize,
+	          bool enableStencilBuffer, bool dirtyRectsEnable, uint32 drawCallMemorySize);
 	void deinit();
 
 	void gl_print_matrix(const float *m);




More information about the Scummvm-git-logs mailing list