MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / linkAndValidateNow

Method linkAndValidateNow

src/main/java/field/graphics/Shader.java:342–415  ·  view source on GitHub ↗
(int name)

Source from the content-addressed store, hash-verified

340 }
341
342 protected String lastAccumulatedError;
343
344 @HiddenInAutocomplete
345 boolean linkAndValidateNow(int name) {
346 lastAccumulatedError = null;
347
348 TreeMap<Integer, Set<Consumer<Integer>>> c = collectChildrenPasses();
349 if (c != null)
350 c.values().stream().flatMap(x -> x.stream()).forEach(x -> {
351 if (x instanceof TransformFeedback) {
352 glTransformFeedbackVaryings(name, ((TransformFeedback) x).target, GL_INTERLEAVED_ATTRIBS);
353 }
354
355 // warning if there are more than one of these?
356 });
357
358 internalScene.values().stream().flatMap(x -> x.stream()).forEach(x -> {
359 if (x instanceof TransformFeedback) {
360 glTransformFeedbackVaryings(name, ((TransformFeedback) x).target, GL_INTERLEAVED_ATTRIBS);
361 }
362
363 // warning if there are more than one of these?
364 });
365
366
367 GraphicsContext.checkError(() -> "before link");
368 glLinkProgram(name);
369 GraphicsContext.checkError(() -> "after link");
370 int linkStatus = glGetProgrami(name, GL20.GL_LINK_STATUS);
371 if (linkStatus == 0) {
372 String ret = GL20.glGetProgramInfoLog(name, 10000);
373 System.err.println(" program failed to link");
374 System.err.println(" log is <" + ret + ">");
375 if (onError != null) {
376 onError.beginError();
377
378 String[] pieces = ret.split("\n");
379 String filtered = "";
380 for (String p : pieces)
381 // the warnings are uninteresting
382 if (p.toLowerCase().trim().startsWith("warning")) {
383 } else
384 filtered += p + "\n";
385
386 lastAccumulatedError = filtered.trim();
387 onError.errorOnLine(1, filtered.trim());
388 onError.endError();
389 }
390 return false;
391 }
392
393
394 GraphicsContext.checkError(() -> "before validate");
395 glValidateProgram(name);
396 GraphicsContext.checkError(() -> "after validate");
397 int validateStatus = glGetProgrami(name, GL20.GL_VALIDATE_STATUS);
398 if (validateStatus == 0) {
399 String ret = GL20.glGetProgramInfoLog(name, 10000);

Callers 1

perform0Method · 0.95

Calls 11

checkErrorMethod · 0.95
logMethod · 0.95
collectChildrenPassesMethod · 0.80
beginErrorMethod · 0.65
errorOnLineMethod · 0.65
endErrorMethod · 0.65
forEachMethod · 0.45
streamMethod · 0.45
printlnMethod · 0.45
splitMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected