Remix.run Logo
Making a Shading Language for My Offline Renderer(agraphicsguynotes.com)
30 points by ibobev 3 days ago | 2 comments
mananaysiempre 2 hours ago | parent | next [-]

> Flex is one of the commonly used tools as a lexical analyzer. [...] Bison is a syntax analyzer.

A valid choice; one might also find re2c[1] or Ragel [2] + Lemon[3] a friendlier if less well-established implementation of essentially the same theory. Moving further away, there’s also ANTLR[4] or spending a week on a hand-coded lexer and parser.

> CPU’s parallelism is not utilized in the same way as GPU since different threads are not synchronized at all, there is simply nothing like Warp or Wavefront. [...] SIMD optimization would be a fairly bad fit for shaders since there are no four instances of shader executions at the same time.

See, however, ISPC[5,6] for how attempting to use SIMD (also known as “90% of your CPU’s compute”) does yield wavefronts, etc. (If I’m reading between the lines of the second reference correctly, the work on it paved the way for LLVM-based shader-compiler backends in AMD and Intel GPU drivers.)

[1] https://re2c.org/

[2] https://www.colm.net/open-source/ragel/

[3] https://sqlite.org/src/doc/trunk/doc/lemon.html

[4] https://www.antlr.org/

[5] https://ispc.github.io/

[6] https://pharr.org/matt/blog/2018/04/18/ispc-origins

jdw64 4 hours ago | parent | prev [-]

Sometimes when I see people taking on the challenge of creating a language, I feel a desire to try it myself. I hope that someday I too can create the language I have in mind.