Shaders : The line numbers on error now correctly takes the version line added to the shader into account

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9295 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent 3a0e1f50ac
commit 544e1f6342
  1. 2
      engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java
  2. 6
      engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java
  3. 9
      engine/src/tools/jme3tools/shader/ShaderDebug.java

@ -1051,7 +1051,7 @@ public class OGLESShaderRenderer implements Renderer {
}
} else {
logger.log(Level.WARNING, "Bad compile of:\n{0}",
new Object[]{ShaderDebug.formatShaderSource(source.getDefines(), source.getSource())});
new Object[]{ShaderDebug.formatShaderSource(source.getDefines(), source.getSource(),stringBuf.toString())});
if (infoLog != null) {
throw new RendererException("compile error in:" + source + " error:" + infoLog);
} else {

@ -995,10 +995,10 @@ public class LwjglRenderer implements Renderer {
new Object[]{source.getName(), infoLog});
} else {
logger.log(Level.FINE, "{0} compile success", source.getName());
}
} else {
}
} else {
logger.log(Level.WARNING, "Bad compile of:\n{0}",
new Object[]{ShaderDebug.formatShaderSource(source.getDefines(), source.getSource())});
new Object[]{ShaderDebug.formatShaderSource(source.getDefines(), source.getSource(),stringBuf.toString())});
if (infoLog != null) {
throw new RendererException("compile error in:" + source + " error:" + infoLog);
} else {

@ -43,11 +43,18 @@ public class ShaderDebug {
* @param source the source
* @return the formated source code
*/
public static String formatShaderSource(String defines, String source) {
public static String formatShaderSource(String defines, String source,String version) {
String[] lines0 = version.split("\n");
String[] lines = defines.split("\n");
String[] lines2 = source.split("\n");
int nblines = 0;
StringBuilder out = new StringBuilder();
if (!version.equals("")) {
for (String string : lines0) {
nblines++;
out.append(nblines).append("\t").append(string).append("\n");
}
}
if (!defines.equals("")) {
for (String string : lines) {
nblines++;

Loading…
Cancel
Save