From 53a40c887e9a15a22a1a847a413d6da207ecf966 Mon Sep 17 00:00:00 2001 From: Nehon Date: Thu, 12 Feb 2015 22:43:03 +0100 Subject: [PATCH] Fixed shader error output. the shader source code was appended twice in the log. --- .../com/jme3/renderer/opengl/GLRenderer.java | 2 +- .../java/jme3tools/shader/ShaderDebug.java | 19 ++----------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java index 883ec11e1..6a2e61204 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java @@ -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 { diff --git a/jme3-core/src/tools/java/jme3tools/shader/ShaderDebug.java b/jme3-core/src/tools/java/jme3tools/shader/ShaderDebug.java index 4cd085c3f..47a132402 100644 --- a/jme3-core/src/tools/java/jme3tools/shader/ShaderDebug.java +++ b/jme3-core/src/tools/java/jme3tools/shader/ShaderDebug.java @@ -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"); - } - } + StringBuilder out = new StringBuilder(); for (String string : sourceLines) { nblines++; out.append(nblines).append("\t").append(string).append("\n");