mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 10:25:37 +00:00
gpu: don't allocate null materials buffer when running on the CPU
References: https://todo.sr.ht/~eliasnaur/gio/469 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+7
-6
@@ -404,12 +404,6 @@ func newCompute(ctx driver.Device) (*compute, error) {
|
|||||||
conf: new(config),
|
conf: new(config),
|
||||||
memHeader: new(memoryHeader),
|
memHeader: new(memoryHeader),
|
||||||
}
|
}
|
||||||
null, err := ctx.NewTexture(driver.TextureFormatRGBA8, 1, 1, driver.FilterNearest, driver.FilterNearest, driver.BufferBindingShaderStorageRead)
|
|
||||||
if err != nil {
|
|
||||||
g.Release()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
g.output.nullMaterials = null
|
|
||||||
shaders := []struct {
|
shaders := []struct {
|
||||||
prog *computeProgram
|
prog *computeProgram
|
||||||
src shader.Sources
|
src shader.Sources
|
||||||
@@ -431,6 +425,13 @@ func newCompute(ctx driver.Device) (*compute, error) {
|
|||||||
}
|
}
|
||||||
if g.useCPU {
|
if g.useCPU {
|
||||||
g.dispatcher = newDispatcher(runtime.NumCPU())
|
g.dispatcher = newDispatcher(runtime.NumCPU())
|
||||||
|
} else {
|
||||||
|
null, err := ctx.NewTexture(driver.TextureFormatRGBA8, 1, 1, driver.FilterNearest, driver.FilterNearest, driver.BufferBindingShaderStorageRead)
|
||||||
|
if err != nil {
|
||||||
|
g.Release()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
g.output.nullMaterials = null
|
||||||
}
|
}
|
||||||
|
|
||||||
copyVert, copyFrag, err := newShaders(ctx, gio.Shader_copy_vert, gio.Shader_copy_frag)
|
copyVert, copyFrag, err := newShaders(ctx, gio.Shader_copy_vert, gio.Shader_copy_frag)
|
||||||
|
|||||||
Reference in New Issue
Block a user