all: switch to external shaders in the gioui.org/shaders module

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-08-02 17:46:40 +02:00
parent 18b4442393
commit 6aee543234
50 changed files with 112 additions and 11502 deletions
+5 -68
View File
@@ -6,6 +6,8 @@ import (
"errors"
"image"
"time"
"gioui.org/shader"
)
// Device represents the abstraction of underlying GPU
@@ -23,9 +25,9 @@ type Device interface {
NewFramebuffer(tex Texture) (Framebuffer, error)
NewImmutableBuffer(typ BufferBinding, data []byte) (Buffer, error)
NewBuffer(typ BufferBinding, size int) (Buffer, error)
NewComputeProgram(shader ShaderSources) (Program, error)
NewProgram(vertexShader, fragmentShader ShaderSources) (Program, error)
NewInputLayout(vertexShader ShaderSources, layout []InputDesc) (InputLayout, error)
NewComputeProgram(shader shader.Sources) (Program, error)
NewProgram(vertexShader, fragmentShader shader.Sources) (Program, error)
NewInputLayout(vertexShader shader.Sources, layout []shader.InputDesc) (InputLayout, error)
Clear(r, g, b, a float32)
Viewport(x, y, width, height int)
@@ -49,63 +51,6 @@ type Device interface {
Release()
}
type ShaderSources struct {
Name string
GLSL100ES string
GLSL300ES string
GLSL310ES string
GLSL130 string
GLSL150 string
HLSL string
Uniforms UniformsReflection
Inputs []InputLocation
Textures []TextureBinding
Hash string
}
type UniformsReflection struct {
Blocks []UniformBlock
Locations []UniformLocation
Size int
}
type TextureBinding struct {
Name string
Binding int
}
type UniformBlock struct {
Name string
Binding int
}
type UniformLocation struct {
Name string
Type DataType
Size int
Offset int
}
type InputLocation struct {
// For GLSL.
Name string
Location int
// For HLSL.
Semantic string
SemanticIndex int
Type DataType
Size int
}
// InputDesc describes a vertex attribute as laid out in a Buffer.
type InputDesc struct {
Type DataType
Size int
Offset int
}
// InputLayout is the driver specific representation of the mapping
// between Buffers and shader attributes.
type InputLayout interface {
@@ -123,8 +68,6 @@ type TextureFormat uint8
type BufferBinding uint8
type DataType uint8
type Features uint
type Caps struct {
@@ -167,12 +110,6 @@ type Texture interface {
Release()
}
const (
DataTypeFloat DataType = iota
DataTypeInt
DataTypeShort
)
const (
BufferBindingIndices BufferBinding = 1 << iota
BufferBindingVertices