mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/shader: use strings.TrimPrefix
This commit is contained in:
parent
7142a3bcd9
commit
107189a00d
@ -31,32 +31,24 @@ import (
|
||||
|
||||
func glslVertexNormalize(str string) string {
|
||||
p := glsl.VertexPrelude(glsl.GLSLVersionDefault)
|
||||
if strings.HasPrefix(str, p) {
|
||||
str = str[len(p):]
|
||||
}
|
||||
str = strings.TrimPrefix(str, p)
|
||||
return strings.TrimSpace(str)
|
||||
}
|
||||
|
||||
func glslFragmentNormalize(str string) string {
|
||||
p := glsl.FragmentPrelude(glsl.GLSLVersionDefault)
|
||||
if strings.HasPrefix(str, p) {
|
||||
str = str[len(p):]
|
||||
}
|
||||
str = strings.TrimPrefix(str, p)
|
||||
return strings.TrimSpace(str)
|
||||
}
|
||||
|
||||
func hlslNormalize(str string) string {
|
||||
if strings.HasPrefix(str, hlsl.Prelude) {
|
||||
str = str[len(hlsl.Prelude):]
|
||||
}
|
||||
str = strings.TrimPrefix(str, hlsl.Prelude)
|
||||
return strings.TrimSpace(str)
|
||||
}
|
||||
|
||||
func metalNormalize(str string) string {
|
||||
prelude := msl.Prelude(shaderir.Texels)
|
||||
if strings.HasPrefix(str, prelude) {
|
||||
str = str[len(prelude):]
|
||||
}
|
||||
str = strings.TrimPrefix(str, prelude)
|
||||
return strings.TrimSpace(str)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user