mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 20:42:07 +01:00
parent
4940159e5b
commit
406b8a4a08
@ -1464,6 +1464,42 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
func TestShaderOperatorVecAndNumber(t *testing.T) {
|
func TestShaderOperatorVecAndNumber(t *testing.T) {
|
||||||
if _, err := ebiten.NewShader([]byte(`package main
|
if _, err := ebiten.NewShader([]byte(`package main
|
||||||
|
|
||||||
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
|
a := vec2(1) + 2
|
||||||
|
return a.xxyy
|
||||||
|
}`)); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := ebiten.NewShader([]byte(`package main
|
||||||
|
|
||||||
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
|
a := vec2(1) + 2.1
|
||||||
|
return a.xxyy
|
||||||
|
}`)); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := ebiten.NewShader([]byte(`package main
|
||||||
|
|
||||||
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
|
a := vec2(1) % 2
|
||||||
|
return a.xxyy
|
||||||
|
}`)); err == nil {
|
||||||
|
t.Errorf("error must be non-nil but was nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := ebiten.NewShader([]byte(`package main
|
||||||
|
|
||||||
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
|
a := vec2(1) % 2.1
|
||||||
|
return a.xxyy
|
||||||
|
}`)); err == nil {
|
||||||
|
t.Errorf("error must be non-nil but was nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := ebiten.NewShader([]byte(`package main
|
||||||
|
|
||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
a := vec2(1)
|
a := vec2(1)
|
||||||
a += 2
|
a += 2
|
||||||
|
Loading…
Reference in New Issue
Block a user