Getting 'PERFORMANCE WARNING' messages in Chrome

南楼画角 提交于 2019-12-24 04:10:09

问题


I just recently starting getting these messages, and was wondering if anyone has seen them, or know what may be causing them. I'm using Three.js with Chrome version '21.0.1180.57' on MacOS. I don't get these messages with Safari or FireFox.

PERFORMANCE WARNING: Attribute 0 is disabled. This has signficant performance penalty

WebGL: too many errors, no more errors will be reported to the console for this context.


回答1:


Same message on Firefox is : "Error: WebGL: Drawing without vertex attrib 0 array enabled forces the browser to do expensive emulation work when running on desktop OpenGL platforms, for example on Mac. It is preferable to always draw with vertex attrib 0 array enabled, by using bindAttribLocation to bind some always-used attribute to location 0."

This is not only a performance drawback, but will also result in bad output.

PROBLEM: This message occurs if a JS tries to run a WebGL shader that is expecting color information in gl_Color on a mesh not providing a color array.

SOLUTION: Use a WebGL shader with constant color not accessing gl_Color or provide a color array in the mesh to be shaded.

If using lightgl.js from Evan Wallace, try to add the option colors:true in the new GL.Mesh statement and provide a propper mesh.colors array of same size as your vertices array. Or try this shader:

blackShader = new GL.Shader(
  'void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }',
  'void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); }'
);

Sorry, I never used Three.js but the problem should be similar, provide color to your mesh before shading.




回答2:


Looks like a Chrome bug:

http://code.google.com/p/chromium-os/issues/detail?id=32528



来源:https://stackoverflow.com/questions/11767248/getting-performance-warning-messages-in-chrome

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!