processing / processing/processing4
Detect max `smooth()` setting to avoid OpenGL errors
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 494
- 派生
- 183
- 平均合并
- 4 小时 39 分钟
- 30 天内合并 PR
- 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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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