-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fixed taobao-minigame use bitmapfont sometimes error #17023
fixed taobao-minigame use bitmapfont sometimes error #17023
Conversation
@@ -126,6 +126,8 @@ export default class Assembler2D extends Assembler { | |||
indiceOffset = offsetInfo.indiceOffset, | |||
vertexId = offsetInfo.vertexOffset; | |||
for (let i = 0, l = iData.length; i < l; i++) { | |||
//Because taobao-minigame does not allow out-of-bounds access to Uint16Array, otherwise it will report an error and cause the game to be unresponsive | |||
if (cc.sys.platform === cc.sys.TAOBAO_MINIGAME && indiceOffset + 1 >= ibuf.length) break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last member can not be set normally.
@@ -126,6 +126,8 @@ export default class Assembler2D extends Assembler { | |||
indiceOffset = offsetInfo.indiceOffset, | |||
vertexId = offsetInfo.vertexOffset; | |||
for (let i = 0, l = iData.length; i < l; i++) { | |||
//Because taobao-minigame does not allow out-of-bounds access to Uint16Array, otherwise it will report an error and cause the game to be unresponsive | |||
if (cc.sys.platform === cc.sys.TAOBAO_MINIGAME && indiceOffset >= ibuf.length) break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- why do it in for loop, can determine how much data to copy before for loop
- this PR means that on tabao platform, some data will not be copied into ibuf, can it work correctly on tabao platform?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, after project testing, this PR will not cause any abnormalities in the game, and it has solved the problem of the game not responding. I will try to handle this issue in a more performant way.
@@ -125,7 +125,7 @@ export default class Assembler2D extends Assembler { | |||
let ibuf = buffer._iData, | |||
indiceOffset = offsetInfo.indiceOffset, | |||
vertexId = offsetInfo.vertexOffset; | |||
for (let i = 0, l = iData.length; i < l; i++) { | |||
for (let i = 0, l = this.indicesCount; i < l; i++) { | |||
ibuf[indiceOffset++] = vertexId + iData[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may exceed iData too. So i think should use the min value of them, for example
const indicesToFill = min(this.indicesCount, iData.length);
Re: #17022