From 8140e39c2087b33ca3317211d7a24494be752064 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Tue, 17 Aug 2021 09:44:17 +0200 Subject: [PATCH] go.*,gpu: use gioui.org/cpu.Supported to determine CPU fallback support Signed-off-by: Elias Naur --- go.mod | 2 +- go.sum | 3 ++- gpu/compute.go | 2 +- gpu/cpu.go | 3 --- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 1cfdc3b1..5e80aca6 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,6 @@ 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 ) diff --git a/go.sum b/go.sum index 7a4f8c29..db12785c 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,9 @@ 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= 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-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/go.mod h1:mWdiME581d/kV7/iEhLmUgUK5iZ09XR5XpduXzbePVM= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= diff --git a/gpu/compute.go b/gpu/compute.go index dd7e5bfc..cffc6353 100644 --- a/gpu/compute.go +++ b/gpu/compute.go @@ -403,7 +403,7 @@ func newCompute(ctx driver.Device) (*compute, error) { {&g.programs.kernel4, piet.Shader_kernel4_comp, piet.Kernel4ProgramInfo}, } if !caps.Features.Has(driver.FeatureCompute) { - if !supportsCPUCompute { + if !cpu.Supported { return nil, errors.New("gpu: missing support for compute programs") } g.useCPU = true diff --git a/gpu/cpu.go b/gpu/cpu.go index 3e6e714d..f2f84ad0 100644 --- a/gpu/cpu.go +++ b/gpu/cpu.go @@ -3,14 +3,11 @@ package gpu import ( - "runtime" "unsafe" "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. // dispatcher dispatches CPU compute programs across multiple goroutines.