From 52864950f139e4b354e2b33024e50c7d29e1f208 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 8 Jun 2020 15:51:29 +0200 Subject: [PATCH] gpu: panic on z-buffer overflow Drawing more than 65k objects is reasonable, but not today. Updates gio#127 Signed-off-by: Elias Naur --- gpu/gpu.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gpu/gpu.go b/gpu/gpu.go index 44f9116e..56d18863 100644 --- a/gpu/gpu.go +++ b/gpu/gpu.go @@ -750,6 +750,10 @@ loop: continue } state.z++ + if state.z != int(uint16(state.z)) { + // TODO(eliasnaur) gioui.org/issue/127. + panic("more than 65k paint objects not supported") + } // Assume 16-bit depth buffer. const zdepth = 1 << 16 // Convert z to window-space, assuming depth range [0;1].