internal/graphicsdriver/metal: add assertions

This commit is contained in:
Hajime Hoshi
2025-08-25 20:04:38 +09:00
parent c830cf4c63
commit f03b4b9524

View File

@@ -231,7 +231,10 @@ func (g *Graphics) SetVertices(vertices []float32, indices []uint32) error {
func (g *Graphics) flushIfNeeded(present bool) {
if g.cb == (mtl.CommandBuffer{}) {
if g.rce != (mtl.RenderCommandEncoder{}) {
panic("metal: command buffer is empty but render command encoder is not empty")
panic("metal: render command encoder must be empty if command buffer is empty")
}
if present && g.screenDrawable != (ca.MetalDrawable{}) {
panic("metal: screen drawable must be empty if command buffer is empty")
}
return
}