gpu: saturate instead of overflowing depth buffer

Use greater-than-or-equal test and saturate the z depth buffer
when more than 65k objects are drawn.

Fixes gio#127

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-06-08 16:25:47 +02:00
parent 52864950f1
commit 504664e014
6 changed files with 16 additions and 8 deletions
+2
View File
@@ -399,6 +399,8 @@ func (b *Backend) DepthFunc(f backend.DepthFunc) {
switch f {
case backend.DepthFuncGreater:
glfunc = GREATER
case backend.DepthFuncGreaterEqual:
glfunc = GEQUAL
default:
panic("unsupported depth func")
}
+1
View File
@@ -35,6 +35,7 @@ const (
INFO_LOG_LENGTH = 0x8B84
INVALID_INDEX = ^uint(0)
GREATER = 0x204
GEQUAL = 0x206
LINEAR = 0x2601
LINK_STATUS = 0x8b82
LUMINANCE = 0x1909