Skip to content
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

add highp precision check #5675

Merged
merged 4 commits into from
Nov 6, 2019

Conversation

2youyou2
Copy link
Contributor

@2youyou2 2youyou2 commented Nov 5, 2019

Re: cocos-creator/2d-tasks#844

Changes:

  • add highp precision check

老设备上可能不支持 highp,这里判断如果设备不支持 highp 则替换 shader 中的 highp 为 mediump。

image

highpSupported = highp && highp.precision !== 0;
}
if (!highpSupported) {
cc.warn('Program not support highp precision, will change to mediump.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 warnID

@@ -63,6 +63,10 @@ function _unrollLoops(string) {
return string.replace(pattern, replace);
}

function _replaceHighp(string) {
return string.replace(/\bhighp\b/, 'mediump');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是得加个 /g 比较好

@SantyWang
Copy link
Contributor

这个是three的检测方式,看看有没有参考价值 image

@2youyou2
Copy link
Contributor Author

2youyou2 commented Nov 6, 2019

这个是three的检测方式,看看有没有参考价值

加了 vertex precision 的检测,mediump 没加了,不支持游戏都玩不了了。。

@SantyWang SantyWang merged commit 12a3fc4 into cocos:v2.2.1-release Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants