shaderir: Fix the initial variable values on GLSL

This is for consistency with number literals we are introducing.

Updates #1190
This commit is contained in:
Hajime Hoshi 2020-06-17 01:53:41 +09:00
parent 530723ec66
commit 2869885816
16 changed files with 52 additions and 52 deletions

View File

@ -1,5 +1,5 @@
void F0(in vec2 l0, out vec4 l1) { void F0(in vec2 l0, out vec4 l1) {
float l2 = 0.0; float l2 = float(0);
l2 = 0.000000000e+00; l2 = 0.000000000e+00;
l2 = (l2) + (1.000000000e+00); l2 = (l2) + (1.000000000e+00);
l1 = vec4(l0, l2, l2); l1 = vec4(l0, l2, l2);

View File

@ -1,8 +1,8 @@
void F0(in vec2 l0, out vec4 l1) { void F0(in vec2 l0, out vec4 l1) {
float l2 = 0.0; float l2 = float(0);
float l3 = 0.0; float l3 = float(0);
float l4 = 0.0; float l4 = float(0);
float l5 = 0.0; float l5 = float(0);
F1(l4, l5); F1(l4, l5);
l2 = l4; l2 = l4;
l3 = l5; l3 = l5;

View File

@ -1,15 +1,15 @@
void F0(in vec2 l0, out vec4 l1) { void F0(in vec2 l0, out vec4 l1) {
vec4 l2 = vec4(0.0); vec4 l2 = vec4(0);
{ {
vec3 l3 = vec3(0.0); vec3 l3 = vec3(0);
(l2).x = (l0).x; (l2).x = (l0).x;
{ {
vec4 l4 = vec4(0.0); vec4 l4 = vec4(0);
(l2).y = (l3).y; (l2).y = (l3).y;
(l2).z = (l4).z; (l2).z = (l4).z;
} }
{ {
vec4 l4 = vec4(0.0); vec4 l4 = vec4(0);
(l2).y = (l3).y; (l2).y = (l3).y;
(l2).z = (l4).z; (l2).z = (l4).z;
} }

View File

@ -1,5 +1,5 @@
void F0(in vec2 l0, out vec2 l1) { void F0(in vec2 l0, out vec2 l1) {
vec2 l2 = vec2(0.0); vec2 l2 = vec2(0);
F1(l0, l2); F1(l0, l2);
l1 = l2; l1 = l2;
return; return;

View File

@ -1,8 +1,8 @@
void F0(in vec2 l0, out vec2 l1) { void F0(in vec2 l0, out vec2 l1) {
float l2 = 0.0; float l2 = float(0);
float l3 = 0.0; float l3 = float(0);
float l4 = 0.0; float l4 = float(0);
float l5 = 0.0; float l5 = float(0);
F1((l0).x, (l0).y, l2, l3); F1((l0).x, (l0).y, l2, l3);
l4 = l2; l4 = l2;
l5 = l3; l5 = l3;

View File

@ -1,8 +1,8 @@
void F0(in vec2 l0) { void F0(in vec2 l0) {
float l1 = 0.0; float l1 = float(0);
float l2 = 0.0; float l2 = float(0);
float l3 = 0.0; float l3 = float(0);
float l4 = 0.0; float l4 = float(0);
F1((l0).x, (l0).y, l1, l2); F1((l0).x, (l0).y, l1, l2);
F1(l1, l2, l3, l4); F1(l1, l2, l3, l4);
} }

View File

@ -1,5 +1,5 @@
void F0(in vec2 l0, out vec4 l1) { void F0(in vec2 l0, out vec4 l1) {
vec4 l2 = vec4(0.0); vec4 l2 = vec4(0);
l2 = vec4(l0, 0.0, 1.0); l2 = vec4(l0, 0.0, 1.0);
l1 = l2; l1 = l2;
return; return;

View File

@ -1,8 +1,8 @@
void F0(in vec2 l0, out vec4 l1) { void F0(in vec2 l0, out vec4 l1) {
float l2 = 0.0; float l2 = float(0);
float l3 = 0.0; float l3 = float(0);
float l4 = 0.0; float l4 = float(0);
float l5 = 0.0; float l5 = float(0);
F1(l4, l5); F1(l4, l5);
l2 = l4; l2 = l4;
l3 = l5; l3 = l5;

View File

@ -1,5 +1,5 @@
void F0(in vec2 l0, out vec4 l1) { void F0(in vec2 l0, out vec4 l1) {
vec4 l2 = vec4(0.0); vec4 l2 = vec4(0);
l2 = (vec4(0.000000000e+00)) * (vec4(0.000000000e+00)); l2 = (vec4(0.000000000e+00)) * (vec4(0.000000000e+00));
l1 = l2; l1 = l2;
return; return;

View File

@ -1,5 +1,5 @@
void F0(in vec2 l0, out vec4 l1) { void F0(in vec2 l0, out vec4 l1) {
vec4 l2 = vec4(0.0); vec4 l2 = vec4(0);
l2 = vec4(l0, 0.0, 1.0); l2 = vec4(l0, 0.0, 1.0);
l1 = l2; l1 = l2;
return; return;

View File

@ -1,6 +1,6 @@
void F0(in vec2 l0, out vec4 l1) { void F0(in vec2 l0, out vec4 l1) {
vec4 l2 = vec4(0.0); vec4 l2 = vec4(0);
vec4 l3 = vec4(0.0); vec4 l3 = vec4(0);
l2 = vec4(l0, 0.0, 1.0); l2 = vec4(l0, 0.0, 1.0);
(l2).x = (l2).x; (l2).x = (l2).x;
l3 = l2; l3 = l2;

View File

@ -1,6 +1,6 @@
void F0(in vec2 l0, out vec4 l1) { void F0(in vec2 l0, out vec4 l1) {
vec2 l2 = vec2(0.0); vec2 l2 = vec2(0);
vec2 l3 = vec2(0.0); vec2 l3 = vec2(0);
l2 = l0; l2 = l0;
l3 = l0; l3 = l0;
l1 = vec4(l2, l3); l1 = vec4(l2, l3);

View File

@ -6,7 +6,7 @@ varying vec2 V0;
varying vec4 V1; varying vec4 V1;
void main(void) { void main(void) {
mat4 l0 = mat4(0.0); mat4 l0 = mat4(0);
l0 = mat4((2.0) / ((U0).x), 0.0, 0.0, 0.0, 0.0, (2.0) / ((U0).y), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, -(1.0), -(1.0), 0.0, 1.0); l0 = mat4((2.0) / ((U0).x), 0.0, 0.0, 0.0, 0.0, (2.0) / ((U0).y), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, -(1.0), -(1.0), 0.0, 1.0);
gl_Position = (l0) * (vec4(A0, 0.0, 1.0)); gl_Position = (l0) * (vec4(A0, 0.0, 1.0));
V0 = A1; V0 = A1;

View File

@ -6,7 +6,7 @@ varying vec2 V0;
varying vec4 V1; varying vec4 V1;
void main(void) { void main(void) {
mat4 l0 = mat4(0.0); mat4 l0 = mat4(0);
l0 = mat4((2.0) / ((U0).x), 0.0, 0.0, 0.0, 0.0, (2.0) / ((U0).y), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, -(1.0), -(1.0), 0.0, 1.0); l0 = mat4((2.0) / ((U0).x), 0.0, 0.0, 0.0, 0.0, (2.0) / ((U0).y), 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, -(1.0), -(1.0), 0.0, 1.0);
gl_Position = (l0) * (vec4(A0, 0.0, 1.0)); gl_Position = (l0) * (vec4(A0, 0.0, 1.0));
V0 = A1; V0 = A1;

View File

@ -180,19 +180,19 @@ func (p *Program) glslVarInit(t *Type) string {
case Int: case Int:
return "0" return "0"
case Float: case Float:
return "0.0" return "float(0)"
case Vec2: case Vec2:
return "vec2(0.0)" return "vec2(0)"
case Vec3: case Vec3:
return "vec3(0.0)" return "vec3(0)"
case Vec4: case Vec4:
return "vec4(0.0)" return "vec4(0)"
case Mat2: case Mat2:
return "mat2(0.0)" return "mat2(0)"
case Mat3: case Mat3:
return "mat3(0.0)" return "mat3(0)"
case Mat4: case Mat4:
return "mat4(0.0)" return "mat4(0)"
default: default:
panic(fmt.Sprintf("?(unexpected type: %s)", p.glslType(t))) panic(fmt.Sprintf("?(unexpected type: %s)", p.glslType(t)))
} }

View File

@ -290,12 +290,12 @@ varying vec3 V0;`,
}, },
}, },
GlslVS: `void F0(in float l0, out float l1) { GlslVS: `void F0(in float l0, out float l1) {
mat4 l2 = mat4(0.0); mat4 l2 = mat4(0);
mat4 l3 = mat4(0.0); mat4 l3 = mat4(0);
}`, }`,
GlslFS: `void F0(in float l0, out float l1) { GlslFS: `void F0(in float l0, out float l1) {
mat4 l2 = mat4(0.0); mat4 l2 = mat4(0);
mat4 l3 = mat4(0.0); mat4 l3 = mat4(0);
}`, }`,
}, },
{ {
@ -328,19 +328,19 @@ varying vec3 V0;`,
}, },
}, },
GlslVS: `void F0(in float l0, out float l1) { GlslVS: `void F0(in float l0, out float l1) {
mat4 l2 = mat4(0.0); mat4 l2 = mat4(0);
mat4 l3 = mat4(0.0); mat4 l3 = mat4(0);
{ {
mat4 l4 = mat4(0.0); mat4 l4 = mat4(0);
mat4 l5 = mat4(0.0); mat4 l5 = mat4(0);
} }
}`, }`,
GlslFS: `void F0(in float l0, out float l1) { GlslFS: `void F0(in float l0, out float l1) {
mat4 l2 = mat4(0.0); mat4 l2 = mat4(0);
mat4 l3 = mat4(0.0); mat4 l3 = mat4(0);
{ {
mat4 l4 = mat4(0.0); mat4 l4 = mat4(0);
mat4 l5 = mat4(0.0); mat4 l5 = mat4(0);
} }
}`, }`,
}, },
@ -737,8 +737,8 @@ varying float V0;
varying vec2 V1; varying vec2 V1;
void main(void) { void main(void) {
float l0 = 0.0; float l0 = float(0);
vec2 l1 = vec2(0.0); vec2 l1 = vec2(0);
gl_FragColor = gl_FragCoord; gl_FragColor = gl_FragCoord;
l0 = V0; l0 = V0;
l1 = V1; l1 = V1;