games/dangerdeep: Fix compiling GLSL shaders

compiling failed, log:
0:2(1): preprocessor error: #version must appear on the first line

Reported by:	lme
This commit is contained in:
Tobias Kortkamp 2020-03-30 06:08:21 +00:00
parent 65e0458285
commit 475cd433e7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=529862
2 changed files with 27 additions and 1 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= dangerdeep
PORTVERSION= 0.3.0
PORTREVISION= 14
PORTREVISION= 15
CATEGORIES= games
MASTER_SITES= SF/${PORTNAME}/danger_from_the_deep-src/${PORTVERSION}
DIST_SUBDIR= ${PORTNAME}

View File

@ -0,0 +1,26 @@
compiling failed, log:
0:2(1): preprocessor error: #version must appear on the first line
--- src/shader.cpp.orig 2020-03-29 17:02:18 UTC
+++ src/shader.cpp
@@ -74,6 +74,8 @@ glsl_shader::glsl_shader(const string& filename, type
// the program as string
string prg;
+ prg += "#version 110\n";
+
// add defines to top of list for preprocessor
for (defines_list::const_iterator it = dl.begin(); it != dl.end(); ++it) {
prg += string("#define ") + *it + "\n";
@@ -83,7 +85,10 @@ glsl_shader::glsl_shader(const string& filename, type
while (!ifprg.eof()) {
string s;
getline(ifprg, s);
- prg += s + "\n";
+ string prefix("#version");
+ if (0 != s.compare(0, prefix.size(), prefix)) {
+ prg += s + "\n";
+ }
}
const char* prg_cstr = prg.c_str();