mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
Revert "internal/shader: reland: bug fix: int + ivec failed"
This reverts commit 1c4a0ac0dc
.
Reason: TestShaderUniformMatrix2 failed on Windows
Updates #2707
This commit is contained in:
parent
1c4a0ac0dc
commit
8aefa49510
@ -195,14 +195,14 @@ func (cs *compileState) parseExpr(block *block, fname string, expr ast.Expr, mar
|
|||||||
t = lhst
|
t = lhst
|
||||||
case lhst.Equal(&rhst):
|
case lhst.Equal(&rhst):
|
||||||
t = lhst
|
t = lhst
|
||||||
case op2 == shaderir.MatrixMul && (lhst.Main == shaderir.Float || lhst.IsVector()) && rhst.IsMatrix():
|
case lhst.Main == shaderir.Float:
|
||||||
t = lhst
|
|
||||||
case op2 == shaderir.MatrixMul && lhst.IsMatrix() && (rhst.Main == shaderir.Float || rhst.IsVector()):
|
|
||||||
t = rhst
|
t = rhst
|
||||||
case (lhst.Main == shaderir.Float || lhst.Main == shaderir.Int) && rhst.IsVector():
|
case rhst.Main == shaderir.Float:
|
||||||
t = rhst
|
|
||||||
case lhst.IsVector() && (rhst.Main == shaderir.Float || rhst.Main == shaderir.Int):
|
|
||||||
t = lhst
|
t = lhst
|
||||||
|
case op2 == shaderir.MatrixMul && lhst.IsVector() && rhst.IsMatrix():
|
||||||
|
t = lhst
|
||||||
|
case op2 == shaderir.MatrixMul && lhst.IsMatrix() && rhst.IsVector():
|
||||||
|
t = rhst
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("shaderir: invalid expression: %s %s %s", lhst.String(), e.Op, rhst.String()))
|
panic(fmt.Sprintf("shaderir: invalid expression: %s %s %s", lhst.String(), e.Op, rhst.String()))
|
||||||
}
|
}
|
||||||
|
@ -3291,53 +3291,3 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue #2706
|
|
||||||
func TestSyntaxScalarAndVector(t *testing.T) {
|
|
||||||
cases := []struct {
|
|
||||||
stmt string
|
|
||||||
err bool
|
|
||||||
}{
|
|
||||||
{stmt: "a := vec2(1) + 1; var b vec2 = a; _ = b", err: false},
|
|
||||||
{stmt: "a := 1 + vec2(1); var b vec2 = a; _ = b", err: false},
|
|
||||||
{stmt: "a := vec2(1); b := 1; var c vec2 = a + b; _ = c", err: true},
|
|
||||||
{stmt: "a := vec2(1); b := 1; var c vec2 = b + a; _ = c", err: true},
|
|
||||||
{stmt: "a := vec2(1) + 1.0; var b vec2 = a; _ = b", err: false},
|
|
||||||
{stmt: "a := 1.0 + vec2(1); var b vec2 = a; _ = b", err: false},
|
|
||||||
{stmt: "a := vec2(1); b := 1.0; var c vec2 = a + b; _ = c", err: false},
|
|
||||||
{stmt: "a := vec2(1); b := 1.0; var c vec2 = b + a; _ = c", err: false},
|
|
||||||
{stmt: "a := vec2(1) + 1.1; var b vec2 = a; _ = b", err: false},
|
|
||||||
{stmt: "a := 1.1 + vec2(1); var b vec2 = a; _ = b", err: false},
|
|
||||||
{stmt: "a := vec2(1); b := 1.1; var c vec2 = a + b; _ = c", err: false},
|
|
||||||
{stmt: "a := vec2(1); b := 1.1; var c vec2 = b + a; _ = c", err: false},
|
|
||||||
|
|
||||||
{stmt: "a := ivec2(1) + 1; var b ivec2 = a; _ = b", err: false},
|
|
||||||
{stmt: "a := 1 + ivec2(1); var b ivec2 = a; _ = b", err: false},
|
|
||||||
{stmt: "a := ivec2(1); b := 1; var c ivec2 = a + b; _ = c", err: false},
|
|
||||||
{stmt: "a := ivec2(1); b := 1; var c ivec2 = b + a; _ = c", err: false},
|
|
||||||
{stmt: "a := ivec2(1) + 1.0; var b ivec2 = a; _ = b", err: false},
|
|
||||||
{stmt: "a := 1.0 + ivec2(1); var b ivec2 = a; _ = b", err: false},
|
|
||||||
{stmt: "a := ivec2(1); b := 1.0; var c ivec2 = a + b; _ = c", err: true},
|
|
||||||
{stmt: "a := ivec2(1); b := 1.0; var c ivec2 = b + a; _ = c", err: true},
|
|
||||||
{stmt: "a := ivec2(1) + 1.1; var b ivec2 = a; _ = b", err: true},
|
|
||||||
{stmt: "a := 1.1 + ivec2(1); var b ivec2 = a; _ = b", err: true},
|
|
||||||
{stmt: "a := ivec2(1); b := 1.1; var c ivec2 = a + b; _ = c", err: true},
|
|
||||||
{stmt: "a := ivec2(1); b := 1.1; var c ivec2 = b + a; _ = c", err: true},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, c := range cases {
|
|
||||||
stmt := c.stmt
|
|
||||||
src := fmt.Sprintf(`package main
|
|
||||||
|
|
||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|
||||||
%s
|
|
||||||
return position
|
|
||||||
}`, stmt)
|
|
||||||
_, err := compileToIR([]byte(src))
|
|
||||||
if err == nil && c.err {
|
|
||||||
t.Errorf("%s must return an error but does not", stmt)
|
|
||||||
} else if err != nil && !c.err {
|
|
||||||
t.Errorf("%s must not return nil but returned %v", stmt, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user