graphicsdriver/opengl: Adopt WRITE_ONLY for PBOs

It looks like it is safe to use WRITE_ONLY:
https://stackoverflow.com/questions/30248594/write-only-glmapbuffer-what-if-i-dont-write-it-all
This commit is contained in:
Hajime Hoshi 2019-11-24 17:42:23 +09:00
parent 4c4f67197f
commit 9f483ddc60

View File

@ -529,7 +529,9 @@ func (c *context) mapPixelBuffer(buffer buffer, t textureNative) uintptr {
var ptr uintptr
_ = c.t.Call(func() error {
gl.BindBuffer(gl.PIXEL_UNPACK_BUFFER, uint32(buffer))
ptr = gl.MapBuffer(gl.PIXEL_UNPACK_BUFFER, gl.READ_WRITE)
// Even though only the part of the buffer is updated, that's fine.
// https://stackoverflow.com/questions/30248594/write-only-glmapbuffer-what-if-i-dont-write-it-all
ptr = gl.MapBuffer(gl.PIXEL_UNPACK_BUFFER, gl.WRITE_ONLY)
return nil
})
return ptr