cbaggers / varjo

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

Add support for swizzling rgba & stpq #165

Closed mfiano closed 6 years ago

mfiano commented 6 years ago

If I do this in a frag shader, it complains

(if (= (.a color) 0)
      (discard)
      color)

However if I change .a to .w, everything works.

cbaggers commented 6 years ago

what are .a & .w I've never heard of those

djeis97 commented 6 years ago

Gamebox math defines a bunch of varjo macros for swizzling, like .x etc. However when I implemented it I forgot to document that varjo's swizzle special form doesn't support the swizzle groups for rgba or stpq, so a bunch of unusable macros get generated. In short, real issue here is that you can't (vari:swizzle color :a).

cbaggers commented 6 years ago

Ok, so I guess I need to add that then. In the mean time I guess you can tweak you macro generator so .a uses w, .g uses .y etc.

I didn't add rgba or stpq originally as I dont like them, but as varjo is a lot more decoupled from cepl these days I really should :p

cbaggers commented 6 years ago

@mfiano btw you have the coolest avatar!

mfiano commented 6 years ago

Yeah, I completely forgot that I defined templates to translate the syntax of gamebox-math over to vari for swizzling, sorry about that! Also thanks!

cbaggers commented 6 years ago

Fixed on master