This post describes the only part of etna_pipe API that is not yet equal or at least analogous to Gallium. Etnaviv does not yet have a GLSL shader compiler (or TGSI converter). Until then, shaders can only be compiled from native assembly.
Luckily the Vivante ISA is quite straightforward, at least compared to others such as Mali vertex shader assembly. It is possible to write it manually. And it
also is an unified ISA, by which is meant that the vertex and fragment shaders use the same instruction set.
The shader instructions are documented in detail in isa.xml. Some further notes about the ISA can be found in isa.md. Start for example from the basic vertex shader of the framebuffer demo mip_cube:
Save this in a text file named mip_cube_vs.asm, then use the external tool asm.py to compile it
This will give the output as a C array with four uint32_ts per instruction:
To embed this into the program code, copy-paste this output into the source file into the array (alternatively, pipe to a file and #include it):
Do the same thing for the fragment shader and ps. These arrays are used inside the etna_shader_program structure:
This structure defines all the meta-data for the shader. This includes the number of inputs, outputs, varyings, definitions of varyings, number of temporaries (t* registers), initial uniform values for both the vertex and fragment program.
Inside the program, this structure can be compiled to a state atom, that can be bound using bind_etna_shader_state to use it for rendering: