forked from joejulian/gio
go.*,gpu: use gioui.org/cpu.Supported to determine CPU fallback support
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -9,6 +9,6 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
gioui.org/cpu v0.0.0-20210808092351-bfe733dd3334
|
gioui.org/cpu v0.0.0-20210817074228-f6e4eef8cf21
|
||||||
gioui.org/shader v0.0.0-20210816161847-c12352edbd45
|
gioui.org/shader v0.0.0-20210816161847-c12352edbd45
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
gioui.org/cpu v0.0.0-20210808092351-bfe733dd3334 h1:1xK224B5DnjlPKCfVDTl7+olrzgAXn4ym6dum3l34rs=
|
|
||||||
gioui.org/cpu v0.0.0-20210808092351-bfe733dd3334/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
|
gioui.org/cpu v0.0.0-20210808092351-bfe733dd3334/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
|
||||||
|
gioui.org/cpu v0.0.0-20210817074228-f6e4eef8cf21 h1:RyDnd+yA8dL3Co+hFXC4VDJkKRQVS1EvDFmn7N3VMCo=
|
||||||
|
gioui.org/cpu v0.0.0-20210817074228-f6e4eef8cf21/go.mod h1:A8M0Cn5o+vY5LTMlnRoK3O5kG+rH0kWfJjeKd9QpBmQ=
|
||||||
gioui.org/shader v0.0.0-20210816161847-c12352edbd45 h1:tWCgnOK33iYKNvQ4ctNHBknZ6r273Na82wcTOFc29ZM=
|
gioui.org/shader v0.0.0-20210816161847-c12352edbd45 h1:tWCgnOK33iYKNvQ4ctNHBknZ6r273Na82wcTOFc29ZM=
|
||||||
gioui.org/shader v0.0.0-20210816161847-c12352edbd45/go.mod h1:mWdiME581d/kV7/iEhLmUgUK5iZ09XR5XpduXzbePVM=
|
gioui.org/shader v0.0.0-20210816161847-c12352edbd45/go.mod h1:mWdiME581d/kV7/iEhLmUgUK5iZ09XR5XpduXzbePVM=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
|||||||
+1
-1
@@ -403,7 +403,7 @@ func newCompute(ctx driver.Device) (*compute, error) {
|
|||||||
{&g.programs.kernel4, piet.Shader_kernel4_comp, piet.Kernel4ProgramInfo},
|
{&g.programs.kernel4, piet.Shader_kernel4_comp, piet.Kernel4ProgramInfo},
|
||||||
}
|
}
|
||||||
if !caps.Features.Has(driver.FeatureCompute) {
|
if !caps.Features.Has(driver.FeatureCompute) {
|
||||||
if !supportsCPUCompute {
|
if !cpu.Supported {
|
||||||
return nil, errors.New("gpu: missing support for compute programs")
|
return nil, errors.New("gpu: missing support for compute programs")
|
||||||
}
|
}
|
||||||
g.useCPU = true
|
g.useCPU = true
|
||||||
|
|||||||
@@ -3,14 +3,11 @@
|
|||||||
package gpu
|
package gpu
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"gioui.org/cpu"
|
"gioui.org/cpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
const supportsCPUCompute = runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64" || runtime.GOARCH == "arm"
|
|
||||||
|
|
||||||
// This file contains code specific to running compute shaders on the CPU.
|
// This file contains code specific to running compute shaders on the CPU.
|
||||||
|
|
||||||
// dispatcher dispatches CPU compute programs across multiple goroutines.
|
// dispatcher dispatches CPU compute programs across multiple goroutines.
|
||||||
|
|||||||
Reference in New Issue
Block a user