mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 03:02:49 +01:00
parent
febdc46ad5
commit
07514a37c8
12
internal/shader/testdata/array.expected.vs
vendored
12
internal/shader/testdata/array.expected.vs
vendored
@ -4,14 +4,20 @@ void F0(out vec2 l0[2]);
|
|||||||
void F1(out vec2 l0[2]);
|
void F1(out vec2 l0[2]);
|
||||||
|
|
||||||
void F0(out vec2 l0[2]) {
|
void F0(out vec2 l0[2]) {
|
||||||
vec2 l1[2] = vec2[2](vec2(0), vec2(0));
|
vec2 l1[2];
|
||||||
|
l1[0] = vec2(0);
|
||||||
|
l1[1] = vec2(0);
|
||||||
l0 = l1;
|
l0 = l1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void F1(out vec2 l0[2]) {
|
void F1(out vec2 l0[2]) {
|
||||||
vec2 l1[2] = vec2[2](vec2(0), vec2(0));
|
vec2 l1[2];
|
||||||
vec2 l2[2] = vec2[2](vec2(0), vec2(0));
|
l1[0] = vec2(0);
|
||||||
|
l1[1] = vec2(0);
|
||||||
|
vec2 l2[2];
|
||||||
|
l2[0] = vec2(0);
|
||||||
|
l2[1] = vec2(0);
|
||||||
(l1)[0] = vec2(1.0);
|
(l1)[0] = vec2(1.0);
|
||||||
l2 = l1;
|
l2 = l1;
|
||||||
((l2)[1]).y = vec2(2.0);
|
((l2)[1]).y = vec2(2.0);
|
||||||
|
@ -310,9 +310,18 @@ func (c *compileContext) glslBlock(p *shaderir.Program, topBlock, block *shaderi
|
|||||||
|
|
||||||
var lines []string
|
var lines []string
|
||||||
for _, t := range block.LocalVars {
|
for _, t := range block.LocalVars {
|
||||||
|
name := fmt.Sprintf("l%d", localVarIndex)
|
||||||
|
switch t.Main {
|
||||||
|
case shaderir.Array:
|
||||||
|
lines = append(lines, fmt.Sprintf("%s%s;", idt, c.glslVarDecl(p, &t, name)))
|
||||||
|
init := c.glslVarInit(p, &t.Sub[0])
|
||||||
|
for i := 0; i < t.Length; i++ {
|
||||||
|
lines = append(lines, fmt.Sprintf("%s%s[%d] = %s;", idt, name, i, init))
|
||||||
|
}
|
||||||
|
case shaderir.None:
|
||||||
// The type is None e.g., when the variable is a for-loop counter.
|
// The type is None e.g., when the variable is a for-loop counter.
|
||||||
if t.Main != shaderir.None {
|
default:
|
||||||
lines = append(lines, fmt.Sprintf("%s%s = %s;", idt, c.glslVarDecl(p, &t, fmt.Sprintf("l%d", localVarIndex)), c.glslVarInit(p, &t)))
|
lines = append(lines, fmt.Sprintf("%s%s = %s;", idt, c.glslVarDecl(p, &t, name), c.glslVarInit(p, &t)))
|
||||||
}
|
}
|
||||||
localVarIndex++
|
localVarIndex++
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user