gpuPicker stops working after windows resize

Actually, topic name explain problem.
I solved it by calling setPickingList in cases when the render area is resized. However, it looks like the _preparePickingBuffer method should avoid this bug, but it doesn’t do this.

Do you mind sharing a quick repro?

I investigate problem and find out that pickAsync’s promise is not always ends. Sometimes it lock my code because I wait for end of pickAsync’s promise before run another one. You can ensure this by adding console.log before and after pickAsync in https://playground.babylonjs.com/#B5XGIP#37


I do not repro:
Babylon.js Playground (babylonjs.com)

Does sound like a timing thing though.

on screenshot “begin” is out ~5 times more often than “ok”. this is not repro?

Oh!!! I see what you mean now!! I thought we were looking for an error:)

I will update the code to ensure that if a picking is already in progress we simply return null so you can know :slight_smile:

I will keep you updated!

1 Like

You know have a new boolean (pickingInProgress) to avoid launching picking while the previous one is in progress.

If you do it anyway the promise will still resolve with null instead of getting lost :slight_smile:

Thanks a lot for your feedback!

2 Likes

thank you!

But in my case, the problem did not disappear. When the render area is resized, one promise is lost and now I can’t even run the other one.

When playground is updated I will try to reproduce it.

Oh, I see playground is updated.

In https://playground.babylonjs.com/#B5XGIP#65 when you resize window pickAsync always return null.

Checking!

Stupid mistake:
Fix sizing issue by deltakosh · Pull Request #15578 · BabylonJS/Babylon.js (github.com)

I was recreating the texture AFTER setting the parameters ;D

2 Likes

Works fine. Thank you!

1 Like