mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 19:22:49 +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 {
|
switch {
|
||||||
case idx < na:
|
case idx < na:
|
||||||
return fmt.Sprintf("A%d", idx)
|
return fmt.Sprintf("A%d", idx)
|
||||||
case idx < na+nv:
|
case idx == na:
|
||||||
return fmt.Sprintf("V%d", idx-na)
|
|
||||||
case idx == na+nv:
|
|
||||||
return "gl_Position"
|
return "gl_Position"
|
||||||
|
case idx < na+nv+1:
|
||||||
|
return fmt.Sprintf("V%d", idx-na-1)
|
||||||
default:
|
default:
|
||||||
return fmt.Sprintf("l%d", idx-(na+nv+1))
|
return fmt.Sprintf("l%d", idx-(na+nv+1))
|
||||||
}
|
}
|
||||||
|
@ -646,15 +646,15 @@ varying vec3 V0;`,
|
|||||||
Block: block(
|
Block: block(
|
||||||
nil,
|
nil,
|
||||||
assignStmt(
|
assignStmt(
|
||||||
localVariableExpr(5),
|
localVariableExpr(3),
|
||||||
localVariableExpr(0),
|
localVariableExpr(0),
|
||||||
),
|
),
|
||||||
assignStmt(
|
assignStmt(
|
||||||
localVariableExpr(3),
|
localVariableExpr(4),
|
||||||
localVariableExpr(1),
|
localVariableExpr(1),
|
||||||
),
|
),
|
||||||
assignStmt(
|
assignStmt(
|
||||||
localVariableExpr(4),
|
localVariableExpr(5),
|
||||||
localVariableExpr(2),
|
localVariableExpr(2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -695,15 +695,15 @@ varying vec2 V1;`,
|
|||||||
Block: block(
|
Block: block(
|
||||||
nil,
|
nil,
|
||||||
assignStmt(
|
assignStmt(
|
||||||
localVariableExpr(5),
|
localVariableExpr(3),
|
||||||
localVariableExpr(0),
|
localVariableExpr(0),
|
||||||
),
|
),
|
||||||
assignStmt(
|
assignStmt(
|
||||||
localVariableExpr(3),
|
localVariableExpr(4),
|
||||||
localVariableExpr(1),
|
localVariableExpr(1),
|
||||||
),
|
),
|
||||||
assignStmt(
|
assignStmt(
|
||||||
localVariableExpr(4),
|
localVariableExpr(5),
|
||||||
localVariableExpr(2),
|
localVariableExpr(2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -37,10 +37,10 @@ type Func struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VertexFunc takes pseudo params, and the number if len(attributes) + len(varyings) + 1.
|
// 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 0 <= index < len(attributes), the params are in-params and represent attribute variables.
|
||||||
// If len(attributes) <= index < len(attributes) + len(varyings), the params are out-params and treated as varying
|
// If index == len(attributes), the param is an out-param and repesents the position in vec4 (gl_Position in GLSL)
|
||||||
// variables.
|
// If len(attributes) + 1 <= index < len(attributes) + len(varyings) + 1, the params are out-params and represent
|
||||||
// The last param represents the position in vec4 (gl_Position in GLSL).
|
// varying variables.
|
||||||
type VertexFunc struct {
|
type VertexFunc struct {
|
||||||
Block Block
|
Block Block
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ var (
|
|||||||
Exprs: []shaderir.Expr{
|
Exprs: []shaderir.Expr{
|
||||||
{
|
{
|
||||||
Type: shaderir.LocalVariable,
|
Type: shaderir.LocalVariable,
|
||||||
Index: 4, // the varying variable
|
Index: 5, // the varying variable
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: shaderir.LocalVariable,
|
Type: shaderir.LocalVariable,
|
||||||
@ -172,7 +172,7 @@ var (
|
|||||||
Exprs: []shaderir.Expr{
|
Exprs: []shaderir.Expr{
|
||||||
{
|
{
|
||||||
Type: shaderir.LocalVariable,
|
Type: shaderir.LocalVariable,
|
||||||
Index: 5, // gl_Position in GLSL
|
Index: 4, // gl_Position in GLSL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: shaderir.Binary,
|
Type: shaderir.Binary,
|
||||||
|
Loading…
Reference in New Issue
Block a user