mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 01:45:36 +00:00
gpu/internal/driver: rename gpu/backend
There are no longer any importers of package backend outside of gioui.org/gpu. Move it internally, and rename it to the slightly more specific "driver" while we're at it. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
||||
"sync"
|
||||
"text/template"
|
||||
|
||||
"gioui.org/gpu/backend"
|
||||
"gioui.org/gpu/internal/driver"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -138,7 +138,7 @@ func (conv *Converter) Run(out io.Writer) error {
|
||||
|
||||
type ShaderResult struct {
|
||||
Path string
|
||||
Shaders []backend.ShaderSources
|
||||
Shaders []driver.ShaderSources
|
||||
Error error
|
||||
}
|
||||
shaderResults := make([]ShaderResult, len(shaders))
|
||||
@@ -187,7 +187,7 @@ func (conv *Converter) Run(out io.Writer) error {
|
||||
|
||||
fmt.Fprintf(out, "// Code generated by build.go. DO NOT EDIT.\n\n")
|
||||
fmt.Fprintf(out, "package %s\n\n", conv.packageName)
|
||||
fmt.Fprintf(out, "import %q\n\n", "gioui.org/gpu/backend")
|
||||
fmt.Fprintf(out, "import %q\n\n", "gioui.org/gpu/internal/driver")
|
||||
|
||||
fmt.Fprintf(out, "var (\n")
|
||||
|
||||
@@ -202,17 +202,17 @@ func (conv *Converter) Run(out io.Writer) error {
|
||||
|
||||
multiVariant := len(r.Shaders) > 1
|
||||
if multiVariant {
|
||||
fmt.Fprintf(out, "[...]backend.ShaderSources{\n")
|
||||
fmt.Fprintf(out, "[...]driver.ShaderSources{\n")
|
||||
}
|
||||
|
||||
for _, src := range r.Shaders {
|
||||
fmt.Fprintf(out, "backend.ShaderSources{\n")
|
||||
fmt.Fprintf(out, "driver.ShaderSources{\n")
|
||||
fmt.Fprintf(out, "Name: %#v,\n", src.Name)
|
||||
if len(src.Inputs) > 0 {
|
||||
fmt.Fprintf(out, "Inputs: %#v,\n", src.Inputs)
|
||||
}
|
||||
if u := src.Uniforms; len(u.Blocks) > 0 {
|
||||
fmt.Fprintf(out, "Uniforms: backend.UniformsReflection{\n")
|
||||
fmt.Fprintf(out, "Uniforms: driver.UniformsReflection{\n")
|
||||
fmt.Fprintf(out, "Blocks: %#v,\n", u.Blocks)
|
||||
fmt.Fprintf(out, "Locations: %#v,\n", u.Locations)
|
||||
fmt.Fprintf(out, "Size: %d,\n", u.Size)
|
||||
@@ -254,7 +254,7 @@ func (conv *Converter) Run(out io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (conv *Converter) Shader(shaderPath string) ([]backend.ShaderSources, error) {
|
||||
func (conv *Converter) Shader(shaderPath string) ([]driver.ShaderSources, error) {
|
||||
type Variant struct {
|
||||
FetchColorExpr string
|
||||
Header string
|
||||
@@ -279,7 +279,7 @@ func (conv *Converter) Shader(shaderPath string) ([]backend.ShaderSources, error
|
||||
return nil, fmt.Errorf("failed to parse template %q: %w", shaderPath, err)
|
||||
}
|
||||
|
||||
var variants []backend.ShaderSources
|
||||
var variants []driver.ShaderSources
|
||||
for i, variantArg := range variantArgs {
|
||||
variantName := strconv.Itoa(i)
|
||||
var buf bytes.Buffer
|
||||
@@ -288,7 +288,7 @@ func (conv *Converter) Shader(shaderPath string) ([]backend.ShaderSources, error
|
||||
return nil, fmt.Errorf("failed to execute template %q with %#v: %w", shaderPath, variantArg, err)
|
||||
}
|
||||
|
||||
var sources backend.ShaderSources
|
||||
var sources driver.ShaderSources
|
||||
sources.Name = filepath.Base(shaderPath)
|
||||
|
||||
// Ignore error; some shaders are not meant to run in GLSL 1.00.
|
||||
@@ -341,7 +341,7 @@ func (conv *Converter) Shader(shaderPath string) ([]backend.ShaderSources, error
|
||||
return variants, nil
|
||||
}
|
||||
|
||||
func (conv *Converter) ComputeShader(shaderPath string) ([]backend.ShaderSources, error) {
|
||||
func (conv *Converter) ComputeShader(shaderPath string) ([]driver.ShaderSources, error) {
|
||||
shader, err := ioutil.ReadFile(shaderPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load shader %q: %w", shaderPath, err)
|
||||
@@ -352,7 +352,7 @@ func (conv *Converter) ComputeShader(shaderPath string) ([]backend.ShaderSources
|
||||
return nil, fmt.Errorf("failed to convert compute shader %q: %w", shaderPath, err)
|
||||
}
|
||||
|
||||
var sources backend.ShaderSources
|
||||
var sources driver.ShaderSources
|
||||
sources.Name = filepath.Base(shaderPath)
|
||||
|
||||
sources.GLSL310ES, err = conv.spirv.Convert(spirv, "es", "310")
|
||||
@@ -373,7 +373,7 @@ func (conv *Converter) ComputeShader(shaderPath string) ([]backend.ShaderSources
|
||||
}
|
||||
}
|
||||
|
||||
return []backend.ShaderSources{sources}, nil
|
||||
return []driver.ShaderSources{sources}, nil
|
||||
}
|
||||
|
||||
// Workers implements wait group with synchronous logging.
|
||||
|
||||
Reference in New Issue
Block a user