Command finalization could refuse to finalize commands that were
allocated, because its rounding method added 4 extra bytes to commands
whose size is a multiple of 4. Such commands would still be instantiated
but without commands_length advancing, causing the underlying memory to
be reallocated later, leading to overlapping commands.
This commit changes the command generation mechanism. Instead of
creating a command on the stack then calling azrp_queue_command() which
does a needless copy, the new function azrp_new_command() allocates
directly inside the command buffer, avoiding the copy.
This concept is pushed further with the introduction of finer-grained
functions azrp_alloc_command(), azrp_finalize_command() and
azrp_instantiate_command(), which split this process in three steps.
This allows generating commands of variadic size in-place in the
command buffer as well as using non-interval fragment sets.
The code for P8 failed in some non-transparent cases and I'll admit I
could not be bothered to fix it when the superiors formats were already
designed and promised a significant boost.
This basic model supports a couple of options, but mostly designed for
three targets:
* gint on fx-CG 50, with a custom XRAM-streaming rendering engine that
is (to my knowledge) more powerful than all other existing options;
* The standard SDL/OpenGL combo for desktop platforms, using modern
OpenGL 3.3 and some basic shaders.
* The web platform with emscripten and its OpenGL ES 2.0 API that maps
to WebGL 1.0. OpenGL ES 2.0 code could also be used for mobile
platforms if this ever comes up.
The current code only includes setting up the program's main loop
(update/render) as well as basic rendering.
The framework of gint's rendering engine is drawn ("shader"-based
rendering in XRAM). On the OpenGL side, some utilities are defined,
including a primitive layer of shader code compatibility for OpenGL 3.3
vs. OpenGL ES 2.0. Actual rendering is still at prototype stage.