floooh / sokol

minimal cross-platform standalone C headers
https://floooh.github.io/sokol-html5
zlib License
6.54k stars 469 forks source link

Redundant buffer bindings on metal when only changing vertex buffer offset #979

Closed staminajim closed 5 months ago

staminajim commented 5 months ago

In metal, if you send commands which only change the vertex buffer offset, (ie. not binding a different buffer) you get lots of warnings about unnecessary bindings in Xcode. This is pretty common when using shared resource pools.

According to the Apple documentation you should use setVertexBufferOffset instead of setVertexBuffer on the render encoder: https://developer.apple.com/library/archive/documentation/3DDrawing/Conceptual/MTLBestPracticesGuide/BufferBindings.html

Incoming PR which I'm using in my engine which resolves this