OpenGL

The GCW Zero, starting with OpenDingux 2013-09-13 firmware has OpenGL ES 1 and 2 support based on Etnaviv and Mesa, so fully open source.

The Etnaviv project was first published around the start of the year 2013. It has made very good progress since then and now the time has come when we think it is ready to be included in OpenDingux. What "ready" means is that there is enough functionality to run several games without game breaking glitches. There are sure to be many bugs and missing features, since this is a young and complex project. But we feel now is the right time to put it into the hands of all developers.

The Graphics Stack

The graphics stack contains the following components: (from high to low level)  Application, such as a game or emulator Mesa: OpenGL ES implementation Gallium: user space driver, generic part Etnaviv: user space driver, hardware specific part Galcore: kernel driver by Vivante 

Etnaviv Overview

Features  APIs: OpenGL ES 1 and OpenGL ES 2 textures: 2D, cube maps</li> texture compression: DXT1-5, ETC</li> anti-aliasing: 1x, 2x or 4x MSAA</li> vertex texture fetch</li> 16 or 24 bit depth buffer</li> 0 bit or 8 bit stencil buffer</li> 8, 16 or 32 bit (OES_element_index_uint) indices for glDrawElements</li> </ul>

GLES 1 extensions  GL_EXT_blend_minmax</li> GL_EXT_multi_draw_arrays</li> GL_EXT_texture_filter_anisotropic</li> GL_EXT_texture_lod_bias</li> GL_OES_byte_coordinates</li> GL_OES_fixed_point</li> GL_OES_stencil_wrap</li> GL_OES_compressed_paletted_texture</li> GL_OES_query_matrix</li> <li>GL_OES_read_format</li> <li>GL_OES_single_precision</li> <li>GL_OES_draw_texture</li> <li>GL_OES_matrix_get</li> <li>GL_OES_point_size_array</li> <li>GL_OES_point_sprite <li>GL_EXT_texture_format_BGRA8888</li> <li>GL_OES_compressed_ETC1_RGB8_texture</li> <li>GL_OES_depth24</li> <li>GL_OES_element_index_uint</li> <li>GL_OES_fbo_render_mipmap</li> <li>GL_OES_framebuffer_object</li> <li>GL_OES_mapbuffer</li> <li>GL_OES_rgb8_rgba8</li> <li>GL_OES_stencil8</li> <li>GL_OES_texture_env_crossbar</li> <li>GL_OES_texture_mirrored_repeat</li> <li>GL_OES_texture_npot</li> <li>GL_OES_EGL_image</li> <li>GL_OES_packed_depth_stencil</li> <li>GL_OES_texture_cube_map</li> <li>GL_APPLE_texture_max_level</li> <li>GL_EXT_discard_framebuffer</li> <li>GL_EXT_read_format_bgra</li> <li>GL_OES_blend_equation_separate</li> <li>GL_OES_blend_func_separate</li> <li>GL_OES_blend_subtract</li> <li>GL_OES_EGL_image_external</li> <li>GL_OES_vertex_array_object</li> <li>GL_EXT_map_buffer_range</li> <li>GL_OES_surfaceless_context</li> </ul>

GLES 2 extensions <ul> <li>GL_EXT_blend_minmax</li> <li>GL_EXT_multi_draw_arrays</li> <li>GL_EXT_texture_filter_anisotropic</li> <li>GL_EXT_texture_format_BGRA8888</li> <li>GL_OES_compressed_ETC1_RGB8_texture</li> <li>GL_OES_depth24</li> <li>GL_OES_element_index_uint</li> <li>GL_OES_fbo_render_mipmap</li> <li>GL_OES_mapbuffer</li> <li>GL_OES_rgb8_rgba8</li> <li>GL_OES_standard_derivatives</li> <li>GL_OES_stencil8</li> <li>GL_OES_texture_npot</li> <li>GL_OES_EGL_image</li> <li>GL_OES_depth_texture</li> <li>GL_OES_packed_depth_stencil</li> <li>GL_EXT_texture_type_2_10_10_10_REV</li> <li>GL_OES_get_program_binary</li> <li>GL_APPLE_texture_max_level</li> <li>GL_EXT_discard_framebuffer</li> <li>GL_EXT_read_format_bgra</li> <li>GL_NV_fbo_color_attachments</li> <li>GL_OES_EGL_image_external</li> <li>GL_OES_vertex_array_object</li> <li>GL_EXT_unpack_subimage</li> <li>GL_NV_draw_buffers</li> <li>GL_NV_read_buffer</li> <li>GL_EXT_map_buffer_range</li> <li>GL_OES_surfaceless_context</li> </ul>

Known Bugs and Issues

<ul> <li>loops in shaders are not supported</li> <li>indirect access to uniforms not yet supported</li> <li>gl_FrontFacing not yet supported</li> <li>GLSL "texture" bias parameter not yet supported</li> <li>GLSL "textureLod" not yet supported</li> <li>reading from framebuffer (when supertiled) not yet supported</li> <li>GLSL dFdx/dFdy (DDX DDY) do not return the correct result</li> </ul>

Changes in OpenDingux 2013-10-04


 * Extension "GL_OES_texture_3D" no longer erroneously reported; the hardware has no support for 3D textures
 * 16 bit textures are no longer blown up to 32 bit, resulting in reduced size, memory bandwidth and conversion overhead when 16 bit textures are used
 * No more need to add  to your compile flags
 * Fix mipmap computation for non-power of two textures
 * Fix crash issue when doing multiple clears per frame
 * Fix stale uniforms issue (this caused viewport wiggles in d2x)
 * GLES2: Fix constant attributes (glVertexAtrrib)
 * GLES2: Fix shader instruction bug when a computation uses two uniforms
 * GLES2: GLSL "discard" implemented

Changes since OpenDingux 2013-10-04

These changes are in the repositories and will be in the next firmware release.


 * GLES2: prohibit texture wrapping other than CLAMP_TO_EDGE for non power-of-two textures as this is not supported by the hardware

Development

All required headers and libs are included in the 2013-09-13 release of the OpenDingux toolchain for the GCW Zero; older releases won't work.

Use EGL to set up a context for OpenGL ES. We're looking at adding SDL2 as an alternative, but EGL is the only option in this release.

Example code can be found in this project.

Performance Tips

<ul> <li>always use vertex buffer objects (VBOs)</li> <li>put vertices into one interleaved VBO, not multiple VBOs</li> <li>to reduce memory bandwidth use compressed textures (DXTx or ETC) where possible, otherwise 16 bit textures</li> <li>when drawing with glDrawElements use the smallest possible index size</li> </ul>

Debug Tips

The apitrace tool is included in the rootfs. It can capture GL ES calls made by an application for later replay and inspection.

Bug Reports

Although most of the critical problems should have been solved by now, some unknown rendering bugs and crashes may still be present.

Report issues and rendering problems in the Etnaviv issue tracker.

When reporting an issue provide as much information as possible about the GLES and GLSL functions and extensions used and other information that may be useful for narrowing down the problem.

If possible, attach an apitrace dump that shows the problem (run  on the device and send the resulting   file). These can be replayed on various devices to find out when divergences occur.

Contributing

The latest source code can be found at on github: Etnaviv and Mesa.

Help with development is very welcome. Join #etnaviv on irc.freenode.net or web chat to contact the developers.