cbaggers / varjo

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

Add support for extensions and experimental Vulkan support #247

Open JolifantoBambla opened 3 years ago

JolifantoBambla commented 3 years ago

Hey, I've added support for extensions and experimental support for Vulkan/SPIR-V.

For both I've changed the semantics of the context arg in make-stage (nowhere else), which now also allows lists to specify the target environment and enabled/disabled extensions. (See changes to docs/using-the-compiler) I did it there because I didn't want the API to change for these features and from the name of the arg it seemed to make sense.

I probably missed many spots where I could have added more validation for allowed qualifiers and types, but it should at least add everything new required for #220 (except for what needs to be added in glsl-spec). Feel free to request any changes.

I'm still pretty new to CL (this is basically part of my first project), so also feel free to point out any dumb mistakes I made ;)

JolifantoBambla commented 3 years ago

@cbaggers my PR in glsl-spec introduces new types, for which this PR adds type mappings in parse-from-spec. Unfortunately parsing the spec fails for my PR in glsl-spec without those type mappings. So in order not to break anything for quicklisp users either both PRs should make it to the same quicklisp release or this PR has to be merged before the glsl-spec one. Sorry for the inconvenience :/

JolifantoBambla commented 2 years ago

@cbaggers I've added support for the GL_EXT_ray_query extension now. I introduced a new slot allow-unboundp to the v-type class, that allows the usage of uninitialized variables if their type allows it. The problem here was that rayQueryEXT instances are used like this:

void main() {
    rayQueryEXT q;
    rayQueryInitializeEXT(q, ...);
    ...
}

I.e. they have to be declared first and then initialized by calling the (void) function rayQueryInitializeEXT. This can now be done in Vari like this:

(let (((q :ray-query-ext)))
  (ray-query-initialize-ext q ...))

Let me know, if you would prefer a different solution.