ebiten: Add comments about shaders

This commit is contained in:
Hajime Hoshi 2020-09-23 17:13:18 +09:00
parent dc2662e463
commit 14fc77f776

View File

@ -103,12 +103,20 @@ func __vertex(position vec2, texCoord vec2, color vec4) (vec4, vec2, vec4) {
`
}
// Shader represents a compiled shader program.
//
// For the details about the shader, see https://ebiten.org/documents/shader.html.
type Shader struct {
shader *mipmap.Shader
uniformNames []string
uniformTypes []shaderir.Type
}
// NewShader compiles a shader program in the shading language Kage, and retruns the result.
//
// If the compilation fails, NewShader returns an error.
//
// For the details about the shader, see https://ebiten.org/documents/shader.html.
func NewShader(src []byte) (*Shader, error) {
var buf bytes.Buffer
buf.Write(src)
@ -143,6 +151,8 @@ func NewShader(src []byte) (*Shader, error) {
}, nil
}
// Dispose disposes the shader program.
// After disposing, the shader is no longer available.
func (s *Shader) Dispose() {
s.shader.MarkDisposed()
s.shader = nil