mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
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:
@@ -605,6 +605,8 @@ func (b *Backend) prepareDraw(mode backend.DrawMode) {
|
||||
switch b.depthState.fn {
|
||||
case backend.DepthFuncGreater:
|
||||
desc.DepthFunc = _D3D11_COMPARISON_GREATER
|
||||
case backend.DepthFuncGreaterEqual:
|
||||
desc.DepthFunc = _D3D11_COMPARISON_GREATER_EQUAL
|
||||
default:
|
||||
panic("unsupported depth func")
|
||||
}
|
||||
|
||||
@@ -621,7 +621,8 @@ const (
|
||||
|
||||
_D3D11_DEPTH_WRITE_MASK_ALL = 1
|
||||
|
||||
_D3D11_COMPARISON_GREATER = 5
|
||||
_D3D11_COMPARISON_GREATER = 5
|
||||
_D3D11_COMPARISON_GREATER_EQUAL = 7
|
||||
|
||||
_D3D11_BLEND_OP_ADD = 1
|
||||
_D3D11_BLEND_ONE = 2
|
||||
|
||||
Reference in New Issue
Block a user