在 Chrome 中收到“性能警告"消息 [英] Getting 'PERFORMANCE WARNING' messages in Chrome

查看:45
本文介绍了在 Chrome 中收到“性能警告"消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近才开始收到这些消息,想知道是否有人看过它们,或者知道是什么原因导致了它们.我在 MacOS 上使用 Three.js 和 Chrome 版本21.0.1180.57".我在 Safari 或 FireFox 中没有收到这些消息.

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.

性能警告:属性 0 被禁用.这会造成显着的性能损失

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

WebGL:错误太多,不会再向控制台报告此上下文的错误.

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

推荐答案

Firefox 上的相同消息是:错误:WebGL:未启用顶点属性 0 数组的绘图会强制浏览器在桌面 OpenGL 平台上运行时执行昂贵的仿真工作,例如在 Mac 上.最好总是在启用顶点属性 0 数组的情况下绘制,通过使用 bindAttribLocation 将一些始终使用的属性绑定到位置 0."

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.

问题:如果 JS 尝试运行 WebGL 着色器,而该着色器在不提供颜色数组的网格上期望 gl_Color 中的颜色信息,则会出现此消息.

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.

解决方案:使用具有恒定颜色的 WebGL 着色器而不访问 gl_Color 或在要着色的网格中提供颜色数组.

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

如果使用 Evan Wallace 的 lightgl.js,请尝试在 new GL.Mesh 语句中添加选项 colors:true 并提供正确的 mesh.与 vertices 数组大小相同的 colors 数组.或者试试这个着色器:

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); }'
);

抱歉,我从未使用过 Three.js,但问题应该是类似的,在着色之前为您的网格提供颜色.

这篇关于在 Chrome 中收到“性能警告"消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆