mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 16:35:36 +00:00
all: switch to external shaders in the gioui.org/shaders module
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user