mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
internal/shader: bug fix: wrong indexing
This commit is contained in:
parent
41b762ba2c
commit
e2662a8af7
@ -824,10 +824,11 @@ func (cs *compileState) parseFunc(block *block, d *ast.FuncDecl) (function, bool
|
|||||||
// The 0th inParams is a special variable for position and is not included in varying variables.
|
// The 0th inParams is a special variable for position and is not included in varying variables.
|
||||||
if diff := len(cs.ir.Varyings) - (len(inParams) - 1); diff > 0 {
|
if diff := len(cs.ir.Varyings) - (len(inParams) - 1); diff > 0 {
|
||||||
// inParams is not enough when the vertex shader has more returning values than the fragment shader's arguments.
|
// inParams is not enough when the vertex shader has more returning values than the fragment shader's arguments.
|
||||||
|
orig := len(inParams) - 1
|
||||||
for i := 0; i < diff; i++ {
|
for i := 0; i < diff; i++ {
|
||||||
inParams = append(inParams, variable{
|
inParams = append(inParams, variable{
|
||||||
name: "_",
|
name: "_",
|
||||||
typ: cs.ir.Varyings[len(inParams)-1+i],
|
typ: cs.ir.Varyings[orig+i],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user