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

Method perform0

src/main/java/field/graphics/Shader.java:244–338  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

242 this.onError = onError;
243 return this;
244 }
245
246 protected boolean perform0() {
247 boolean work = false;
248
249 GraphicsContext.checkError(() -> "on shader entry");
250
251 Log.log("graphics.trace", () -> " checking :" + source.keySet());
252
253
254 for (Map.Entry<Type, Source> s : source.entrySet()) {
255 work |= s.getValue()
256 .clean();
257 }
258
259 State name = GraphicsContext.get(this);
260
261 work |= name.work;
262 name.work = false;
263
264 if (work) {
265// System.out.println(" -- shader has work to do in stage :"+name+" in context "+GraphicsContext.getContext());
266
267 name.valid = true;
268 for (Map.Entry<Type, Source> s : source.entrySet()) {
269 Source.State state = GraphicsContext.get(s.getValue());
270 if (s.getValue().status != 0 && state.name != -1 && !state.attachedTo.contains(name.name)) {
271 GL20.glAttachShader(name.name, state.name);
272 state.attachedTo.add(name.name);
273 }
274 }
275
276 if (!source.containsKey(Type.compute)) {
277 GL30.glBindFragDataLocation(name.name, 0, "_output");
278 GL30.glBindFragDataLocation(name.name, 0, "_output0");
279 GL30.glBindFragDataLocation(name.name, 1, "_output1");
280 GL30.glBindFragDataLocation(name.name, 2, "_output2");
281 GL30.glBindFragDataLocation(name.name, 3, "_output3");
282
283 for (int i = 1; i < 16; i++)
284 glBindAttribLocation(name.name, i, "attribute" + i);
285 }
286
287 GraphicsContext.checkError(() -> "before link and validate");
288 name.valid = linkAndValidateNow(name.name);
289 GraphicsContext.checkError(() -> "afer link and validate");
290
291 if (name.valid) {
292 if (introspection == null) {
293 introspection = new ShaderIntrospection(this);
294 introspection.reloadedAt = Instant.now();
295 } else {
296 introspection.reloadedAt = Instant.now();
297 introspection.reloadedTimes++;
298 introspection.invocationCountSinceReload = 0;
299 }
300
301 introspection.introspectNow();

Callers

nothing calls this directly

Calls 15

checkErrorMethod · 0.95
logMethod · 0.95
getMethod · 0.95
linkAndValidateNowMethod · 0.95
getContextMethod · 0.95
nowMethod · 0.80
introspectNowMethod · 0.80
changeShaderMethod · 0.80
cleanMethod · 0.65
setMethod · 0.65
getValueMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected