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:
Elias Naur
2020-03-15 12:20:19 +01:00
parent daecdcaabf
commit 7fba3bb8fe
7 changed files with 24 additions and 53 deletions
+4 -13
View File
@@ -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) {