[Scummvm-git-logs] scummvm master -> 400ba4017fb8eeae49f6e35c430655dccf1512e6

aquadran noreply at scummvm.org
Sun Nov 21 19:28:24 UTC 2021


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:
400ba4017f GRAPHICS: Allow load engine shaders from extra path


Commit: 400ba4017fb8eeae49f6e35c430655dccf1512e6
    https://github.com/scummvm/scummvm/commit/400ba4017fb8eeae49f6e35c430655dccf1512e6
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-11-21T20:28:20+01:00

Commit Message:
GRAPHICS: Allow load engine shaders from extra path

Changed paths:
    graphics/opengl/shader.cpp


diff --git a/graphics/opengl/shader.cpp b/graphics/opengl/shader.cpp
index 832c9b84f9..3dbd4b7a49 100644
--- a/graphics/opengl/shader.cpp
+++ b/graphics/opengl/shader.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "common/scummsys.h"
+#include "common/config-manager.h"
 
 #if defined(USE_OPENGL_SHADERS)
 
@@ -33,14 +34,18 @@ namespace OpenGL {
 static const GLchar *readFile(const Common::String &filename) {
 	Common::File file;
 
-	// Allow load shaders from source code directory without install them
-	// It's used for development purpose
-	// FIXME: it's doesn't work with just search subdirs in 'engines'
+	// Allow load shaders from source code directory without install them.
+	// It's used for development purpose.
+	// Additionally allow load shaders outside distribution data path,
+	// 'extrapath' is used temporary in SearchMan.
 	SearchMan.addDirectory("GRIM_SHADERS", "engines/grim", 0, 2);
 	SearchMan.addDirectory("MYST3_SHADERS", "engines/myst3", 0, 2);
 	SearchMan.addDirectory("STARK_SHADERS", "engines/stark", 0, 2);
 	SearchMan.addDirectory("WINTERMUTE_SHADERS", "engines/wintermute/base/gfx/opengl", 0, 5);
 	SearchMan.addDirectory("PLAYGROUND3D_SHADERS", "engines/playground3d", 0, 2);
+	if (ConfMan.hasKey("extrapath")) {
+		SearchMan.addDirectory("EXTRA_PATH", Common::FSNode(ConfMan.get("extrapath")), 0, 2);
+	}
 	file.open(Common::String("shaders/") + filename);
 	if (!file.isOpen())
 		error("Could not open shader %s!", filename.c_str());
@@ -49,6 +54,7 @@ static const GLchar *readFile(const Common::String &filename) {
 	SearchMan.remove("STARK_SHADERS");
 	SearchMan.remove("WINTERMUTE_SHADERS");
 	SearchMan.remove("PLAYGROUND3D_SHADERS");
+	SearchMan.remove("EXTRA_PATH");
 
 	const int32 size = file.size();
 	GLchar *shaderSource = new GLchar[size + 1];




More information about the Scummvm-git-logs mailing list