mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
app,gpu: move errDeviceLost from package app to package gpu
The Vulkan backend can return device lost error from more than just Present. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -70,7 +70,7 @@ func (c *d3d11Context) Present() error {
|
||||
// Ignore
|
||||
return nil
|
||||
case d3d11.DXGI_ERROR_DEVICE_RESET, d3d11.DXGI_ERROR_DEVICE_REMOVED, d3d11.D3DDDIERR_DEVICEREMOVED:
|
||||
return errDeviceLost
|
||||
return gpu.ErrDeviceLost
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
||||
@@ -113,11 +113,6 @@ type context interface {
|
||||
Unlock()
|
||||
}
|
||||
|
||||
// errDeviceLost is returned from Context.Present when
|
||||
// the underlying GPU device is gone and should be
|
||||
// recreated.
|
||||
var errDeviceLost = errors.New("GPU device lost")
|
||||
|
||||
// Driver is the interface for the platform implementation
|
||||
// of a window.
|
||||
type driver interface {
|
||||
|
||||
+2
-2
@@ -153,7 +153,7 @@ func (w *Window) validateAndProcess(frameStart time.Time, size image.Point, sync
|
||||
})
|
||||
if err != nil {
|
||||
w.destroyGPU()
|
||||
if err == errDeviceLost {
|
||||
if errors.Is(err, gpu.ErrDeviceLost) {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
@@ -175,7 +175,7 @@ func (w *Window) validateAndProcess(frameStart time.Time, size image.Point, sync
|
||||
if w.gpu != nil {
|
||||
if err := w.render(frame, size); err != nil {
|
||||
w.destroyGPU()
|
||||
if err == errDeviceLost {
|
||||
if errors.Is(err, gpu.ErrDeviceLost) {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
|
||||
@@ -28,3 +28,7 @@ type Direct3D11 = driver.Direct3D11
|
||||
|
||||
// Metal denotes the Apple Metal API.
|
||||
type Metal = driver.Metal
|
||||
|
||||
// ErrDeviceLost is returned from GPU operations when the underlying GPU device
|
||||
// is lost and should be recreated.
|
||||
var ErrDeviceLost = driver.ErrDeviceLost
|
||||
|
||||
@@ -54,6 +54,8 @@ type Device interface {
|
||||
Release()
|
||||
}
|
||||
|
||||
var ErrDeviceLost = errors.New("GPU device lost")
|
||||
|
||||
type LoadDesc struct {
|
||||
Action LoadAction
|
||||
ClearColor f32color.RGBA
|
||||
|
||||
Reference in New Issue
Block a user