On Thu, 2009-12-31 at 01:37 -0800, Luca Barbieri wrote: > This is a series of 4 patches that add the required infrastructure for > writing Gallium demos and programs and include two such demos, > galliumgears and galliumglobe. > > The first two patches have already been posted, but I am including them > again in git format-patch format as part of the series (they were > manually generated). > > The patches are all attached, and the commit message of the third and > fourth is replicated in the message body for easier reading. > > > >From 04597af67fb6fa556e04ee5b293ad2b774178cbf Mon Sep 17 00:00:00 2001 > From: Luca Barbieri <l...@luca-barbieri.com> > Date: Thu, 31 Dec 2009 09:41:38 +0100 > Subject: [PATCH 3/4] Add utility framework for Gallium programs > > This is an utility library called "galliumut", designed to make writing > Gallium applications (as opposed to state trackers) easier. > It is put in gallium/programs since it doesn't follow the same coding > standards and doesn't share the same goal of gallium/auxiliary. > > It requires my EGL_MESA_gallium extension patch to allow creation of a > Gallium context capable of displaying surfaces to the user. > For X11 usage, it also requires my MESA_screen_surface patch to make > egl_glx automatically create a maximized window for EGL programs. > > * galliumut.h contains miscellaneous utility functions, easy framebuffer > setup functions, mesh (vertex+index buffer) utilities and creation of > common state objects > > * egl_gallium.c uses the MESA_screen_surface and EGL_MESA_gallium to set > up a pipe_context and pipe_framebuffer_state suitable for drawing to the > screen and implements a render loop > > * image.c/image.h uses the gdk-pixbuf library to create a pipe_texture > from an image in the filesystem > > * ureg_lib.h adds utility functions, asin/acos, normalize and vector > transform functions to ureg > > * uureg.h is a wrapper around ureg which allows to write much terser > shaders. > It features, for instance, a short macro for each possible swizzle and > writemask, macros that don't include the "ureg" word, and automatic > conversion of ureg_dst and scalars to ureg_src. > > * math_lib.h is a 3/4-sized vector/matrix library with SSE/SSE2 > optimization > math_lib_fp.h and math_lib_fp_transform.h are internally used headers > > * test_math tests math_lib.h > > * normal_gen.c/normal_gen.h include vertex and fragment shaders for > normal map generation > > > >From 5a855511dfc524e298696f4356cf56595fc584e1 Mon Sep 17 00:00:00 2001 > From: Luca Barbieri <l...@luca-barbieri.com> > Date: Thu, 31 Dec 2009 10:24:09 +0100 > Subject: [PATCH 4/4] Add galliumgears and galliumglobe Gallium API demos > > This patch includes two demos which don't use OpenGL, but directly draw > using the Gallium3D API, with context setup done using EGL through the > galliumut framework. > They require my MESA_screen_surface, EGL_MESA_gallium and galliumut > patches > > This provides a direct demonstration of the Gallium API. > In addition to having fun writing Gallium demos, test suites for Gallium > drivers can be written in this fashion. > > galliumgears is a Gallium remake of the gears demo. > In addition to the classic demo it features: > - Smart frustum which never puts the gears offscreen > - Per-pixel diffuse and specular lighting (can be disabled to get the > classic gears look) > - Better meshes for gears with configurable amount of triangles for > better rounded interiors > - Configurable gear speed > > galliumglobe is a new demo which renders a pixel-perfect spinning Earth > globe. > It works this way: > 1. Downloads NASA Blue Marble imagery for Earth color, altitude and > nighttime lighting. > 2. Uses the GPU to generate mipmaps and a spherical normal map from the > heightmaps > 3. Optionally builds a triangle fan which rasterizes to a perfect circle > (1000-8000 triangles will be used for normal display sizes), and > otherwise uses KIL in the fragment shader > 4. For each window resize, uses the GPU to generate a texture containing > 16-bit (split into 2 8-bit values) map projection u, v coordinates for > points on the screen > 5. Uses a fragment shader that for each point in a circle on the screen, > gets the u,v coordinates from the texture, applies latitude translation > and does diffuse/specular calculation using pre-rotated light and half > vectors > Anisotropic filtering is used for quality rendering at the poles and > equator extremes. > > The demo is configurable in many ways: see the usage message for more > information. > > The demos have been tested with softpipe and nv40, and may need > adjustments to work on other drivers.
Luca, This is great stuff, and it couldn't have been in better timing. I was just about to get the python gallium tests we have working with llvmpipe too, and your work will save me a bunch of time. Instead of mesa/src/gallium/programs/ I'd prefer to have these on mesa/progs/gallium/, to keep the drivers/APIs in mesa/src samples/tests in mesa/progs. I'm going to move the python tests/examples from mesa/src/gallium/statetrackers/python/* to mesa/progs/gallium/python too. I also agree with Keith's comments about code formatting -- nobody wants to be pedantic about this, but Mesa is a joint project and once the code gets committed chances are it will be eventually modified by people besides the original author, and that's where code syntax consistency helps. Jose ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev