@monkeyslunch@mstdn.ca avatar monkeyslunch , to random
@lritter@mastodon.gamedev.place avatar lritter , to random

writing C++ wrappers around SDL code so i can use them in LRDL becomes a strain.

i want to talk to SDL directly. but for that, i need to generate declarations from SDL header files. i do have the generator from a previous prototype (written in python), just need to change the target syntax a little.

but i first need LRDL to support C pointers, enums, arrays, structs and unions, so we have full C ABI support.

so that's first today.

lritter OP ,
@lritter@mastodon.gamedev.place avatar

array types are in.

lritter OP ,
@lritter@mastodon.gamedev.place avatar

struct and union types are in.

ALT
  • Reply
  • Loading...
  • lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    enums are in.

    lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    and finally, pointers are in.

    now i can adapt the header generator.

    lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    forgot one more: function types.

    lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    altering the header translator turns out to be a bit more involved, since before there were no pointer types, which made it easier to deal with recursive references.

    so now i have to restructure a bit, and also support more types...

    lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    translation works. a short excerpt below. compiler parses correctly... only the backend's codegen needs to be fixed now.

    ALT
  • Reply
  • Loading...
  • @lritter@mastodon.gamedev.place avatar lritter , to random

    loop as fractal primitive

    @wesfly@mastodon.social avatar wesfly , to random

    Working on a new aircraft in the simulator. I still have to improve the flight model, but it'll be online in a few days.
    I used this code as inspiration: https://gist.github.com/Hermitao/0a908f8af19b11132e3bdb5ba4ef99f0

    Fighter jet above Calvi, France
    Fighter jet above Calvi, France

    ALT
    @lritter@mastodon.gamedev.place avatar lritter , to random

    i hate my compiler at the moment. it's a mess.

    @lritter@mastodon.gamedev.place avatar lritter , (edited ) to random

    waking up while dreaming of meshing implicit surfaces while knowing that the compiler for it still needs to be completed

    it will be worth it

    @lritter@mastodon.gamedev.place avatar lritter , to random

    > error: a template declaration cannot appear at block scope

    cowards!

    @lritter@mastodon.gamedev.place avatar lritter , to random

    Slang 🤝 C++
    ..........cpp

    lritter OP ,
    @lritter@mastodon.gamedev.place avatar
    • host table impls need to implement SDL_gpu upload/download locally; no global system.

    • tables accessed from gpu cases need a parallel implementation in slang; slang has limited support for generics - what i can't get to work there, i'll do with macros.

    i hope that's all.

    lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    set up a test case. parses, but we're not generating slang code yet.

    ALT
  • Reply
  • Loading...
  • lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    the language is asking a lot of the compiler. the existing code generator is not suited to generate code for two different targets simultaneously.

    for instance: tables need to be properly tagged where they are accessed, so we declare them in the right places. not every generated compute shader needs all of the tables, so we need to generate only the ones used by that shader.

    i don't like how chaotic the compiler code is becoming already.

    lritter OP , (edited )
    @lritter@mastodon.gamedev.place avatar

    yesterday i thought i'm going to port analysis / code generator to soufflé datalog and embed the engine in the compiler again, with the goal of encoding complex processing in an easier to maintain format.

    but the compiler is already far enough to replace parts of itself.

    so instead, i'll port analysis and code generator to LRDL, and generate C++ source code from it. (i call this process "retconning")

    lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    cgen.lrdl is now used by compiler; next task was to feed the compiler data model into cgen, and i've just completed this too.

    next is to write some actual analysis and processing from the populated 20 tables.

    lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    need to change some internals again.

    presently, tables hold back new insertions until update() has been called on them, which happens before the first read.

    however, tables can practically already mutate on insert, because the scheduling already ensures that reads occur only after all insertions - with one exception: cues, which are backedge insertions that need to be scheduled for the next iteration.

    therefore update() needs to be called only at the end of an iteration.

    lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    changed when table updates happen and refactored the most important containers for it (they can now take a more efficient route for simple insertions).

    the fib test below runs without changes.

    ALT
  • Reply
  • Loading...
  • lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    the fibonacci test seemed a little dissatisfying since it can only linearly complete the table, so i added this other iterative example which can be parallelized per iteration.

    ALT
  • Reply
  • Loading...
  • lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    @Sharlock93 only the but i'll do a real introduction somewhere this year.

    lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    i added another test: stackless hylomorphic parallel processing https://en.wikipedia.org/wiki/Hylomorphism_(computer_science) on the example of topological sorting of a DAG.

    with the right primitives, this was straightforward to think about.

    ALT
  • Reply
  • Loading...
  • lritter OP ,
    @lritter@mastodon.gamedev.place avatar

    one more test, for the "event" table type, which is a synchronization primitive to organize barriers in topological order.

    ALT
  • Reply
  • Loading...