Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kage: compilation panic on partial function expr #2989

Open
1 of 11 tasks
Zyko0 opened this issue May 15, 2024 · 0 comments
Open
1 of 11 tasks

Kage: compilation panic on partial function expr #2989

Zyko0 opened this issue May 15, 2024 · 0 comments

Comments

@Zyko0
Copy link
Contributor

Zyko0 commented May 15, 2024

Ebitengine Version

v2.8.0-alpha.1.0.20240512060738-5bb060b1e9a9

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

Go Version (go version)

1.21.1

What steps will reproduce the problem?

Trying to compile:

func Fragment(dst vec4, src vec2, color vec4) vec4 {
  return vec4(0)+imageSrc3At
}

What is the expected result?

Compilation error

What happens instead?

Panic:

panic: runtime error: index out of range [0] with length 0

goroutine 51 [running]:
github.com/hajimehoshi/ebiten/v2/internal/shader.(*compileState).parseExpr
        github.com/hajimehoshi/ebiten/v2@v2.8.0-alpha.1.0.20240512060738-5bb060b1e9a9/internal/shader/expr.go:91
github.com/hajimehoshi/ebiten/v2/internal/shader.(*compileState).parseStmt
        github.com/hajimehoshi/ebiten/v2@v2.8.0-alpha.1.0.20240512060738-5bb060b1e9a9/internal/shader/stmt.go:348
github.com/hajimehoshi/ebiten/v2/internal/shader.(*compileState).parseBlock
        github.com/hajimehoshi/ebiten/v2@v2.8.0-alpha.1.0.20240512060738-5bb060b1e9a9/internal/shader/shader.go:934
github.com/hajimehoshi/ebiten/v2/internal/shader.(*compileState).parseFunc
        github.com/hajimehoshi/ebiten/v2@v2.8.0-alpha.1.0.20240512060738-5bb060b1e9a9/internal/shader/shader.go:840
github.com/hajimehoshi/ebiten/v2/internal/shader.(*compileState).parseDecl
        github.com/hajimehoshi/ebiten/v2@v2.8.0-alpha.1.0.20240512060738-5bb060b1e9a9/internal/shader/shader.go:452
github.com/hajimehoshi/ebiten/v2/internal/shader.(*compileState).parse
        github.com/hajimehoshi/ebiten/v2@v2.8.0-alpha.1.0.20240512060738-5bb060b1e9a9/internal/shader/shader.go:339
github.com/hajimehoshi/ebiten/v2/internal/shader.Compile
        github.com/hajimehoshi/ebiten/v2@v2.8.0-alpha.1.0.20240512060738-5bb060b1e9a9/internal/shader/shader.go:207
github.com/hajimehoshi/ebiten/v2/internal/graphics.CompileShader
        github.com/hajimehoshi/ebiten/v2@v2.8.0-alpha.1.0.20240512060738-5bb060b1e9a9/internal/graphics/shader.go:191
github.com/hajimehoshi/ebiten/v2.NewShader

Anything else you feel useful to add?

Not completely related, but this is a valid program, and prob shouldn't:

func Fragment(dst vec4, src vec2, color vec4) vec4 {
  return vec4(1, 0, 0, 1)
  return imageSrc3At // does nothing
}
@Zyko0 Zyko0 added the bug label May 15, 2024
@hajimehoshi hajimehoshi added this to the v2.8.0 milestone May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants