Fixed shader error output. the shader source code was appended twice in the log.
This commit is contained in:
parent
5b6b33c8f5
commit
53a40c887e
@ -1096,7 +1096,7 @@ public class GLRenderer implements Renderer {
|
||||
source.clearUpdateNeeded();
|
||||
} else {
|
||||
logger.log(Level.WARNING, "Bad compile of:\n{0}",
|
||||
new Object[]{ShaderDebug.formatShaderSource(source.getDefines(), source.getSource(), stringBuf.toString())});
|
||||
new Object[]{ShaderDebug.formatShaderSource(stringBuf.toString())});
|
||||
if (infoLog != null) {
|
||||
throw new RendererException("compile error in: " + source + "\n" + infoLog);
|
||||
} else {
|
||||
|
@ -39,28 +39,13 @@ public class ShaderDebug {
|
||||
|
||||
/**
|
||||
* Append the line numbers to the source code of a shader to output it
|
||||
* @param defines the defines
|
||||
* @param source the source
|
||||
* @return the formated source code
|
||||
*/
|
||||
public static String formatShaderSource(String defines, String source, String version) {
|
||||
String[] versionLines = version.split("\n");
|
||||
String[] definesLines = defines.split("\n");
|
||||
public static String formatShaderSource(String source) {
|
||||
String[] sourceLines = source.split("\n");
|
||||
int nblines = 0;
|
||||
StringBuilder out = new StringBuilder();
|
||||
if (!version.equals("")) {
|
||||
for (String string : versionLines) {
|
||||
nblines++;
|
||||
out.append(nblines).append("\t").append(string).append("\n");
|
||||
}
|
||||
}
|
||||
if (!defines.equals("")) {
|
||||
for (String string : definesLines) {
|
||||
nblines++;
|
||||
out.append(nblines).append("\t").append(string).append("\n");
|
||||
}
|
||||
}
|
||||
for (String string : sourceLines) {
|
||||
nblines++;
|
||||
out.append(nblines).append("\t").append(string).append("\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user