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. 2
      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 { } else {
logger.log(Level.WARNING, "Bad compile of:\n{0}", 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) { if (infoLog != null) {
throw new RendererException("compile error in:" + source + " error:" + infoLog); throw new RendererException("compile error in:" + source + " error:" + infoLog);
} else { } else {

@ -998,7 +998,7 @@ public class LwjglRenderer implements Renderer {
} }
} else { } else {
logger.log(Level.WARNING, "Bad compile of:\n{0}", 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) { if (infoLog != null) {
throw new RendererException("compile error in:" + source + " error:" + infoLog); throw new RendererException("compile error in:" + source + " error:" + infoLog);
} else { } else {

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

Loading…
Cancel
Save