mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55: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
|
// Ignore
|
||||||
return nil
|
return nil
|
||||||
case d3d11.DXGI_ERROR_DEVICE_RESET, d3d11.DXGI_ERROR_DEVICE_REMOVED, d3d11.D3DDDIERR_DEVICEREMOVED:
|
case d3d11.DXGI_ERROR_DEVICE_RESET, d3d11.DXGI_ERROR_DEVICE_REMOVED, d3d11.D3DDDIERR_DEVICEREMOVED:
|
||||||
return errDeviceLost
|
return gpu.ErrDeviceLost
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -113,11 +113,6 @@ type context interface {
|
|||||||
Unlock()
|
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
|
// Driver is the interface for the platform implementation
|
||||||
// of a window.
|
// of a window.
|
||||||
type driver interface {
|
type driver interface {
|
||||||
|
|||||||
+2
-2
@@ -153,7 +153,7 @@ func (w *Window) validateAndProcess(frameStart time.Time, size image.Point, sync
|
|||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.destroyGPU()
|
w.destroyGPU()
|
||||||
if err == errDeviceLost {
|
if errors.Is(err, gpu.ErrDeviceLost) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
@@ -175,7 +175,7 @@ func (w *Window) validateAndProcess(frameStart time.Time, size image.Point, sync
|
|||||||
if w.gpu != nil {
|
if w.gpu != nil {
|
||||||
if err := w.render(frame, size); err != nil {
|
if err := w.render(frame, size); err != nil {
|
||||||
w.destroyGPU()
|
w.destroyGPU()
|
||||||
if err == errDeviceLost {
|
if errors.Is(err, gpu.ErrDeviceLost) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -28,3 +28,7 @@ type Direct3D11 = driver.Direct3D11
|
|||||||
|
|
||||||
// Metal denotes the Apple Metal API.
|
// Metal denotes the Apple Metal API.
|
||||||
type Metal = driver.Metal
|
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()
|
Release()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ErrDeviceLost = errors.New("GPU device lost")
|
||||||
|
|
||||||
type LoadDesc struct {
|
type LoadDesc struct {
|
||||||
Action LoadAction
|
Action LoadAction
|
||||||
ClearColor f32color.RGBA
|
ClearColor f32color.RGBA
|
||||||
|
|||||||
Reference in New Issue
Block a user