Brainstorming: Noise optimization - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: Brainstorming: Noise optimization (/thread-832.html) |
RE: Brainstorming: Noise optimization - xoft - 01-19-2014 I have no idea how vector instructions work and how you want to use that language, can you provide a simple end-to-end example? RE: Brainstorming: Noise optimization - worktycho - 01-19-2014 So instead of something like: Code: for (int i = 0; i < ArrayCount; i++) Code: @StartVectorCalc(ArrayCount,i,a_Array) The actual calculation being done with c++ operators. Results var and iteration var may be unnecessary but width is essential. The $ in front of Amplitude indicates its a scalar to avoid needing to do to much c++ parsing. RE: Brainstorming: Noise optimization - xoft - 01-19-2014 I'm still not too convinced about Lua parsing, it is a big chunk of work to make Lua parse something, it's much easier to let it generate something out of data it already has. Is there any way we could represent the vector code as a Lua table, for example, and let Lua generate the C++ code out of that into a "vec_doThisThat.inc" file, then in the hand-maintained cpp file we would use #include "vec_doThisThat.inc" in places where we wanted the actual code to be inserted. So, to sum up: vector_input.lua: GenerateCode = { vec_ThisThat = { -- Describe the calculation in a Lua table here }, ... } cNoise.cpp: void cCubicNoise::Generate1D(...) { // Prepare the data #include "vec_ThisThat.h" // Do some post-processing } As for Lua under Windows, there's still the possibility to abuse tolua++ when generating the bindings to execute this additional script as well. RE: Brainstorming: Noise optimization - worktycho - 01-19-2014 Sort of a lisp-style language. Why not just use lisp syntax because a lisp parser is easy and lisp syntax is slightly easier to read then lua object syntax when it comes to code. RE: Brainstorming: Noise optimization - xoft - 01-19-2014 Because we don't want to bring yet another dependency to the code? Is there even a decent lisp interpreter for windows? RE: Brainstorming: Noise optimization - worktycho - 01-19-2014 Not actually in lisp, just lisp syntax. I can code a lisp parser reasonably quickly and then a lisp-like DSL on top of that as quickly as I can on lua tables. RE: Brainstorming: Noise optimization - xoft - 01-19-2014 I fail to see the point of making an extra parser when you can represent the data reasonably well directly. RE: Brainstorming: Noise optimization - worktycho - 01-19-2014 Just written one, probably full of bugs but should be easy to use. I'll push it to a branch if you want to see it. As for another reading the table syntax will be confusing: Code: VectorFunction = { For most people writing lisp is hard enough, writing lisp in a DDL is even harder. RE: Brainstorming: Noise optimization - worktycho - 01-19-2014 At the moment Code: a = b + c Code: (= a (+ b c)) RE: Brainstorming: Noise optimization - FakeTruth - 01-19-2014 Why not just write the actual code, in C++, and use #if/#else for other platform specific code. Seems much easier to me. |