shaderir: Add new lines

This commit is contained in:
Hajime Hoshi 2020-05-17 17:06:21 +09:00
parent f4a1f90d92
commit 29dbad28f9
2 changed files with 5 additions and 0 deletions

View File

@ -90,6 +90,7 @@ func (p *Program) Glsl() string {
// Vertex func
if len(p.VertexFunc.Block.Stmts) > 0 {
lines = append(lines, "")
lines = append(lines, "#if defined(COMPILING_VERTEX_SHADER)")
lines = append(lines, "void main(void) {")
lines = append(lines, p.glslBlock(&p.VertexFunc.Block, 0, 0)...)
@ -99,6 +100,7 @@ func (p *Program) Glsl() string {
// Fragment func
if len(p.FragmentFunc.Block.Stmts) > 0 {
lines = append(lines, "")
lines = append(lines, "#if defined(COMPILING_FRAGMENT_SHADER)")
lines = append(lines, "void main(void) {")
lines = append(lines, p.glslBlock(&p.FragmentFunc.Block, 0, 0)...)

View File

@ -610,6 +610,7 @@ attribute float A1;
attribute vec2 A2;
varying float V0;
varying vec2 V1;
#if defined(COMPILING_VERTEX_SHADER)
void main(void) {
gl_Position = A0;
@ -678,6 +679,7 @@ attribute float A1;
attribute vec2 A2;
varying float V0;
varying vec2 V1;
#if defined(COMPILING_VERTEX_SHADER)
void main(void) {
gl_Position = A0;
@ -685,6 +687,7 @@ void main(void) {
V1 = A2;
}
#endif
#if defined(COMPILING_FRAGMENT_SHADER)
void main(void) {
vec2 l0;