skelterjohn / go.wde

Windows, drawing and events for Go
217 stars 46 forks source link

Slow rendering from RGBA buffer to wde.Window #16

Closed errnoh closed 12 years ago

errnoh commented 12 years ago

I've been messing around with high fps rendering with go.wde and I'm coming to conclusion that by allowing straight access to buffer would be really helpful for any fast paced rendering.

This would also benefit much from high speed copying from RGBA (and the other usual ones possibly?) buffers. There's actually ready code to do just that in wde/xgb at https://github.com/BurntSushi/xgbutil/blob/master/xgraphics/convert.go . It just needs to be opened for use and other platforms would need to have similar interface.

I've made benchmarks for approach like this, those can be found at: https://github.com/errnoh/wde-drawbench

rgba -> rgba seems to be blazing fast. No idea what is actually going there. Still, the test seems to say that it's doing what it should. (edit: well, probably just some fast copy instruction of memory block, since the data doesn't actually need to be changed)

(alpha was discarded on win.Window implementation) win.Window gained 6-7x speed (windows workstation) xgb.Window gained 4x speed (windows workstation)

errnoh commented 12 years ago

Fixed in fbdd89a3fcf8834a3ea90f3658666a2025eb1cd8