Skip to content

Commit

Permalink
internal/builtinshader: move a clearing shader to builtinshader
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed May 4, 2024
1 parent ca9a806 commit d7df5eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 1 addition & 7 deletions internal/atlas/shader.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,7 @@ func init() {
return nil
})
wg.Go(func() error {
ir, err := graphics.CompileShader([]byte(`//kage:unit pixels
package main
func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 {
return vec4(0)
}`))
ir, err := graphics.CompileShader([]byte(builtinshader.ClearShaderSource))
if err != nil {
return fmt.Errorf("atlas: compiling the clear shader failed: %w", err)
}
Expand Down
9 changes: 9 additions & 0 deletions internal/builtinshader/shader.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,12 @@ func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 {
return mix(mix(c0, c1, rate.x), mix(c2, c3, rate.x), rate.y)
}
`)

var ClearShaderSource = []byte(`//kage:unit pixels
package main
func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 {
return vec4(0)
}
`)

0 comments on commit d7df5eb

Please sign in to comment.