File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
core/src/processing/opengl Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 3
3
/*
4
4
Part of the Processing project - http://processing.org
5
5
6
- Copyright (c) 2012-16 The Processing Foundation
6
+ Copyright (c) 2012-17 The Processing Foundation
7
7
Copyright (c) 2004-12 Ben Fry and Casey Reas
8
8
Copyright (c) 2001-04 Massachusetts Institute of Technology
9
9
@@ -1991,8 +1991,9 @@ protected static String[] preprocessShaderSource(String[] src0,
1991
1991
String [] src = new String [src0 .length +offset ];
1992
1992
for (int i = 0 ; i < src0 .length ; i ++) {
1993
1993
String line = src0 [i ];
1994
- if (line .contains ("#version" )) {
1995
- line = "" ;
1994
+ int versionIndex = line .indexOf ("#version" );
1995
+ if (versionIndex >= 0 ) {
1996
+ line = line .substring (0 , versionIndex );
1996
1997
}
1997
1998
for (int j = 0 ; j < search .length ; j ++) {
1998
1999
line = search [j ].matcher (line ).replaceAll (replace [j ]);
@@ -2005,8 +2006,12 @@ protected static String[] preprocessShaderSource(String[] src0,
2005
2006
protected static boolean containsVersionDirective (String [] shSrc ) {
2006
2007
for (int i = 0 ; i < shSrc .length ; i ++) {
2007
2008
String line = shSrc [i ];
2008
- if (line .contains ("#version" )) {
2009
- return true ;
2009
+ int versionIndex = line .indexOf ("#version" );
2010
+ if (versionIndex >= 0 ) {
2011
+ int commentIndex = line .indexOf ("//" );
2012
+ if (commentIndex < 0 || versionIndex < commentIndex ) {
2013
+ return true ;
2014
+ }
2010
2015
}
2011
2016
}
2012
2017
return false ;
You can’t perform that action at this time.
0 commit comments