processing / processing/processing4

Detect max `smooth()` setting to avoid OpenGL errors

Aperta
#694 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement help wanted opengl
Lingua principale
Java
Stelle
494
Fork
183
Merge medio
4h 39m
PR unite (30g)
3

Descrizione

Created by: cacheflowe

I don't think this really needs to be addressed, but I wanted to make note of the error, since I didn't find any info elsewhere. I was moving a Java project to Mac from Windows (where this isn't a problem), and it took me a bit to figure out what was causing the error.

On a Silicon Mac (I'm on an M1) with Processing 4.2, setting smooth(8) in setup() has a weird side-effect of breaking PGraphics. I now see in the smooth() documentation that 8 is a valid value, but not on all machines. This makes sense, and probably explains the error, noted below. The problem goes away if I use smooth(4) instead!

The code:

PGraphics pg;

void setup() {
  size(400, 400, P3D);
  smooth(8);

  pg = createGraphics(400, 400, P3D);
  pg.beginDraw();
  pg.fill(0, 255, 0);
  pg.rect(20, 20, 60, 60);
  pg.endDraw();
}

void draw() {
  background(0);
  image(pg, 0, 0);
  ellipse(120, 192, 144, 144);
  ellipse(280, 192, 144, 144);
}

The error:

OpenGL error 1282 at bot beginDraw(): invalid operation
RuntimeException: Cannot validate shader program:
Validation Failed: Current draw framebuffer is invalid.

RuntimeException: Cannot validate shader program:
Validation Failed: Current draw framebuffer is invalid.

If I comment out the drawing on pg, the error changes, and the app doesn't completely crash:

The code:

PGraphics pg;

void setup() {
  size(400, 400, P3D);
  smooth(8);

  pg = createGraphics(400, 400, P3D);
}

void draw() {
  background(0);
  image(pg, 0, 0);
  ellipse(120, 192, 144, 144);
  ellipse(280, 192, 144, 144);
}

The error:

UNSUPPORTED (log once): POSSIBLE ISSUE: unit 0 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable
OpenGL error 1282 at bot beginDraw(): invalid operation
OpenGL error 1286 at top endDraw(): invalid framebuffer operation
OpenGL error 1286 at bot endDraw(): invalid framebuffer operation
The pixels array is null.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con la riproduzione di setup() usando smooth(8), P3D e createGraphics(), quindi traccia il percorso PGraphics beginDraw() che produce gli errori di framebuffer segnalati su un Mac M1. Confronta il comportamento con smooth(4); il lavoro è completato quando un’impostazione smooth non supportata viene rilevata o gestita senza che si verifichino gli errori OpenGL e PGraphics.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
computer-graphics
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.