Open caiolaytynher opened 1 month ago
ditto, also bumped into this one (shader.varying_uv is a float2x3)
#unroll for vi in 0..<3 {
shader.varying_uv[vi] = vertices[t[vi]].xy
}
fails with a dump, where this works
shader.varying_uv[0] = vertices[t[0]].xy
shader.varying_uv[1] = vertices[t[1]].xy
shader.varying_uv[2] = vertices[t[2]].xy
so constants works via indexing
Context
When you define a vector as a compile time constant, you can only access it's fields with compile time constants. That's not the case with matrices, you can access the fields of a compile time constant matrix with variables just fine. However, trying to access a globally defined matrix inside of a procedure, if it is not a constant value it gives a llvm compile error that is unreadable. However, if you just define the matrix locally to the procedure or pass it by argument, the error stops.
I don't know if this is intended or not, but definitely seems like this shouldn't happen. If otherwise this is intended, then I suggest working on the compile error.
Odin and OS Info
Odin: dev-2024-07:fc5ce30 OS: Windows 10 Professional (version: 22H2), build 19045.4651 CPU: AMD Ryzen 5 5500U with Radeon Graphics RAM: 5989 MiB Backend: LLVM 18.1.8
Expected Behavior
I should be able to use matrices defined as variables in the global scope with other variables as indexes without having to pass the matrix as an argument.
Current Behavior
If you define a matrix in the global scope that is being used inside of a procedure, then trying to access it's fields using variables gives compile errors.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Just run the following:
Failure Logs
Error: