google / xrtl

Cross-platform Real-Time Rendering Library
Apache License 2.0
128 stars 26 forks source link

Making buffer/texture upload/download more portable. #82

Closed benvanik closed 7 years ago

benvanik commented 7 years ago

As it was the ReadData/WriteData methods were unsafe unless you glFinished (or did crazy things in vk/mtl). This preserves the handy synchronous read/write but also enables properly synchronized versions.

The Read/Writes now support scatter/gather usage, which will really help dynamic writes generated during command buffer construction (for UBO data, etc).

Vk/mtl implementations may be able to exploit memory types to optimize the synchronous read/write variants (such as when the memory is Shared/host visible), but since GL can't this has to remain a detail hidden by the API.

The ES3 backend is not yet optimized and should really have a dedicated transfer queue performing the reads/writes and staging buffers to do the copies. This change is just about getting the API sane, though.