mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 23:55:39 +00:00
gpu/backend: remove clear color and depth state
Specifying the clear color and depth at the time of clearing is less error prone and a better for modern GPU APIs. As a bonus, we can get rid of the BufferAttachment type. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+4
-13
@@ -385,23 +385,14 @@ func (b *Backend) Viewport(x, y, width, height int) {
|
||||
b.funcs.Viewport(x, y, width, height)
|
||||
}
|
||||
|
||||
func (b *Backend) Clear(attachments backend.BufferAttachments) {
|
||||
var mask Enum
|
||||
if attachments&backend.BufferAttachmentColor != 0 {
|
||||
mask |= COLOR_BUFFER_BIT
|
||||
}
|
||||
if attachments&backend.BufferAttachmentDepth != 0 {
|
||||
mask |= DEPTH_BUFFER_BIT
|
||||
}
|
||||
b.funcs.Clear(mask)
|
||||
func (b *Backend) Clear(colR, colG, colB, colA float32) {
|
||||
b.funcs.ClearColor(colR, colG, colB, colA)
|
||||
b.funcs.Clear(COLOR_BUFFER_BIT)
|
||||
}
|
||||
|
||||
func (b *Backend) ClearDepth(d float32) {
|
||||
b.funcs.ClearDepthf(d)
|
||||
}
|
||||
|
||||
func (b *Backend) ClearColor(colR, colG, colB, colA float32) {
|
||||
b.funcs.ClearColor(colR, colG, colB, colA)
|
||||
b.funcs.Clear(DEPTH_BUFFER_BIT)
|
||||
}
|
||||
|
||||
func (b *Backend) DepthFunc(f backend.DepthFunc) {
|
||||
|
||||
Reference in New Issue
Block a user