-
Notifications
You must be signed in to change notification settings - Fork 0
Description
We have a level of indirection in the engine that isn't necessary and eats up a small but certain amount of space.
Instead of having a loop that calls render_pass with a pass descriptor, we could have the unrolled logic directly:
{
render_to: textures.foo,
clear: [0.0, 0.0, 0.8, 0.0],
program: "effect",
texture_inputs: [textures.bar],
scene: [{ geometry: "quad" }],
}
would turn into:
render_to(textures.foo);
clear([0.0, 0.0, 0.8, 0.0]);
program(programs.blur_h, [textures.bar]);
draw_scene([{ geometry: geometries.quad }]);
This would let us avoid setting states that don't need to be set several times like the render target or the program. This would also let us remove branches that check whether properties of the descriptor exist.
This would also let us easily hand-write the render-loop and add some specific logic like "if t is in this range, use this texture, otherwise this one", etc.
We can still use the json representation for editing and generate the render loop from it (or even choose at build time whether or not to generate it).
I am certain that this will make the things strictly smaller. On some demos the difference may not be big but it will at least make it possible to express some things that are hard to express in the current setup (at the expense of extra logic in the exporter).