Table of Contents

NervLuna: Simplifying manual bindings

In my last post I covered restoring the LLVM JIT compiler support in the NervLand project. That part seems to be working not too bad for now, but I realized that if I want to be able to dynamically inject new functions in the lua state then I need a more user friendly way to do it still using the Luna infrastructure, but with a mechanism a bit similar to what is done in the SOL library. So this will be the main topic that we will cover here. Let's get started [Spoiler alert: this is going to be a little tricky :-)]

Initial support for manual bindings generation

I have just created a luaSandBox module to store any precompiled extension I could think about, and that's where I should start experimenting with those manual bindings generation steps.

Extending support for functions assignments

Unifying function return type

Adding support for lambdas

Providing the SimpleCmdBuffersProvider in the sandbox module

self.cbufs, self.pushArr)

  1. - local prov = nvk.SimpleCmdBuffersProvider(self.renderer, renderpass, vbuf, pipelineLayout, cfg, pipelineCache,
  2. - self.cbufs, self.pushArr)

self.renderer:set_cmd_buffer_provider(prov)

I have now placed all my custom luna templates in in a single luna_shared_templates.h file to avoid repeating that code in each binding.

Conclusion