mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
shaderir: Change the param order
This commit is contained in:
parent
3118657fff
commit
fa5b2ed730
@ -249,10 +249,10 @@ func (p *Program) glslBlock(b *Block, level int, localVarIndex int) []string {
|
||||
switch {
|
||||
case idx < na:
|
||||
return fmt.Sprintf("A%d", idx)
|
||||
case idx < na+nv:
|
||||
return fmt.Sprintf("V%d", idx-na)
|
||||
case idx == na+nv:
|
||||
case idx == na:
|
||||
return "gl_Position"
|
||||
case idx < na+nv+1:
|
||||
return fmt.Sprintf("V%d", idx-na-1)
|
||||
default:
|
||||
return fmt.Sprintf("l%d", idx-(na+nv+1))
|
||||
}
|
||||
|
@ -646,15 +646,15 @@ varying vec3 V0;`,
|
||||
Block: block(
|
||||
nil,
|
||||
assignStmt(
|
||||
localVariableExpr(5),
|
||||
localVariableExpr(3),
|
||||
localVariableExpr(0),
|
||||
),
|
||||
assignStmt(
|
||||
localVariableExpr(3),
|
||||
localVariableExpr(4),
|
||||
localVariableExpr(1),
|
||||
),
|
||||
assignStmt(
|
||||
localVariableExpr(4),
|
||||
localVariableExpr(5),
|
||||
localVariableExpr(2),
|
||||
),
|
||||
),
|
||||
@ -695,15 +695,15 @@ varying vec2 V1;`,
|
||||
Block: block(
|
||||
nil,
|
||||
assignStmt(
|
||||
localVariableExpr(5),
|
||||
localVariableExpr(3),
|
||||
localVariableExpr(0),
|
||||
),
|
||||
assignStmt(
|
||||
localVariableExpr(3),
|
||||
localVariableExpr(4),
|
||||
localVariableExpr(1),
|
||||
),
|
||||
assignStmt(
|
||||
localVariableExpr(4),
|
||||
localVariableExpr(5),
|
||||
localVariableExpr(2),
|
||||
),
|
||||
),
|
||||
|
@ -37,10 +37,10 @@ type Func struct {
|
||||
}
|
||||
|
||||
// VertexFunc takes pseudo params, and the number if len(attributes) + len(varyings) + 1.
|
||||
// If 0 <= index < len(attributes), the params are in-params and treated as attribute variables.
|
||||
// If len(attributes) <= index < len(attributes) + len(varyings), the params are out-params and treated as varying
|
||||
// variables.
|
||||
// The last param represents the position in vec4 (gl_Position in GLSL).
|
||||
// If 0 <= index < len(attributes), the params are in-params and represent attribute variables.
|
||||
// If index == len(attributes), the param is an out-param and repesents the position in vec4 (gl_Position in GLSL)
|
||||
// If len(attributes) + 1 <= index < len(attributes) + len(varyings) + 1, the params are out-params and represent
|
||||
// varying variables.
|
||||
type VertexFunc struct {
|
||||
Block Block
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ var (
|
||||
Exprs: []shaderir.Expr{
|
||||
{
|
||||
Type: shaderir.LocalVariable,
|
||||
Index: 4, // the varying variable
|
||||
Index: 5, // the varying variable
|
||||
},
|
||||
{
|
||||
Type: shaderir.LocalVariable,
|
||||
@ -172,7 +172,7 @@ var (
|
||||
Exprs: []shaderir.Expr{
|
||||
{
|
||||
Type: shaderir.LocalVariable,
|
||||
Index: 5, // gl_Position in GLSL
|
||||
Index: 4, // gl_Position in GLSL
|
||||
},
|
||||
{
|
||||
Type: shaderir.Binary,
|
||||
|
Loading…
Reference in New Issue
Block a user