mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
gpu,gpu/backend: [compute] handle loss of buffer contents during download
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"image"
|
||||
"time"
|
||||
)
|
||||
@@ -225,6 +226,8 @@ const (
|
||||
BlendFactorDstColor
|
||||
)
|
||||
|
||||
var ErrContentLost = errors.New("buffer content lost")
|
||||
|
||||
func (f Features) Has(feats Features) bool {
|
||||
return f&feats == feats
|
||||
}
|
||||
|
||||
@@ -821,6 +821,9 @@ func (g *compute) render(tileDims image.Point) error {
|
||||
t.kernel4.end()
|
||||
|
||||
if err := g.buffers.memory.buffer.Download(gunsafe.StructView(g.memHeader)); err != nil {
|
||||
if err == backend.ErrContentLost {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
switch errCode := g.memHeader.mem_error; errCode {
|
||||
|
||||
+1
-1
@@ -704,7 +704,7 @@ func (b *gpuBuffer) Download(data []byte) error {
|
||||
}
|
||||
copy(data, bufferMap)
|
||||
if !b.backend.funcs.UnmapBuffer(firstBinding) {
|
||||
return errors.New("buffer content lost")
|
||||
return backend.ErrContentLost
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user