Re: Data transfers from/to client

On Tue, Feb 6, 2018 at 4:00 PM, Myles C. Maxfield <mmaxfield@apple.com>
wrote:

>
>
> On Feb 5, 2018, at 2:33 PM, Corentin Wallez <cwallez@google.com> wrote:
>
> Thanks for taking another look. I think we are on the same page and both
> of your concerns are because the document wasn't clear enough.
>
> 1. The document isn't clear enough: we are not looking at have synchronous
> polling work when used with a while-loop like this. We could even spec
> isPending to not be able to change until Javascript execution yields to the
> browser (like qury results i nWebGL). The for loop was just an
> (unfortunate) image of what calls the application would do inside a RAF or
> setTimeout loop. That said WebGL _might_ allow blocking in workers in the
> future. We should probably piggy-back on its decision.
>
> 2. I'm not sure what race there is. The pointer would go back to null only
> if the buffer or the memory are unmapped. The buffer cannot be used by the
> GPU while it is mapped because it has to stay in the MapRead usage (NXT's
> concept of "memory barrier") until unmapped. Hence the application controls
> when the memory is invalidated and when getPointer() returns nullptr.
>
>
> Oh, I must have missed something critical. Why does the example code check
> the return of getPointer()?
>
> Because the pointer might be null if the device was lost, or if some other
part of the application decided it didn't need the data anymore and
unmapped the buffer while isPending() = true.

Received on Tuesday, 6 February 2018 21:04:29 UTC