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();
|
source.clearUpdateNeeded();
|
||||||
} 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(), stringBuf.toString())});
|
new Object[]{ShaderDebug.formatShaderSource(stringBuf.toString())});
|
||||||
if (infoLog != null) {
|
if (infoLog != null) {
|
||||||
throw new RendererException("compile error in: " + source + "\n" + infoLog);
|
throw new RendererException("compile error in: " + source + "\n" + infoLog);
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,28 +39,13 @@ public class ShaderDebug {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Append the line numbers to the source code of a shader to output it
|
* Append the line numbers to the source code of a shader to output it
|
||||||
* @param defines the defines
|
|
||||||
* @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, String version) {
|
public static String formatShaderSource(String source) {
|
||||||
String[] versionLines = version.split("\n");
|
|
||||||
String[] definesLines = defines.split("\n");
|
|
||||||
String[] sourceLines = source.split("\n");
|
String[] sourceLines = source.split("\n");
|
||||||
int nblines = 0;
|
int nblines = 0;
|
||||||
StringBuilder out = new StringBuilder();
|
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) {
|
for (String string : sourceLines) {
|
||||||
nblines++;
|
nblines++;
|
||||||
out.append(nblines).append("\t").append(string).append("\n");
|
out.append(nblines).append("\t").append(string).append("\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user