mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
gpu,gpu/gl: implement shader uniform buffers
Emulate them for the OpenGL ES backend because 2.0 doesn't support uniform buffers. The future d3d backend only supports uniform (constant) buffers. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+8
-7
@@ -41,10 +41,11 @@ type Backend interface {
|
||||
}
|
||||
|
||||
type ShaderSources struct {
|
||||
GLES2 string
|
||||
HLSL []byte
|
||||
Uniforms []UniformLocation
|
||||
Inputs []InputLocation
|
||||
GLES2 string
|
||||
HLSL []byte
|
||||
Uniforms []UniformLocation
|
||||
UniformSize int
|
||||
Inputs []InputLocation
|
||||
}
|
||||
|
||||
type UniformLocation struct {
|
||||
@@ -106,11 +107,10 @@ type Caps struct {
|
||||
type Program interface {
|
||||
Bind()
|
||||
Release()
|
||||
SetVertexUniforms(buf Buffer)
|
||||
SetFragmentUniforms(buf Buffer)
|
||||
UniformFor(uniform string) Uniform
|
||||
Uniform1i(u Uniform, v int)
|
||||
Uniform1f(u Uniform, v float32)
|
||||
Uniform2f(u Uniform, v0, v1 float32)
|
||||
Uniform4f(u Uniform, v0, v1, v2, v3 float32)
|
||||
}
|
||||
|
||||
type Uniform interface{}
|
||||
@@ -161,6 +161,7 @@ const (
|
||||
const (
|
||||
BufferTypeIndices BufferType = iota
|
||||
BufferTypeVertices
|
||||
BufferTypeUniforms
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user