-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Line shaders not working on Chrome/Linux #6386
Comments
I'll have access to my Linux machine by end of next week and can help test this if no one else get to this before then. Just ping me in case I forgot. |
Thanks @limzykenneth! |
Thanks @asukaminato0721! Looks like this may be a very specific driver bug then. I'm going to close this issue, but in case anyone else needs to work around this for their specific setup, I added this chunk of code to use const prevGetLineShader = p5.RendererGL.prototype._getLineShader
p5.RendererGL.prototype._getLineShader = function () {
if (!this._defaultLineShader) {
this._defaultLineShader = prevGetLineShader.call(this)
this._defaultLineShader._vertSrc = this._defaultLineShader._vertSrc.replace(
/mediump/g,
'highp',
)
this._defaultLineShader._fragSrc = this._defaultLineShader._fragSrc.replace(
/mediump/g,
'highp',
)
}
return this._defaultLineShader
} |
Hey, little update to this: since 7cf062d I've been finding that on AWS linux, the color shader also doesn't work reliably, and shapes are disappearing. This definitely feels like a driver bug, and the combination of using GL ES 300 + const shadersToReplace = [
['_getImmediateModeShader', '_defaultImmediateModeShader'],
['_getNormalShader', '_defaultNormalShader'],
['_getColorShader', '_defaultColorShader'],
['_getPointShader', '_defaultPointShader'],
['_getLineShader', '_defaultLineShader'],
['_getFontShader', '_defaultFontShader'],
]
for (const [method, cacheKey] of shadersToReplace) {
const prevMethod = P5.RendererGL.prototype[method]
p5.RendererGL.prototype[method] = function () {
if (!this[cacheKey]) {
this[cacheKey] = prevMethod.call(this)
this[cacheKey]._vertSrc = this[cacheKey]._vertSrc.replace(
/mediump/g,
'highp',
)
this[cacheKey]._fragSrc = this[cacheKey]._fragSrc.replace(
/mediump/g,
'highp',
)
}
return this[cacheKey]
}
} At least for this use case of mine of cloud exports, a way to tell p5 to use I think when I asked before if this is reproducible on Linux, that might not have been enough, since most? all? desktop drivers ignore |
Most appropriate sub-area of p5.js?
p5.js version
1.7.0
Web browser and version
Chrome 108
Operating System
Amazon Linux
Steps to reproduce this
At work we do some cloud rendering of p5 via Chome/Puppeteer in AWS Batch. I noticed that WebGL lines were not showing up in our cloud exports (left) compared to in-browser on Chrome for Mac (right):
This is a screenshot of chrome://gpu from the cloud environment (click to expand):
We were able to fix our issue by changing the precision in the line vertex/fragment shader to be
highp
instead ofmediump
:p5.js/src/webgl/shaders/line.vert
Lines 21 to 22 in 45ada83
As I only have access to my Mac locally, what I don't know is if this is an issue with our setup on AWS or if this is a general issue on Linux. Is anyone else able to run this on Chrome for Linux and let me know if the line renders for you or not? If this is a general issue, then maybe we should update the line shader. But it might be a bug specifically in the drivers for this environment.
Snippet:
Live: https://editor.p5js.org/davepagurek/sketches/rhLpTaCeX
The text was updated successfully, but these errors were encountered: