refactoring finished
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gogpu/gputypes"
|
||||
@@ -47,7 +46,7 @@ var _ FrameGenerator = (*WGPUGenerator)(nil)
|
||||
// WGPUOption customizes NewWGPUGenerator.
|
||||
type WGPUOption func(*WGPUGenerator)
|
||||
|
||||
func NewWGPUGenerator(width, height uint, kernelPath string, opts ...WGPUOption) (*WGPUGenerator, error) {
|
||||
func NewWGPUGenerator(width, height uint, wgsl string, opts ...WGPUOption) (*WGPUGenerator, error) {
|
||||
g := &WGPUGenerator{
|
||||
width: int(width),
|
||||
height: int(height),
|
||||
@@ -75,13 +74,8 @@ func NewWGPUGenerator(width, height uint, kernelPath string, opts ...WGPUOption)
|
||||
}
|
||||
g.queue = g.device.Queue()
|
||||
|
||||
wgsl, err := os.ReadFile(kernelPath)
|
||||
if err != nil {
|
||||
g.Close()
|
||||
return nil, fmt.Errorf("wgpu: read kernel: %w", err)
|
||||
}
|
||||
if g.shader, err = g.device.CreateShaderModule(&wgpu.ShaderModuleDescriptor{
|
||||
Label: "v210-shader", WGSL: string(wgsl),
|
||||
Label: "v210-shader", WGSL: wgsl,
|
||||
}); err != nil {
|
||||
g.Close()
|
||||
return nil, fmt.Errorf("wgpu: shader: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user