processing / processing/processing4

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

オープン
#694 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

enhancement help wanted opengl
主要言語
Java
スター
494
フォーク
183
平均マージ
4時間 39分
マージ済み PR(30日)
3

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

smooth(8)、P3D、createGraphics()を使用したsetup()の再現から始め、次に、M1 Macで報告されているframebufferエラーを発生させるPGraphics beginDraw()の経路を追跡します。smooth(4)の場合の動作と比較します。未対応のsmooth設定が検出または処理され、OpenGLおよびPGraphicsのエラーが発生しなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
computer-graphics
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。