cbaggers / varjo

Lisp to GLSL Language Translator
BSD 2-Clause "Simplified" License
223 stars 23 forks source link

Trying to pass bvecs between stages can cause issues. Real issue we need to check cross stage types #162

Open cbaggers opened 6 years ago

cbaggers commented 6 years ago
;;;; fragment shader
;; this:
(let ((color (texture (image tex) uv)))
  (if (< (.x gl-frag-coord) 400)
      (bvec4 nil nil nil t)
      color))

;; translates to:
void main()
{
    vec4 COLOR = texture(TEX.IMAGE,v_in._GEOMETRY_STAGE_OUT_0);
    if ((gl_FragCoord.x < 400))
    {
        bvec4(false,false,false,true);
    }
    else
    {
        COLOR;
    }
    <invalid> g_GEXPR0_3956 = NIL;
    _FRAGMENT_STAGE_OUT_0 = g_GEXPR0_3956;
    return;
}"

;; glsl compile log:
0(26) : error C0000: syntax error, unexpected '<', expecting "::" at token "<"
0(51) : error C0000: syntax error, unexpected '<' at token "<"
[Condition of type SIMPLE-ERROR]