util: Move gallium's PIPE_FORMAT utils to /util/format/
authorEric Anholt <eric@anholt.net>
Thu, 27 Jun 2019 22:05:31 +0000 (15:05 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 14 Nov 2019 18:47:20 +0000 (10:47 -0800)
To make PIPE_FORMATs usable from non-gallium parts of Mesa, I want to
move their helpers out of gallium.  Since u_format used
util_copy_rect(), I moved that in there, too.

I've put it in a separate directory in util/ because it's a big chunk
of related code, and it's not clear to me whether we might want it as
a separate library from libmesa_util at some point.

Closes: #1905
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
357 files changed:
src/broadcom/compiler/nir_to_vir.c
src/broadcom/compiler/v3d_nir_lower_logic_ops.c
src/freedreno/ir3/ir3_shader.c
src/gallium/auxiliary/Android.mk
src/gallium/auxiliary/Makefile.sources
src/gallium/auxiliary/SConscript
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_pipe_aaline.c
src/gallium/auxiliary/draw/draw_pipe_offset.c
src/gallium/auxiliary/draw/draw_pipe_pstipple.c
src/gallium/auxiliary/draw/draw_pt.c
src/gallium/auxiliary/draw/draw_pt_fetch.c
src/gallium/auxiliary/driver_ddebug/dd_draw.c
src/gallium/auxiliary/driver_noop/noop_pipe.c
src/gallium/auxiliary/driver_rbug/rbug_core.c
src/gallium/auxiliary/driver_trace/tr_dump.c
src/gallium/auxiliary/driver_trace/tr_dump_defines.h
src/gallium/auxiliary/driver_trace/tr_dump_state.c
src/gallium/auxiliary/driver_trace/tr_screen.c
src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c
src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c
src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
src/gallium/auxiliary/gallivm/lp_bld_sample.c
src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
src/gallium/auxiliary/gallivm/lp_bld_type.h
src/gallium/auxiliary/hud/hud_context.c
src/gallium/auxiliary/meson.build
src/gallium/auxiliary/renderonly/renderonly.c
src/gallium/auxiliary/tgsi/tgsi_info.h
src/gallium/auxiliary/translate/translate_generic.c
src/gallium/auxiliary/translate/translate_sse.c
src/gallium/auxiliary/util/u_blit.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_compute.c
src/gallium/auxiliary/util/u_debug_describe.c
src/gallium/auxiliary/util/u_debug_gallium.c
src/gallium/auxiliary/util/u_debug_image.c
src/gallium/auxiliary/util/u_draw.c
src/gallium/auxiliary/util/u_dump_state.c
src/gallium/auxiliary/util/u_format.c [deleted file]
src/gallium/auxiliary/util/u_format.csv [deleted file]
src/gallium/auxiliary/util/u_format.h [deleted file]
src/gallium/auxiliary/util/u_format_bptc.c [deleted file]
src/gallium/auxiliary/util/u_format_bptc.h [deleted file]
src/gallium/auxiliary/util/u_format_etc.c [deleted file]
src/gallium/auxiliary/util/u_format_etc.h [deleted file]
src/gallium/auxiliary/util/u_format_latc.c [deleted file]
src/gallium/auxiliary/util/u_format_latc.h [deleted file]
src/gallium/auxiliary/util/u_format_other.c [deleted file]
src/gallium/auxiliary/util/u_format_other.h [deleted file]
src/gallium/auxiliary/util/u_format_pack.py [deleted file]
src/gallium/auxiliary/util/u_format_parse.py [deleted file]
src/gallium/auxiliary/util/u_format_rgtc.c [deleted file]
src/gallium/auxiliary/util/u_format_rgtc.h [deleted file]
src/gallium/auxiliary/util/u_format_s3tc.c [deleted file]
src/gallium/auxiliary/util/u_format_s3tc.h [deleted file]
src/gallium/auxiliary/util/u_format_table.py [deleted file]
src/gallium/auxiliary/util/u_format_tests.c [deleted file]
src/gallium/auxiliary/util/u_format_tests.h [deleted file]
src/gallium/auxiliary/util/u_format_yuv.c [deleted file]
src/gallium/auxiliary/util/u_format_yuv.h [deleted file]
src/gallium/auxiliary/util/u_format_zs.c [deleted file]
src/gallium/auxiliary/util/u_format_zs.h [deleted file]
src/gallium/auxiliary/util/u_gen_mipmap.c
src/gallium/auxiliary/util/u_pack_color.h
src/gallium/auxiliary/util/u_pstipple.c
src/gallium/auxiliary/util/u_resource.c
src/gallium/auxiliary/util/u_sampler.c
src/gallium/auxiliary/util/u_surface.c
src/gallium/auxiliary/util/u_surface.h
src/gallium/auxiliary/util/u_tests.c
src/gallium/auxiliary/util/u_threaded_context.c
src/gallium/auxiliary/util/u_tile.c
src/gallium/auxiliary/util/u_transfer_helper.c
src/gallium/auxiliary/util/u_vbuf.c
src/gallium/auxiliary/vl/vl_deint_filter.c
src/gallium/auxiliary/vl/vl_vertex_buffers.c
src/gallium/auxiliary/vl/vl_video_buffer.c
src/gallium/drivers/etnaviv/etnaviv_etc2.c
src/gallium/drivers/etnaviv/etnaviv_format.h
src/gallium/drivers/etnaviv/etnaviv_transfer.c
src/gallium/drivers/etnaviv/etnaviv_translate.h
src/gallium/drivers/freedreno/a2xx/fd2_program.c
src/gallium/drivers/freedreno/a2xx/fd2_screen.c
src/gallium/drivers/freedreno/a2xx/fd2_util.c
src/gallium/drivers/freedreno/a3xx/fd3_draw.c
src/gallium/drivers/freedreno/a3xx/fd3_emit.c
src/gallium/drivers/freedreno/a3xx/fd3_format.c
src/gallium/drivers/freedreno/a3xx/fd3_format.h
src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
src/gallium/drivers/freedreno/a3xx/fd3_program.c
src/gallium/drivers/freedreno/a3xx/fd3_screen.c
src/gallium/drivers/freedreno/a3xx/fd3_texture.c
src/gallium/drivers/freedreno/a4xx/fd4_emit.c
src/gallium/drivers/freedreno/a4xx/fd4_format.c
src/gallium/drivers/freedreno/a4xx/fd4_gmem.c
src/gallium/drivers/freedreno/a4xx/fd4_program.c
src/gallium/drivers/freedreno/a4xx/fd4_screen.c
src/gallium/drivers/freedreno/a4xx/fd4_texture.c
src/gallium/drivers/freedreno/a5xx/fd5_emit.c
src/gallium/drivers/freedreno/a5xx/fd5_format.c
src/gallium/drivers/freedreno/a5xx/fd5_gmem.c
src/gallium/drivers/freedreno/a5xx/fd5_program.c
src/gallium/drivers/freedreno/a5xx/fd5_screen.c
src/gallium/drivers/freedreno/a5xx/fd5_texture.c
src/gallium/drivers/freedreno/a6xx/fd6_emit.c
src/gallium/drivers/freedreno/a6xx/fd6_format.c
src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
src/gallium/drivers/freedreno/a6xx/fd6_program.c
src/gallium/drivers/freedreno/a6xx/fd6_screen.c
src/gallium/drivers/freedreno/a6xx/fd6_texture.c
src/gallium/drivers/freedreno/freedreno_draw.c
src/gallium/drivers/freedreno/freedreno_gmem.c
src/gallium/drivers/freedreno/freedreno_resource.c
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/freedreno/freedreno_util.c
src/gallium/drivers/freedreno/ir3/ir3_gallium.c
src/gallium/drivers/i915/i915_clear.c
src/gallium/drivers/i915/i915_resource_texture.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/i915/i915_state_emit.c
src/gallium/drivers/i915/i915_surface.c
src/gallium/drivers/iris/iris_blit.c
src/gallium/drivers/iris/iris_clear.c
src/gallium/drivers/iris/iris_context.c
src/gallium/drivers/iris/iris_formats.c
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/iris/iris_screen.c
src/gallium/drivers/iris/iris_state.c
src/gallium/drivers/lima/lima_draw.c
src/gallium/drivers/lima/lima_resource.c
src/gallium/drivers/llvmpipe/lp_bld_alpha.c
src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
src/gallium/drivers/llvmpipe/lp_bld_depth.c
src/gallium/drivers/llvmpipe/lp_rast_priv.h
src/gallium/drivers/llvmpipe/lp_scene.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_surface.c
src/gallium/drivers/llvmpipe/lp_test.h
src/gallium/drivers/llvmpipe/lp_test_format.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/nouveau/nouveau_screen.c
src/gallium/drivers/nouveau/nouveau_video.c
src/gallium/drivers/nouveau/nouveau_vp3_video.c
src/gallium/drivers/nouveau/nv30/nv30_miptree.c
src/gallium/drivers/nouveau/nv30/nv30_push.c
src/gallium/drivers/nouveau/nv30/nv30_resource.c
src/gallium/drivers/nouveau/nv30/nv30_screen.c
src/gallium/drivers/nouveau/nv30/nv30_state.c
src/gallium/drivers/nouveau/nv30/nv30_state_validate.c
src/gallium/drivers/nouveau/nv30/nv30_texture.c
src/gallium/drivers/nouveau/nv30/nv30_vbo.c
src/gallium/drivers/nouveau/nv50/nv50_blit.h
src/gallium/drivers/nouveau/nv50/nv50_miptree.c
src/gallium/drivers/nouveau/nv50/nv50_push.c
src/gallium/drivers/nouveau/nv50/nv50_resource.c
src/gallium/drivers/nouveau/nv50/nv50_screen.c
src/gallium/drivers/nouveau/nv50/nv50_surface.c
src/gallium/drivers/nouveau/nv50/nv50_tex.c
src/gallium/drivers/nouveau/nv50/nv50_transfer.c
src/gallium/drivers/nouveau/nv50/nv50_vbo.c
src/gallium/drivers/nouveau/nv50/nv84_video.c
src/gallium/drivers/nouveau/nv50/nv98_video.c
src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c
src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c
src/gallium/drivers/nouveau/nvc0/nvc0_video.c
src/gallium/drivers/panfrost/nir/nir_lower_framebuffer.c
src/gallium/drivers/panfrost/pan_afbc.c
src/gallium/drivers/panfrost/pan_blending.c
src/gallium/drivers/panfrost/pan_blit.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_format.h
src/gallium/drivers/panfrost/pan_fragment.c
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_mfbd.c
src/gallium/drivers/panfrost/pan_resource.c
src/gallium/drivers/panfrost/pan_screen.c
src/gallium/drivers/panfrost/pan_sfbd.c
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_fs.c
src/gallium/drivers/r300/r300_hyperz.c
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_state_inlines.h
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_texture_desc.c
src/gallium/drivers/r300/r300_transfer.c
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_formats.h
src/gallium/drivers/r600/r600_pipe_common.c
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/radeonsi/Android.mk
src/gallium/drivers/radeonsi/gfx10_format_table.py
src/gallium/drivers/radeonsi/meson.build
src/gallium/drivers/radeonsi/si_blit.c
src/gallium/drivers/radeonsi/si_clear.c
src/gallium/drivers/radeonsi/si_compute_blit.c
src/gallium/drivers/radeonsi/si_descriptors.c
src/gallium/drivers/radeonsi/si_dma.c
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_texture.c
src/gallium/drivers/softpipe/sp_buffer.c
src/gallium/drivers/softpipe/sp_image.c
src/gallium/drivers/softpipe/sp_quad_blend.c
src/gallium/drivers/softpipe/sp_quad_depth_test.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/softpipe/sp_state_sampler.c
src/gallium/drivers/softpipe/sp_state_so.c
src/gallium/drivers/softpipe/sp_state_surface.c
src/gallium/drivers/softpipe/sp_surface.c
src/gallium/drivers/softpipe/sp_tex_sample.c
src/gallium/drivers/softpipe/sp_tex_tile_cache.c
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/drivers/softpipe/sp_tile_cache.c
src/gallium/drivers/svga/svga_format.c
src/gallium/drivers/svga/svga_pipe_blit.c
src/gallium/drivers/svga/svga_pipe_sampler.c
src/gallium/drivers/svga/svga_pipe_vertex.c
src/gallium/drivers/svga/svga_resource_texture.c
src/gallium/drivers/svga/svga_sampler_view.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/drivers/svga/svga_shader.c
src/gallium/drivers/svga/svga_state_constants.c
src/gallium/drivers/svga/svga_state_framebuffer.c
src/gallium/drivers/svga/svga_state_fs.c
src/gallium/drivers/svga/svga_state_rss.c
src/gallium/drivers/svga/svga_state_sampler.c
src/gallium/drivers/svga/svga_surface.c
src/gallium/drivers/swr/swr_context.cpp
src/gallium/drivers/swr/swr_screen.cpp
src/gallium/drivers/swr/swr_screen.h
src/gallium/drivers/swr/swr_shader.cpp
src/gallium/drivers/swr/swr_state.cpp
src/gallium/drivers/v3d/v3d_blit.c
src/gallium/drivers/v3d/v3d_program.c
src/gallium/drivers/v3d/v3d_resource.c
src/gallium/drivers/v3d/v3d_screen.c
src/gallium/drivers/v3d/v3dx_draw.c
src/gallium/drivers/v3d/v3dx_emit.c
src/gallium/drivers/v3d/v3dx_format_table.c
src/gallium/drivers/v3d/v3dx_rcl.c
src/gallium/drivers/v3d/v3dx_state.c
src/gallium/drivers/vc4/vc4_blit.c
src/gallium/drivers/vc4/vc4_draw.c
src/gallium/drivers/vc4/vc4_formats.c
src/gallium/drivers/vc4/vc4_nir_lower_blend.c
src/gallium/drivers/vc4/vc4_nir_lower_io.c
src/gallium/drivers/vc4/vc4_program.c
src/gallium/drivers/vc4/vc4_resource.c
src/gallium/drivers/vc4/vc4_screen.c
src/gallium/drivers/virgl/virgl_context.c
src/gallium/drivers/virgl/virgl_encode.c
src/gallium/drivers/virgl/virgl_resource.c
src/gallium/drivers/virgl/virgl_screen.c
src/gallium/drivers/virgl/virgl_texture.c
src/gallium/drivers/zink/zink_blit.c
src/gallium/drivers/zink/zink_context.c
src/gallium/drivers/zink/zink_resource.c
src/gallium/drivers/zink/zink_screen.c
src/gallium/drivers/zink/zink_surface.c
src/gallium/state_trackers/clover/core/memory.cpp
src/gallium/state_trackers/clover/core/resource.cpp
src/gallium/state_trackers/dri/dri2.c
src/gallium/state_trackers/dri/dri_drawable.c
src/gallium/state_trackers/dri/dri_screen.c
src/gallium/state_trackers/dri/drisw.c
src/gallium/state_trackers/hgl/hgl.c
src/gallium/state_trackers/nine/adapter9.c
src/gallium/state_trackers/nine/basetexture9.c
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/nine/nine_pipe.h
src/gallium/state_trackers/nine/vertexdeclaration9.c
src/gallium/state_trackers/nine/volume9.c
src/gallium/state_trackers/osmesa/osmesa.c
src/gallium/state_trackers/vdpau/device.c
src/gallium/state_trackers/vdpau/output.c
src/gallium/state_trackers/wgl/stw_ext_pixelformat.c
src/gallium/state_trackers/wgl/stw_pixelformat.c
src/gallium/state_trackers/xvmc/subpicture.c
src/gallium/tests/graw/graw_util.h
src/gallium/tests/trivial/compute.c
src/gallium/tests/unit/translate_test.c
src/gallium/tests/unit/u_format_compatible_test.c
src/gallium/tests/unit/u_format_test.c
src/gallium/winsys/amdgpu/drm/amdgpu_surface.c
src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
src/gallium/winsys/radeon/drm/radeon_drm_surface.c
src/gallium/winsys/svga/drm/vmw_screen_dri.c
src/gallium/winsys/sw/dri/dri_sw_winsys.c
src/gallium/winsys/sw/gdi/gdi_sw_winsys.c
src/gallium/winsys/sw/hgl/hgl_sw_winsys.c
src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
src/mesa/state_tracker/st_atom_framebuffer.c
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_cb_blit.c
src/mesa/state_tracker/st_cb_clear.c
src/mesa/state_tracker/st_cb_copyimage.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_eglimage.c
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_cb_readpixels.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_draw.c
src/mesa/state_tracker/st_format.c
src/mesa/state_tracker/st_gen_mipmap.c
src/mesa/state_tracker/st_manager.c
src/mesa/state_tracker/st_pbo.c
src/mesa/state_tracker/st_sampler_view.c
src/mesa/state_tracker/st_texture.c
src/mesa/state_tracker/tests/st_format.c
src/util/Android.mk
src/util/Makefile.sources
src/util/SConscript
src/util/format/meson.build [new file with mode: 0644]
src/util/format/u_format.c [new file with mode: 0644]
src/util/format/u_format.csv [new file with mode: 0644]
src/util/format/u_format.h [new file with mode: 0644]
src/util/format/u_format_bptc.c [new file with mode: 0644]
src/util/format/u_format_bptc.h [new file with mode: 0644]
src/util/format/u_format_etc.c [new file with mode: 0644]
src/util/format/u_format_etc.h [new file with mode: 0644]
src/util/format/u_format_latc.c [new file with mode: 0644]
src/util/format/u_format_latc.h [new file with mode: 0644]
src/util/format/u_format_other.c [new file with mode: 0644]
src/util/format/u_format_other.h [new file with mode: 0644]
src/util/format/u_format_pack.py [new file with mode: 0644]
src/util/format/u_format_parse.py [new file with mode: 0644]
src/util/format/u_format_rgtc.c [new file with mode: 0644]
src/util/format/u_format_rgtc.h [new file with mode: 0644]
src/util/format/u_format_s3tc.c [new file with mode: 0644]
src/util/format/u_format_s3tc.h [new file with mode: 0644]
src/util/format/u_format_table.py [new file with mode: 0644]
src/util/format/u_format_tests.c [new file with mode: 0644]
src/util/format/u_format_tests.h [new file with mode: 0644]
src/util/format/u_format_yuv.c [new file with mode: 0644]
src/util/format/u_format_yuv.h [new file with mode: 0644]
src/util/format/u_format_zs.c [new file with mode: 0644]
src/util/format/u_format_zs.h [new file with mode: 0644]
src/util/meson.build

index 86b87837f8ed4423b297409052aeb09f0631a410..7af5fdebd8f69b29c71ada0c52528ded7f57faab 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <inttypes.h>
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/ralloc.h"
index 5c3a7c58ac868805d16d712bec8ff9d3e62a82ed..832f6bb6a9dc2a3b901feb44bf22b1d2cd7bc6f6 100644 (file)
@@ -30,7 +30,7 @@
  * appropriately.
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "compiler/nir/nir_builder.h"
 #include "compiler/nir/nir_format_convert.h"
 #include "v3d_compiler.h"
index 173693007618aab2d82b8114979ba2d020193854..c5ad1ed297e41fa79589f6a6b84b5830209f9991 100644 (file)
@@ -27,7 +27,7 @@
 #include "util/u_atomic.h"
 #include "util/u_string.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "drm/freedreno_drmif.h"
 
index a2d5fa60da4db956a0aae04f43ec86b171b2b887..f73299637705e46fd6d8b6c3c2f0083aadc3fe32 100644 (file)
@@ -70,9 +70,6 @@ $(intermediates)/indices/u_unfilled_gen.c \
 $(intermediates)/util/u_format_srgb.c: $(intermediates)/%.c: $(LOCAL_PATH)/%.py
        $(transform-generated-source)
 
-$(intermediates)/util/u_format_table.c: $(intermediates)/%.c: $(LOCAL_PATH)/%.py $(LOCAL_PATH)/util/u_format.csv
-       $(transform-generated-source)
-
 LOCAL_GENERATED_SOURCES += $(MESA_GEN_NIR_H)
 
 include $(GALLIUM_COMMON_MK)
index 8961ae2a1e056e90af51593fe1c88318451f2355..2cc7e8a3fc700bac6b35a14e0ff63f2de3ac316b 100644 (file)
@@ -244,26 +244,6 @@ C_SOURCES := \
        util/u_dump.h \
        util/u_dump_state.c \
        util/u_fifo.h \
-       util/u_format.c \
-       util/u_format.h \
-       util/u_format_bptc.c \
-       util/u_format_bptc.h \
-       util/u_format_etc.c \
-       util/u_format_etc.h \
-       util/u_format_latc.c \
-       util/u_format_latc.h \
-       util/u_format_other.c \
-       util/u_format_other.h \
-       util/u_format_rgtc.c \
-       util/u_format_rgtc.h \
-       util/u_format_s3tc.c \
-       util/u_format_s3tc.h \
-       util/u_format_tests.c \
-       util/u_format_tests.h \
-       util/u_format_yuv.c \
-       util/u_format_yuv.h \
-       util/u_format_zs.c \
-       util/u_format_zs.h \
        util/u_framebuffer.c \
        util/u_framebuffer.h \
        util/u_gen_mipmap.c \
@@ -396,8 +376,7 @@ VL_STUB_SOURCES := \
 
 GENERATED_SOURCES := \
        indices/u_indices_gen.c \
-       indices/u_unfilled_gen.c \
-       util/u_format_table.c
+       indices/u_unfilled_gen.c
 
 GALLIVM_SOURCES := \
        gallivm/lp_bld_arit.c \
index bdd9a1beaa105e008159c3a7ad8d849f0f57ea45..56134da03ee708b1e70db4f253eda1a5cc005d43 100644 (file)
@@ -26,18 +26,6 @@ env.CodeGenerate(
     command = python_cmd + ' $SCRIPT > $TARGET'
 )
 
-env.CodeGenerate(
-    target = 'util/u_format_table.c',
-    script = '#src/gallium/auxiliary/util/u_format_table.py',
-    source = ['#src/gallium/auxiliary/util/u_format.csv'],
-    command = python_cmd + ' $SCRIPT $SOURCE > $TARGET'
-)
-
-env.Depends('util/u_format_table.c', [
-    '#src/gallium/auxiliary/util/u_format_parse.py',
-    'util/u_format_pack.py',
-])
-
 source = env.ParseSourceList('Makefile.sources', [
     'C_SOURCES',
     'VL_STUB_SOURCES',
index db634b419a1c393aa11f7b9addeb6fbb11111ea0..59bcd0dd510271a854c0f6f5c88018ba107c1d60 100644 (file)
@@ -38,7 +38,7 @@
 #include "util/u_inlines.h"
 #include "util/u_helpers.h"
 #include "util/u_prim.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "draw_context.h"
 #include "draw_pipe.h"
 #include "draw_prim_assembler.h"
index 66a943aff425d80a84870c612f78818971a8f430..e84fb5d615765c84dbea1ed99a514b9995c61f1c 100644 (file)
@@ -37,7 +37,7 @@
 #include "pipe/p_shader_tokens.h"
 #include "util/u_inlines.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
index f58e32b98a46e98fa5544d0b6848bd12b5c5dcda..191bd43d11796122222f1e8da2daa8830580d3d6 100644 (file)
@@ -32,7 +32,7 @@
  * \author  Brian Paul
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "draw_pipe.h"
index 33bd7b6cfd511807391335e0368cdc6aef0eba1d..bd6637a6730ce827b39e54e2647e44a40e1e587e 100644 (file)
@@ -40,7 +40,7 @@
 #include "pipe/p_shader_tokens.h"
 #include "util/u_inlines.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_pstipple.h"
index 88063ee5e484456322cecaf93c69f2b18e13d118..f69189763109b6b97581f37eb6965e05f5696212 100644 (file)
@@ -39,7 +39,7 @@
 #include "tgsi/tgsi_dump.h"
 #include "util/u_math.h"
 #include "util/u_prim.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_draw.h"
 
 
index 84fd6bf37a8fd4103903beb3ee89562541efa5a5..17fcfa06728f704f10281b60f62a49aa5931513c 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "util/u_memory.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "draw/draw_context.h"
 #include "draw/draw_private.h"
 #include "draw/draw_pt.h"
index b2ed5d5f13b40656efa69bbc0a6987556563bf3f..a0414a6cd5e87554f8cee6dcd14b5cbc333dfd56 100644 (file)
@@ -28,7 +28,7 @@
 #include "dd_pipe.h"
 
 #include "util/u_dump.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_framebuffer.h"
 #include "util/u_helpers.h"
 #include "util/u_inlines.h"
index 290b99823767b940472e8fc90feb6cb8661797af..fe7267c39caef03e8d1ade8366ed5c94273314aa 100644 (file)
@@ -28,7 +28,7 @@
 #include "pipe/p_screen.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_upload_mgr.h"
 #include "noop_public.h"
 
index 66ac79385e1ccb11c96b048a9951626695dc6ae5..d8dda8af2271c2826a14f2a0672f83806ff429c4 100644 (file)
@@ -27,7 +27,7 @@
 
 
 #include "os/os_thread.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_string.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
index 5bee07dd54ed74577fdcdbc4ee2e24b34b27edc3..0be21ac6fb4ea859f280c637665ad562acca4775 100644 (file)
@@ -50,7 +50,7 @@
 #include "util/u_memory.h"
 #include "util/u_string.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "tr_dump.h"
 #include "tr_screen.h"
index f6e94addfa15836da2fc57e51637bb7387bf3f4b..7c18cd13adc063c8c4e5b96f1b381ebca80bd625 100644 (file)
@@ -29,7 +29,7 @@
 #define TR_DUMP_DEFINES_H_
 
 #include "pipe/p_compiler.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_dump.h"
 #include "tr_dump.h"
 
index 88a50b80903c919e8987be2be0d150710dd0a0ad..bd0d7204cfff928286e19add667725aafba97af8 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "pipe/p_compiler.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "tgsi/tgsi_dump.h"
 
 #include "tr_dump.h"
index 0d2c99cda539987ee80e6da3078f75a7f44eda83..a0943519ea52fd81424b93677b0927608c8f2a6c 100644 (file)
@@ -25,7 +25,7 @@
  *
  **************************************************************************/
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/simple_list.h"
 
index 21680dba74a0bd6531cdd41f650e4ac3c3d282e7..a529fe2f0ef86da1671c9245eb4c15a7305bd8cd 100644 (file)
@@ -33,7 +33,7 @@
  */
 
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
 #include "util/u_pointer.h"
index 636a4a6238fde24897cc5d72022bb2f0685f0380..7d106195d0a5682abe4067bd546753228fe0bcc3 100644 (file)
@@ -36,7 +36,7 @@
 #include "lp_bld_gather.h"
 
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "pipe/p_state.h"
 
 
index 2949494c1cca24ca10b8f0b13ebd84d42b63c96e..0be00130212e3eb629818b6b66e9ed5f12918206 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <llvm/Config/llvm-config.h>
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_string.h"
 #include "util/u_cpu_detect.h"
index 938a16519cd01dab1fa78830b886b1b7249cd95a..c5962a666998d48d62e70337b5f2b99d67212665 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "pipe/p_defines.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
 #include "util/u_math.h"
index fafa67c26192a8b504d657f0eac2758efc6d612e..121452d75966a2e5229a5ba5ea955bfc554eff38 100644 (file)
@@ -34,7 +34,7 @@
  */
 
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_cpu_detect.h"
 
 #include "lp_bld_arit.h"
index e49ae810a5e34748d1a241b263e0e451e2c72984..fa145e1c3b292dc6356304dee4fb68d5a9de5965 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_cpu_detect.h"
 #include "lp_bld_arit.h"
index f89d5fd74331597e9d837ef17e520f7eaa42cf06..83a0755d03d4e831eb6d70c5cb58c4838bd84452 100644 (file)
@@ -39,7 +39,7 @@
 #include "util/u_dump.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_cpu_detect.h"
 #include "lp_bld_debug.h"
 #include "lp_bld_type.h"
index 964818bebed74c87c6b8a233a7817c67b070be83..9161e234c626577466f41849ba720487c5d4759e 100644 (file)
@@ -40,7 +40,7 @@
 #include "util/u_dump.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_cpu_detect.h"
 #include "util/format_rgb9e5.h"
 #include "lp_bld_debug.h"
index 62f1f85461332d4c4df71f439ad9d4567f69fe64..9c7dc252166d8e693f7abf633317a24c390a21dc 100644 (file)
@@ -37,7 +37,7 @@
 #define LP_BLD_TYPE_H
 
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "pipe/p_compiler.h"
 #include "gallivm/lp_bld.h"
 
index 9e6d8fd11a06ccd077b52ff22e00b49540f27ef0..f9733d2de4aa6056135e1c3b7deffff3822d279e 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "cso_cache/cso_context.h"
 #include "util/u_draw_quad.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
index c7ae8fd53e210287aae3398f2bb01eb2242cc258..9ebfcea8624d4bcb361b900b99ccfa291f53e127 100644 (file)
@@ -264,26 +264,6 @@ files_libgallium = files(
   'util/u_dump.h',
   'util/u_dump_state.c',
   'util/u_fifo.h',
-  'util/u_format.c',
-  'util/u_format.h',
-  'util/u_format_bptc.c',
-  'util/u_format_bptc.h',
-  'util/u_format_etc.c',
-  'util/u_format_etc.h',
-  'util/u_format_latc.c',
-  'util/u_format_latc.h',
-  'util/u_format_other.c',
-  'util/u_format_other.h',
-  'util/u_format_rgtc.c',
-  'util/u_format_rgtc.h',
-  'util/u_format_s3tc.c',
-  'util/u_format_s3tc.h',
-  'util/u_format_tests.c',
-  'util/u_format_tests.h',
-  'util/u_format_yuv.c',
-  'util/u_format_yuv.h',
-  'util/u_format_zs.c',
-  'util/u_format_zs.h',
   'util/u_framebuffer.c',
   'util/u_framebuffer.h',
   'util/u_gen_mipmap.c',
@@ -508,18 +488,9 @@ u_unfilled_gen_c = custom_target(
   capture : true,
 )
 
-u_format_table_c = custom_target(
-  'u_format_table.c',
-  input : ['util/u_format_table.py', 'util/u_format.csv'],
-  output : 'u_format_table.c',
-  command : [prog_python, '@INPUT@'],
-  depend_files : files('util/u_format_pack.py', 'util/u_format_parse.py'),
-  capture : true,
-)
-
 libgallium = static_library(
   'gallium',
-  [files_libgallium, u_indices_gen_c, u_unfilled_gen_c, u_format_table_c],
+  [files_libgallium, u_indices_gen_c, u_unfilled_gen_c],
   include_directories : [
     inc_loader, inc_gallium, inc_src, inc_include, include_directories('util')
   ],
index d6a344009378f6cec7d830bef05e242e1ee705d8..29ba92ae02f909e2bcda517f25aaeb5e10986561 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "state_tracker/drm_driver.h"
 #include "pipe/p_screen.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 
index f0bf27ea08b671048582005b8502685b48e46296..40ff9bc117212e51cb19b2f2c74d9dfa6d42dbe6 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "pipe/p_compiler.h"
 #include "pipe/p_shader_tokens.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #if defined __cplusplus
 extern "C" {
index 9f8be2fa8377f225e816639570ee70ed32ff6918..ac3310b4c5ebf5de75a99be6fe139ac743a15082 100644 (file)
@@ -31,7 +31,7 @@
   */
 
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_half.h"
 #include "util/u_math.h"
 #include "pipe/p_state.h"
index 35d29f6db4070593709768f681bcba4dffe5b6fb..c128ac3da7e4eb2f97d7de37c250b0c08251e6fb 100644 (file)
@@ -30,7 +30,7 @@
 #include "pipe/p_compiler.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "translate.h"
 
index 8577486b769364d6cb438bf9e68118f81b6459f5..1216766ee84ba34ddd0327be19deba9f154ad524 100644 (file)
@@ -42,7 +42,7 @@
 
 #include "util/u_blit.h"
 #include "util/u_draw_quad.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_sampler.h"
index f4bd04287c0e160c825bdf09f045ab918234f578..fd7813aae11e059f359a0a000b7d38b24768ec0a 100644 (file)
@@ -38,7 +38,7 @@
 #include "pipe/p_shader_tokens.h"
 #include "pipe/p_state.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
 #include "util/u_blitter.h"
index ccf7119291b45cea759a2affd515879ea16dea98..83f8c710c735562a34971a007871301c19f55db3 100644 (file)
@@ -30,7 +30,7 @@
 #include "pipe/p_state.h"
 
 #include "u_bitcast.h"
-#include "u_format.h"
+#include "util/format/u_format.h"
 #include "u_sampler.h"
 #include "tgsi/tgsi_text.h"
 #include "tgsi/tgsi_ureg.h"
index b78c99dd45a96543c34cfed13c13483321cfc888..8bfd970a508411660767ca3dd098e7012e3a9dd0 100644 (file)
@@ -25,7 +25,7 @@
  **************************************************************************/
 
 #include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_debug_describe.h"
 #include "util/u_string.h"
 
index 9dad0c27c554129c301ead544d956bcc6e4c87b1..63a1e69c0d4121d84310db869a0ad60aeb00f682 100644 (file)
@@ -30,7 +30,7 @@
 #include "util/u_debug.h"
 #include "u_debug_gallium.h"
 #include "u_dump.h"
-#include "u_format.h"
+#include "util/format/u_format.h"
 
 #ifdef DEBUG
 
index 4e7984886d0d17b6b644664e3156df4fa84e87d8..9eb5e1836b3d309a4877f32c0fea246576aacae0 100644 (file)
@@ -25,7 +25,7 @@
 
 
 #include "util/u_debug_image.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
index a7590f7f043142da1a6d765d9f01b8d344aadc3b..b7daa21c692bb945d1f52726bc1151fb2736acb9 100644 (file)
@@ -29,7 +29,7 @@
 #include "util/u_debug.h"
 #include "util/u_inlines.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_draw.h"
 
 
index 5e312bda121aadc4ee0632024d32c2fb50e6fc66..422dc86754f1bbb80f1cec2964039d281ba947af 100644 (file)
@@ -29,7 +29,7 @@
 #include "pipe/p_compiler.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "tgsi/tgsi_dump.h"
 
 #include <inttypes.h>
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
deleted file mode 100644 (file)
index 3364361..0000000
+++ /dev/null
@@ -1,991 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * @file
- * Pixel format accessor functions.
- *
- * @author Jose Fonseca <jfonseca@vmware.com>
- */
-
-#include "util/u_memory.h"
-#include "u_format.h"
-#include "u_format_s3tc.h"
-#include "u_surface.h"
-#include "util/u_math.h"
-
-#include "pipe/p_defines.h"
-#include "pipe/p_screen.h"
-
-
-boolean
-util_format_is_float(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-   int i;
-
-   assert(desc);
-   if (!desc) {
-      return FALSE;
-   }
-
-   i = util_format_get_first_non_void_channel(format);
-   if (i < 0) {
-      return FALSE;
-   }
-
-   return desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT ? TRUE : FALSE;
-}
-
-
-/** Test if the format contains RGB, but not alpha */
-boolean
-util_format_has_alpha(enum pipe_format format)
-{
-   const struct util_format_description *desc =
-      util_format_description(format);
-
-   return (desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
-           desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
-          desc->swizzle[3] != PIPE_SWIZZLE_1;
-}
-
-
-boolean
-util_format_is_luminance(enum pipe_format format)
-{
-   const struct util_format_description *desc =
-      util_format_description(format);
-
-   if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
-        desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
-       desc->swizzle[0] == PIPE_SWIZZLE_X &&
-       desc->swizzle[1] == PIPE_SWIZZLE_X &&
-       desc->swizzle[2] == PIPE_SWIZZLE_X &&
-       desc->swizzle[3] == PIPE_SWIZZLE_1) {
-      return TRUE;
-   }
-   return FALSE;
-}
-
-boolean
-util_format_is_alpha(enum pipe_format format)
-{
-   const struct util_format_description *desc =
-      util_format_description(format);
-
-   if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
-        desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
-       desc->swizzle[0] == PIPE_SWIZZLE_0 &&
-       desc->swizzle[1] == PIPE_SWIZZLE_0 &&
-       desc->swizzle[2] == PIPE_SWIZZLE_0 &&
-       desc->swizzle[3] == PIPE_SWIZZLE_X) {
-      return TRUE;
-   }
-   return FALSE;
-}
-
-boolean
-util_format_is_pure_integer(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-   int i;
-
-   /* Find the first non-void channel. */
-   i = util_format_get_first_non_void_channel(format);
-   if (i == -1)
-      return FALSE;
-
-   return desc->channel[i].pure_integer ? TRUE : FALSE;
-}
-
-boolean
-util_format_is_pure_sint(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-   int i;
-
-   i = util_format_get_first_non_void_channel(format);
-   if (i == -1)
-      return FALSE;
-
-   return (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE;
-}
-
-boolean
-util_format_is_pure_uint(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-   int i;
-
-   i = util_format_get_first_non_void_channel(format);
-   if (i == -1)
-      return FALSE;
-
-   return (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE;
-}
-
-/**
- * Returns true if the format contains normalized signed channels.
- */
-boolean
-util_format_is_snorm(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   return desc->is_snorm;
-}
-
-/**
- * Returns true if the format contains normalized unsigned channels.
- */
-boolean
-util_format_is_unorm(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   return desc->is_unorm;
-}
-
-boolean
-util_format_is_snorm8(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-   int i;
-
-   if (desc->is_mixed)
-      return FALSE;
-
-   i = util_format_get_first_non_void_channel(format);
-   if (i == -1)
-      return FALSE;
-
-   return desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED &&
-          !desc->channel[i].pure_integer &&
-          desc->channel[i].normalized &&
-          desc->channel[i].size == 8;
-}
-
-boolean
-util_format_is_luminance_alpha(enum pipe_format format)
-{
-   const struct util_format_description *desc =
-      util_format_description(format);
-
-   if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
-        desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
-       desc->swizzle[0] == PIPE_SWIZZLE_X &&
-       desc->swizzle[1] == PIPE_SWIZZLE_X &&
-       desc->swizzle[2] == PIPE_SWIZZLE_X &&
-       desc->swizzle[3] == PIPE_SWIZZLE_Y) {
-      return TRUE;
-   }
-   return FALSE;
-}
-
-
-boolean
-util_format_is_intensity(enum pipe_format format)
-{
-   const struct util_format_description *desc =
-      util_format_description(format);
-
-   if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
-        desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
-       desc->swizzle[0] == PIPE_SWIZZLE_X &&
-       desc->swizzle[1] == PIPE_SWIZZLE_X &&
-       desc->swizzle[2] == PIPE_SWIZZLE_X &&
-       desc->swizzle[3] == PIPE_SWIZZLE_X) {
-      return TRUE;
-   }
-   return FALSE;
-}
-
-boolean
-util_format_is_subsampled_422(enum pipe_format format)
-{
-   const struct util_format_description *desc =
-      util_format_description(format);
-
-   return desc->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED &&
-      desc->block.width == 2 &&
-      desc->block.height == 1 &&
-      desc->block.bits == 32;
-}
-
-/**
- * Calculates the MRD for the depth format. MRD is used in depth bias
- * for UNORM and unbound depth buffers. When the depth buffer is floating
- * point, the depth bias calculation does not use the MRD. However, the
- * default MRD will be 1.0 / ((1 << 24) - 1).
- */
-double
-util_get_depth_format_mrd(const struct util_format_description *desc)
-{
-   /*
-    * Depth buffer formats without a depth component OR scenarios
-    * without a bound depth buffer default to D24.
-    */
-   double mrd = 1.0 / ((1 << 24) - 1);
-   unsigned depth_channel;
-
-   assert(desc);
-
-   /*
-    * Some depth formats do not store the depth component in the first
-    * channel, detect the format and adjust the depth channel. Get the
-    * swizzled depth component channel.
-    */
-   depth_channel = desc->swizzle[0];
-
-   if (desc->channel[depth_channel].type == UTIL_FORMAT_TYPE_UNSIGNED &&
-       desc->channel[depth_channel].normalized) {
-      int depth_bits;
-
-      depth_bits = desc->channel[depth_channel].size;
-      mrd = 1.0 / ((1ULL << depth_bits) - 1);
-   }
-
-   return mrd;
-}
-
-
-void
-util_format_read_4f(enum pipe_format format,
-                    float *dst, unsigned dst_stride,
-                    const void *src, unsigned src_stride,
-                    unsigned x, unsigned y, unsigned w, unsigned h)
-{
-   const struct util_format_description *format_desc;
-   const uint8_t *src_row;
-   float *dst_row;
-
-   format_desc = util_format_description(format);
-
-   assert(x % format_desc->block.width == 0);
-   assert(y % format_desc->block.height == 0);
-
-   src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
-   dst_row = dst;
-
-   format_desc->unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
-
-void
-util_format_write_4f(enum pipe_format format,
-                     const float *src, unsigned src_stride,
-                     void *dst, unsigned dst_stride,
-                     unsigned x, unsigned y, unsigned w, unsigned h)
-{
-   const struct util_format_description *format_desc;
-   uint8_t *dst_row;
-   const float *src_row;
-
-   format_desc = util_format_description(format);
-
-   assert(x % format_desc->block.width == 0);
-   assert(y % format_desc->block.height == 0);
-
-   dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
-   src_row = src;
-
-   format_desc->pack_rgba_float(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
-
-void
-util_format_read_4ub(enum pipe_format format, uint8_t *dst, unsigned dst_stride, const void *src, unsigned src_stride, unsigned x, unsigned y, unsigned w, unsigned h)
-{
-   const struct util_format_description *format_desc;
-   const uint8_t *src_row;
-   uint8_t *dst_row;
-
-   format_desc = util_format_description(format);
-
-   assert(x % format_desc->block.width == 0);
-   assert(y % format_desc->block.height == 0);
-
-   src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
-   dst_row = dst;
-
-   format_desc->unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
-
-void
-util_format_write_4ub(enum pipe_format format, const uint8_t *src, unsigned src_stride, void *dst, unsigned dst_stride, unsigned x, unsigned y, unsigned w, unsigned h)
-{
-   const struct util_format_description *format_desc;
-   uint8_t *dst_row;
-   const uint8_t *src_row;
-
-   format_desc = util_format_description(format);
-
-   assert(x % format_desc->block.width == 0);
-   assert(y % format_desc->block.height == 0);
-
-   dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
-   src_row = src;
-
-   format_desc->pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
-void
-util_format_read_4ui(enum pipe_format format,
-                     unsigned *dst, unsigned dst_stride,
-                     const void *src, unsigned src_stride,
-                     unsigned x, unsigned y, unsigned w, unsigned h)
-{
-   const struct util_format_description *format_desc;
-   const uint8_t *src_row;
-   uint32_t *dst_row;
-
-   format_desc = util_format_description(format);
-
-   assert(x % format_desc->block.width == 0);
-   assert(y % format_desc->block.height == 0);
-
-   src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
-   dst_row = dst;
-
-   format_desc->unpack_rgba_uint(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
-void
-util_format_write_4ui(enum pipe_format format,
-                      const unsigned int *src, unsigned src_stride,
-                      void *dst, unsigned dst_stride,
-                      unsigned x, unsigned y, unsigned w, unsigned h)
-{
-   const struct util_format_description *format_desc;
-   uint8_t *dst_row;
-   const uint32_t *src_row;
-
-   format_desc = util_format_description(format);
-
-   assert(x % format_desc->block.width == 0);
-   assert(y % format_desc->block.height == 0);
-
-   dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
-   src_row = src;
-
-   format_desc->pack_rgba_uint(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
-void
-util_format_read_4i(enum pipe_format format,
-                    int *dst, unsigned dst_stride,
-                    const void *src, unsigned src_stride,
-                    unsigned x, unsigned y, unsigned w, unsigned h)
-{
-   const struct util_format_description *format_desc;
-   const uint8_t *src_row;
-   int32_t *dst_row;
-
-   format_desc = util_format_description(format);
-
-   assert(x % format_desc->block.width == 0);
-   assert(y % format_desc->block.height == 0);
-
-   src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
-   dst_row = dst;
-
-   format_desc->unpack_rgba_sint(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
-void
-util_format_write_4i(enum pipe_format format,
-                      const int *src, unsigned src_stride,
-                      void *dst, unsigned dst_stride,
-                      unsigned x, unsigned y, unsigned w, unsigned h)
-{
-   const struct util_format_description *format_desc;
-   uint8_t *dst_row;
-   const int32_t *src_row;
-
-   format_desc = util_format_description(format);
-
-   assert(x % format_desc->block.width == 0);
-   assert(y % format_desc->block.height == 0);
-
-   dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
-   src_row = src;
-
-   format_desc->pack_rgba_sint(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
-/**
- * Check if we can safely memcopy from the source format to the dest format.
- * This basically covers the cases of a "used" channel copied to a typeless
- * channel, plus some 1-channel cases.
- * Examples of compatible copy formats include:
- *    b8g8r8a8_unorm -> b8g8r8x8_unorm
- *    a8r8g8b8_unorm -> x8r8g8b8_unorm
- *    b5g5r5a1_unorm -> b5g5r5x1_unorm
- *    b4g4r4a4_unorm -> b4g4r4x4_unorm
- *    l8_unorm -> r8_unorm
- *    i8_unorm -> l8_unorm
- *    i8_unorm -> a8_unorm
- *    i8_unorm -> r8_unorm
- *    l16_unorm -> r16_unorm
- *    z24_unorm_s8_uint -> z24x8_unorm
- *    s8_uint_z24_unorm -> x8z24_unorm
- *    r8g8b8a8_unorm -> r8g8b8x8_unorm
- *    a8b8g8r8_srgb -> x8b8g8r8_srgb
- *    b8g8r8a8_srgb -> b8g8r8x8_srgb
- *    a8r8g8b8_srgb -> x8r8g8b8_srgb
- *    a8b8g8r8_unorm -> x8b8g8r8_unorm
- *    r10g10b10a2_uscaled -> r10g10b10x2_uscaled
- *    r10sg10sb10sa2u_norm -> r10g10b10x2_snorm
- */
-boolean
-util_is_format_compatible(const struct util_format_description *src_desc,
-                          const struct util_format_description *dst_desc)
-{
-   unsigned chan;
-
-   if (src_desc->format == dst_desc->format) {
-      return TRUE;
-   }
-
-   if (src_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN ||
-       dst_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
-      return FALSE;
-   }
-
-   if (src_desc->block.bits != dst_desc->block.bits ||
-       src_desc->nr_channels != dst_desc->nr_channels ||
-       src_desc->colorspace != dst_desc->colorspace) {
-      return FALSE;
-   }
-
-   for (chan = 0; chan < 4; ++chan) {
-      if (src_desc->channel[chan].size !=
-          dst_desc->channel[chan].size) {
-         return FALSE;
-      }
-   }
-
-   for (chan = 0; chan < 4; ++chan) {
-      enum pipe_swizzle swizzle = dst_desc->swizzle[chan];
-
-      if (swizzle < 4) {
-         if (src_desc->swizzle[chan] != swizzle) {
-            return FALSE;
-         }
-         if ((src_desc->channel[swizzle].type !=
-              dst_desc->channel[swizzle].type) ||
-             (src_desc->channel[swizzle].normalized !=
-              dst_desc->channel[swizzle].normalized)) {
-            return FALSE;
-         }
-      }
-   }
-
-   return TRUE;
-}
-
-
-boolean
-util_format_fits_8unorm(const struct util_format_description *format_desc)
-{
-   unsigned chan;
-
-   /*
-    * After linearized sRGB values require more than 8bits.
-    */
-
-   if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
-      return FALSE;
-   }
-
-   switch (format_desc->layout) {
-
-   case UTIL_FORMAT_LAYOUT_S3TC:
-      /*
-       * These are straight forward.
-       */
-      return TRUE;
-   case UTIL_FORMAT_LAYOUT_RGTC:
-      if (format_desc->format == PIPE_FORMAT_RGTC1_SNORM ||
-          format_desc->format == PIPE_FORMAT_RGTC2_SNORM ||
-          format_desc->format == PIPE_FORMAT_LATC1_SNORM ||
-          format_desc->format == PIPE_FORMAT_LATC2_SNORM)
-         return FALSE;
-      return TRUE;
-   case UTIL_FORMAT_LAYOUT_BPTC:
-      if (format_desc->format == PIPE_FORMAT_BPTC_RGBA_UNORM)
-         return TRUE;
-      return FALSE;
-
-   case UTIL_FORMAT_LAYOUT_ETC:
-      if (format_desc->format == PIPE_FORMAT_ETC1_RGB8)
-         return TRUE;
-      return FALSE;
-
-   case UTIL_FORMAT_LAYOUT_PLAIN:
-      /*
-       * For these we can find a generic rule.
-       */
-
-      for (chan = 0; chan < format_desc->nr_channels; ++chan) {
-         switch (format_desc->channel[chan].type) {
-         case UTIL_FORMAT_TYPE_VOID:
-            break;
-         case UTIL_FORMAT_TYPE_UNSIGNED:
-            if (!format_desc->channel[chan].normalized ||
-                format_desc->channel[chan].size > 8) {
-               return FALSE;
-            }
-            break;
-         default:
-            return FALSE;
-         }
-      }
-      return TRUE;
-
-   default:
-      /*
-       * Handle all others on a case by case basis.
-       */
-
-      switch (format_desc->format) {
-      case PIPE_FORMAT_R1_UNORM:
-      case PIPE_FORMAT_UYVY:
-      case PIPE_FORMAT_YUYV:
-      case PIPE_FORMAT_R8G8_B8G8_UNORM:
-      case PIPE_FORMAT_G8R8_G8B8_UNORM:
-         return TRUE;
-
-      default:
-         return FALSE;
-      }
-   }
-}
-
-
-boolean
-util_format_translate(enum pipe_format dst_format,
-                      void *dst, unsigned dst_stride,
-                      unsigned dst_x, unsigned dst_y,
-                      enum pipe_format src_format,
-                      const void *src, unsigned src_stride,
-                      unsigned src_x, unsigned src_y,
-                      unsigned width, unsigned height)
-{
-   const struct util_format_description *dst_format_desc;
-   const struct util_format_description *src_format_desc;
-   uint8_t *dst_row;
-   const uint8_t *src_row;
-   unsigned x_step, y_step;
-   unsigned dst_step;
-   unsigned src_step;
-
-   dst_format_desc = util_format_description(dst_format);
-   src_format_desc = util_format_description(src_format);
-
-   if (util_is_format_compatible(src_format_desc, dst_format_desc)) {
-      /*
-       * Trivial case.
-       */
-
-      util_copy_rect(dst, dst_format, dst_stride,  dst_x, dst_y,
-                     width, height, src, (int)src_stride,
-                     src_x, src_y);
-      return TRUE;
-   }
-
-   assert(dst_x % dst_format_desc->block.width == 0);
-   assert(dst_y % dst_format_desc->block.height == 0);
-   assert(src_x % src_format_desc->block.width == 0);
-   assert(src_y % src_format_desc->block.height == 0);
-
-   dst_row = (uint8_t *)dst + dst_y*dst_stride + dst_x*(dst_format_desc->block.bits/8);
-   src_row = (const uint8_t *)src + src_y*src_stride + src_x*(src_format_desc->block.bits/8);
-
-   /*
-    * This works because all pixel formats have pixel blocks with power of two
-    * sizes.
-    */
-
-   y_step = MAX2(dst_format_desc->block.height, src_format_desc->block.height);
-   x_step = MAX2(dst_format_desc->block.width, src_format_desc->block.width);
-   assert(y_step % dst_format_desc->block.height == 0);
-   assert(y_step % src_format_desc->block.height == 0);
-
-   dst_step = y_step / dst_format_desc->block.height * dst_stride;
-   src_step = y_step / src_format_desc->block.height * src_stride;
-
-   /*
-    * TODO: double formats will loose precision
-    * TODO: Add a special case for formats that are mere swizzles of each other
-    */
-
-   if (src_format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS ||
-       dst_format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
-      float *tmp_z = NULL;
-      uint8_t *tmp_s = NULL;
-
-      assert(x_step == 1);
-      assert(y_step == 1);
-
-      if (src_format_desc->unpack_z_float &&
-          dst_format_desc->pack_z_float) {
-         tmp_z = MALLOC(width * sizeof *tmp_z);
-      }
-
-      if (src_format_desc->unpack_s_8uint &&
-          dst_format_desc->pack_s_8uint) {
-         tmp_s = MALLOC(width * sizeof *tmp_s);
-      }
-
-      while (height--) {
-         if (tmp_z) {
-            src_format_desc->unpack_z_float(tmp_z, 0, src_row, src_stride, width, 1);
-            dst_format_desc->pack_z_float(dst_row, dst_stride, tmp_z, 0, width, 1);
-         }
-
-         if (tmp_s) {
-            src_format_desc->unpack_s_8uint(tmp_s, 0, src_row, src_stride, width, 1);
-            dst_format_desc->pack_s_8uint(dst_row, dst_stride, tmp_s, 0, width, 1);
-         }
-
-         dst_row += dst_step;
-         src_row += src_step;
-      }
-
-      FREE(tmp_s);
-
-      FREE(tmp_z);
-
-      return TRUE;
-   }
-
-   if (util_format_fits_8unorm(src_format_desc) ||
-       util_format_fits_8unorm(dst_format_desc)) {
-      unsigned tmp_stride;
-      uint8_t *tmp_row;
-
-      if (!src_format_desc->unpack_rgba_8unorm ||
-          !dst_format_desc->pack_rgba_8unorm) {
-         return FALSE;
-      }
-
-      tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
-      tmp_row = MALLOC(y_step * tmp_stride);
-      if (!tmp_row)
-         return FALSE;
-
-      while (height >= y_step) {
-         src_format_desc->unpack_rgba_8unorm(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
-         dst_format_desc->pack_rgba_8unorm(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
-
-         dst_row += dst_step;
-         src_row += src_step;
-         height -= y_step;
-      }
-
-      if (height) {
-         src_format_desc->unpack_rgba_8unorm(tmp_row, tmp_stride, src_row, src_stride, width, height);
-         dst_format_desc->pack_rgba_8unorm(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
-      }
-
-      FREE(tmp_row);
-   }
-   else if (util_format_is_pure_sint(src_format) ||
-            util_format_is_pure_sint(dst_format)) {
-      unsigned tmp_stride;
-      int *tmp_row;
-
-      if (!src_format_desc->unpack_rgba_sint ||
-          !dst_format_desc->pack_rgba_sint) {
-         return FALSE;
-      }
-
-      tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
-      tmp_row = MALLOC(y_step * tmp_stride);
-      if (!tmp_row)
-         return FALSE;
-
-      while (height >= y_step) {
-         src_format_desc->unpack_rgba_sint(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
-         dst_format_desc->pack_rgba_sint(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
-
-         dst_row += dst_step;
-         src_row += src_step;
-         height -= y_step;
-      }
-
-      if (height) {
-         src_format_desc->unpack_rgba_sint(tmp_row, tmp_stride, src_row, src_stride, width, height);
-         dst_format_desc->pack_rgba_sint(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
-      }
-
-      FREE(tmp_row);
-   }
-   else if (util_format_is_pure_uint(src_format) ||
-            util_format_is_pure_uint(dst_format)) {
-      unsigned tmp_stride;
-      unsigned int *tmp_row;
-
-      if (!src_format_desc->unpack_rgba_uint ||
-          !dst_format_desc->pack_rgba_uint) {
-         return FALSE;
-      }
-
-      tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
-      tmp_row = MALLOC(y_step * tmp_stride);
-      if (!tmp_row)
-         return FALSE;
-
-      while (height >= y_step) {
-         src_format_desc->unpack_rgba_uint(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
-         dst_format_desc->pack_rgba_uint(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
-
-         dst_row += dst_step;
-         src_row += src_step;
-         height -= y_step;
-      }
-
-      if (height) {
-         src_format_desc->unpack_rgba_uint(tmp_row, tmp_stride, src_row, src_stride, width, height);
-         dst_format_desc->pack_rgba_uint(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
-      }
-
-      FREE(tmp_row);
-   }
-   else {
-      unsigned tmp_stride;
-      float *tmp_row;
-
-      if (!src_format_desc->unpack_rgba_float ||
-          !dst_format_desc->pack_rgba_float) {
-         return FALSE;
-      }
-
-      tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
-      tmp_row = MALLOC(y_step * tmp_stride);
-      if (!tmp_row)
-         return FALSE;
-
-      while (height >= y_step) {
-         src_format_desc->unpack_rgba_float(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
-         dst_format_desc->pack_rgba_float(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
-
-         dst_row += dst_step;
-         src_row += src_step;
-         height -= y_step;
-      }
-
-      if (height) {
-         src_format_desc->unpack_rgba_float(tmp_row, tmp_stride, src_row, src_stride, width, height);
-         dst_format_desc->pack_rgba_float(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
-      }
-
-      FREE(tmp_row);
-   }
-   return TRUE;
-}
-
-boolean
-util_format_translate_3d(enum pipe_format dst_format,
-                         void *dst, unsigned dst_stride,
-                         unsigned dst_slice_stride,
-                         unsigned dst_x, unsigned dst_y,
-                         unsigned dst_z,
-                         enum pipe_format src_format,
-                         const void *src, unsigned src_stride,
-                         unsigned src_slice_stride,
-                         unsigned src_x, unsigned src_y,
-                         unsigned src_z, unsigned width,
-                         unsigned height, unsigned depth)
-{
-   uint8_t *dst_layer;
-   const uint8_t *src_layer;
-   unsigned z;
-   dst_layer = dst;
-   src_layer = src;
-   dst_layer += dst_z * dst_slice_stride;
-   src_layer += src_z * src_slice_stride;
-   for (z = 0; z < depth; ++z) {
-      if (!util_format_translate(dst_format, dst_layer, dst_stride,
-                                 dst_x, dst_y,
-                                 src_format, src_layer, src_stride,
-                                 src_x, src_y,
-                                 width, height))
-          return FALSE;
-
-      dst_layer += dst_slice_stride;
-      src_layer += src_slice_stride;
-   }
-   return TRUE;
-}
-
-void util_format_compose_swizzles(const unsigned char swz1[4],
-                                  const unsigned char swz2[4],
-                                  unsigned char dst[4])
-{
-   unsigned i;
-
-   for (i = 0; i < 4; i++) {
-      dst[i] = swz2[i] <= PIPE_SWIZZLE_W ?
-               swz1[swz2[i]] : swz2[i];
-   }
-}
-
-void util_format_apply_color_swizzle(union pipe_color_union *dst,
-                                     const union pipe_color_union *src,
-                                     const unsigned char swz[4],
-                                     const boolean is_integer)
-{
-   unsigned c;
-
-   if (is_integer) {
-      for (c = 0; c < 4; ++c) {
-         switch (swz[c]) {
-         case PIPE_SWIZZLE_X:   dst->ui[c] = src->ui[0]; break;
-         case PIPE_SWIZZLE_Y: dst->ui[c] = src->ui[1]; break;
-         case PIPE_SWIZZLE_Z:  dst->ui[c] = src->ui[2]; break;
-         case PIPE_SWIZZLE_W: dst->ui[c] = src->ui[3]; break;
-         default:
-            dst->ui[c] = (swz[c] == PIPE_SWIZZLE_1) ? 1 : 0;
-            break;
-         }
-      }
-   } else {
-      for (c = 0; c < 4; ++c) {
-         switch (swz[c]) {
-         case PIPE_SWIZZLE_X:   dst->f[c] = src->f[0]; break;
-         case PIPE_SWIZZLE_Y: dst->f[c] = src->f[1]; break;
-         case PIPE_SWIZZLE_Z:  dst->f[c] = src->f[2]; break;
-         case PIPE_SWIZZLE_W: dst->f[c] = src->f[3]; break;
-         default:
-            dst->f[c] = (swz[c] == PIPE_SWIZZLE_1) ? 1.0f : 0.0f;
-            break;
-         }
-      }
-   }
-}
-
-void pipe_swizzle_4f(float *dst, const float *src,
-                            const unsigned char swz[4])
-{
-   unsigned i;
-
-   for (i = 0; i < 4; i++) {
-      if (swz[i] <= PIPE_SWIZZLE_W)
-         dst[i] = src[swz[i]];
-      else if (swz[i] == PIPE_SWIZZLE_0)
-         dst[i] = 0;
-      else if (swz[i] == PIPE_SWIZZLE_1)
-         dst[i] = 1;
-   }
-}
-
-void util_format_unswizzle_4f(float *dst, const float *src,
-                              const unsigned char swz[4])
-{
-   unsigned i;
-
-   for (i = 0; i < 4; i++) {
-      switch (swz[i]) {
-      case PIPE_SWIZZLE_X:
-         dst[0] = src[i];
-         break;
-      case PIPE_SWIZZLE_Y:
-         dst[1] = src[i];
-         break;
-      case PIPE_SWIZZLE_Z:
-         dst[2] = src[i];
-         break;
-      case PIPE_SWIZZLE_W:
-         dst[3] = src[i];
-         break;
-      }
-   }
-}
-
-enum pipe_format
-util_format_snorm8_to_sint8(enum pipe_format format)
-{
-   switch (format) {
-   case PIPE_FORMAT_R8_SNORM:
-      return PIPE_FORMAT_R8_SINT;
-   case PIPE_FORMAT_R8G8_SNORM:
-      return PIPE_FORMAT_R8G8_SINT;
-   case PIPE_FORMAT_R8G8B8_SNORM:
-      return PIPE_FORMAT_R8G8B8_SINT;
-   case PIPE_FORMAT_R8G8B8A8_SNORM:
-      return PIPE_FORMAT_R8G8B8A8_SINT;
-
-   case PIPE_FORMAT_A8_SNORM:
-      return PIPE_FORMAT_A8_SINT;
-   case PIPE_FORMAT_L8_SNORM:
-      return PIPE_FORMAT_L8_SINT;
-   case PIPE_FORMAT_L8A8_SNORM:
-      return PIPE_FORMAT_L8A8_SINT;
-   case PIPE_FORMAT_I8_SNORM:
-      return PIPE_FORMAT_I8_SINT;
-
-   case PIPE_FORMAT_R8G8B8X8_SNORM:
-      return PIPE_FORMAT_R8G8B8X8_SINT;
-   case PIPE_FORMAT_R8A8_SNORM:
-      return PIPE_FORMAT_R8A8_SINT;
-   case PIPE_FORMAT_G8R8_SNORM:
-      return PIPE_FORMAT_G8R8_SINT;
-   case PIPE_FORMAT_A8B8G8R8_SNORM:
-      return PIPE_FORMAT_A8B8G8R8_SINT;
-   case PIPE_FORMAT_X8B8G8R8_SNORM:
-      return PIPE_FORMAT_X8B8G8R8_SINT;
-
-   default:
-      return format;
-   }
-}
-
-bool
-util_format_planar_is_supported(struct pipe_screen *screen,
-                                enum pipe_format format,
-                                enum pipe_texture_target target,
-                                unsigned sample_count,
-                                unsigned storage_sample_count,
-                                unsigned bind)
-{
-   unsigned num_planes = util_format_get_num_planes(format);
-   assert(num_planes >= 2);
-
-   for (unsigned i = 0; i < num_planes; i++) {
-      if (!screen->is_format_supported(screen,
-                                       util_format_get_plane_format(format, i),
-                                       target, sample_count,
-                                       storage_sample_count, bind))
-         return false;
-   }
-
-   return true;
-}
diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
deleted file mode 100644 (file)
index 61ad815..0000000
+++ /dev/null
@@ -1,511 +0,0 @@
-###########################################################################
-# 
-# Copyright 2009-2010 VMware, Inc.
-# All Rights Reserved.
-# 
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sub license, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-# 
-# The above copyright notice and this permission notice (including the
-# next paragraph) shall be included in all copies or substantial portions
-# of the Software.
-# 
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR
-# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-# 
-###########################################################################
-
-# This CSV file has the input data for u_format.h's struct
-# util_format_description. It is also used as input for radeonsi's format
-# mapping.
-#
-# Each format entry contains:
-# - name, per enum pipe_format
-# - layout, per enum util_format_layout, in shortened lower caps
-# - pixel block's width
-# - pixel block's height
-# - channel encoding (only meaningful for plain layout), containing for each
-#   channel the following information:
-#   - type, one of
-#     - 'x': void
-#     - 'u': unsigned
-#     - 's': signed
-#     - 'h': fixed
-#     - 'f': FLOAT
-#   - optionally followed by 'n' if it is normalized
-#   - optionally followed by 'p' if it is pure
-#   - number of bits
-# - channel swizzle 
-# - color space: rgb, srgb, yuv, zs
-# - (optional) channel encoding for big-endian targets
-# - (optional) channel swizzle for big-endian targets
-#
-# See also:
-# - http://msdn.microsoft.com/en-us/library/bb172558.aspx (D3D9)
-# - http://msdn.microsoft.com/en-us/library/bb205073.aspx#mapping_texture_formats (D3D9 -> D3D10)
-# - http://msdn.microsoft.com/en-us/library/bb173059.aspx (D3D10)
-#
-# Note that GL doesn't really specify the layout of internal formats. See
-# OpenGL 2.1 specification, Table 3.16, on the "Correspondence of sized
-# internal formats to base in- ternal formats, and desired component
-# resolutions for each sized internal format."
-
-# None
-# Described as regular uint_8 bytes, i.e. PIPE_FORMAT_R8_USCALED
-PIPE_FORMAT_NONE                    , plain, 1, 1, 1, u8  ,     ,     ,     , x001, rgb
-
-# Typical rendertarget formats
-PIPE_FORMAT_B8G8R8A8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , un8 , zyxw, rgb
-PIPE_FORMAT_B8G8R8X8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , x8  , zyx1, rgb
-PIPE_FORMAT_A8R8G8B8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , un8 , yzwx, rgb
-PIPE_FORMAT_X8R8G8B8_UNORM          , plain, 1, 1, 1, x8  , un8 , un8 , un8 , yzw1, rgb
-PIPE_FORMAT_A8B8G8R8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , un8 , wzyx, rgb
-PIPE_FORMAT_X8B8G8R8_UNORM          , plain, 1, 1, 1, x8  , un8 , un8 , un8 , wzy1, rgb
-# PIPE_FORMAT_R8G8B8A8_UNORM is below
-PIPE_FORMAT_R8G8B8X8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , x8  , xyz1, rgb
-PIPE_FORMAT_R5G5B5A1_UNORM          , plain, 1, 1, 1, un5 , un5 , un5 , un1 , xyzw, rgb, un1 , un5 , un5 , un5 , wzyx
-PIPE_FORMAT_B5G5R5X1_UNORM          , plain, 1, 1, 1, un5 , un5 , un5 , x1  , zyx1, rgb, x1  , un5 , un5 , un5 , yzw1
-PIPE_FORMAT_B5G5R5A1_UNORM          , plain, 1, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb, un1 , un5 , un5 , un5 , yzwx
-PIPE_FORMAT_X1B5G5R5_UNORM          , plain, 1, 1, 1, x1  , un5 , un5 , un5 , wzy1, rgb, un5 , un5 , un5 ,  x1 , xyz1
-PIPE_FORMAT_A1R5G5B5_UNORM          , plain, 1, 1, 1, un1 , un5 , un5 , un5 , yzwx, rgb, un5 , un5 , un5 , un1 , zyxw
-PIPE_FORMAT_A1B5G5R5_UNORM          , plain, 1, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb, un5 , un5 , un5 , un1 , xyzw
-PIPE_FORMAT_R4G4B4A4_UNORM          , plain, 1, 1, 1, un4 , un4 , un4 , un4 , xyzw, rgb, un4 , un4 , un4 , un4 , wzyx
-PIPE_FORMAT_B4G4R4A4_UNORM          , plain, 1, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb, un4 , un4 , un4 , un4 , yzwx
-PIPE_FORMAT_B4G4R4X4_UNORM          , plain, 1, 1, 1, un4 , un4 , un4 , x4  , zyx1, rgb, x4  , un4 , un4 , un4 , yzw1
-PIPE_FORMAT_A4R4G4B4_UNORM          , plain, 1, 1, 1, un4 , un4 , un4 , un4 , yzwx, rgb, un4 , un4 , un4 , un4 , zyxw
-PIPE_FORMAT_A4B4G4R4_UNORM          , plain, 1, 1, 1, un4 , un4 , un4 , un4 , wzyx, rgb, un4 , un4 , un4 , un4 , xyzw
-PIPE_FORMAT_R5G6B5_UNORM            , plain, 1, 1, 1, un5 , un6 , un5 ,     , xyz1, rgb, un5 , un6 , un5 ,     , zyx1
-PIPE_FORMAT_B5G6R5_UNORM            , plain, 1, 1, 1, un5 , un6 , un5 ,     , zyx1, rgb, un5 , un6 , un5 ,     , xyz1
-PIPE_FORMAT_R10G10B10A2_UNORM       , plain, 1, 1, 1, un10, un10, un10, un2 , xyzw, rgb, un2 , un10, un10, un10, wzyx
-PIPE_FORMAT_R10G10B10X2_UNORM       , plain, 1, 1, 1, un10, un10, un10, x2,   xyz1, rgb, x2  , un10, un10, un10, wzy1
-PIPE_FORMAT_B10G10R10A2_UNORM       , plain, 1, 1, 1, un10, un10, un10, un2 , zyxw, rgb, un2 , un10, un10, un10, yzwx
-PIPE_FORMAT_A2R10G10B10_UNORM       , plain, 1, 1, 1, un2 , un10, un10, un10, yzwx, rgb, un10, un10, un10, un2 , zyxw
-PIPE_FORMAT_A2B10G10R10_UNORM       , plain, 1, 1, 1, un2 , un10, un10, un10, wzyx, rgb, un10, un10, un10, un2 , xyzw
-PIPE_FORMAT_R3G3B2_UNORM            , plain, 1, 1, 1, un3 , un3 , un2 ,     , xyz1, rgb, un3 , un3 , un2 ,     , zyx1
-PIPE_FORMAT_B2G3R3_UNORM            , plain, 1, 1, 1, un2 , un3 , un3 ,     , zyx1, rgb, un3 , un3 , un2 ,     , xyz1
-
-# Luminance/Intensity/Alpha formats
-PIPE_FORMAT_L8_UNORM                , plain, 1, 1, 1, un8 ,     ,     ,     , xxx1, rgb
-PIPE_FORMAT_A8_UNORM                , plain, 1, 1, 1, un8 ,     ,     ,     , 000x, rgb
-PIPE_FORMAT_I8_UNORM                , plain, 1, 1, 1, un8 ,     ,     ,     , xxxx, rgb
-PIPE_FORMAT_L4A4_UNORM              , plain, 1, 1, 1, un4 , un4 ,     ,     , xxxy, rgb, un4 , un4 ,     ,     , yyyx
-PIPE_FORMAT_L8A8_UNORM              , plain, 1, 1, 1, un8 , un8 ,     ,     , xxxy, rgb
-PIPE_FORMAT_L16_UNORM               , plain, 1, 1, 1, un16,     ,     ,     , xxx1, rgb
-PIPE_FORMAT_A16_UNORM               , plain, 1, 1, 1, un16,     ,     ,     , 000x, rgb
-PIPE_FORMAT_I16_UNORM               , plain, 1, 1, 1, un16,     ,     ,     , xxxx, rgb
-PIPE_FORMAT_L16A16_UNORM            , plain, 1, 1, 1, un16, un16,     ,     , xxxy, rgb
-PIPE_FORMAT_A8_SNORM                , plain, 1, 1, 1, sn8 ,     ,     ,     , 000x, rgb
-PIPE_FORMAT_L8_SNORM                , plain, 1, 1, 1, sn8 ,     ,     ,     , xxx1, rgb
-PIPE_FORMAT_L8A8_SNORM              , plain, 1, 1, 1, sn8 , sn8 ,     ,     , xxxy, rgb
-PIPE_FORMAT_I8_SNORM                , plain, 1, 1, 1, sn8 ,     ,     ,     , xxxx, rgb
-PIPE_FORMAT_A16_SNORM               , plain, 1, 1, 1, sn16,     ,     ,     , 000x, rgb
-PIPE_FORMAT_L16_SNORM               , plain, 1, 1, 1, sn16,     ,     ,     , xxx1, rgb
-PIPE_FORMAT_L16A16_SNORM            , plain, 1, 1, 1, sn16, sn16,     ,     , xxxy, rgb
-PIPE_FORMAT_I16_SNORM               , plain, 1, 1, 1, sn16,     ,     ,     , xxxx, rgb
-PIPE_FORMAT_A16_FLOAT               , plain, 1, 1, 1, f16 ,     ,     ,     , 000x, rgb
-PIPE_FORMAT_L16_FLOAT               , plain, 1, 1, 1, f16 ,     ,     ,     , xxx1, rgb
-PIPE_FORMAT_L16A16_FLOAT            , plain, 1, 1, 1, f16 , f16 ,     ,     , xxxy, rgb
-PIPE_FORMAT_I16_FLOAT               , plain, 1, 1, 1, f16 ,     ,     ,     , xxxx, rgb
-PIPE_FORMAT_A32_FLOAT               , plain, 1, 1, 1, f32 ,     ,     ,     , 000x, rgb
-PIPE_FORMAT_L32_FLOAT               , plain, 1, 1, 1, f32 ,     ,     ,     , xxx1, rgb
-PIPE_FORMAT_L32A32_FLOAT            , plain, 1, 1, 1, f32 , f32 ,     ,     , xxxy, rgb
-PIPE_FORMAT_I32_FLOAT               , plain, 1, 1, 1, f32 ,     ,     ,     , xxxx, rgb
-
-# SRGB formats
-PIPE_FORMAT_L8_SRGB                 , plain, 1, 1, 1, un8 ,     ,     ,     , xxx1, srgb 
-PIPE_FORMAT_R8_SRGB                 , plain, 1, 1, 1, un8 ,     ,     ,     , x001, srgb
-PIPE_FORMAT_L8A8_SRGB               , plain, 1, 1, 1, un8 , un8 ,     ,     , xxxy, srgb 
-PIPE_FORMAT_R8G8B8_SRGB             , plain, 1, 1, 1, un8 , un8 , un8 ,     , xyz1, srgb 
-PIPE_FORMAT_R8G8B8A8_SRGB           , plain, 1, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb 
-PIPE_FORMAT_A8B8G8R8_SRGB           , plain, 1, 1, 1, un8 , un8 , un8 , un8 , wzyx, srgb
-PIPE_FORMAT_X8B8G8R8_SRGB           , plain, 1, 1, 1, x8  , un8 , un8 , un8 , wzy1, srgb
-PIPE_FORMAT_B8G8R8A8_SRGB           , plain, 1, 1, 1, un8 , un8 , un8 , un8 , zyxw, srgb
-PIPE_FORMAT_B8G8R8X8_SRGB           , plain, 1, 1, 1, un8 , un8 , un8 , x8  , zyx1, srgb
-PIPE_FORMAT_A8R8G8B8_SRGB           , plain, 1, 1, 1, un8 , un8 , un8 , un8 , yzwx, srgb
-PIPE_FORMAT_X8R8G8B8_SRGB           , plain, 1, 1, 1, x8  , un8 , un8 , un8 , yzw1, srgb
-
-# Mixed-sign formats (typically used for bump map textures)
-PIPE_FORMAT_R8SG8SB8UX8U_NORM       , plain, 1, 1, 1, sn8 , sn8 , un8 , x8  , xyz1, rgb
-PIPE_FORMAT_R10SG10SB10SA2U_NORM    , plain, 1, 1, 1, sn10, sn10, sn10, un2 , xyzw, rgb, un2 , sn10, sn10, sn10, wzyx
-PIPE_FORMAT_R5SG5SB6U_NORM          , plain, 1, 1, 1, sn5 , sn5 , un6 ,     , xyz1, rgb, un6 , sn5 , sn5 ,     , zyx1
-
-# Depth-stencil formats
-PIPE_FORMAT_S8_UINT                 , plain, 1, 1, 1, up8 ,     ,     ,     , _x__, zs
-PIPE_FORMAT_Z16_UNORM               , plain, 1, 1, 1, un16,     ,     ,     , x___, zs
-PIPE_FORMAT_Z32_UNORM               , plain, 1, 1, 1, un32,     ,     ,     , x___, zs
-PIPE_FORMAT_Z32_FLOAT               , plain, 1, 1, 1, f32 ,     ,     ,     , x___, zs
-PIPE_FORMAT_Z24_UNORM_S8_UINT       , plain, 1, 1, 1, un24, up8 ,     ,     , xy__, zs,    up8 , un24,     ,     , yx__
-PIPE_FORMAT_S8_UINT_Z24_UNORM       , plain, 1, 1, 1, up8 , un24,     ,     , yx__, zs,    un24, up8 ,     ,     , xy__
-PIPE_FORMAT_X24S8_UINT              , plain, 1, 1, 1, x24 , up8 ,     ,     , _y__, zs,    up8 , x24 ,     ,     , _x__
-PIPE_FORMAT_S8X24_UINT              , plain, 1, 1, 1, up8 , x24 ,     ,     , _x__, zs,    x24 , up8 ,     ,     , _y__
-PIPE_FORMAT_Z24X8_UNORM             , plain, 1, 1, 1, un24, x8  ,     ,     , x___, zs,    x8  , un24,     ,     , y___
-PIPE_FORMAT_X8Z24_UNORM             , plain, 1, 1, 1, x8  , un24,     ,     , y___, zs,    un24, x8  ,     ,     , x___
-PIPE_FORMAT_Z32_FLOAT_S8X24_UINT    , plain, 1, 1, 1, f32 , up8 ,  x24,     , xy__, zs,    f32 , x24 ,  up8,     , xz__
-PIPE_FORMAT_X32_S8X24_UINT          , plain, 1, 1, 1, x32 , up8 ,  x24,     , _y__, zs,    x32 , x24 ,  up8,     , _z__
-
-# Depth-stencil formats equivalent to blitting PIPE_FORMAT_Z24_UNORM_S8_UINT
-# as PIPE_FORMAT_R8G8B8A8_*, in that it is an equivalent size to the z/s
-# format.  This is mainly for hw that has some sort of bandwidth compressed
-# format where the compression for z24s8 is not equivalent to r8g8b8a8,
-# and therefore some special handling is required for blits.
-PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8 , plain, 1, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb
-
-# YUV formats
-# http://www.fourcc.org/yuv.php#UYVY
-PIPE_FORMAT_UYVY                     , subsampled, 2, 1, 1, x32 ,     ,     ,     , xyz1, yuv
-# http://www.fourcc.org/yuv.php#YUYV (a.k.a http://www.fourcc.org/yuv.php#YUY2)
-PIPE_FORMAT_YUYV                     , subsampled, 2, 1, 1, x32 ,     ,     ,     , xyz1, yuv
-
-PIPE_FORMAT_AYUV                    , other, 4, 4, 1, un8 ,     ,     ,     , xyzw, yuv
-PIPE_FORMAT_XYUV                    , other, 4, 4, 1, un8 ,     ,     ,     , xyz1, yuv
-
-# same subsampling but with rgb channels
-PIPE_FORMAT_R8G8_B8G8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , xyz1, rgb
-PIPE_FORMAT_G8R8_G8B8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , xyz1, rgb
-PIPE_FORMAT_G8R8_B8R8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , yxz1, rgb
-PIPE_FORMAT_R8G8_R8B8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , yxz1, rgb
-
-# some special formats not fitting anywhere else
-PIPE_FORMAT_R11G11B10_FLOAT         , other,     1, 1, 1, f11 , f11 , f10 ,     , xyz1, rgb
-PIPE_FORMAT_R9G9B9E5_FLOAT          , other,     1, 1, 1, f9  , f9  , f9  , x5  , xyz1, rgb
-PIPE_FORMAT_R1_UNORM                , other,     8, 1, 1, x8  ,     ,     ,     , x001, rgb
-# A.k.a. D3DFMT_CxV8U8
-PIPE_FORMAT_R8G8Bx_SNORM            , other,     1, 1, 1, sn8 , sn8 ,     ,     , xyz1, rgb
-
-# Compressed formats
-# - http://en.wikipedia.org/wiki/S3_Texture_Compression
-# - http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt
-# - http://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
-# - http://www.opengl.org/registry/specs/EXT/texture_compression_latc.txt
-# - http://www.opengl.org/registry/specs/ARB/texture_compression_bptc.txt
-# - http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
-# - http://msdn.microsoft.com/en-us/library/bb694531.aspx
-PIPE_FORMAT_DXT1_RGB                , s3tc, 4, 4, 1, x64 ,     ,     ,     , xyz1, rgb
-PIPE_FORMAT_DXT1_RGBA               , s3tc, 4, 4, 1, x64 ,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_DXT3_RGBA               , s3tc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_DXT5_RGBA               , s3tc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_DXT1_SRGB               , s3tc, 4, 4, 1, x64 ,     ,     ,     , xyz1, srgb
-PIPE_FORMAT_DXT1_SRGBA              , s3tc, 4, 4, 1, x64 ,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_DXT3_SRGBA              , s3tc, 4, 4, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_DXT5_SRGBA              , s3tc, 4, 4, 1, x128,     ,     ,     , xyzw, srgb
-
-# FXT1 compressed formats
-PIPE_FORMAT_FXT1_RGB              , fxt1, 8, 4, 1, x128,     ,     ,     , xyz1, rgb
-PIPE_FORMAT_FXT1_RGBA             , fxt1, 8, 4, 1, x128,     ,     ,     , xyzw, rgb
-
-PIPE_FORMAT_RGTC1_UNORM             , rgtc, 4, 4, 1, x64,      ,     ,     , x001, rgb
-PIPE_FORMAT_RGTC1_SNORM             , rgtc, 4, 4, 1, x64,      ,     ,     , x001, rgb
-PIPE_FORMAT_RGTC2_UNORM             , rgtc, 4, 4, 1, x128,     ,     ,     , xy01, rgb
-PIPE_FORMAT_RGTC2_SNORM             , rgtc, 4, 4, 1, x128,     ,     ,     , xy01, rgb
-
-PIPE_FORMAT_LATC1_UNORM             , rgtc, 4, 4, 1, x64,      ,     ,     , xxx1, rgb
-PIPE_FORMAT_LATC1_SNORM             , rgtc, 4, 4, 1, x64,      ,     ,     , xxx1, rgb
-PIPE_FORMAT_LATC2_UNORM             , rgtc, 4, 4, 1, x128,     ,     ,     , xxxy, rgb
-PIPE_FORMAT_LATC2_SNORM             , rgtc, 4, 4, 1, x128,     ,     ,     , xxxy, rgb
-
-PIPE_FORMAT_ETC1_RGB8               ,  etc, 4, 4, 1, x64,      ,     ,     , xyz1, rgb
-
-PIPE_FORMAT_ETC2_RGB8               ,  etc, 4, 4, 1, x64,      ,     ,     , xyz1, rgb
-PIPE_FORMAT_ETC2_SRGB8              ,  etc, 4, 4, 1, x64,      ,     ,     , xyz1, srgb
-PIPE_FORMAT_ETC2_RGB8A1             ,  etc, 4, 4, 1, x64,      ,     ,     , xyzw, rgb
-PIPE_FORMAT_ETC2_SRGB8A1            ,  etc, 4, 4, 1, x64,      ,     ,     , xyzw, srgb
-PIPE_FORMAT_ETC2_RGBA8              ,  etc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ETC2_SRGBA8             ,  etc, 4, 4, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ETC2_R11_UNORM          ,  etc, 4, 4, 1, x64,      ,     ,     , x001, rgb
-PIPE_FORMAT_ETC2_R11_SNORM          ,  etc, 4, 4, 1, x64,      ,     ,     , x001, rgb
-PIPE_FORMAT_ETC2_RG11_UNORM         ,  etc, 4, 4, 1, x128,     ,     ,     , xy01, rgb
-PIPE_FORMAT_ETC2_RG11_SNORM         ,  etc, 4, 4, 1, x128,     ,     ,     , xy01, rgb
-
-PIPE_FORMAT_BPTC_RGBA_UNORM         , bptc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_BPTC_SRGBA              , bptc, 4, 4, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_BPTC_RGB_FLOAT          , bptc, 4, 4, 1, x128,     ,     ,     , xyz1, rgb
-PIPE_FORMAT_BPTC_RGB_UFLOAT         , bptc, 4, 4, 1, x128,     ,     ,     , xyz1, rgb
-
-PIPE_FORMAT_ASTC_4x4                , astc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_5x4                , astc, 5, 4, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_5x5                , astc, 5, 5, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_6x5                , astc, 6, 5, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_6x6                , astc, 6, 6, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_8x5                , astc, 8, 5, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_8x6                , astc, 8, 6, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_8x8                , astc, 8, 8, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_10x5               , astc,10, 5, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_10x6               , astc,10, 6, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_10x8               , astc,10, 8, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_10x10              , astc,10,10, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_12x10              , astc,12,10, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_12x12              , astc,12,12, 1, x128,     ,     ,     , xyzw, rgb
-
-PIPE_FORMAT_ASTC_4x4_SRGB           , astc, 4, 4, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_5x4_SRGB           , astc, 5, 4, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_5x5_SRGB           , astc, 5, 5, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_6x5_SRGB           , astc, 6, 5, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_6x6_SRGB           , astc, 6, 6, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_8x5_SRGB           , astc, 8, 5, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_8x6_SRGB           , astc, 8, 6, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_8x8_SRGB           , astc, 8, 8, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_10x5_SRGB          , astc,10, 5, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_10x6_SRGB          , astc,10, 6, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_10x8_SRGB          , astc,10, 8, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_10x10_SRGB         , astc,10,10, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_12x10_SRGB         , astc,12,10, 1, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_12x12_SRGB         , astc,12,12, 1, x128,     ,     ,     , xyzw, srgb
-
-PIPE_FORMAT_ASTC_3x3x3              , astc, 3, 3, 3, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_4x3x3              , astc, 4, 3, 3, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_4x4x3              , astc, 4, 4, 3, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_4x4x4              , astc, 4, 4, 4, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_5x4x4              , astc, 5, 4, 4, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_5x5x4              , astc, 5, 5, 4, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_5x5x5              , astc, 5, 5, 5, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_6x5x5              , astc, 6, 5, 5, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_6x6x5              , astc, 6, 6, 5, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_6x6x6              , astc, 6, 6, 6, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ASTC_3x3x3_SRGB         , astc, 3, 3, 3, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_4x3x3_SRGB         , astc, 4, 3, 3, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_4x4x3_SRGB         , astc, 4, 4, 3, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_4x4x4_SRGB         , astc, 4, 4, 4, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_5x4x4_SRGB         , astc, 5, 4, 4, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_5x5x4_SRGB         , astc, 5, 5, 4, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_5x5x5_SRGB         , astc, 5, 5, 5, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_6x5x5_SRGB         , astc, 6, 5, 5, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_6x6x5_SRGB         , astc, 6, 6, 5, x128,     ,     ,     , xyzw, srgb
-PIPE_FORMAT_ASTC_6x6x6_SRGB         , astc, 6, 6, 6, x128,     ,     ,     , xyzw, srgb
-
-PIPE_FORMAT_ATC_RGB                 ,  atc, 4, 4, 1, x64,      ,     ,     , xyz1, rgb
-PIPE_FORMAT_ATC_RGBA_EXPLICIT       ,  atc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
-PIPE_FORMAT_ATC_RGBA_INTERPOLATED   ,  atc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
-
-# Straightforward D3D10-like formats (also used for 
-# vertex buffer element description)
-# 
-# See also:
-# - src/gallium/auxiliary/translate/translate_generic.c
-# - src/mesa/state_tracker/st_draw.c
-PIPE_FORMAT_R64_FLOAT               , plain, 1, 1, 1, f64 ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R64G64_FLOAT            , plain, 1, 1, 1, f64 , f64 ,     ,     , xy01, rgb
-PIPE_FORMAT_R64G64B64_FLOAT         , plain, 1, 1, 1, f64 , f64 , f64 ,     , xyz1, rgb
-PIPE_FORMAT_R64G64B64A64_FLOAT      , plain, 1, 1, 1, f64 , f64 , f64 , f64 , xyzw, rgb
-PIPE_FORMAT_R32_FLOAT               , plain, 1, 1, 1, f32 ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R32G32_FLOAT            , plain, 1, 1, 1, f32 , f32 ,     ,     , xy01, rgb
-PIPE_FORMAT_R32G32B32_FLOAT         , plain, 1, 1, 1, f32 , f32 , f32 ,     , xyz1, rgb
-PIPE_FORMAT_R32G32B32A32_FLOAT      , plain, 1, 1, 1, f32 , f32 , f32 , f32 , xyzw, rgb
-PIPE_FORMAT_R32_UNORM               , plain, 1, 1, 1, un32,     ,     ,     , x001, rgb
-PIPE_FORMAT_R32G32_UNORM            , plain, 1, 1, 1, un32, un32,     ,     , xy01, rgb
-PIPE_FORMAT_R32G32B32_UNORM         , plain, 1, 1, 1, un32, un32, un32,     , xyz1, rgb
-PIPE_FORMAT_R32G32B32A32_UNORM      , plain, 1, 1, 1, un32, un32, un32, un32, xyzw, rgb
-PIPE_FORMAT_R32_USCALED             , plain, 1, 1, 1, u32 ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R32G32_USCALED          , plain, 1, 1, 1, u32 , u32 ,     ,     , xy01, rgb
-PIPE_FORMAT_R32G32B32_USCALED       , plain, 1, 1, 1, u32 , u32 , u32 ,     , xyz1, rgb
-PIPE_FORMAT_R32G32B32A32_USCALED    , plain, 1, 1, 1, u32 , u32 , u32 , u32 , xyzw, rgb
-PIPE_FORMAT_R32_SNORM               , plain, 1, 1, 1, sn32,     ,     ,     , x001, rgb
-PIPE_FORMAT_R32G32_SNORM            , plain, 1, 1, 1, sn32, sn32,     ,     , xy01, rgb
-PIPE_FORMAT_R32G32B32_SNORM         , plain, 1, 1, 1, sn32, sn32, sn32,     , xyz1, rgb
-PIPE_FORMAT_R32G32B32A32_SNORM      , plain, 1, 1, 1, sn32, sn32, sn32, sn32, xyzw, rgb
-PIPE_FORMAT_R32_SSCALED             , plain, 1, 1, 1, s32 ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R32G32_SSCALED          , plain, 1, 1, 1, s32 , s32 ,     ,     , xy01, rgb
-PIPE_FORMAT_R32G32B32_SSCALED       , plain, 1, 1, 1, s32 , s32 , s32 ,     , xyz1, rgb
-PIPE_FORMAT_R32G32B32A32_SSCALED    , plain, 1, 1, 1, s32 , s32 , s32 , s32 , xyzw, rgb
-PIPE_FORMAT_R16_FLOAT               , plain, 1, 1, 1, f16 ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R16G16_FLOAT            , plain, 1, 1, 1, f16 , f16 ,     ,     , xy01, rgb
-PIPE_FORMAT_R16G16B16_FLOAT         , plain, 1, 1, 1, f16 , f16 , f16 ,     , xyz1, rgb
-PIPE_FORMAT_R16G16B16A16_FLOAT      , plain, 1, 1, 1, f16 , f16 , f16 , f16 , xyzw, rgb
-PIPE_FORMAT_R16_UNORM               , plain, 1, 1, 1, un16,     ,     ,     , x001, rgb
-PIPE_FORMAT_R16G16_UNORM            , plain, 1, 1, 1, un16, un16,     ,     , xy01, rgb
-PIPE_FORMAT_R16G16B16_UNORM         , plain, 1, 1, 1, un16, un16, un16,     , xyz1, rgb
-PIPE_FORMAT_R16G16B16A16_UNORM      , plain, 1, 1, 1, un16, un16, un16, un16, xyzw, rgb
-PIPE_FORMAT_R16_USCALED             , plain, 1, 1, 1, u16 ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R16G16_USCALED          , plain, 1, 1, 1, u16 , u16 ,     ,     , xy01, rgb
-PIPE_FORMAT_R16G16B16_USCALED       , plain, 1, 1, 1, u16 , u16 , u16 ,     , xyz1, rgb
-PIPE_FORMAT_R16G16B16A16_USCALED    , plain, 1, 1, 1, u16 , u16 , u16 , u16 , xyzw, rgb
-PIPE_FORMAT_R16_SNORM               , plain, 1, 1, 1, sn16,     ,     ,     , x001, rgb
-PIPE_FORMAT_R16G16_SNORM            , plain, 1, 1, 1, sn16, sn16,     ,     , xy01, rgb
-PIPE_FORMAT_R16G16B16_SNORM         , plain, 1, 1, 1, sn16, sn16, sn16,     , xyz1, rgb
-PIPE_FORMAT_R16G16B16A16_SNORM      , plain, 1, 1, 1, sn16, sn16, sn16, sn16, xyzw, rgb
-PIPE_FORMAT_R16_SSCALED             , plain, 1, 1, 1, s16 ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R16G16_SSCALED          , plain, 1, 1, 1, s16 , s16 ,     ,     , xy01, rgb
-PIPE_FORMAT_R16G16B16_SSCALED       , plain, 1, 1, 1, s16 , s16 , s16 ,     , xyz1, rgb
-PIPE_FORMAT_R16G16B16A16_SSCALED    , plain, 1, 1, 1, s16 , s16 , s16 , s16 , xyzw, rgb
-PIPE_FORMAT_R8_UNORM                , plain, 1, 1, 1, un8 ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R8G8_UNORM              , plain, 1, 1, 1, un8 , un8 ,     ,     , xy01, rgb
-PIPE_FORMAT_R8G8B8_UNORM            , plain, 1, 1, 1, un8 , un8 , un8 ,     , xyz1, rgb
-PIPE_FORMAT_B8G8R8_UNORM            , plain, 1, 1, 1, un8 , un8 , un8 ,     , zyx1, rgb
-PIPE_FORMAT_R8G8B8A8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb
-PIPE_FORMAT_R8_USCALED              , plain, 1, 1, 1, u8  ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R8G8_USCALED            , plain, 1, 1, 1, u8  , u8  ,     ,     , xy01, rgb
-PIPE_FORMAT_R8G8B8_USCALED          , plain, 1, 1, 1, u8  , u8  , u8  ,     , xyz1, rgb
-PIPE_FORMAT_R8G8B8A8_USCALED        , plain, 1, 1, 1, u8  , u8  , u8  , u8  , xyzw, rgb
-PIPE_FORMAT_R8_SNORM                , plain, 1, 1, 1, sn8 ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R8G8_SNORM              , plain, 1, 1, 1, sn8 , sn8 ,     ,     , xy01, rgb
-PIPE_FORMAT_R8G8B8_SNORM            , plain, 1, 1, 1, sn8 , sn8 , sn8 ,     , xyz1, rgb
-PIPE_FORMAT_R8G8B8A8_SNORM          , plain, 1, 1, 1, sn8 , sn8 , sn8 , sn8 , xyzw, rgb
-PIPE_FORMAT_R8_SSCALED              , plain, 1, 1, 1, s8  ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R8G8_SSCALED            , plain, 1, 1, 1, s8  , s8  ,     ,     , xy01, rgb
-PIPE_FORMAT_R8G8B8_SSCALED          , plain, 1, 1, 1, s8  , s8  , s8  ,     , xyz1, rgb
-PIPE_FORMAT_R8G8B8A8_SSCALED        , plain, 1, 1, 1, s8  , s8  , s8  , s8  , xyzw, rgb
-
-# GL-specific vertex buffer element formats
-# A.k.a. GL_FIXED
-PIPE_FORMAT_R32_FIXED               , plain, 1, 1, 1, h32 ,     ,     ,     , x001, rgb
-PIPE_FORMAT_R32G32_FIXED            , plain, 1, 1, 1, h32 , h32 ,     ,     , xy01, rgb
-PIPE_FORMAT_R32G32B32_FIXED         , plain, 1, 1, 1, h32 , h32 , h32 ,     , xyz1, rgb
-PIPE_FORMAT_R32G32B32A32_FIXED      , plain, 1, 1, 1, h32 , h32 , h32 , h32 , xyzw, rgb
-
-# D3D9-specific vertex buffer element formats
-# See also:
-# - http://msdn.microsoft.com/en-us/library/bb172533.aspx
-# A.k.a. D3DDECLTYPE_UDEC3
-PIPE_FORMAT_R10G10B10X2_USCALED     , plain, 1, 1, 1, u10 , u10 , u10  , x2 , xyz1, rgb, x2  , u10 , u10 , u10 , wzy1
-# A.k.a. D3DDECLTYPE_DEC3N
-PIPE_FORMAT_R10G10B10X2_SNORM       , plain, 1, 1, 1, sn10, sn10, sn10 , x2 , xyz1, rgb, x2  , sn10, sn10, sn10, wzy1
-
-PIPE_FORMAT_YV12                  , planar3, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
-PIPE_FORMAT_YV16                  , planar3, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
-PIPE_FORMAT_IYUV                  , planar3, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
-PIPE_FORMAT_NV12                  , planar2, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
-PIPE_FORMAT_NV21                  , planar2, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
-
-PIPE_FORMAT_P016                  , planar2, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
-
-# Usually used to implement IA44 and AI44 formats in video decoding
-PIPE_FORMAT_A4R4_UNORM              , plain, 1, 1, 1, un4 , un4 ,     ,     , y00x, rgb, un4, un4 ,     ,     , x00y
-PIPE_FORMAT_R4A4_UNORM              , plain, 1, 1, 1, un4 , un4 ,     ,     , x00y, rgb, un4, un4 ,     ,     , y00x
-PIPE_FORMAT_R8A8_UNORM              , plain, 1, 1, 1, un8 , un8 ,     ,     , x00y, rgb
-PIPE_FORMAT_A8R8_UNORM              , plain, 1, 1, 1, un8 , un8 ,     ,     , y00x, rgb
-
-# ARB_vertex_type_10_10_10_2_REV
-PIPE_FORMAT_R10G10B10A2_USCALED     , plain, 1, 1, 1, u10 , u10 , u10 , u2  , xyzw, rgb, u2  , u10 , u10 , u10 , wzyx
-PIPE_FORMAT_R10G10B10A2_SSCALED     , plain, 1, 1, 1, s10 , s10 , s10 , s2  , xyzw, rgb, s2  , s10 , s10 , s10 , wzyx
-PIPE_FORMAT_R10G10B10A2_SNORM       , plain, 1, 1, 1, sn10, sn10, sn10, sn2 , xyzw, rgb, sn2 , sn10, sn10, sn10, wzyx
-PIPE_FORMAT_B10G10R10A2_USCALED     , plain, 1, 1, 1, u10 , u10 , u10 , u2  , zyxw, rgb, u2  , u10 , u10 , u10 , yzwx
-PIPE_FORMAT_B10G10R10A2_SSCALED     , plain, 1, 1, 1, s10 , s10 , s10 , s2  , zyxw, rgb, s2  , s10 , s10 , s10 , yzwx
-PIPE_FORMAT_B10G10R10A2_SNORM       , plain, 1, 1, 1, sn10, sn10, sn10, sn2 , zyxw, rgb, sn2 , sn10, sn10, sn10, yzwx
-
-PIPE_FORMAT_R8_UINT                 , plain, 1, 1, 1, up8, , , , x001, rgb
-PIPE_FORMAT_R8G8_UINT               , plain, 1, 1, 1, up8, up8, , , xy01, rgb
-PIPE_FORMAT_R8G8B8_UINT             , plain, 1, 1, 1, up8, up8, up8, , xyz1, rgb
-PIPE_FORMAT_R8G8B8A8_UINT           , plain, 1, 1, 1, up8, up8, up8, up8, xyzw, rgb
-
-PIPE_FORMAT_R8_SINT                 , plain, 1, 1, 1, sp8, , , , x001, rgb
-PIPE_FORMAT_R8G8_SINT               , plain, 1, 1, 1, sp8, sp8, , , xy01, rgb
-PIPE_FORMAT_R8G8B8_SINT             , plain, 1, 1, 1, sp8, sp8, sp8, , xyz1, rgb
-PIPE_FORMAT_R8G8B8A8_SINT           , plain, 1, 1, 1, sp8, sp8, sp8, sp8, xyzw, rgb
-
-PIPE_FORMAT_R16_UINT                , plain, 1, 1, 1, up16, , , , x001, rgb
-PIPE_FORMAT_R16G16_UINT             , plain, 1, 1, 1, up16, up16, , , xy01, rgb
-PIPE_FORMAT_R16G16B16_UINT          , plain, 1, 1, 1, up16, up16, up16, , xyz1, rgb
-PIPE_FORMAT_R16G16B16A16_UINT       , plain, 1, 1, 1, up16, up16, up16, up16, xyzw, rgb
-
-PIPE_FORMAT_R16_SINT                , plain, 1, 1, 1, sp16, , , , x001, rgb
-PIPE_FORMAT_R16G16_SINT             , plain, 1, 1, 1, sp16, sp16, , , xy01, rgb
-PIPE_FORMAT_R16G16B16_SINT          , plain, 1, 1, 1, sp16, sp16, sp16, , xyz1, rgb
-PIPE_FORMAT_R16G16B16A16_SINT       , plain, 1, 1, 1, sp16, sp16, sp16, sp16, xyzw, rgb
-
-PIPE_FORMAT_R32_UINT                , plain, 1, 1, 1, up32, , , , x001, rgb
-PIPE_FORMAT_R32G32_UINT             , plain, 1, 1, 1, up32, up32, , , xy01, rgb
-PIPE_FORMAT_R32G32B32_UINT          , plain, 1, 1, 1, up32, up32, up32, , xyz1, rgb
-PIPE_FORMAT_R32G32B32A32_UINT       , plain, 1, 1, 1, up32, up32, up32, up32, xyzw, rgb
-
-PIPE_FORMAT_R32_SINT                , plain, 1, 1, 1, sp32, , , , x001, rgb
-PIPE_FORMAT_R32G32_SINT             , plain, 1, 1, 1, sp32, sp32, , , xy01, rgb
-PIPE_FORMAT_R32G32B32_SINT          , plain, 1, 1, 1, sp32, sp32, sp32, , xyz1, rgb
-PIPE_FORMAT_R32G32B32A32_SINT       , plain, 1, 1, 1, sp32, sp32, sp32, sp32, xyzw, rgb
-
-PIPE_FORMAT_A8_UINT                 , plain, 1, 1, 1, up8, , , , 000x, rgb
-PIPE_FORMAT_I8_UINT                 , plain, 1, 1, 1, up8, , , , xxxx, rgb
-PIPE_FORMAT_L8_UINT                 , plain, 1, 1, 1, up8, , , , xxx1, rgb
-PIPE_FORMAT_L8A8_UINT               , plain, 1, 1, 1, up8, up8, , , xxxy, rgb
-
-PIPE_FORMAT_A8_SINT                 , plain, 1, 1, 1, sp8, , , , 000x, rgb
-PIPE_FORMAT_I8_SINT                 , plain, 1, 1, 1, sp8, , , , xxxx, rgb
-PIPE_FORMAT_L8_SINT                 , plain, 1, 1, 1, sp8, , , , xxx1, rgb
-PIPE_FORMAT_L8A8_SINT               , plain, 1, 1, 1, sp8, sp8, , , xxxy, rgb
-
-PIPE_FORMAT_A16_UINT                , plain, 1, 1, 1, up16, , , , 000x, rgb
-PIPE_FORMAT_I16_UINT                , plain, 1, 1, 1, up16, , , , xxxx, rgb
-PIPE_FORMAT_L16_UINT                , plain, 1, 1, 1, up16, , , , xxx1, rgb
-PIPE_FORMAT_L16A16_UINT             , plain, 1, 1, 1, up16, up16, , , xxxy, rgb
-
-PIPE_FORMAT_A16_SINT                , plain, 1, 1, 1, sp16, , , , 000x, rgb
-PIPE_FORMAT_I16_SINT                , plain, 1, 1, 1, sp16, , , , xxxx, rgb
-PIPE_FORMAT_L16_SINT                , plain, 1, 1, 1, sp16, , , , xxx1, rgb
-PIPE_FORMAT_L16A16_SINT             , plain, 1, 1, 1, sp16, sp16, , , xxxy, rgb
-
-PIPE_FORMAT_A32_UINT                , plain, 1, 1, 1, up32, , , , 000x, rgb
-PIPE_FORMAT_I32_UINT                , plain, 1, 1, 1, up32, , , , xxxx, rgb
-PIPE_FORMAT_L32_UINT                , plain, 1, 1, 1, up32, , , , xxx1, rgb
-PIPE_FORMAT_L32A32_UINT             , plain, 1, 1, 1, up32, up32, , , xxxy, rgb
-
-PIPE_FORMAT_A32_SINT                , plain, 1, 1, 1, sp32, , , , 000x, rgb
-PIPE_FORMAT_I32_SINT                , plain, 1, 1, 1, sp32, , , , xxxx, rgb
-PIPE_FORMAT_L32_SINT                , plain, 1, 1, 1, sp32, , , , xxx1, rgb
-PIPE_FORMAT_L32A32_SINT             , plain, 1, 1, 1, sp32, sp32, , , xxxy, rgb
-
-PIPE_FORMAT_B8G8R8A8_UINT           , plain, 1, 1, 1, up8 , up8 , up8 , up8 , zyxw, rgb
-PIPE_FORMAT_A8R8G8B8_UINT           , plain, 1, 1, 1, up8 , up8 , up8 , up8 , yzwx, rgb
-PIPE_FORMAT_A8B8G8R8_UINT           , plain, 1, 1, 1, up8 , up8 , up8 , up8 , wzyx, rgb
-PIPE_FORMAT_A2R10G10B10_UINT        , plain, 1, 1, 1, up2 , up10, up10, up10, yzwx, rgb, up10, up10, up10, up2 , zyxw
-PIPE_FORMAT_A2B10G10R10_UINT        , plain, 1, 1, 1, up2 , up10, up10, up10, wzyx, rgb, up10, up10, up10, up2 , xyzw
-PIPE_FORMAT_B10G10R10A2_UINT        , plain, 1, 1, 1, up10, up10, up10, up2, zyxw, rgb, up2 , up10, up10, up10, yzwx
-PIPE_FORMAT_R5G6B5_UINT             , plain, 1, 1, 1, up5 , up6 , up5 ,     , xyz1, rgb, up5 , up6 , up5 ,     , zyx1
-PIPE_FORMAT_B5G6R5_UINT             , plain, 1, 1, 1, up5 , up6 , up5 ,     , zyx1, rgb, up5 , up6 , up5 ,     , xyz1
-PIPE_FORMAT_R3G3B2_UINT             , plain, 1, 1, 1, up3 , up3 , up2 ,     , xyz1, rgb, up3 , up3 , up2 ,     , zyx1
-PIPE_FORMAT_B2G3R3_UINT             , plain, 1, 1, 1, up2 , up3 , up3 ,     , zyx1, rgb, up3 , up3 , up2 ,     , xyz1
-PIPE_FORMAT_R4G4B4A4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , xyzw, rgb, up4 , up4 , up4 , up4 , wzyx
-PIPE_FORMAT_B4G4R4A4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , zyxw, rgb, up4 , up4 , up4 , up4 , yzwx
-PIPE_FORMAT_A4R4G4B4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , yzwx, rgb, up4 , up4 , up4 , up4 , zyxw
-PIPE_FORMAT_A4B4G4R4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , wzyx, rgb, up4 , up4 , up4 , up4 , xyzw
-PIPE_FORMAT_A1R5G5B5_UINT           , plain, 1, 1, 1, up1 , up5 , up5 , up5 , wzyx, rgb, up5 , up5 , up5 , up1 , zyxw
-PIPE_FORMAT_A1B5G5R5_UINT           , plain, 1, 1, 1, up1 , up5 , up5 , up5 , wzyx, rgb, up5 , up5 , up5 , up1 , xyzw
-PIPE_FORMAT_R5G5B5A1_UINT           , plain, 1, 1, 1, up5 , up5 , up5 , up1 , xyzw, rgb, up5 , up5 , up5 , up1 , wzyx
-PIPE_FORMAT_B5G5R5A1_UINT           , plain, 1, 1, 1, up5 , up5 , up5 , up1 , zyxw, rgb, up1 , up5 , up5 , up5 , yzwx
-
-PIPE_FORMAT_R8G8B8X8_SNORM          , plain, 1, 1, 1, sn8,  sn8,  sn8,  x8,  xyz1, rgb
-PIPE_FORMAT_R8G8B8X8_SRGB           , plain, 1, 1, 1, un8,  un8,  un8,  x8,  xyz1, srgb
-PIPE_FORMAT_R8G8B8X8_UINT           , plain, 1, 1, 1, up8,  up8,  up8,  x8,  xyz1, rgb
-PIPE_FORMAT_R8G8B8X8_SINT           , plain, 1, 1, 1, sp8,  sp8,  sp8,  x8,  xyz1, rgb
-PIPE_FORMAT_B10G10R10X2_UNORM       , plain, 1, 1, 1, un10, un10, un10, x2,  zyx1, rgb, x2  , un10, un10, un10, yzw1
-PIPE_FORMAT_R16G16B16X16_UNORM      , plain, 1, 1, 1, un16, un16, un16, x16, xyz1, rgb
-PIPE_FORMAT_R16G16B16X16_SNORM      , plain, 1, 1, 1, sn16, sn16, sn16, x16, xyz1, rgb
-PIPE_FORMAT_R16G16B16X16_FLOAT      , plain, 1, 1, 1, f16,  f16,  f16,  x16, xyz1, rgb
-PIPE_FORMAT_R16G16B16X16_UINT       , plain, 1, 1, 1, up16, up16, up16, x16, xyz1, rgb
-PIPE_FORMAT_R16G16B16X16_SINT       , plain, 1, 1, 1, sp16, sp16, sp16, x16, xyz1, rgb
-PIPE_FORMAT_R32G32B32X32_FLOAT      , plain, 1, 1, 1, f32,  f32,  f32,  x32, xyz1, rgb
-PIPE_FORMAT_R32G32B32X32_UINT       , plain, 1, 1, 1, up32, up32, up32, x32, xyz1, rgb
-PIPE_FORMAT_R32G32B32X32_SINT       , plain, 1, 1, 1, sp32, sp32, sp32, x32, xyz1, rgb
-
-PIPE_FORMAT_R8A8_SNORM              , plain, 1, 1, 1, sn8  ,  sn8 ,     ,     , x00y, rgb
-PIPE_FORMAT_R16A16_UNORM            , plain, 1, 1, 1, un16 , un16 ,     ,     , x00y, rgb
-PIPE_FORMAT_R16A16_SNORM            , plain, 1, 1, 1, sn16 , sn16 ,     ,     , x00y, rgb
-PIPE_FORMAT_R16A16_FLOAT            , plain, 1, 1, 1, f16  , f16  ,     ,     , x00y, rgb
-PIPE_FORMAT_R32A32_FLOAT            , plain, 1, 1, 1, f32  , f32  ,     ,     , x00y, rgb
-PIPE_FORMAT_R8A8_UINT               , plain, 1, 1, 1, up8  , up8  ,     ,     , x00y, rgb
-PIPE_FORMAT_R8A8_SINT               , plain, 1, 1, 1, sp8  , sp8  ,     ,     , x00y, rgb
-PIPE_FORMAT_R16A16_UINT             , plain, 1, 1, 1, up16 , up16 ,     ,     , x00y, rgb
-PIPE_FORMAT_R16A16_SINT             , plain, 1, 1, 1, sp16 , sp16 ,     ,     , x00y, rgb
-PIPE_FORMAT_R32A32_UINT             , plain, 1, 1, 1, up32 , up32 ,     ,     , x00y, rgb
-PIPE_FORMAT_R32A32_SINT             , plain, 1, 1, 1, sp32 , sp32 ,     ,     , x00y, rgb
-PIPE_FORMAT_R10G10B10A2_UINT        , plain, 1, 1, 1, up10 , up10 , up10, up2 , xyzw, rgb, up2 , up10, up10, up10, wzyx
-
-PIPE_FORMAT_B5G6R5_SRGB             , plain, 1, 1, 1, un5 , un6 , un5 ,     , zyx1, srgb, un5 , un6 , un5 ,     , xyz1
-
-PIPE_FORMAT_G8R8_UNORM              , plain, 1, 1, 1, un8 , un8 , , , yx01, rgb
-PIPE_FORMAT_G8R8_SNORM              , plain, 1, 1, 1, sn8 , sn8 , , , yx01, rgb
-PIPE_FORMAT_G8R8_SINT               , plain, 1, 1, 1, sp8 , sp8 , , , yx01, rgb
-PIPE_FORMAT_G16R16_UNORM            , plain, 1, 1, 1, un16, un16, , , yx01, rgb
-PIPE_FORMAT_G16R16_SNORM            , plain, 1, 1, 1, sn16, sn16, , , yx01, rgb
-
-PIPE_FORMAT_A8B8G8R8_SNORM          , plain, 1, 1, 1, sn8 , sn8 , sn8 , sn8 , wzyx, rgb
-PIPE_FORMAT_A8B8G8R8_SINT           , plain, 1, 1, 1, sp8 , sp8 , sp8 , sp8 , wzyx, rgb
-PIPE_FORMAT_X8B8G8R8_SNORM          , plain, 1, 1, 1, x8,   sn8,  sn8,  sn8,  wzy1, rgb
-PIPE_FORMAT_X8B8G8R8_SINT           , plain, 1, 1, 1, x8,   sp8,  sp8,  sp8,  wzy1, rgb
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
deleted file mode 100644 (file)
index f1aa116..0000000
+++ /dev/null
@@ -1,1510 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009-2010 Vmware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#ifndef U_FORMAT_H
-#define U_FORMAT_H
-
-
-#include "pipe/p_format.h"
-#include "pipe/p_defines.h"
-#include "util/u_debug.h"
-
-union pipe_color_union;
-struct pipe_screen;
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * Describe how to pack/unpack pixels into/from the prescribed format.
- *
- * XXX: This could be renamed to something like util_format_pack, or broke down
- * in flags inside util_format_block that said exactly what we want.
- */
-enum util_format_layout {
-   /**
-    * Formats with util_format_block::width == util_format_block::height == 1
-    * that can be described as an ordinary data structure.
-    */
-   UTIL_FORMAT_LAYOUT_PLAIN,
-
-   /**
-    * Formats with sub-sampled channels.
-    *
-    * This is for formats like YVYU where there is less than one sample per
-    * pixel.
-    */
-   UTIL_FORMAT_LAYOUT_SUBSAMPLED,
-
-   /**
-    * S3 Texture Compression formats.
-    */
-   UTIL_FORMAT_LAYOUT_S3TC,
-
-   /**
-    * Red-Green Texture Compression formats.
-    */
-   UTIL_FORMAT_LAYOUT_RGTC,
-
-   /**
-    * Ericsson Texture Compression
-    */
-   UTIL_FORMAT_LAYOUT_ETC,
-
-   /**
-    * BC6/7 Texture Compression
-    */
-   UTIL_FORMAT_LAYOUT_BPTC,
-
-   UTIL_FORMAT_LAYOUT_ASTC,
-
-   UTIL_FORMAT_LAYOUT_ATC,
-
-   /** Formats with 2 or more planes. */
-   UTIL_FORMAT_LAYOUT_PLANAR2,
-   UTIL_FORMAT_LAYOUT_PLANAR3,
-
-   UTIL_FORMAT_LAYOUT_FXT1 = 10,
-
-   /**
-    * Everything else that doesn't fit in any of the above layouts.
-    */
-   UTIL_FORMAT_LAYOUT_OTHER,
-};
-
-
-struct util_format_block
-{
-   /** Block width in pixels */
-   unsigned width;
-   
-   /** Block height in pixels */
-   unsigned height;
-
-   /** Block depth in pixels */
-   unsigned depth;
-
-   /** Block size in bits */
-   unsigned bits;
-};
-
-
-enum util_format_type {
-   UTIL_FORMAT_TYPE_VOID = 0,
-   UTIL_FORMAT_TYPE_UNSIGNED = 1,
-   UTIL_FORMAT_TYPE_SIGNED = 2,
-   UTIL_FORMAT_TYPE_FIXED = 3,
-   UTIL_FORMAT_TYPE_FLOAT = 4
-};
-
-
-enum util_format_colorspace {
-   UTIL_FORMAT_COLORSPACE_RGB = 0,
-   UTIL_FORMAT_COLORSPACE_SRGB = 1,
-   UTIL_FORMAT_COLORSPACE_YUV = 2,
-   UTIL_FORMAT_COLORSPACE_ZS = 3
-};
-
-
-struct util_format_channel_description
-{
-   unsigned type:5;        /**< UTIL_FORMAT_TYPE_x */
-   unsigned normalized:1;
-   unsigned pure_integer:1;
-   unsigned size:9;        /**< bits per channel */
-   unsigned shift:16;      /** number of bits from lsb */
-};
-
-
-struct util_format_description
-{
-   enum pipe_format format;
-
-   const char *name;
-
-   /**
-    * Short name, striped of the prefix, lower case.
-    */
-   const char *short_name;
-
-   /**
-    * Pixel block dimensions.
-    */
-   struct util_format_block block;
-
-   enum util_format_layout layout;
-
-   /**
-    * The number of channels.
-    */
-   unsigned nr_channels:3;
-
-   /**
-    * Whether all channels have the same number of (whole) bytes and type.
-    */
-   unsigned is_array:1;
-
-   /**
-    * Whether the pixel format can be described as a bitfield structure.
-    *
-    * In particular:
-    * - pixel depth must be 8, 16, or 32 bits;
-    * - all channels must be unsigned, signed, or void
-    */
-   unsigned is_bitmask:1;
-
-   /**
-    * Whether channels have mixed types (ignoring UTIL_FORMAT_TYPE_VOID).
-    */
-   unsigned is_mixed:1;
-
-   /**
-    * Whether the format contains UNORM channels
-    */
-   unsigned is_unorm:1;
-
-   /**
-    * Whether the format contains SNORM channels
-    */
-   unsigned is_snorm:1;
-
-   /**
-    * Input channel description, in the order XYZW.
-    *
-    * Only valid for UTIL_FORMAT_LAYOUT_PLAIN formats.
-    *
-    * If each channel is accessed as an individual N-byte value, X is always
-    * at the lowest address in memory, Y is always next, and so on.  For all
-    * currently-defined formats, the N-byte value has native endianness.
-    *
-    * If instead a group of channels is accessed as a single N-byte value,
-    * the order of the channels within that value depends on endianness.
-    * For big-endian targets, X is the most significant subvalue,
-    * otherwise it is the least significant one.
-    *
-    * For example, if X is 8 bits and Y is 24 bits, the memory order is:
-    *
-    *                 0  1  2  3
-    *  little-endian: X  Yl Ym Yu    (l = lower, m = middle, u = upper)
-    *  big-endian:    X  Yu Ym Yl
-    *
-    * If X is 5 bits, Y is 5 bits, Z is 5 bits and W is 1 bit, the layout is:
-    *
-    *                        0        1
-    *                 msb  lsb msb  lsb
-    *  little-endian: YYYXXXXX WZZZZZYY
-    *  big-endian:    XXXXXYYY YYZZZZZW
-    */
-   struct util_format_channel_description channel[4];
-
-   /**
-    * Output channel swizzle.
-    *
-    * The order is either:
-    * - RGBA
-    * - YUV(A)
-    * - ZS
-    * depending on the colorspace.
-    */
-   unsigned char swizzle[4];
-
-   /**
-    * Colorspace transformation.
-    */
-   enum util_format_colorspace colorspace;
-
-   /**
-    * Unpack pixel blocks to R8G8B8A8_UNORM.
-    * Note: strides are in bytes.
-    *
-    * Only defined for non-depth-stencil formats.
-    */
-   void
-   (*unpack_rgba_8unorm)(uint8_t *dst, unsigned dst_stride,
-                         const uint8_t *src, unsigned src_stride,
-                         unsigned width, unsigned height);
-
-   /**
-    * Pack pixel blocks from R8G8B8A8_UNORM.
-    * Note: strides are in bytes.
-    *
-    * Only defined for non-depth-stencil formats.
-    */
-   void
-   (*pack_rgba_8unorm)(uint8_t *dst, unsigned dst_stride,
-                       const uint8_t *src, unsigned src_stride,
-                       unsigned width, unsigned height);
-
-   /**
-    * Fetch a single pixel (i, j) from a block.
-    *
-    * XXX: Only defined for a very few select formats.
-    */
-   void
-   (*fetch_rgba_8unorm)(uint8_t *dst,
-                        const uint8_t *src,
-                        unsigned i, unsigned j);
-
-   /**
-    * Unpack pixel blocks to R32G32B32A32_FLOAT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for non-depth-stencil formats.
-    */
-   void
-   (*unpack_rgba_float)(float *dst, unsigned dst_stride,
-                        const uint8_t *src, unsigned src_stride,
-                        unsigned width, unsigned height);
-
-   /**
-    * Pack pixel blocks from R32G32B32A32_FLOAT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for non-depth-stencil formats.
-    */
-   void
-   (*pack_rgba_float)(uint8_t *dst, unsigned dst_stride,
-                      const float *src, unsigned src_stride,
-                      unsigned width, unsigned height);
-
-   /**
-    * Fetch a single pixel (i, j) from a block.
-    *
-    * Only defined for non-depth-stencil and non-integer formats.
-    */
-   void
-   (*fetch_rgba_float)(float *dst,
-                       const uint8_t *src,
-                       unsigned i, unsigned j);
-
-   /**
-    * Unpack pixels to Z32_UNORM.
-    * Note: strides are in bytes.
-    *
-    * Only defined for depth formats.
-    */
-   void
-   (*unpack_z_32unorm)(uint32_t *dst, unsigned dst_stride,
-                       const uint8_t *src, unsigned src_stride,
-                       unsigned width, unsigned height);
-
-   /**
-    * Pack pixels from Z32_FLOAT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for depth formats.
-    */
-   void
-   (*pack_z_32unorm)(uint8_t *dst, unsigned dst_stride,
-                     const uint32_t *src, unsigned src_stride,
-                     unsigned width, unsigned height);
-
-   /**
-    * Unpack pixels to Z32_FLOAT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for depth formats.
-    */
-   void
-   (*unpack_z_float)(float *dst, unsigned dst_stride,
-                     const uint8_t *src, unsigned src_stride,
-                     unsigned width, unsigned height);
-
-   /**
-    * Pack pixels from Z32_FLOAT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for depth formats.
-    */
-   void
-   (*pack_z_float)(uint8_t *dst, unsigned dst_stride,
-                   const float *src, unsigned src_stride,
-                   unsigned width, unsigned height);
-
-   /**
-    * Unpack pixels to S8_UINT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for stencil formats.
-    */
-   void
-   (*unpack_s_8uint)(uint8_t *dst, unsigned dst_stride,
-                     const uint8_t *src, unsigned src_stride,
-                     unsigned width, unsigned height);
-
-   /**
-    * Pack pixels from S8_UINT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for stencil formats.
-    */
-   void
-   (*pack_s_8uint)(uint8_t *dst, unsigned dst_stride,
-                   const uint8_t *src, unsigned src_stride,
-                   unsigned width, unsigned height);
-
-  /**
-    * Unpack pixel blocks to R32G32B32A32_UINT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for INT formats.
-    */
-   void
-   (*unpack_rgba_uint)(uint32_t *dst, unsigned dst_stride,
-                       const uint8_t *src, unsigned src_stride,
-                       unsigned width, unsigned height);
-
-   void
-   (*pack_rgba_uint)(uint8_t *dst, unsigned dst_stride,
-                     const uint32_t *src, unsigned src_stride,
-                     unsigned width, unsigned height);
-
-  /**
-    * Unpack pixel blocks to R32G32B32A32_SINT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for INT formats.
-    */
-   void
-   (*unpack_rgba_sint)(int32_t *dst, unsigned dst_stride,
-                       const uint8_t *src, unsigned src_stride,
-                       unsigned width, unsigned height);
-
-   void
-   (*pack_rgba_sint)(uint8_t *dst, unsigned dst_stride,
-                     const int32_t *src, unsigned src_stride,
-                     unsigned width, unsigned height);
-
-   /**
-    * Fetch a single pixel (i, j) from a block.
-    *
-    * Only defined for unsigned (pure) integer formats.
-    */
-   void
-   (*fetch_rgba_uint)(uint32_t *dst,
-                      const uint8_t *src,
-                      unsigned i, unsigned j);
-
-   /**
-    * Fetch a single pixel (i, j) from a block.
-    *
-    * Only defined for signed (pure) integer formats.
-    */
-   void
-   (*fetch_rgba_sint)(int32_t *dst,
-                      const uint8_t *src,
-                      unsigned i, unsigned j);
-};
-
-
-extern const struct util_format_description 
-util_format_description_table[];
-
-
-const struct util_format_description *
-util_format_description(enum pipe_format format);
-
-
-/*
- * Format query functions.
- */
-
-static inline const char *
-util_format_name(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return "PIPE_FORMAT_???";
-   }
-
-   return desc->name;
-}
-
-static inline const char *
-util_format_short_name(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return "???";
-   }
-
-   return desc->short_name;
-}
-
-/**
- * Whether this format is plain, see UTIL_FORMAT_LAYOUT_PLAIN for more info.
- */
-static inline boolean
-util_format_is_plain(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   if (!format) {
-      return FALSE;
-   }
-
-   return desc->layout == UTIL_FORMAT_LAYOUT_PLAIN ? TRUE : FALSE;
-}
-
-static inline boolean 
-util_format_is_compressed(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return FALSE;
-   }
-
-   switch (desc->layout) {
-   case UTIL_FORMAT_LAYOUT_S3TC:
-   case UTIL_FORMAT_LAYOUT_RGTC:
-   case UTIL_FORMAT_LAYOUT_ETC:
-   case UTIL_FORMAT_LAYOUT_BPTC:
-   case UTIL_FORMAT_LAYOUT_ASTC:
-   case UTIL_FORMAT_LAYOUT_ATC:
-      /* XXX add other formats in the future */
-      return TRUE;
-   default:
-      return FALSE;
-   }
-}
-
-static inline boolean 
-util_format_is_s3tc(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return FALSE;
-   }
-
-   return desc->layout == UTIL_FORMAT_LAYOUT_S3TC ? TRUE : FALSE;
-}
-
-static inline boolean
-util_format_is_etc(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return FALSE;
-   }
-
-   return desc->layout == UTIL_FORMAT_LAYOUT_ETC ? TRUE : FALSE;
-}
-
-static inline boolean 
-util_format_is_srgb(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-   return desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB;
-}
-
-static inline boolean
-util_format_has_depth(const struct util_format_description *desc)
-{
-   return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
-          desc->swizzle[0] != PIPE_SWIZZLE_NONE;
-}
-
-static inline boolean
-util_format_has_stencil(const struct util_format_description *desc)
-{
-   return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
-          desc->swizzle[1] != PIPE_SWIZZLE_NONE;
-}
-
-static inline boolean
-util_format_is_depth_or_stencil(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return FALSE;
-   }
-
-   return util_format_has_depth(desc) ||
-          util_format_has_stencil(desc);
-}
-
-static inline boolean
-util_format_is_depth_and_stencil(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return FALSE;
-   }
-
-   return util_format_has_depth(desc) &&
-          util_format_has_stencil(desc);
-}
-
-/**
- * For depth-stencil formats, return the equivalent depth-only format.
- */
-static inline enum pipe_format
-util_format_get_depth_only(enum pipe_format format)
-{
-   switch (format) {
-   case PIPE_FORMAT_Z24_UNORM_S8_UINT:
-      return PIPE_FORMAT_Z24X8_UNORM;
-
-   case PIPE_FORMAT_S8_UINT_Z24_UNORM:
-      return PIPE_FORMAT_X8Z24_UNORM;
-
-   case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
-      return PIPE_FORMAT_Z32_FLOAT;
-
-   default:
-      return format;
-   }
-}
-
-static inline boolean
-util_format_is_yuv(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return FALSE;
-   }
-
-   return desc->colorspace == UTIL_FORMAT_COLORSPACE_YUV;
-}
-
-/**
- * Calculates the depth format type based upon the incoming format description.
- */
-static inline unsigned
-util_get_depth_format_type(const struct util_format_description *desc)
-{
-   unsigned depth_channel = desc->swizzle[0];
-   if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
-       depth_channel != PIPE_SWIZZLE_NONE) {
-      return desc->channel[depth_channel].type;
-   } else {
-      return UTIL_FORMAT_TYPE_VOID;
-   }
-}
-
-
-/**
- * Calculates the MRD for the depth format. MRD is used in depth bias
- * for UNORM and unbound depth buffers. When the depth buffer is floating
- * point, the depth bias calculation does not use the MRD. However, the
- * default MRD will be 1.0 / ((1 << 24) - 1).
- */
-double
-util_get_depth_format_mrd(const struct util_format_description *desc);
-
-
-/**
- * Return whether this is an RGBA, Z, S, or combined ZS format.
- * Useful for initializing pipe_blit_info::mask.
- */
-static inline unsigned
-util_format_get_mask(enum pipe_format format)
-{
-   const struct util_format_description *desc =
-      util_format_description(format);
-
-   if (!desc)
-      return 0;
-
-   if (util_format_has_depth(desc)) {
-      if (util_format_has_stencil(desc)) {
-         return PIPE_MASK_ZS;
-      } else {
-         return PIPE_MASK_Z;
-      }
-   } else {
-      if (util_format_has_stencil(desc)) {
-         return PIPE_MASK_S;
-      } else {
-         return PIPE_MASK_RGBA;
-      }
-   }
-}
-
-/**
- * Give the RGBA colormask of the channels that can be represented in this
- * format.
- *
- * That is, the channels whose values are preserved.
- */
-static inline unsigned
-util_format_colormask(const struct util_format_description *desc)
-{
-   unsigned colormask;
-   unsigned chan;
-
-   switch (desc->colorspace) {
-   case UTIL_FORMAT_COLORSPACE_RGB:
-   case UTIL_FORMAT_COLORSPACE_SRGB:
-   case UTIL_FORMAT_COLORSPACE_YUV:
-      colormask = 0;
-      for (chan = 0; chan < 4; ++chan) {
-         if (desc->swizzle[chan] < 4) {
-            colormask |= (1 << chan);
-         }
-      }
-      return colormask;
-   case UTIL_FORMAT_COLORSPACE_ZS:
-      return 0;
-   default:
-      assert(0);
-      return 0;
-   }
-}
-
-
-/**
- * Checks if color mask covers every channel for the specified format
- *
- * @param desc       a format description to check colormask with
- * @param colormask  a bit mask for channels, matches format of PIPE_MASK_RGBA
- */
-static inline boolean
-util_format_colormask_full(const struct util_format_description *desc, unsigned colormask)
-{
-   return (~colormask & util_format_colormask(desc)) == 0;
-}
-
-
-boolean
-util_format_is_float(enum pipe_format format);
-
-
-boolean
-util_format_has_alpha(enum pipe_format format);
-
-
-boolean
-util_format_is_luminance(enum pipe_format format);
-
-boolean
-util_format_is_alpha(enum pipe_format format);
-
-boolean
-util_format_is_luminance_alpha(enum pipe_format format);
-
-
-boolean
-util_format_is_intensity(enum pipe_format format);
-
-boolean
-util_format_is_subsampled_422(enum pipe_format format);
-
-boolean
-util_format_is_pure_integer(enum pipe_format format);
-
-boolean
-util_format_is_pure_sint(enum pipe_format format);
-
-boolean
-util_format_is_pure_uint(enum pipe_format format);
-
-boolean
-util_format_is_snorm(enum pipe_format format);
-
-boolean
-util_format_is_unorm(enum pipe_format format);
-
-boolean
-util_format_is_snorm8(enum pipe_format format);
-
-/**
- * Check if the src format can be blitted to the destination format with
- * a simple memcpy.  For example, blitting from RGBA to RGBx is OK, but not
- * the reverse.
- */
-boolean
-util_is_format_compatible(const struct util_format_description *src_desc,
-                          const struct util_format_description *dst_desc);
-
-/**
- * Whether this format is a rgab8 variant.
- *
- * That is, any format that matches the
- *
- *   PIPE_FORMAT_?8?8?8?8_UNORM
- */
-static inline boolean
-util_format_is_rgba8_variant(const struct util_format_description *desc)
-{
-   unsigned chan;
-
-   if(desc->block.width != 1 ||
-      desc->block.height != 1 ||
-      desc->block.bits != 32)
-      return FALSE;
-
-   for(chan = 0; chan < 4; ++chan) {
-      if(desc->channel[chan].type != UTIL_FORMAT_TYPE_UNSIGNED &&
-         desc->channel[chan].type != UTIL_FORMAT_TYPE_VOID)
-         return FALSE;
-      if(desc->channel[chan].type == UTIL_FORMAT_TYPE_UNSIGNED &&
-         !desc->channel[chan].normalized)
-         return FALSE;
-      if(desc->channel[chan].size != 8)
-         return FALSE;
-   }
-
-   return TRUE;
-}
-
-/**
- * Return total bits needed for the pixel format per block.
- */
-static inline uint
-util_format_get_blocksizebits(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return 0;
-   }
-
-   return desc->block.bits;
-}
-
-/**
- * Return bytes per block (not pixel) for the given format.
- */
-static inline uint
-util_format_get_blocksize(enum pipe_format format)
-{
-   uint bits = util_format_get_blocksizebits(format);
-   uint bytes = bits / 8;
-
-   assert(bits % 8 == 0);
-   assert(bytes > 0);
-   if (bytes == 0) {
-      bytes = 1;
-   }
-
-   return bytes;
-}
-
-static inline uint
-util_format_get_blockwidth(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return 1;
-   }
-
-   return desc->block.width;
-}
-
-static inline uint
-util_format_get_blockheight(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return 1;
-   }
-
-   return desc->block.height;
-}
-
-static inline uint
-util_format_get_blockdepth(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   assert(desc);
-   if (!desc) {
-      return 1;
-   }
-
-   return desc->block.depth;
-}
-
-static inline unsigned
-util_format_get_nblocksx(enum pipe_format format,
-                         unsigned x)
-{
-   unsigned blockwidth = util_format_get_blockwidth(format);
-   return (x + blockwidth - 1) / blockwidth;
-}
-
-static inline unsigned
-util_format_get_nblocksy(enum pipe_format format,
-                         unsigned y)
-{
-   unsigned blockheight = util_format_get_blockheight(format);
-   return (y + blockheight - 1) / blockheight;
-}
-
-static inline unsigned
-util_format_get_nblocksz(enum pipe_format format,
-                         unsigned z)
-{
-   unsigned blockdepth = util_format_get_blockdepth(format);
-   return (z + blockdepth - 1) / blockdepth;
-}
-
-static inline unsigned
-util_format_get_nblocks(enum pipe_format format,
-                        unsigned width,
-                        unsigned height)
-{
-   assert(util_format_get_blockdepth(format) == 1);
-   return util_format_get_nblocksx(format, width) * util_format_get_nblocksy(format, height);
-}
-
-static inline size_t
-util_format_get_stride(enum pipe_format format,
-                       unsigned width)
-{
-   return (size_t)util_format_get_nblocksx(format, width) * util_format_get_blocksize(format);
-}
-
-static inline size_t
-util_format_get_2d_size(enum pipe_format format,
-                        size_t stride,
-                        unsigned height)
-{
-   return util_format_get_nblocksy(format, height) * stride;
-}
-
-static inline uint
-util_format_get_component_bits(enum pipe_format format,
-                               enum util_format_colorspace colorspace,
-                               uint component)
-{
-   const struct util_format_description *desc = util_format_description(format);
-   enum util_format_colorspace desc_colorspace;
-
-   assert(format);
-   if (!format) {
-      return 0;
-   }
-
-   assert(component < 4);
-
-   /* Treat RGB and SRGB as equivalent. */
-   if (colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
-      colorspace = UTIL_FORMAT_COLORSPACE_RGB;
-   }
-   if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
-      desc_colorspace = UTIL_FORMAT_COLORSPACE_RGB;
-   } else {
-      desc_colorspace = desc->colorspace;
-   }
-
-   if (desc_colorspace != colorspace) {
-      return 0;
-   }
-
-   switch (desc->swizzle[component]) {
-   case PIPE_SWIZZLE_X:
-      return desc->channel[0].size;
-   case PIPE_SWIZZLE_Y:
-      return desc->channel[1].size;
-   case PIPE_SWIZZLE_Z:
-      return desc->channel[2].size;
-   case PIPE_SWIZZLE_W:
-      return desc->channel[3].size;
-   default:
-      return 0;
-   }
-}
-
-/**
- * Given a linear RGB colorspace format, return the corresponding SRGB
- * format, or PIPE_FORMAT_NONE if none.
- */
-static inline enum pipe_format
-util_format_srgb(enum pipe_format format)
-{
-   if (util_format_is_srgb(format))
-      return format;
-
-   switch (format) {
-   case PIPE_FORMAT_L8_UNORM:
-      return PIPE_FORMAT_L8_SRGB;
-   case PIPE_FORMAT_R8_UNORM:
-      return PIPE_FORMAT_R8_SRGB;
-   case PIPE_FORMAT_L8A8_UNORM:
-      return PIPE_FORMAT_L8A8_SRGB;
-   case PIPE_FORMAT_R8G8B8_UNORM:
-      return PIPE_FORMAT_R8G8B8_SRGB;
-   case PIPE_FORMAT_A8B8G8R8_UNORM:
-      return PIPE_FORMAT_A8B8G8R8_SRGB;
-   case PIPE_FORMAT_X8B8G8R8_UNORM:
-      return PIPE_FORMAT_X8B8G8R8_SRGB;
-   case PIPE_FORMAT_B8G8R8A8_UNORM:
-      return PIPE_FORMAT_B8G8R8A8_SRGB;
-   case PIPE_FORMAT_B8G8R8X8_UNORM:
-      return PIPE_FORMAT_B8G8R8X8_SRGB;
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
-      return PIPE_FORMAT_A8R8G8B8_SRGB;
-   case PIPE_FORMAT_X8R8G8B8_UNORM:
-      return PIPE_FORMAT_X8R8G8B8_SRGB;
-   case PIPE_FORMAT_R8G8B8A8_UNORM:
-      return PIPE_FORMAT_R8G8B8A8_SRGB;
-   case PIPE_FORMAT_R8G8B8X8_UNORM:
-      return PIPE_FORMAT_R8G8B8X8_SRGB;
-   case PIPE_FORMAT_DXT1_RGB:
-      return PIPE_FORMAT_DXT1_SRGB;
-   case PIPE_FORMAT_DXT1_RGBA:
-      return PIPE_FORMAT_DXT1_SRGBA;
-   case PIPE_FORMAT_DXT3_RGBA:
-      return PIPE_FORMAT_DXT3_SRGBA;
-   case PIPE_FORMAT_DXT5_RGBA:
-      return PIPE_FORMAT_DXT5_SRGBA;
-   case PIPE_FORMAT_B5G6R5_UNORM:
-      return PIPE_FORMAT_B5G6R5_SRGB;
-   case PIPE_FORMAT_BPTC_RGBA_UNORM:
-      return PIPE_FORMAT_BPTC_SRGBA;
-   case PIPE_FORMAT_ETC2_RGB8:
-      return PIPE_FORMAT_ETC2_SRGB8;
-   case PIPE_FORMAT_ETC2_RGB8A1:
-      return PIPE_FORMAT_ETC2_SRGB8A1;
-   case PIPE_FORMAT_ETC2_RGBA8:
-      return PIPE_FORMAT_ETC2_SRGBA8;
-   case PIPE_FORMAT_ASTC_4x4:
-      return PIPE_FORMAT_ASTC_4x4_SRGB;
-   case PIPE_FORMAT_ASTC_5x4:
-      return PIPE_FORMAT_ASTC_5x4_SRGB;
-   case PIPE_FORMAT_ASTC_5x5:
-      return PIPE_FORMAT_ASTC_5x5_SRGB;
-   case PIPE_FORMAT_ASTC_6x5:
-      return PIPE_FORMAT_ASTC_6x5_SRGB;
-   case PIPE_FORMAT_ASTC_6x6:
-      return PIPE_FORMAT_ASTC_6x6_SRGB;
-   case PIPE_FORMAT_ASTC_8x5:
-      return PIPE_FORMAT_ASTC_8x5_SRGB;
-   case PIPE_FORMAT_ASTC_8x6:
-      return PIPE_FORMAT_ASTC_8x6_SRGB;
-   case PIPE_FORMAT_ASTC_8x8:
-      return PIPE_FORMAT_ASTC_8x8_SRGB;
-   case PIPE_FORMAT_ASTC_10x5:
-      return PIPE_FORMAT_ASTC_10x5_SRGB;
-   case PIPE_FORMAT_ASTC_10x6:
-      return PIPE_FORMAT_ASTC_10x6_SRGB;
-   case PIPE_FORMAT_ASTC_10x8:
-      return PIPE_FORMAT_ASTC_10x8_SRGB;
-   case PIPE_FORMAT_ASTC_10x10:
-      return PIPE_FORMAT_ASTC_10x10_SRGB;
-   case PIPE_FORMAT_ASTC_12x10:
-      return PIPE_FORMAT_ASTC_12x10_SRGB;
-   case PIPE_FORMAT_ASTC_12x12:
-      return PIPE_FORMAT_ASTC_12x12_SRGB;
-
-   default:
-      return PIPE_FORMAT_NONE;
-   }
-}
-
-/**
- * Given an sRGB format, return the corresponding linear colorspace format.
- * For non sRGB formats, return the format unchanged.
- */
-static inline enum pipe_format
-util_format_linear(enum pipe_format format)
-{
-   switch (format) {
-   case PIPE_FORMAT_L8_SRGB:
-      return PIPE_FORMAT_L8_UNORM;
-   case PIPE_FORMAT_R8_SRGB:
-      return PIPE_FORMAT_R8_UNORM;
-   case PIPE_FORMAT_L8A8_SRGB:
-      return PIPE_FORMAT_L8A8_UNORM;
-   case PIPE_FORMAT_R8G8B8_SRGB:
-      return PIPE_FORMAT_R8G8B8_UNORM;
-   case PIPE_FORMAT_A8B8G8R8_SRGB:
-      return PIPE_FORMAT_A8B8G8R8_UNORM;
-   case PIPE_FORMAT_X8B8G8R8_SRGB:
-      return PIPE_FORMAT_X8B8G8R8_UNORM;
-   case PIPE_FORMAT_B8G8R8A8_SRGB:
-      return PIPE_FORMAT_B8G8R8A8_UNORM;
-   case PIPE_FORMAT_B8G8R8X8_SRGB:
-      return PIPE_FORMAT_B8G8R8X8_UNORM;
-   case PIPE_FORMAT_A8R8G8B8_SRGB:
-      return PIPE_FORMAT_A8R8G8B8_UNORM;
-   case PIPE_FORMAT_X8R8G8B8_SRGB:
-      return PIPE_FORMAT_X8R8G8B8_UNORM;
-   case PIPE_FORMAT_R8G8B8A8_SRGB:
-      return PIPE_FORMAT_R8G8B8A8_UNORM;
-   case PIPE_FORMAT_R8G8B8X8_SRGB:
-      return PIPE_FORMAT_R8G8B8X8_UNORM;
-   case PIPE_FORMAT_DXT1_SRGB:
-      return PIPE_FORMAT_DXT1_RGB;
-   case PIPE_FORMAT_DXT1_SRGBA:
-      return PIPE_FORMAT_DXT1_RGBA;
-   case PIPE_FORMAT_DXT3_SRGBA:
-      return PIPE_FORMAT_DXT3_RGBA;
-   case PIPE_FORMAT_DXT5_SRGBA:
-      return PIPE_FORMAT_DXT5_RGBA;
-   case PIPE_FORMAT_B5G6R5_SRGB:
-      return PIPE_FORMAT_B5G6R5_UNORM;
-   case PIPE_FORMAT_BPTC_SRGBA:
-      return PIPE_FORMAT_BPTC_RGBA_UNORM;
-   case PIPE_FORMAT_ETC2_SRGB8:
-      return PIPE_FORMAT_ETC2_RGB8;
-   case PIPE_FORMAT_ETC2_SRGB8A1:
-      return PIPE_FORMAT_ETC2_RGB8A1;
-   case PIPE_FORMAT_ETC2_SRGBA8:
-      return PIPE_FORMAT_ETC2_RGBA8;
-   case PIPE_FORMAT_ASTC_4x4_SRGB:
-      return PIPE_FORMAT_ASTC_4x4;
-   case PIPE_FORMAT_ASTC_5x4_SRGB:
-      return PIPE_FORMAT_ASTC_5x4;
-   case PIPE_FORMAT_ASTC_5x5_SRGB:
-      return PIPE_FORMAT_ASTC_5x5;
-   case PIPE_FORMAT_ASTC_6x5_SRGB:
-      return PIPE_FORMAT_ASTC_6x5;
-   case PIPE_FORMAT_ASTC_6x6_SRGB:
-      return PIPE_FORMAT_ASTC_6x6;
-   case PIPE_FORMAT_ASTC_8x5_SRGB:
-      return PIPE_FORMAT_ASTC_8x5;
-   case PIPE_FORMAT_ASTC_8x6_SRGB:
-      return PIPE_FORMAT_ASTC_8x6;
-   case PIPE_FORMAT_ASTC_8x8_SRGB:
-      return PIPE_FORMAT_ASTC_8x8;
-   case PIPE_FORMAT_ASTC_10x5_SRGB:
-      return PIPE_FORMAT_ASTC_10x5;
-   case PIPE_FORMAT_ASTC_10x6_SRGB:
-      return PIPE_FORMAT_ASTC_10x6;
-   case PIPE_FORMAT_ASTC_10x8_SRGB:
-      return PIPE_FORMAT_ASTC_10x8;
-   case PIPE_FORMAT_ASTC_10x10_SRGB:
-      return PIPE_FORMAT_ASTC_10x10;
-   case PIPE_FORMAT_ASTC_12x10_SRGB:
-      return PIPE_FORMAT_ASTC_12x10;
-   case PIPE_FORMAT_ASTC_12x12_SRGB:
-      return PIPE_FORMAT_ASTC_12x12;
-   default:
-      return format;
-   }
-}
-
-/**
- * Given a depth-stencil format, return the corresponding stencil-only format.
- * For stencil-only formats, return the format unchanged.
- */
-static inline enum pipe_format
-util_format_stencil_only(enum pipe_format format)
-{
-   switch (format) {
-   /* mask out the depth component */
-   case PIPE_FORMAT_Z24_UNORM_S8_UINT:
-      return PIPE_FORMAT_X24S8_UINT;
-   case PIPE_FORMAT_S8_UINT_Z24_UNORM:
-      return PIPE_FORMAT_S8X24_UINT;
-   case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
-      return PIPE_FORMAT_X32_S8X24_UINT;
-
-   /* stencil only formats */
-   case PIPE_FORMAT_X24S8_UINT:
-   case PIPE_FORMAT_S8X24_UINT:
-   case PIPE_FORMAT_X32_S8X24_UINT:
-   case PIPE_FORMAT_S8_UINT:
-      return format;
-
-   default:
-      assert(0);
-      return PIPE_FORMAT_NONE;
-   }
-}
-
-/**
- * Converts PIPE_FORMAT_*I* to PIPE_FORMAT_*R*.
- * This is identity for non-intensity formats.
- */
-static inline enum pipe_format
-util_format_intensity_to_red(enum pipe_format format)
-{
-   switch (format) {
-   case PIPE_FORMAT_I8_UNORM:
-      return PIPE_FORMAT_R8_UNORM;
-   case PIPE_FORMAT_I8_SNORM:
-      return PIPE_FORMAT_R8_SNORM;
-   case PIPE_FORMAT_I16_UNORM:
-      return PIPE_FORMAT_R16_UNORM;
-   case PIPE_FORMAT_I16_SNORM:
-      return PIPE_FORMAT_R16_SNORM;
-   case PIPE_FORMAT_I16_FLOAT:
-      return PIPE_FORMAT_R16_FLOAT;
-   case PIPE_FORMAT_I32_FLOAT:
-      return PIPE_FORMAT_R32_FLOAT;
-   case PIPE_FORMAT_I8_UINT:
-      return PIPE_FORMAT_R8_UINT;
-   case PIPE_FORMAT_I8_SINT:
-      return PIPE_FORMAT_R8_SINT;
-   case PIPE_FORMAT_I16_UINT:
-      return PIPE_FORMAT_R16_UINT;
-   case PIPE_FORMAT_I16_SINT:
-      return PIPE_FORMAT_R16_SINT;
-   case PIPE_FORMAT_I32_UINT:
-      return PIPE_FORMAT_R32_UINT;
-   case PIPE_FORMAT_I32_SINT:
-      return PIPE_FORMAT_R32_SINT;
-   default:
-      assert(!util_format_is_intensity(format));
-      return format;
-   }
-}
-
-/**
- * Converts PIPE_FORMAT_*L* to PIPE_FORMAT_*R*.
- * This is identity for non-luminance formats.
- */
-static inline enum pipe_format
-util_format_luminance_to_red(enum pipe_format format)
-{
-   switch (format) {
-   case PIPE_FORMAT_L8_UNORM:
-      return PIPE_FORMAT_R8_UNORM;
-   case PIPE_FORMAT_L8_SNORM:
-      return PIPE_FORMAT_R8_SNORM;
-   case PIPE_FORMAT_L16_UNORM:
-      return PIPE_FORMAT_R16_UNORM;
-   case PIPE_FORMAT_L16_SNORM:
-      return PIPE_FORMAT_R16_SNORM;
-   case PIPE_FORMAT_L16_FLOAT:
-      return PIPE_FORMAT_R16_FLOAT;
-   case PIPE_FORMAT_L32_FLOAT:
-      return PIPE_FORMAT_R32_FLOAT;
-   case PIPE_FORMAT_L8_UINT:
-      return PIPE_FORMAT_R8_UINT;
-   case PIPE_FORMAT_L8_SINT:
-      return PIPE_FORMAT_R8_SINT;
-   case PIPE_FORMAT_L16_UINT:
-      return PIPE_FORMAT_R16_UINT;
-   case PIPE_FORMAT_L16_SINT:
-      return PIPE_FORMAT_R16_SINT;
-   case PIPE_FORMAT_L32_UINT:
-      return PIPE_FORMAT_R32_UINT;
-   case PIPE_FORMAT_L32_SINT:
-      return PIPE_FORMAT_R32_SINT;
-
-   case PIPE_FORMAT_LATC1_UNORM:
-      return PIPE_FORMAT_RGTC1_UNORM;
-   case PIPE_FORMAT_LATC1_SNORM:
-      return PIPE_FORMAT_RGTC1_SNORM;
-
-   case PIPE_FORMAT_L4A4_UNORM:
-      return PIPE_FORMAT_R4A4_UNORM;
-
-   case PIPE_FORMAT_L8A8_UNORM:
-      return PIPE_FORMAT_R8A8_UNORM;
-   case PIPE_FORMAT_L8A8_SNORM:
-      return PIPE_FORMAT_R8A8_SNORM;
-   case PIPE_FORMAT_L16A16_UNORM:
-      return PIPE_FORMAT_R16A16_UNORM;
-   case PIPE_FORMAT_L16A16_SNORM:
-      return PIPE_FORMAT_R16A16_SNORM;
-   case PIPE_FORMAT_L16A16_FLOAT:
-      return PIPE_FORMAT_R16A16_FLOAT;
-   case PIPE_FORMAT_L32A32_FLOAT:
-      return PIPE_FORMAT_R32A32_FLOAT;
-   case PIPE_FORMAT_L8A8_UINT:
-      return PIPE_FORMAT_R8A8_UINT;
-   case PIPE_FORMAT_L8A8_SINT:
-      return PIPE_FORMAT_R8A8_SINT;
-   case PIPE_FORMAT_L16A16_UINT:
-      return PIPE_FORMAT_R16A16_UINT;
-   case PIPE_FORMAT_L16A16_SINT:
-      return PIPE_FORMAT_R16A16_SINT;
-   case PIPE_FORMAT_L32A32_UINT:
-      return PIPE_FORMAT_R32A32_UINT;
-   case PIPE_FORMAT_L32A32_SINT:
-      return PIPE_FORMAT_R32A32_SINT;
-
-   /* We don't have compressed red-alpha variants for these. */
-   case PIPE_FORMAT_LATC2_UNORM:
-   case PIPE_FORMAT_LATC2_SNORM:
-      return PIPE_FORMAT_NONE;
-
-   default:
-      assert(!util_format_is_luminance(format) &&
-            !util_format_is_luminance_alpha(format));
-      return format;
-   }
-}
-
-static inline unsigned
-util_format_get_num_planes(enum pipe_format format)
-{
-   switch (util_format_description(format)->layout) {
-   case UTIL_FORMAT_LAYOUT_PLANAR3:
-      return 3;
-   case UTIL_FORMAT_LAYOUT_PLANAR2:
-      return 2;
-   default:
-      return 1;
-   }
-}
-
-static inline enum pipe_format
-util_format_get_plane_format(enum pipe_format format, unsigned plane)
-{
-   switch (format) {
-   case PIPE_FORMAT_YV12:
-   case PIPE_FORMAT_YV16:
-   case PIPE_FORMAT_IYUV:
-      return PIPE_FORMAT_R8_UNORM;
-   case PIPE_FORMAT_NV12:
-      return !plane ? PIPE_FORMAT_R8_UNORM : PIPE_FORMAT_RG88_UNORM;
-   case PIPE_FORMAT_NV21:
-      return !plane ? PIPE_FORMAT_R8_UNORM : PIPE_FORMAT_GR88_UNORM;
-   case PIPE_FORMAT_P016:
-      return !plane ? PIPE_FORMAT_R16_UNORM : PIPE_FORMAT_R16G16_UNORM;
-   default:
-      return format;
-   }
-}
-
-static inline unsigned
-util_format_get_plane_width(enum pipe_format format, unsigned plane,
-                            unsigned width)
-{
-   switch (format) {
-   case PIPE_FORMAT_YV12:
-   case PIPE_FORMAT_YV16:
-   case PIPE_FORMAT_IYUV:
-   case PIPE_FORMAT_NV12:
-   case PIPE_FORMAT_NV21:
-   case PIPE_FORMAT_P016:
-      return !plane ? width : (width + 1) / 2;
-   default:
-      return width;
-   }
-}
-
-static inline unsigned
-util_format_get_plane_height(enum pipe_format format, unsigned plane,
-                             unsigned height)
-{
-   switch (format) {
-   case PIPE_FORMAT_YV12:
-   case PIPE_FORMAT_IYUV:
-   case PIPE_FORMAT_NV12:
-   case PIPE_FORMAT_NV21:
-   case PIPE_FORMAT_P016:
-      return !plane ? height : (height + 1) / 2;
-   case PIPE_FORMAT_YV16:
-   default:
-      return height;
-   }
-}
-
-bool util_format_planar_is_supported(struct pipe_screen *screen,
-                                     enum pipe_format format,
-                                     enum pipe_texture_target target,
-                                     unsigned sample_count,
-                                     unsigned storage_sample_count,
-                                     unsigned bind);
-
-/**
- * Return the number of components stored.
- * Formats with block size != 1x1 will always have 1 component (the block).
- */
-static inline unsigned
-util_format_get_nr_components(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-   return desc->nr_channels;
-}
-
-/**
- * Return the index of the first non-void channel
- * -1 if no non-void channels
- */
-static inline int
-util_format_get_first_non_void_channel(enum pipe_format format)
-{
-   const struct util_format_description *desc = util_format_description(format);
-   int i;
-
-   for (i = 0; i < 4; i++)
-      if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID)
-         break;
-
-   if (i == 4)
-       return -1;
-
-   return i;
-}
-
-/**
- * Whether this format is any 8-bit UNORM variant. Looser than
- * util_is_rgba8_variant (also includes alpha textures, for instance).
- */
-
-static inline bool
-util_format_is_unorm8(const struct util_format_description *desc)
-{
-   int c = util_format_get_first_non_void_channel(desc->format);
-
-   if (c == -1)
-      return false;
-
-   return desc->is_unorm && desc->is_array && desc->channel[c].size == 8;
-}
-
-/*
- * Format access functions.
- */
-
-void
-util_format_read_4f(enum pipe_format format,
-                    float *dst, unsigned dst_stride, 
-                    const void *src, unsigned src_stride, 
-                    unsigned x, unsigned y, unsigned w, unsigned h);
-
-void
-util_format_write_4f(enum pipe_format format,
-                     const float *src, unsigned src_stride, 
-                     void *dst, unsigned dst_stride, 
-                     unsigned x, unsigned y, unsigned w, unsigned h);
-
-void
-util_format_read_4ub(enum pipe_format format,
-                     uint8_t *dst, unsigned dst_stride, 
-                     const void *src, unsigned src_stride, 
-                     unsigned x, unsigned y, unsigned w, unsigned h);
-
-void
-util_format_write_4ub(enum pipe_format format,
-                      const uint8_t *src, unsigned src_stride, 
-                      void *dst, unsigned dst_stride, 
-                      unsigned x, unsigned y, unsigned w, unsigned h);
-
-void
-util_format_read_4ui(enum pipe_format format,
-                     unsigned *dst, unsigned dst_stride,
-                     const void *src, unsigned src_stride,
-                     unsigned x, unsigned y, unsigned w, unsigned h);
-
-void
-util_format_write_4ui(enum pipe_format format,
-                      const unsigned int *src, unsigned src_stride,
-                      void *dst, unsigned dst_stride,
-                      unsigned x, unsigned y, unsigned w, unsigned h);
-
-void
-util_format_read_4i(enum pipe_format format,
-                    int *dst, unsigned dst_stride,
-                    const void *src, unsigned src_stride,
-                    unsigned x, unsigned y, unsigned w, unsigned h);
-
-void
-util_format_write_4i(enum pipe_format format,
-                     const int *src, unsigned src_stride,
-                     void *dst, unsigned dst_stride,
-                     unsigned x, unsigned y, unsigned w, unsigned h);
-
-/*
- * Generic format conversion;
- */
-
-boolean
-util_format_fits_8unorm(const struct util_format_description *format_desc);
-
-boolean
-util_format_translate(enum pipe_format dst_format,
-                      void *dst, unsigned dst_stride,
-                      unsigned dst_x, unsigned dst_y,
-                      enum pipe_format src_format,
-                      const void *src, unsigned src_stride,
-                      unsigned src_x, unsigned src_y,
-                      unsigned width, unsigned height);
-
-boolean
-util_format_translate_3d(enum pipe_format dst_format,
-                         void *dst, unsigned dst_stride,
-                         unsigned dst_slice_stride,
-                         unsigned dst_x, unsigned dst_y,
-                         unsigned dst_z,
-                         enum pipe_format src_format,
-                         const void *src, unsigned src_stride,
-                         unsigned src_slice_stride,
-                         unsigned src_x, unsigned src_y,
-                         unsigned src_z, unsigned width,
-                         unsigned height, unsigned depth);
-
-/*
- * Swizzle operations.
- */
-
-/* Compose two sets of swizzles.
- * If V is a 4D vector and the function parameters represent functions that
- * swizzle vector components, this holds:
- *     swz2(swz1(V)) = dst(V)
- */
-void util_format_compose_swizzles(const unsigned char swz1[4],
-                                  const unsigned char swz2[4],
-                                  unsigned char dst[4]);
-
-/* Apply the swizzle provided in \param swz (which is one of PIPE_SWIZZLE_x)
- * to \param src and store the result in \param dst.
- * \param is_integer determines the value written for PIPE_SWIZZLE_1.
- */
-void util_format_apply_color_swizzle(union pipe_color_union *dst,
-                                     const union pipe_color_union *src,
-                                     const unsigned char swz[4],
-                                     const boolean is_integer);
-
-void pipe_swizzle_4f(float *dst, const float *src,
-                            const unsigned char swz[4]);
-
-void util_format_unswizzle_4f(float *dst, const float *src,
-                              const unsigned char swz[4]);
-
-enum pipe_format
-util_format_snorm8_to_sint8(enum pipe_format format);
-
-#ifdef __cplusplus
-} // extern "C" {
-#endif
-
-#endif /* ! U_FORMAT_H */
diff --git a/src/gallium/auxiliary/util/u_format_bptc.c b/src/gallium/auxiliary/util/u_format_bptc.c
deleted file mode 100644 (file)
index 519a541..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-/**************************************************************************
- *
- * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
- * Copyright (c) 2008 VMware, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "u_format.h"
-#include "u_format_bptc.h"
-#include "util/format_srgb.h"
-#include "util/u_math.h"
-
-#define BPTC_BLOCK_DECODE
-#include "../../../mesa/main/texcompress_bptc_tmp.h"
-
-void
-util_format_bptc_rgba_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                               const uint8_t *src_row, unsigned src_stride,
-                                               unsigned width, unsigned height)
-{
-  decompress_rgba_unorm(width, height,
-                        src_row, src_stride,
-                        dst_row, dst_stride);
-}
-
-void
-util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                             const uint8_t *src_row, unsigned src_stride,
-                                             unsigned width, unsigned height)
-{
-   compress_rgba_unorm(width, height,
-                       src_row, src_stride,
-                       dst_row, dst_stride);
-}
-
-void
-util_format_bptc_rgba_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                              const uint8_t *src_row, unsigned src_stride,
-                                              unsigned width, unsigned height)
-{
-   uint8_t *temp_block;
-   temp_block = malloc(width * height * 4 * sizeof(uint8_t));
-   decompress_rgba_unorm(width, height,
-                         src_row, src_stride,
-                         temp_block, width * 4 * sizeof(uint8_t));
-   util_format_read_4f(PIPE_FORMAT_R8G8B8A8_UNORM,
-                       dst_row, dst_stride,
-                       temp_block, width * 4 * sizeof(uint8_t),
-                       0, 0, width, height);
-   free((void *) temp_block);
-}
-
-void
-util_format_bptc_rgba_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                            const float *src_row, unsigned src_stride,
-                                            unsigned width, unsigned height)
-{
-   uint8_t *temp_block;
-   temp_block = malloc(width * height * 4 * sizeof(uint8_t));
-   util_format_read_4ub(PIPE_FORMAT_R32G32B32A32_FLOAT,
-                        temp_block, width * 4 * sizeof(uint8_t),
-                        src_row, src_stride,
-                        0, 0, width, height);
-   compress_rgba_unorm(width, height,
-                       temp_block, width * 4 * sizeof(uint8_t),
-                       dst_row, dst_stride);
-   free((void *) temp_block);
-}
-
-void
-util_format_bptc_rgba_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                             unsigned width, unsigned height)
-{
-   uint8_t temp_block[4];
-
-   fetch_rgba_unorm_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
-                               temp_block, (width % 4) + (height % 4) * 4);
-
-   util_format_read_4f(PIPE_FORMAT_R8G8B8A8_UNORM,
-                       dst, 4 * sizeof(float),
-                       temp_block, 4 * sizeof(uint8_t),
-                       0, 0, 1, 1);
-}
-
-void
-util_format_bptc_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                          const uint8_t *src_row, unsigned src_stride,
-                                          unsigned width, unsigned height)
-{
-   decompress_rgba_unorm(width, height,
-                         src_row, src_stride,
-                         dst_row, dst_stride);
-}
-
-void
-util_format_bptc_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height)
-{
-   compress_rgba_unorm(width, height,
-                       src_row, src_stride,
-                       dst_row, dst_stride);
-}
-
-void
-util_format_bptc_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   uint8_t *temp_block;
-   temp_block = malloc(width * height * 4 * sizeof(uint8_t));
-   decompress_rgba_unorm(width, height,
-                         src_row, src_stride,
-                         temp_block, width * 4 * sizeof(uint8_t));
-   util_format_read_4f(PIPE_FORMAT_R8G8B8A8_SRGB,
-                       dst_row, dst_stride,
-                       temp_block, width * 4 * sizeof(uint8_t),
-                       0, 0, width, height);
-   free((void *) temp_block);
-}
-
-void
-util_format_bptc_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                       const float *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   compress_rgb_float(width, height,
-                      src_row, src_stride,
-                      dst_row, dst_stride,
-                      true);
-}
-
-void
-util_format_bptc_srgba_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        unsigned width, unsigned height)
-{
-   uint8_t temp_block[4];
-
-   fetch_rgba_unorm_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
-                               temp_block, (width % 4) + (height % 4) * 4);
-   util_format_read_4f(PIPE_FORMAT_R8G8B8A8_SRGB,
-                       dst, 4 * sizeof(float),
-                       temp_block, width * 4 * sizeof(uint8_t),
-                       0, 0, 1, 1);
-}
-
-void
-util_format_bptc_rgb_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                              const uint8_t *src_row, unsigned src_stride,
-                                              unsigned width, unsigned height)
-{
-   float *temp_block;
-   temp_block = malloc(width * height * 4 * sizeof(float));
-   decompress_rgb_float(width, height,
-                        src_row, src_stride,
-                        temp_block, width * 4 * sizeof(float),
-                        true);
-   util_format_read_4ub(PIPE_FORMAT_R32G32B32A32_FLOAT,
-                        dst_row, dst_stride,
-                        temp_block, width * 4 * sizeof(float),
-                        0, 0, width, height);
-   free((void *) temp_block);
-}
-
-void
-util_format_bptc_rgb_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                            const uint8_t *src_row, unsigned src_stride,
-                                            unsigned width, unsigned height)
-{
-   compress_rgba_unorm(width, height,
-                       src_row, src_stride,
-                       dst_row, dst_stride);
-}
-
-void
-util_format_bptc_rgb_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                             const uint8_t *src_row, unsigned src_stride,
-                                             unsigned width, unsigned height)
-{
-   decompress_rgb_float(width, height,
-                        src_row, src_stride,
-                        dst_row, dst_stride,
-                        true);
-}
-
-void
-util_format_bptc_rgb_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                           const float *src_row, unsigned src_stride,
-                                           unsigned width, unsigned height)
-{
-   compress_rgb_float(width, height,
-                      src_row, src_stride,
-                      dst_row, dst_stride,
-                      true);
-}
-
-void
-util_format_bptc_rgb_float_fetch_rgba_float(float *dst, const uint8_t *src,
-                                            unsigned width, unsigned height)
-{
-   fetch_rgb_float_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
-                              dst, (width % 4) + (height % 4) * 4, true);
-}
-
-void
-util_format_bptc_rgb_ufloat_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                               const uint8_t *src_row, unsigned src_stride,
-                                               unsigned width, unsigned height)
-{
-   float *temp_block;
-   temp_block = malloc(width * height * 4 * sizeof(float));
-   decompress_rgb_float(width, height,
-                        src_row, src_stride,
-                        temp_block, width * 4 * sizeof(float),
-                        false);
-   util_format_read_4ub(PIPE_FORMAT_R32G32B32A32_FLOAT,
-                        dst_row, dst_stride,
-                        temp_block, width * 4 * sizeof(float),
-                        0, 0, width, height);
-   free((void *) temp_block);
-}
-
-void
-util_format_bptc_rgb_ufloat_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                             const uint8_t *src_row, unsigned src_stride,
-                                             unsigned width, unsigned height)
-{
-   compress_rgba_unorm(width, height,
-                       src_row, src_stride,
-                       dst_row, dst_stride);
-}
-
-void
-util_format_bptc_rgb_ufloat_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                              const uint8_t *src_row, unsigned src_stride,
-                                              unsigned width, unsigned height)
-{
-   decompress_rgb_float(width, height,
-                        src_row, src_stride,
-                        dst_row, dst_stride,
-                        false);
-}
-
-void
-util_format_bptc_rgb_ufloat_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                            const float *src_row, unsigned src_stride,
-                                            unsigned width, unsigned height)
-{
-   compress_rgb_float(width, height,
-                      src_row, src_stride,
-                      dst_row, dst_stride,
-                      false);
-}
-
-void
-util_format_bptc_rgb_ufloat_fetch_rgba_float(float *dst, const uint8_t *src,
-                                             unsigned width, unsigned height)
-{
-   fetch_rgb_float_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
-                              dst, (width % 4) + (height % 4) * 4, false);
-}
diff --git a/src/gallium/auxiliary/util/u_format_bptc.h b/src/gallium/auxiliary/util/u_format_bptc.h
deleted file mode 100644 (file)
index eaf3ec3..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#ifndef U_FORMAT_BPTC_H_
-#define U_FORMAT_BPTC_H_
-
-
-#include "pipe/p_compiler.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void
-util_format_bptc_rgba_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                               const uint8_t *src_row, unsigned src_stride,
-                                               unsigned width, unsigned height);
-void
-util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                             const uint8_t *src_row, unsigned src_stride,
-                                             unsigned width, unsigned height);
-void
-util_format_bptc_rgba_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                              const uint8_t *src_row, unsigned src_stride,
-                                              unsigned width, unsigned height);
-void
-util_format_bptc_rgba_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                            const float *src_row, unsigned src_stride,
-                                            unsigned width, unsigned height);
-void
-util_format_bptc_rgba_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                             unsigned width, unsigned height);
-
-void
-util_format_bptc_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                          const uint8_t *src_row, unsigned src_stride,
-                                          unsigned width, unsigned height);
-void
-util_format_bptc_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height);
-void
-util_format_bptc_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height);
-void
-util_format_bptc_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                       const float *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height);
-void
-util_format_bptc_srgba_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        unsigned width, unsigned height);
-
-void
-util_format_bptc_rgb_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                              const uint8_t *src_row, unsigned src_stride,
-                                              unsigned width, unsigned height);
-void
-util_format_bptc_rgb_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                            const uint8_t *src_row, unsigned src_stride,
-                                            unsigned width, unsigned height);
-void
-util_format_bptc_rgb_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                             const uint8_t *src_row, unsigned src_stride,
-                                             unsigned width, unsigned height);
-void
-util_format_bptc_rgb_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                           const float *src_row, unsigned src_stride,
-                                           unsigned width, unsigned height);
-void
-util_format_bptc_rgb_float_fetch_rgba_float(float *dst, const uint8_t *src,
-                                            unsigned width, unsigned height);
-
-void
-util_format_bptc_rgb_ufloat_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                               const uint8_t *src_row, unsigned src_stride,
-                                               unsigned width, unsigned height);
-void
-util_format_bptc_rgb_ufloat_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                             const uint8_t *src_row, unsigned src_stride,
-                                             unsigned width, unsigned height);
-void
-util_format_bptc_rgb_ufloat_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                              const uint8_t *src_row, unsigned src_stride,
-                                              unsigned width, unsigned height);
-void
-util_format_bptc_rgb_ufloat_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                            const float *src_row, unsigned src_stride,
-                                            unsigned width, unsigned height);
-void
-util_format_bptc_rgb_ufloat_fetch_rgba_float(float *dst, const uint8_t *src,
-                                             unsigned width, unsigned height);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* U_FORMAT_BPTC_H_ */
diff --git a/src/gallium/auxiliary/util/u_format_etc.c b/src/gallium/auxiliary/util/u_format_etc.c
deleted file mode 100644 (file)
index cc0a6ae..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "pipe/p_compiler.h"
-#include "util/u_debug.h"
-#include "util/u_math.h"
-#include "u_format_etc.h"
-
-/* define etc1_parse_block and etc. */
-#define UINT8_TYPE uint8_t
-#define TAG(x) x
-#include "../../../mesa/main/texcompress_etc_tmp.h"
-#undef TAG
-#undef UINT8_TYPE
-
-void
-util_format_etc1_rgb8_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   etc1_unpack_rgba8888(dst_row, dst_stride, src_row, src_stride, width, height);
-}
-
-void
-util_format_etc1_rgb8_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                       UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                       UNUSED unsigned width, UNUSED unsigned height)
-{
-   assert(0);
-}
-
-void
-util_format_etc1_rgb8_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   const unsigned bw = 4, bh = 4, bs = 8, comps = 4;
-   struct etc1_block block;
-   unsigned x, y, i, j;
-
-   for (y = 0; y < height; y += bh) {
-      const uint8_t *src = src_row;
-
-      for (x = 0; x < width; x+= bw) {
-         etc1_parse_block(&block, src);
-
-         for (j = 0; j < bh; j++) {
-            float *dst = dst_row + (y + j) * dst_stride / sizeof(*dst_row) + x * comps;
-            uint8_t tmp[3];
-
-            for (i = 0; i < bw; i++) {
-               etc1_fetch_texel(&block, i, j, tmp);
-               dst[0] = ubyte_to_float(tmp[0]);
-               dst[1] = ubyte_to_float(tmp[1]);
-               dst[2] = ubyte_to_float(tmp[2]);
-               dst[3] = 1.0f;
-               dst += comps;
-            }
-         }
-
-         src += bs;
-      }
-
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_etc1_rgb8_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                      UNUSED const float *src_row, UNUSED unsigned src_stride,
-                                      UNUSED unsigned width, UNUSED unsigned height)
-{
-   assert(0);
-}
-
-void
-util_format_etc1_rgb8_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   struct etc1_block block;
-   uint8_t tmp[3];
-
-   assert(i < 4 && j < 4); /* check i, j against 4x4 block size */
-
-   etc1_parse_block(&block, src);
-   etc1_fetch_texel(&block, i, j, tmp);
-
-   dst[0] = ubyte_to_float(tmp[0]);
-   dst[1] = ubyte_to_float(tmp[1]);
-   dst[2] = ubyte_to_float(tmp[2]);
-   dst[3] = 1.0f;
-}
diff --git a/src/gallium/auxiliary/util/u_format_etc.h b/src/gallium/auxiliary/util/u_format_etc.h
deleted file mode 100644 (file)
index 30c3dcb..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2011 LunarG, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-#ifndef U_FORMAT_ETC1_H_
-#define U_FORMAT_ETC1_H_
-
-void
-util_format_etc1_rgb8_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_etc1_rgb8_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_etc1_rgb8_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_etc1_rgb8_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_etc1_rgb8_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-#endif /* U_FORMAT_ETC1_H_ */
diff --git a/src/gallium/auxiliary/util/u_format_latc.c b/src/gallium/auxiliary/util/u_format_latc.c
deleted file mode 100644 (file)
index f145081..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-/**************************************************************************
- *
- * Copyright (C) 2011 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include <stdio.h>
-#include "u_format.h"
-#include "u_format_rgtc.h"
-#include "u_format_latc.h"
-#include "util/rgtc.h"
-#include "util/u_math.h"
-
-void
-util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   /* Fix warnings here: */
-   (void) util_format_unsigned_encode_rgtc_ubyte;
-   (void) util_format_signed_encode_rgtc_ubyte;
-
-   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
-   dst[1] = dst[0];
-   dst[2] = dst[0];
-   dst[3] = 255;
-}
-
-void
-util_format_latc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_rgtc1_unorm_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
-}
-
-void
-util_format_latc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row,
-                                        unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_rgtc1_unorm_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
-}
-
-void
-util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   unsigned x, y, i, j;
-   int block_size = 8;
-
-   for(y = 0; y < height; y += 4) {
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += 4) {
-         for(j = 0; j < 4; ++j) {
-            for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
-               uint8_t tmp_r;
-               util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
-               dst[0] =
-               dst[1] =
-               dst[2] = ubyte_to_float(tmp_r);
-               dst[3] = 1.0;
-            }
-         }
-         src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_latc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_rgtc1_unorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
-}
-
-void
-util_format_latc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp_r;
-
-   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
-   dst[0] =
-   dst[1] =
-   dst[2] = ubyte_to_float(tmp_r);
-   dst[3] = 1.0;
-}
-
-void
-util_format_latc1_snorm_fetch_rgba_8unorm(UNUSED uint8_t *dst, UNUSED const uint8_t *src,
-                                          UNUSED unsigned i, UNUSED unsigned j)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_latc1_snorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                           UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                           UNUSED unsigned width, UNUSED unsigned height)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_latc1_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_latc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_rgtc1_snorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
-}
-
-void
-util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   unsigned x, y, i, j;
-   int block_size = 8;
-
-   for(y = 0; y < height; y += 4) {
-      const int8_t *src = (int8_t *)src_row;
-      for(x = 0; x < width; x += 4) {
-         for(j = 0; j < 4; ++j) {
-            for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
-               int8_t tmp_r;
-               util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
-               dst[0] =
-               dst[1] =
-               dst[2] = byte_to_float_tex(tmp_r);
-               dst[3] = 1.0;
-            }
-         }
-         src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   int8_t tmp_r;
-
-   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
-   dst[0] =
-   dst[1] =
-   dst[2] = byte_to_float_tex(tmp_r);
-   dst[3] = 1.0;
-}
-
-
-void
-util_format_latc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
-   dst[1] = dst[0];
-   dst[2] = dst[0];
-   util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 3, 2);
-}
-
-void
-util_format_latc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_rgtc2_unorm_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
-}
-
-void
-util_format_latc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_rgtc2_unorm_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
-}
-
-void
-util_format_latc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_rxtc2_unorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height, 3);
-}
-
-void
-util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   unsigned x, y, i, j;
-   int block_size = 16;
-
-   for(y = 0; y < height; y += 4) {
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += 4) {
-         for(j = 0; j < 4; ++j) {
-            for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
-               uint8_t tmp_r, tmp_g;
-               util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
-               util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
-               dst[0] =
-               dst[1] =
-               dst[2] = ubyte_to_float(tmp_r);
-               dst[3] = ubyte_to_float(tmp_g);
-            }
-         }
-         src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_latc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp_r, tmp_g;
-
-   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
-   util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
-   dst[0] =
-   dst[1] =
-   dst[2] = ubyte_to_float(tmp_r);
-   dst[3] = ubyte_to_float(tmp_g);
-}
-
-
-void
-util_format_latc2_snorm_fetch_rgba_8unorm(UNUSED uint8_t *dst, UNUSED const uint8_t *src,
-                                          UNUSED unsigned i, UNUSED unsigned j)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_latc2_snorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                           UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                           UNUSED unsigned width, UNUSED unsigned height)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_latc2_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   unsigned x, y, i, j;
-   int block_size = 16;
-
-   for(y = 0; y < height; y += 4) {
-      const int8_t *src = (int8_t *)src_row;
-      for(x = 0; x < width; x += 4) {
-         for(j = 0; j < 4; ++j) {
-            for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
-               int8_t tmp_r, tmp_g;
-               util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
-               util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
-               dst[0] =
-               dst[1] =
-               dst[2] = byte_to_float_tex(tmp_r);
-               dst[3] = byte_to_float_tex(tmp_g);
-            }
-         }
-         src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_latc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_rxtc2_snorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height, 3);
-}
-
-void
-util_format_latc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   int8_t tmp_r, tmp_g;
-
-   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
-   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
-   dst[0] =
-   dst[1] =
-   dst[2] = byte_to_float_tex(tmp_r);
-   dst[3] = byte_to_float_tex(tmp_g);
-}
-
diff --git a/src/gallium/auxiliary/util/u_format_latc.h b/src/gallium/auxiliary/util/u_format_latc.h
deleted file mode 100644 (file)
index 1f08887..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2011 Red Hat Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-#ifndef U_FORMAT_LATC_H_
-#define U_FORMAT_LATC_H_
-
-void
-util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_latc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-
-void
-util_format_latc1_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_latc1_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc1_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-void
-util_format_latc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_latc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-void
-util_format_latc2_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_latc2_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_latc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-#endif
diff --git a/src/gallium/auxiliary/util/u_format_other.c b/src/gallium/auxiliary/util/u_format_other.c
deleted file mode 100644 (file)
index 213cb9f..0000000
+++ /dev/null
@@ -1,422 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#include "u_format_other.h"
-#include "util/u_math.h"
-#include "util/format_rgb9e5.h"
-#include "util/format_r11g11b10f.h"
-
-
-void
-util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; y += 1) {
-      float *dst = dst_row;
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += 1) {
-         uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
-         rgb9e5_to_float3(value, dst);
-         dst[3] = 1; /* a */
-         src += 4;
-         dst += 4;
-      }
-      src_row += src_stride;
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                      const float *src_row, unsigned src_stride,
-                                      unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; y += 1) {
-      const float *src = src_row;
-      uint8_t *dst = dst_row;
-      for(x = 0; x < width; x += 1) {
-         uint32_t value = util_cpu_to_le32(float3_to_rgb9e5(src));
-         *(uint32_t *)dst = value;
-         src += 4;
-         dst += 4;
-      }
-      dst_row += dst_stride;
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src,
-                                       UNUSED unsigned i, UNUSED unsigned j)
-{
-   uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
-   rgb9e5_to_float3(value, dst);
-   dst[3] = 1; /* a */
-}
-
-
-void
-util_format_r9g9b9e5_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   unsigned x, y;
-   float p[3];
-   for(y = 0; y < height; y += 1) {
-      uint8_t *dst = dst_row;
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += 1) {
-         uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
-         rgb9e5_to_float3(value, p);
-         dst[0] = float_to_ubyte(p[0]); /* r */
-         dst[1] = float_to_ubyte(p[1]); /* g */
-         dst[2] = float_to_ubyte(p[2]); /* b */
-         dst[3] = 255; /* a */
-         src += 4;
-         dst += 4;
-      }
-      src_row += src_stride;
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-   float p[3];
-   for(y = 0; y < height; y += 1) {
-      const uint8_t *src = src_row;
-      uint8_t *dst = dst_row;
-      for(x = 0; x < width; x += 1) {
-         uint32_t value;
-         p[0] = ubyte_to_float(src[0]);
-         p[1] = ubyte_to_float(src[1]);
-         p[2] = ubyte_to_float(src[2]);
-         value = util_cpu_to_le32(float3_to_rgb9e5(p));
-         *(uint32_t *)dst = value;
-         src += 4;
-         dst += 4;
-      }
-      dst_row += dst_stride;
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; y += 1) {
-      float *dst = dst_row;
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += 1) {
-         uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
-         r11g11b10f_to_float3(value, dst);
-         dst[3] = 1; /* a */
-         src += 4;
-         dst += 4;
-      }
-      src_row += src_stride;
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_r11g11b10_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                      const float *src_row, unsigned src_stride,
-                                      unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; y += 1) {
-      const float *src = src_row;
-      uint8_t *dst = dst_row;
-      for(x = 0; x < width; x += 1) {
-         uint32_t value = util_cpu_to_le32(float3_to_r11g11b10f(src));
-         *(uint32_t *)dst = value;
-         src += 4;
-         dst += 4;
-      }
-      dst_row += dst_stride;
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        UNUSED unsigned i, UNUSED unsigned j)
-{
-   uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
-   r11g11b10f_to_float3(value, dst);
-   dst[3] = 1; /* a */
-}
-
-
-void
-util_format_r11g11b10_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   unsigned x, y;
-   float p[3];
-   for(y = 0; y < height; y += 1) {
-      uint8_t *dst = dst_row;
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += 1) {
-         uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
-         r11g11b10f_to_float3(value, p);
-         dst[0] = float_to_ubyte(p[0]); /* r */
-         dst[1] = float_to_ubyte(p[1]); /* g */
-         dst[2] = float_to_ubyte(p[2]); /* b */
-         dst[3] = 255; /* a */
-         src += 4;
-         dst += 4;
-      }
-      src_row += src_stride;
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-   float p[3];
-   for(y = 0; y < height; y += 1) {
-      const uint8_t *src = src_row;
-      uint8_t *dst = dst_row;
-      for(x = 0; x < width; x += 1) {
-         uint32_t value;
-         p[0] = ubyte_to_float(src[0]);
-         p[1] = ubyte_to_float(src[1]);
-         p[2] = ubyte_to_float(src[2]);
-         value = util_cpu_to_le32(float3_to_r11g11b10f(p));
-         *(uint32_t *)dst = value;
-         src += 4;
-         dst += 4;
-      }
-      dst_row += dst_stride;
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_r1_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                                  UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                  UNUSED unsigned width, UNUSED unsigned height)
-{
-
-}
-
-
-void
-util_format_r1_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                UNUSED const float *src_row, UNUSED unsigned src_stride,
-                                UNUSED unsigned width, UNUSED unsigned height)
-{
-
-}
-
-
-void
-util_format_r1_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                                 UNUSED unsigned i, UNUSED unsigned j)
-{
-
-}
-
-
-void
-util_format_r1_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                   UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                   UNUSED unsigned width, UNUSED unsigned height)
-{
-
-}
-
-
-void
-util_format_r1_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                 UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                 UNUSED unsigned width, UNUSED unsigned height)
-{
-}
-
-
-/*
- * PIPE_FORMAT_R8G8Bx_SNORM
- *
- * A.k.a. D3DFMT_CxV8U8
- */
-
-static uint8_t
-r8g8bx_derive(int16_t r, int16_t g)
-{
-   /* Derive blue from red and green components.
-    * Apparently, we must always use integers to perform calculations,
-    * otherwise the results won't match D3D's CxV8U8 definition.
-    */
-   return (uint8_t)sqrtf(0x7f * 0x7f - r * r - g * g) * 0xff / 0x7f;
-}
-
-void
-util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                      const uint8_t *src_row, unsigned src_stride,
-                                      unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for(y = 0; y < height; y += 1) {
-      float *dst = dst_row;
-      const uint16_t *src = (const uint16_t *)src_row;
-      for(x = 0; x < width; x += 1) {
-         uint16_t value = util_cpu_to_le16(*src++);
-         int16_t r, g;
-
-         r = ((int16_t)(value << 8)) >> 8;
-         g = ((int16_t)(value << 0)) >> 8;
-
-         dst[0] = (float)(r * (1.0f/0x7f)); /* r */
-         dst[1] = (float)(g * (1.0f/0x7f)); /* g */
-         dst[2] = r8g8bx_derive(r, g) * (1.0f/0xff); /* b */
-         dst[3] = 1.0f; /* a */
-         dst += 4;
-      }
-      src_row += src_stride;
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; y += 1) {
-      uint8_t *dst = dst_row;
-      const uint16_t *src = (const uint16_t *)src_row;
-      for(x = 0; x < width; x += 1) {
-         uint16_t value = util_cpu_to_le16(*src++);
-         int16_t r, g;
-
-         r = ((int16_t)(value << 8)) >> 8;
-         g = ((int16_t)(value << 0)) >> 8;
-
-         dst[0] = (uint8_t)(((uint16_t)MAX2(r, 0)) * 0xff / 0x7f); /* r */
-         dst[1] = (uint8_t)(((uint16_t)MAX2(g, 0)) * 0xff / 0x7f); /* g */
-         dst[2] = r8g8bx_derive(r, g); /* b */
-         dst[3] = 255; /* a */
-         dst += 4;
-      }
-      src_row += src_stride;
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                    const float *src_row, unsigned src_stride,
-                                    unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; y += 1) {
-      const float *src = src_row;
-      uint16_t *dst = (uint16_t *)dst_row;
-      for(x = 0; x < width; x += 1) {
-         uint16_t value = 0;
-
-         value |= (uint16_t)(((int8_t)(CLAMP(src[0], -1, 1) * 0x7f)) & 0xff) ;
-         value |= (uint16_t)((((int8_t)(CLAMP(src[1], -1, 1) * 0x7f)) & 0xff) << 8) ;
-
-         *dst++ = util_le16_to_cpu(value);
-
-         src += 4;
-      }
-      dst_row += dst_stride;
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                     const uint8_t *src_row, unsigned src_stride,
-                                     unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for(y = 0; y < height; y += 1) {
-      const uint8_t *src = src_row;
-      uint16_t *dst = (uint16_t *)dst_row;
-      for(x = 0; x < width; x += 1) {
-         uint16_t value = 0;
-
-         value |= src[0] >> 1;
-         value |= (src[1] >> 1) << 8;
-
-         *dst++ = util_le16_to_cpu(value);
-
-         src += 4;
-      }
-      dst_row += dst_stride;
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                     UNUSED unsigned i, UNUSED unsigned j)
-{
-   uint16_t value = util_cpu_to_le16(*(const uint16_t *)src);
-   int16_t r, g;
-
-   r = ((int16_t)(value << 8)) >> 8;
-   g = ((int16_t)(value << 0)) >> 8;
-
-   dst[0] = r * (1.0f/0x7f); /* r */
-   dst[1] = g * (1.0f/0x7f); /* g */
-   dst[2] = r8g8bx_derive(r, g) * (1.0f/0xff); /* b */
-   dst[3] = 1.0f; /* a */
-}
diff --git a/src/gallium/auxiliary/util/u_format_other.h b/src/gallium/auxiliary/util/u_format_other.h
deleted file mode 100644 (file)
index 2f6a908..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#ifndef U_FORMAT_OTHER_H_
-#define U_FORMAT_OTHER_H_
-
-
-#include "pipe/p_compiler.h"
-
-
-void
-util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height);
-
-void
-util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                      const float *src_row, unsigned src_stride,
-                                      unsigned width, unsigned height);
-
-void
-util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src,
-                                       unsigned i, unsigned j);
-
-void
-util_format_r9g9b9e5_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height);
-
-void
-util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height);
-
-
-void
-util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height);
-
-void
-util_format_r11g11b10_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                      const float *src_row, unsigned src_stride,
-                                      unsigned width, unsigned height);
-
-void
-util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src,
-                                       unsigned i, unsigned j);
-
-void
-util_format_r11g11b10_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height);
-
-void
-util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height);
-
-
-void
-util_format_r1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                  const uint8_t *src_row, unsigned src_stride,
-                                  unsigned width, unsigned height);
-
-void
-util_format_r1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                const float *src_row, unsigned src_stride,
-                                unsigned width, unsigned height);
-
-void
-util_format_r1_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                 unsigned i, unsigned j);
-
-void
-util_format_r1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                   const uint8_t *src_row, unsigned src_stride,
-                                   unsigned width, unsigned height);
-
-void
-util_format_r1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                 const uint8_t *src_row, unsigned src_stride,
-                                 unsigned width, unsigned height);
-
-void
-util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                      const uint8_t *src_row, unsigned src_stride,
-                                      unsigned width, unsigned height);
-
-void
-util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                    const float *src_row, unsigned src_stride,
-                                    unsigned width, unsigned height);
-
-void
-util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                     unsigned i, unsigned j);
-
-void
-util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height);
-
-void
-util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                     const uint8_t *src_row, unsigned src_stride,
-                                     unsigned width, unsigned height);
-
-#endif /* U_FORMAT_OTHER_H_ */
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
deleted file mode 100644 (file)
index 6f05847..0000000
+++ /dev/null
@@ -1,761 +0,0 @@
-
-'''
-/**************************************************************************
- *
- * Copyright 2009-2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * @file
- * Pixel format packing and unpacking functions.
- *
- * @author Jose Fonseca <jfonseca@vmware.com>
- */
-'''
-
-
-from __future__ import division, print_function
-
-import sys
-
-from u_format_parse import *
-
-
-if sys.version_info < (3, 0):
-    integer_types = (int, long)
-
-else:
-    integer_types = (int, )
-
-
-def inv_swizzles(swizzles):
-    '''Return an array[4] of inverse swizzle terms'''
-    '''Only pick the first matching value to avoid l8 getting blue and i8 getting alpha'''
-    inv_swizzle = [None]*4
-    for i in range(4):
-        swizzle = swizzles[i]
-        if swizzle < 4 and inv_swizzle[swizzle] == None:
-            inv_swizzle[swizzle] = i
-    return inv_swizzle
-
-def print_channels(format, func):
-    if format.nr_channels() <= 1:
-        func(format.le_channels, format.le_swizzles)
-    else:
-        if (format.le_channels == format.be_channels and
-            [c.shift for c in format.le_channels] ==
-            [c.shift for c in format.be_channels] and
-            format.le_swizzles == format.be_swizzles):
-            func(format.le_channels, format.le_swizzles)
-        else:
-            print('#if UTIL_ARCH_BIG_ENDIAN')
-            func(format.be_channels, format.be_swizzles)
-            print('#else')
-            func(format.le_channels, format.le_swizzles)
-            print('#endif')
-
-def generate_format_type(format):
-    '''Generate a structure that describes the format.'''
-
-    assert format.layout == PLAIN
-    
-    def generate_bitfields(channels, swizzles):
-        for channel in channels:
-            if channel.type == VOID:
-                if channel.size:
-                    print('   unsigned %s:%u;' % (channel.name, channel.size))
-            elif channel.type == UNSIGNED:
-                print('   unsigned %s:%u;' % (channel.name, channel.size))
-            elif channel.type in (SIGNED, FIXED):
-                print('   int %s:%u;' % (channel.name, channel.size))
-            elif channel.type == FLOAT:
-                if channel.size == 64:
-                    print('   double %s;' % (channel.name))
-                elif channel.size == 32:
-                    print('   float %s;' % (channel.name))
-                else:
-                    print('   unsigned %s:%u;' % (channel.name, channel.size))
-            else:
-                assert 0
-
-    def generate_full_fields(channels, swizzles):
-        for channel in channels:
-            assert channel.size % 8 == 0 and is_pot(channel.size)
-            if channel.type == VOID:
-                if channel.size:
-                    print('   uint%u_t %s;' % (channel.size, channel.name))
-            elif channel.type == UNSIGNED:
-                print('   uint%u_t %s;' % (channel.size, channel.name))
-            elif channel.type in (SIGNED, FIXED):
-                print('   int%u_t %s;' % (channel.size, channel.name))
-            elif channel.type == FLOAT:
-                if channel.size == 64:
-                    print('   double %s;' % (channel.name))
-                elif channel.size == 32:
-                    print('   float %s;' % (channel.name))
-                elif channel.size == 16:
-                    print('   uint16_t %s;' % (channel.name))
-                else:
-                    assert 0
-            else:
-                assert 0
-
-    use_bitfields = False
-    for channel in format.le_channels:
-        if channel.size % 8 or not is_pot(channel.size):
-            use_bitfields = True
-
-    print('struct util_format_%s {' % format.short_name())
-    if use_bitfields:
-        print_channels(format, generate_bitfields)
-    else:
-        print_channels(format, generate_full_fields)
-    print('};')
-    print()
-
-
-def is_format_supported(format):
-    '''Determines whether we actually have the plumbing necessary to generate the 
-    to read/write to/from this format.'''
-
-    # FIXME: Ideally we would support any format combination here.
-
-    if format.layout != PLAIN:
-        return False
-
-    for i in range(4):
-        channel = format.le_channels[i]
-        if channel.type not in (VOID, UNSIGNED, SIGNED, FLOAT, FIXED):
-            return False
-        if channel.type == FLOAT and channel.size not in (16, 32, 64):
-            return False
-
-    return True
-
-def native_type(format):
-    '''Get the native appropriate for a format.'''
-
-    if format.name == 'PIPE_FORMAT_R11G11B10_FLOAT':
-        return 'uint32_t'
-    if format.name == 'PIPE_FORMAT_R9G9B9E5_FLOAT':
-        return 'uint32_t'
-
-    if format.layout == PLAIN:
-        if not format.is_array():
-            # For arithmetic pixel formats return the integer type that matches the whole pixel
-            return 'uint%u_t' % format.block_size()
-        else:
-            # For array pixel formats return the integer type that matches the color channel
-            channel = format.array_element()
-            if channel.type in (UNSIGNED, VOID):
-                return 'uint%u_t' % channel.size
-            elif channel.type in (SIGNED, FIXED):
-                return 'int%u_t' % channel.size
-            elif channel.type == FLOAT:
-                if channel.size == 16:
-                    return 'uint16_t'
-                elif channel.size == 32:
-                    return 'float'
-                elif channel.size == 64:
-                    return 'double'
-                else:
-                    assert False
-            else:
-                assert False
-    else:
-        assert False
-
-
-def intermediate_native_type(bits, sign):
-    '''Find a native type adequate to hold intermediate results of the request bit size.'''
-
-    bytes = 4 # don't use anything smaller than 32bits
-    while bytes * 8 < bits:
-        bytes *= 2
-    bits = bytes*8
-
-    if sign:
-        return 'int%u_t' % bits
-    else:
-        return 'uint%u_t' % bits
-
-
-def get_one_shift(type):
-    '''Get the number of the bit that matches unity for this type.'''
-    if type.type == 'FLOAT':
-        assert False
-    if not type.norm:
-        return 0
-    if type.type == UNSIGNED:
-        return type.size
-    if type.type == SIGNED:
-        return type.size - 1
-    if type.type == FIXED:
-        return type.size / 2
-    assert False
-
-
-def truncate_mantissa(x, bits):
-    '''Truncate an integer so it can be represented exactly with a floating
-    point mantissa'''
-
-    assert isinstance(x, integer_types)
-
-    s = 1
-    if x < 0:
-        s = -1
-        x = -x
-
-    # We can represent integers up to mantissa + 1 bits exactly
-    mask = (1 << (bits + 1)) - 1
-
-    # Slide the mask until the MSB matches
-    shift = 0
-    while (x >> shift) & ~mask:
-        shift += 1
-
-    x &= mask << shift
-    x *= s
-    return x
-
-
-def value_to_native(type, value):
-    '''Get the value of unity for this type.'''
-    if type.type == FLOAT:
-        if type.size <= 32 \
-            and isinstance(value, integer_types):
-            return truncate_mantissa(value, 23)
-        return value
-    if type.type == FIXED:
-        return int(value * (1 << (type.size // 2)))
-    if not type.norm:
-        return int(value)
-    if type.type == UNSIGNED:
-        return int(value * ((1 << type.size) - 1))
-    if type.type == SIGNED:
-        return int(value * ((1 << (type.size - 1)) - 1))
-    assert False
-
-
-def native_to_constant(type, value):
-    '''Get the value of unity for this type.'''
-    if type.type == FLOAT:
-        if type.size <= 32:
-            return "%.1ff" % float(value)
-        else:
-            return "%.1f" % float(value)
-    else:
-        return str(int(value))
-
-
-def get_one(type):
-    '''Get the value of unity for this type.'''
-    return value_to_native(type, 1)
-
-
-def clamp_expr(src_channel, dst_channel, dst_native_type, value):
-    '''Generate the expression to clamp the value in the source type to the
-    destination type range.'''
-
-    if src_channel == dst_channel:
-        return value
-
-    src_min = src_channel.min()
-    src_max = src_channel.max()
-    dst_min = dst_channel.min()
-    dst_max = dst_channel.max()
-    
-    # Translate the destination range to the src native value
-    dst_min_native = native_to_constant(src_channel, value_to_native(src_channel, dst_min))
-    dst_max_native = native_to_constant(src_channel, value_to_native(src_channel, dst_max))
-
-    if src_min < dst_min and src_max > dst_max:
-        return 'CLAMP(%s, %s, %s)' % (value, dst_min_native, dst_max_native)
-
-    if src_max > dst_max:
-        return 'MIN2(%s, %s)' % (value, dst_max_native)
-        
-    if src_min < dst_min:
-        return 'MAX2(%s, %s)' % (value, dst_min_native)
-
-    return value
-
-
-def conversion_expr(src_channel, 
-                    dst_channel, dst_native_type, 
-                    value, 
-                    clamp=True, 
-                    src_colorspace = RGB, 
-                    dst_colorspace = RGB):
-    '''Generate the expression to convert a value between two types.'''
-
-    if src_colorspace != dst_colorspace:
-        if src_colorspace == SRGB:
-            assert src_channel.type == UNSIGNED
-            assert src_channel.norm
-            assert src_channel.size <= 8
-            assert src_channel.size >= 4
-            assert dst_colorspace == RGB
-            if src_channel.size < 8:
-                value = '%s << %x | %s >> %x' % (value, 8 - src_channel.size, value, 2 * src_channel.size - 8)
-            if dst_channel.type == FLOAT:
-                return 'util_format_srgb_8unorm_to_linear_float(%s)' % value
-            else:
-                assert dst_channel.type == UNSIGNED
-                assert dst_channel.norm
-                assert dst_channel.size == 8
-                return 'util_format_srgb_to_linear_8unorm(%s)' % value
-        elif dst_colorspace == SRGB:
-            assert dst_channel.type == UNSIGNED
-            assert dst_channel.norm
-            assert dst_channel.size <= 8
-            assert src_colorspace == RGB
-            if src_channel.type == FLOAT:
-                value =  'util_format_linear_float_to_srgb_8unorm(%s)' % value
-            else:
-                assert src_channel.type == UNSIGNED
-                assert src_channel.norm
-                assert src_channel.size == 8
-                value = 'util_format_linear_to_srgb_8unorm(%s)' % value
-            # XXX rounding is all wrong.
-            if dst_channel.size < 8:
-                return '%s >> %x' % (value, 8 - dst_channel.size)
-            else:
-                return value
-        elif src_colorspace == ZS:
-            pass
-        elif dst_colorspace == ZS:
-            pass
-        else:
-            assert 0
-
-    if src_channel == dst_channel:
-        return value
-
-    src_type = src_channel.type
-    src_size = src_channel.size
-    src_norm = src_channel.norm
-    src_pure = src_channel.pure
-
-    # Promote half to float
-    if src_type == FLOAT and src_size == 16:
-        value = 'util_half_to_float(%s)' % value
-        src_size = 32
-
-    # Special case for float <-> ubytes for more accurate results
-    # Done before clamping since these functions already take care of that
-    if src_type == UNSIGNED and src_norm and src_size == 8 and dst_channel.type == FLOAT and dst_channel.size == 32:
-        return 'ubyte_to_float(%s)' % value
-    if src_type == FLOAT and src_size == 32 and dst_channel.type == UNSIGNED and dst_channel.norm and dst_channel.size == 8:
-        return 'float_to_ubyte(%s)' % value
-
-    if clamp:
-        if dst_channel.type != FLOAT or src_type != FLOAT:
-            value = clamp_expr(src_channel, dst_channel, dst_native_type, value)
-
-    if src_type in (SIGNED, UNSIGNED) and dst_channel.type in (SIGNED, UNSIGNED):
-        if not src_norm and not dst_channel.norm:
-            # neither is normalized -- just cast
-            return '(%s)%s' % (dst_native_type, value)
-
-        src_one = get_one(src_channel)
-        dst_one = get_one(dst_channel)
-
-        if src_one > dst_one and src_norm and dst_channel.norm:
-            # We can just bitshift
-            src_shift = get_one_shift(src_channel)
-            dst_shift = get_one_shift(dst_channel)
-            value = '(%s >> %s)' % (value, src_shift - dst_shift)
-        else:
-            # We need to rescale using an intermediate type big enough to hold the multiplication of both
-            tmp_native_type = intermediate_native_type(src_size + dst_channel.size, src_channel.sign and dst_channel.sign)
-            value = '((%s)%s)' % (tmp_native_type, value)
-            value = '(%s * 0x%x / 0x%x)' % (value, dst_one, src_one)
-        value = '(%s)%s' % (dst_native_type, value)
-        return value
-
-    # Promote to either float or double
-    if src_type != FLOAT:
-        if src_norm or src_type == FIXED:
-            one = get_one(src_channel)
-            if src_size <= 23:
-                value = '(%s * (1.0f/0x%x))' % (value, one)
-                if dst_channel.size <= 32:
-                    value = '(float)%s' % value
-                src_size = 32
-            else:
-                # bigger than single precision mantissa, use double
-                value = '(%s * (1.0/0x%x))' % (value, one)
-                src_size = 64
-            src_norm = False
-        else:
-            if src_size <= 23 or dst_channel.size <= 32:
-                value = '(float)%s' % value
-                src_size = 32
-            else:
-                # bigger than single precision mantissa, use double
-                value = '(double)%s' % value
-                src_size = 64
-        src_type = FLOAT
-
-    # Convert double or float to non-float
-    if dst_channel.type != FLOAT:
-        if dst_channel.norm or dst_channel.type == FIXED:
-            dst_one = get_one(dst_channel)
-            if dst_channel.size <= 23:
-                value = 'util_iround(%s * 0x%x)' % (value, dst_one)
-            else:
-                # bigger than single precision mantissa, use double
-                value = '(%s * (double)0x%x)' % (value, dst_one)
-        value = '(%s)%s' % (dst_native_type, value)
-    else:
-        # Cast double to float when converting to either half or float
-        if dst_channel.size <= 32 and src_size > 32:
-            value = '(float)%s' % value
-            src_size = 32
-
-        if dst_channel.size == 16:
-            value = 'util_float_to_half(%s)' % value
-        elif dst_channel.size == 64 and src_size < 64:
-            value = '(double)%s' % value
-
-    return value
-
-
-def generate_unpack_kernel(format, dst_channel, dst_native_type):
-
-    if not is_format_supported(format):
-        return
-    
-    assert format.layout == PLAIN
-
-    def unpack_from_bitmask(channels, swizzles):
-        depth = format.block_size()
-        print('         uint%u_t value = *(const uint%u_t *)src;' % (depth, depth)) 
-
-        # Declare the intermediate variables
-        for i in range(format.nr_channels()):
-            src_channel = channels[i]
-            if src_channel.type == UNSIGNED:
-                print('         uint%u_t %s;' % (depth, src_channel.name))
-            elif src_channel.type == SIGNED:
-                print('         int%u_t %s;' % (depth, src_channel.name))
-
-        # Compute the intermediate unshifted values 
-        for i in range(format.nr_channels()):
-            src_channel = channels[i]
-            value = 'value'
-            shift = src_channel.shift
-            if src_channel.type == UNSIGNED:
-                if shift:
-                    value = '%s >> %u' % (value, shift)
-                if shift + src_channel.size < depth:
-                    value = '(%s) & 0x%x' % (value, (1 << src_channel.size) - 1)
-            elif src_channel.type == SIGNED:
-                if shift + src_channel.size < depth:
-                    # Align the sign bit
-                    lshift = depth - (shift + src_channel.size)
-                    value = '%s << %u' % (value, lshift)
-                # Cast to signed
-                value = '(int%u_t)(%s) ' % (depth, value)
-                if src_channel.size < depth:
-                    # Align the LSB bit
-                    rshift = depth - src_channel.size
-                    value = '(%s) >> %u' % (value, rshift)
-            else:
-                value = None
-                
-            if value is not None:
-                print('         %s = %s;' % (src_channel.name, value))
-                
-        # Convert, swizzle, and store final values
-        for i in range(4):
-            swizzle = swizzles[i]
-            if swizzle < 4:
-                src_channel = channels[swizzle]
-                src_colorspace = format.colorspace
-                if src_colorspace == SRGB and i == 3:
-                    # Alpha channel is linear
-                    src_colorspace = RGB
-                value = src_channel.name
-                value = conversion_expr(src_channel, 
-                                        dst_channel, dst_native_type, 
-                                        value,
-                                        src_colorspace = src_colorspace)
-            elif swizzle == SWIZZLE_0:
-                value = '0'
-            elif swizzle == SWIZZLE_1:
-                value = get_one(dst_channel)
-            elif swizzle == SWIZZLE_NONE:
-                value = '0'
-            else:
-                assert False
-            print('         dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i]))
-        
-    def unpack_from_struct(channels, swizzles):
-        print('         struct util_format_%s pixel;' % format.short_name())
-        print('         memcpy(&pixel, src, sizeof pixel);')
-    
-        for i in range(4):
-            swizzle = swizzles[i]
-            if swizzle < 4:
-                src_channel = channels[swizzle]
-                src_colorspace = format.colorspace
-                if src_colorspace == SRGB and i == 3:
-                    # Alpha channel is linear
-                    src_colorspace = RGB
-                value = 'pixel.%s' % src_channel.name
-                value = conversion_expr(src_channel, 
-                                        dst_channel, dst_native_type, 
-                                        value,
-                                        src_colorspace = src_colorspace)
-            elif swizzle == SWIZZLE_0:
-                value = '0'
-            elif swizzle == SWIZZLE_1:
-                value = get_one(dst_channel)
-            elif swizzle == SWIZZLE_NONE:
-                value = '0'
-            else:
-                assert False
-            print('         dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i]))
-    
-    if format.is_bitmask():
-        print_channels(format, unpack_from_bitmask)
-    else:
-        print_channels(format, unpack_from_struct)
-
-
-def generate_pack_kernel(format, src_channel, src_native_type):
-
-    if not is_format_supported(format):
-        return
-    
-    dst_native_type = native_type(format)
-
-    assert format.layout == PLAIN
-
-    def pack_into_bitmask(channels, swizzles):
-        inv_swizzle = inv_swizzles(swizzles)
-
-        depth = format.block_size()
-        print('         uint%u_t value = 0;' % depth) 
-
-        for i in range(4):
-            dst_channel = channels[i]
-            shift = dst_channel.shift
-            if inv_swizzle[i] is not None:
-                value ='src[%u]' % inv_swizzle[i]
-                dst_colorspace = format.colorspace
-                if dst_colorspace == SRGB and inv_swizzle[i] == 3:
-                    # Alpha channel is linear
-                    dst_colorspace = RGB
-                value = conversion_expr(src_channel, 
-                                        dst_channel, dst_native_type, 
-                                        value,
-                                        dst_colorspace = dst_colorspace)
-                if dst_channel.type in (UNSIGNED, SIGNED):
-                    if shift + dst_channel.size < depth:
-                        value = '(%s) & 0x%x' % (value, (1 << dst_channel.size) - 1)
-                    if shift:
-                        value = '(uint32_t)(%s) << %u' % (value, shift)
-                    if dst_channel.type == SIGNED:
-                        # Cast to unsigned
-                        value = '(uint%u_t)(%s) ' % (depth, value)
-                else:
-                    value = None
-                if value is not None:
-                    print('         value |= %s;' % (value))
-                
-        print('         *(uint%u_t *)dst = value;' % depth) 
-
-    def pack_into_struct(channels, swizzles):
-        inv_swizzle = inv_swizzles(swizzles)
-
-        print('         struct util_format_%s pixel;' % format.short_name())
-    
-        for i in range(4):
-            dst_channel = channels[i]
-            width = dst_channel.size
-            if inv_swizzle[i] is None:
-                continue
-            dst_colorspace = format.colorspace
-            if dst_colorspace == SRGB and inv_swizzle[i] == 3:
-                # Alpha channel is linear
-                dst_colorspace = RGB
-            value ='src[%u]' % inv_swizzle[i]
-            value = conversion_expr(src_channel, 
-                                    dst_channel, dst_native_type, 
-                                    value, 
-                                    dst_colorspace = dst_colorspace)
-            print('         pixel.%s = %s;' % (dst_channel.name, value))
-    
-        print('         memcpy(dst, &pixel, sizeof pixel);')
-    
-    if format.is_bitmask():
-        print_channels(format, pack_into_bitmask)
-    else:
-        print_channels(format, pack_into_struct)
-
-
-def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
-    '''Generate the function to unpack pixels from a particular format'''
-
-    name = format.short_name()
-
-    print('static inline void')
-    print('util_format_%s_unpack_%s(%s *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)' % (name, dst_suffix, dst_native_type))
-    print('{')
-
-    if is_format_supported(format):
-        print('   unsigned x, y;')
-        print('   for(y = 0; y < height; y += %u) {' % (format.block_height,))
-        print('      %s *dst = dst_row;' % (dst_native_type))
-        print('      const uint8_t *src = src_row;')
-        print('      for(x = 0; x < width; x += %u) {' % (format.block_width,))
-        
-        generate_unpack_kernel(format, dst_channel, dst_native_type)
-    
-        print('         src += %u;' % (format.block_size() / 8,))
-        print('         dst += 4;')
-        print('      }')
-        print('      src_row += src_stride;')
-        print('      dst_row += dst_stride/sizeof(*dst_row);')
-        print('   }')
-
-    print('}')
-    print()
-    
-
-def generate_format_pack(format, src_channel, src_native_type, src_suffix):
-    '''Generate the function to pack pixels to a particular format'''
-
-    name = format.short_name()
-
-    print('static inline void')
-    print('util_format_%s_pack_%s(uint8_t *dst_row, unsigned dst_stride, const %s *src_row, unsigned src_stride, unsigned width, unsigned height)' % (name, src_suffix, src_native_type))
-    print('{')
-    
-    if is_format_supported(format):
-        print('   unsigned x, y;')
-        print('   for(y = 0; y < height; y += %u) {' % (format.block_height,))
-        print('      const %s *src = src_row;' % (src_native_type))
-        print('      uint8_t *dst = dst_row;')
-        print('      for(x = 0; x < width; x += %u) {' % (format.block_width,))
-    
-        generate_pack_kernel(format, src_channel, src_native_type)
-            
-        print('         src += 4;')
-        print('         dst += %u;' % (format.block_size() / 8,))
-        print('      }')
-        print('      dst_row += dst_stride;')
-        print('      src_row += src_stride/sizeof(*src_row);')
-        print('   }')
-        
-    print('}')
-    print()
-    
-
-def generate_format_fetch(format, dst_channel, dst_native_type, dst_suffix):
-    '''Generate the function to unpack pixels from a particular format'''
-
-    name = format.short_name()
-
-    print('static inline void')
-    print('util_format_%s_fetch_%s(%s *dst, const uint8_t *src, UNUSED unsigned i, UNUSED unsigned j)' % (name, dst_suffix, dst_native_type))
-    print('{')
-
-    if is_format_supported(format):
-        generate_unpack_kernel(format, dst_channel, dst_native_type)
-
-    print('}')
-    print()
-
-
-def is_format_hand_written(format):
-    return format.layout != PLAIN or format.colorspace == ZS
-
-
-def generate(formats):
-    print()
-    print('#include "pipe/p_compiler.h"')
-    print('#include "util/u_math.h"')
-    print('#include "u_half.h"')
-    print('#include "u_format.h"')
-    print('#include "u_format_other.h"')
-    print('#include "util/format_srgb.h"')
-    print('#include "u_format_yuv.h"')
-    print('#include "u_format_zs.h"')
-    print()
-
-    for format in formats:
-        if not is_format_hand_written(format):
-            
-            if is_format_supported(format) and not format.is_bitmask():
-                generate_format_type(format)
-
-            if format.is_pure_unsigned():
-                native_type = 'unsigned'
-                suffix = 'unsigned'
-                channel = Channel(UNSIGNED, False, True, 32)
-
-                generate_format_unpack(format, channel, native_type, suffix)
-                generate_format_pack(format, channel, native_type, suffix)
-                generate_format_fetch(format, channel, native_type, suffix)
-
-                channel = Channel(SIGNED, False, True, 32)
-                native_type = 'int'
-                suffix = 'signed'
-                generate_format_unpack(format, channel, native_type, suffix)
-                generate_format_pack(format, channel, native_type, suffix)   
-            elif format.is_pure_signed():
-                native_type = 'int'
-                suffix = 'signed'
-                channel = Channel(SIGNED, False, True, 32)
-
-                generate_format_unpack(format, channel, native_type, suffix)
-                generate_format_pack(format, channel, native_type, suffix)   
-                generate_format_fetch(format, channel, native_type, suffix)
-
-                native_type = 'unsigned'
-                suffix = 'unsigned'
-                channel = Channel(UNSIGNED, False, True, 32)
-                generate_format_unpack(format, channel, native_type, suffix)
-                generate_format_pack(format, channel, native_type, suffix)   
-            else:
-                channel = Channel(FLOAT, False, False, 32)
-                native_type = 'float'
-                suffix = 'rgba_float'
-
-                generate_format_unpack(format, channel, native_type, suffix)
-                generate_format_pack(format, channel, native_type, suffix)
-                generate_format_fetch(format, channel, native_type, suffix)
-
-                channel = Channel(UNSIGNED, True, False, 8)
-                native_type = 'uint8_t'
-                suffix = 'rgba_8unorm'
-
-                generate_format_unpack(format, channel, native_type, suffix)
-                generate_format_pack(format, channel, native_type, suffix)
-
diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py
deleted file mode 100644 (file)
index 541ae69..0000000
+++ /dev/null
@@ -1,405 +0,0 @@
-
-'''
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-'''
-
-
-from __future__ import division
-
-
-VOID, UNSIGNED, SIGNED, FIXED, FLOAT = range(5)
-
-SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_0, SWIZZLE_1, SWIZZLE_NONE, = range(7)
-
-PLAIN = 'plain'
-
-RGB = 'rgb'
-SRGB = 'srgb'
-YUV = 'yuv'
-ZS = 'zs'
-
-
-def is_pot(x):
-   return (x & (x - 1)) == 0
-
-
-VERY_LARGE = 99999999999999999999999
-
-
-class Channel:
-    '''Describe the channel of a color channel.'''
-    
-    def __init__(self, type, norm, pure, size, name = ''):
-        self.type = type
-        self.norm = norm
-        self.pure = pure
-        self.size = size
-        self.sign = type in (SIGNED, FIXED, FLOAT)
-        self.name = name
-
-    def __str__(self):
-        s = str(self.type)
-        if self.norm:
-            s += 'n'
-        if self.pure:
-            s += 'p'
-        s += str(self.size)
-        return s
-
-    def __eq__(self, other):
-        if other is None:
-            return False
-
-        return self.type == other.type and self.norm == other.norm and self.pure == other.pure and self.size == other.size
-
-    def __ne__(self, other):
-        return not self == other
-
-    def max(self):
-        '''Maximum representable number.'''
-        if self.type == FLOAT:
-            return VERY_LARGE
-        if self.type == FIXED:
-            return (1 << (self.size // 2)) - 1
-        if self.norm:
-            return 1
-        if self.type == UNSIGNED:
-            return (1 << self.size) - 1
-        if self.type == SIGNED:
-            return (1 << (self.size - 1)) - 1
-        assert False
-    
-    def min(self):
-        '''Minimum representable number.'''
-        if self.type == FLOAT:
-            return -VERY_LARGE
-        if self.type == FIXED:
-            return -(1 << (self.size // 2))
-        if self.type == UNSIGNED:
-            return 0
-        if self.norm:
-            return -1
-        if self.type == SIGNED:
-            return -(1 << (self.size - 1))
-        assert False
-
-
-class Format:
-    '''Describe a pixel format.'''
-
-    def __init__(self, name, layout, block_width, block_height, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace):
-        self.name = name
-        self.layout = layout
-        self.block_width = block_width
-        self.block_height = block_height
-        self.block_depth = block_depth
-        self.le_channels = le_channels
-        self.le_swizzles = le_swizzles
-        self.be_channels = be_channels
-        self.be_swizzles = be_swizzles
-        self.name = name
-        self.colorspace = colorspace
-
-    def __str__(self):
-        return self.name
-
-    def short_name(self):
-        '''Make up a short norm for a format, suitable to be used as suffix in
-        function names.'''
-
-        name = self.name
-        if name.startswith('PIPE_FORMAT_'):
-            name = name[len('PIPE_FORMAT_'):]
-        name = name.lower()
-        return name
-
-    def block_size(self):
-        size = 0
-        for channel in self.le_channels:
-            size += channel.size
-        return size
-
-    def nr_channels(self):
-        nr_channels = 0
-        for channel in self.le_channels:
-            if channel.size:
-                nr_channels += 1
-        return nr_channels
-
-    def array_element(self):
-        if self.layout != PLAIN:
-            return None
-        ref_channel = self.le_channels[0]
-        if ref_channel.type == VOID:
-           ref_channel = self.le_channels[1]
-        for channel in self.le_channels:
-            if channel.size and (channel.size != ref_channel.size or channel.size % 8):
-                return None
-            if channel.type != VOID:
-                if channel.type != ref_channel.type:
-                    return None
-                if channel.norm != ref_channel.norm:
-                    return None
-                if channel.pure != ref_channel.pure:
-                    return None
-        return ref_channel
-
-    def is_array(self):
-        return self.array_element() != None
-
-    def is_mixed(self):
-        if self.layout != PLAIN:
-            return False
-        ref_channel = self.le_channels[0]
-        if ref_channel.type == VOID:
-           ref_channel = self.le_channels[1]
-        for channel in self.le_channels[1:]:
-            if channel.type != VOID:
-                if channel.type != ref_channel.type:
-                    return True
-                if channel.norm != ref_channel.norm:
-                    return True
-                if channel.pure != ref_channel.pure:
-                    return True
-        return False
-
-    def is_compressed(self):
-        for channel in self.le_channels:
-            if channel.type != VOID:
-                return False
-        return True
-
-    def is_unorm(self):
-        # Non-compressed formats all have unorm or srgb in their name.
-        for keyword in ['_UNORM', '_SRGB']:
-            if keyword in self.name:
-                return True
-
-        # All the compressed formats in GLES3.2 and GL4.6 ("Table 8.14: Generic
-        # and specific compressed internal formats.") that aren't snorm for
-        # border colors are unorm, other than BPTC_*_FLOAT.
-        return self.is_compressed() and not ('FLOAT' in self.name or self.is_snorm())
-
-    def is_snorm(self):
-        return '_SNORM' in self.name
-
-    def is_pot(self):
-        return is_pot(self.block_size())
-
-    def is_int(self):
-        if self.layout != PLAIN:
-            return False
-        for channel in self.le_channels:
-            if channel.type not in (VOID, UNSIGNED, SIGNED):
-                return False
-        return True
-
-    def is_float(self):
-        if self.layout != PLAIN:
-            return False
-        for channel in self.le_channels:
-            if channel.type not in (VOID, FLOAT):
-                return False
-        return True
-
-    def is_bitmask(self):
-        if self.layout != PLAIN:
-            return False
-        if self.block_size() not in (8, 16, 32):
-            return False
-        for channel in self.le_channels:
-            if channel.type not in (VOID, UNSIGNED, SIGNED):
-                return False
-        return True
-
-    def is_pure_color(self):
-        if self.layout != PLAIN or self.colorspace == ZS:
-            return False
-        pures = [channel.pure
-                 for channel in self.le_channels
-                 if channel.type != VOID]
-        for x in pures:
-           assert x == pures[0]
-        return pures[0]
-
-    def channel_type(self):
-        types = [channel.type
-                 for channel in self.le_channels
-                 if channel.type != VOID]
-        for x in types:
-           assert x == types[0]
-        return types[0]
-
-    def is_pure_signed(self):
-        return self.is_pure_color() and self.channel_type() == SIGNED
-
-    def is_pure_unsigned(self):
-        return self.is_pure_color() and self.channel_type() == UNSIGNED
-
-    def has_channel(self, id):
-        return self.le_swizzles[id] != SWIZZLE_NONE
-
-    def has_depth(self):
-        return self.colorspace == ZS and self.has_channel(0)
-
-    def has_stencil(self):
-        return self.colorspace == ZS and self.has_channel(1)
-
-    def stride(self):
-        return self.block_size()/8
-
-
-_type_parse_map = {
-    '':  VOID,
-    'x': VOID,
-    'u': UNSIGNED,
-    's': SIGNED,
-    'h': FIXED,
-    'f': FLOAT,
-}
-
-_swizzle_parse_map = {
-    'x': SWIZZLE_X,
-    'y': SWIZZLE_Y,
-    'z': SWIZZLE_Z,
-    'w': SWIZZLE_W,
-    '0': SWIZZLE_0,
-    '1': SWIZZLE_1,
-    '_': SWIZZLE_NONE,
-}
-
-def _parse_channels(fields, layout, colorspace, swizzles):
-    if layout == PLAIN:
-        names = ['']*4
-        if colorspace in (RGB, SRGB):
-            for i in range(4):
-                swizzle = swizzles[i]
-                if swizzle < 4:
-                    names[swizzle] += 'rgba'[i]
-        elif colorspace == ZS:
-            for i in range(4):
-                swizzle = swizzles[i]
-                if swizzle < 4:
-                    names[swizzle] += 'zs'[i]
-        else:
-            assert False
-        for i in range(4):
-            if names[i] == '':
-                names[i] = 'x'
-    else:
-        names = ['x', 'y', 'z', 'w']
-
-    channels = []
-    for i in range(0, 4):
-        field = fields[i]
-        if field:
-            type = _type_parse_map[field[0]]
-            if field[1] == 'n':
-                norm = True
-                pure = False
-                size = int(field[2:])
-            elif field[1] == 'p':
-                pure = True
-                norm = False
-                size = int(field[2:])
-            else:
-                norm = False
-                pure = False
-                size = int(field[1:])
-        else:
-            type = VOID
-            norm = False
-            pure = False
-            size = 0
-        channel = Channel(type, norm, pure, size, names[i])
-        channels.append(channel)
-
-    return channels
-
-def parse(filename):
-    '''Parse the format description in CSV format in terms of the
-    Channel and Format classes above.'''
-
-    stream = open(filename)
-    formats = []
-    for line in stream:
-        try:
-            comment = line.index('#')
-        except ValueError:
-            pass
-        else:
-            line = line[:comment]
-        line = line.strip()
-        if not line:
-            continue
-
-        fields = [field.strip() for field in line.split(',')]
-        if len (fields) == 11:
-            fields += fields[5:10]
-        assert len (fields) == 16
-
-        name = fields[0]
-        layout = fields[1]
-        block_width, block_height, block_depth = map(int, fields[2:5])
-        colorspace = fields[10]
-
-        le_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[9]]
-        le_channels = _parse_channels(fields[5:9], layout, colorspace, le_swizzles)
-
-        be_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[15]]
-        be_channels = _parse_channels(fields[11:15], layout, colorspace, be_swizzles)
-
-        le_shift = 0
-        for channel in le_channels:
-            channel.shift = le_shift
-            le_shift += channel.size
-
-        for i in range(4):
-            assert (le_swizzles[i] != SWIZZLE_NONE) == (be_swizzles[i] != SWIZZLE_NONE)
-
-        format = Format(name, layout, block_width, block_height, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace)
-
-        if format.is_array() and not format.is_bitmask():
-            # Formats accessed as arrays by the pack functions (R32G32_FLOAT or
-            # R8G8B8_UNORM, for example) should not be channel-ordering-reversed
-            # for BE.
-            # Note that __eq__ on channels ignores .shift!
-            assert(format.be_channels == format.le_channels)
-            assert(format.be_swizzles == format.le_swizzles)
-            format.be_channels = format.le_channels
-        else:
-            be_shift = 0
-            for channel in format.be_channels[3::-1]:
-                channel.shift = be_shift
-                be_shift += channel.size
-
-            assert le_shift == be_shift
-
-        formats.append(format)
-    return formats
-
diff --git a/src/gallium/auxiliary/util/u_format_rgtc.c b/src/gallium/auxiliary/util/u_format_rgtc.c
deleted file mode 100644 (file)
index 0b98c01..0000000
+++ /dev/null
@@ -1,448 +0,0 @@
-/**************************************************************************
- *
- * Copyright (C) 2011 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include <stdio.h>
-#include "u_format.h"
-#include "u_format_rgtc.h"
-#include "util/u_math.h"
-#include "util/rgtc.h"
-
-void
-util_format_rgtc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
-   dst[1] = 0;
-   dst[2] = 0;
-   dst[3] = 255;
-}
-
-void
-util_format_rgtc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   const unsigned bw = 4, bh = 4, comps = 4;
-   unsigned x, y, i, j;
-   unsigned block_size = 8;
-
-   for(y = 0; y < height; y += bh) {
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += bw) {
-         for(j = 0; j < bh; ++j) {
-            for(i = 0; i < bw; ++i) {
-               uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
-              util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
-              dst[1] = 0;
-              dst[2] = 0;
-              dst[3] = 255;
-           }
-        }
-        src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, 
-                                        unsigned src_stride, unsigned width, unsigned height)
-{
-   const unsigned bw = 4, bh = 4, bytes_per_block = 8;
-   unsigned x, y, i, j;
-
-   for(y = 0; y < height; y += bh) {
-      uint8_t *dst = dst_row;
-      for(x = 0; x < width; x += bw) {
-         uint8_t tmp[4][4];  /* [bh][bw][comps] */
-         for(j = 0; j < bh; ++j) {
-            for(i = 0; i < bw; ++i) {
-              tmp[j][i] = src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4];
-            }
-         }
-         util_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
-         dst += bytes_per_block;
-      }
-      dst_row += dst_stride / sizeof(*dst_row);
-   }
-}
-
-void
-util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   unsigned x, y, i, j;
-   int block_size = 8;
-   for(y = 0; y < height; y += 4) {
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += 4) {
-         for(j = 0; j < 4; ++j) {
-            for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
-               uint8_t tmp_r;
-               util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
-               dst[0] = ubyte_to_float(tmp_r);
-               dst[1] = 0.0;
-               dst[2] = 0.0;
-               dst[3] = 1.0;
-            }
-         }
-         src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   const unsigned bw = 4, bh = 4, bytes_per_block = 8;
-   unsigned x, y, i, j;
-
-   for(y = 0; y < height; y += bh) {
-      uint8_t *dst = dst_row;
-      for(x = 0; x < width; x += bw) {
-         uint8_t tmp[4][4];  /* [bh][bw][comps] */
-         for(j = 0; j < bh; ++j) {
-            for(i = 0; i < bw; ++i) {
-              tmp[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
-            }
-         }
-         util_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
-         dst += bytes_per_block;
-      }
-      dst_row += dst_stride / sizeof(*dst_row);
-   }
-}
-
-void
-util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp_r;
-   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
-   dst[0] = ubyte_to_float(tmp_r);
-   dst[1] = 0.0;
-   dst[2] = 0.0;
-   dst[3] = 1.0;
-}
-
-void
-util_format_rgtc1_snorm_fetch_rgba_8unorm(UNUSED uint8_t *dst, UNUSED const uint8_t *src,
-                                          UNUSED unsigned i, UNUSED unsigned j)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc1_snorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                           UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                           UNUSED unsigned width, UNUSED unsigned height)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc1_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   const unsigned bw = 4, bh = 4, bytes_per_block = 8;
-   unsigned x, y, i, j;
-
-   for(y = 0; y < height; y += bh) {
-      int8_t *dst = (int8_t *)dst_row;
-      for(x = 0; x < width; x += bw) {
-         int8_t tmp[4][4];  /* [bh][bw][comps] */
-         for(j = 0; j < bh; ++j) {
-            for(i = 0; i < bw; ++i) {
-              tmp[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
-            }
-         }
-         util_format_signed_encode_rgtc_ubyte(dst, tmp, 4, 4);
-         dst += bytes_per_block;
-      }
-      dst_row += dst_stride / sizeof(*dst_row);
-   }
-}
-
-void
-util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   unsigned x, y, i, j;
-   int block_size = 8;
-   for(y = 0; y < height; y += 4) {
-      const int8_t *src = (int8_t *)src_row;
-      for(x = 0; x < width; x += 4) {
-         for(j = 0; j < 4; ++j) {
-            for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
-               int8_t tmp_r;
-               util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
-               dst[0] = byte_to_float_tex(tmp_r);
-               dst[1] = 0.0;
-               dst[2] = 0.0;
-               dst[3] = 1.0;
-            }
-         }
-         src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   int8_t tmp_r;
-   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
-   dst[0] = byte_to_float_tex(tmp_r);
-   dst[1] = 0.0;
-   dst[2] = 0.0;
-   dst[3] = 1.0;
-}
-
-
-void
-util_format_rgtc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
-   util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2);
-   dst[2] = 0;
-   dst[3] = 255;
-}
-
-void
-util_format_rgtc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   const unsigned bw = 4, bh = 4, comps = 4;
-   unsigned x, y, i, j;
-   unsigned block_size = 16;
-
-   for(y = 0; y < height; y += bh) {
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += bw) {
-         for(j = 0; j < bh; ++j) {
-            for(i = 0; i < bw; ++i) {
-               uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
-              util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
-              util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2);
-              dst[2] = 0;
-              dst[3] = 255;
-           }
-        }
-        src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   const unsigned bw = 4, bh = 4, bytes_per_block = 16;
-   unsigned x, y, i, j;
-
-   for(y = 0; y < height; y += bh) {
-      uint8_t *dst = dst_row;
-      for(x = 0; x < width; x += bw) {
-         uint8_t tmp_r[4][4];  /* [bh][bw] */
-         uint8_t tmp_g[4][4];  /* [bh][bw] */
-         for(j = 0; j < bh; ++j) {
-            for(i = 0; i < bw; ++i) {
-              tmp_r[j][i] = src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4];
-              tmp_g[j][i] = src_row[((y + j)*src_stride/sizeof(*src_row) + (x + i)*4) + 1];
-            }
-         }
-         util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
-         util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
-         dst += bytes_per_block;
-      }
-      dst_row += dst_stride / sizeof(*dst_row);
-   }
-}
-
-void
-util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off)
-{
-   const unsigned bw = 4, bh = 4, bytes_per_block = 16;
-   unsigned x, y, i, j;
-
-   for(y = 0; y < height; y += bh) {
-      uint8_t *dst = dst_row;
-      for(x = 0; x < width; x += bw) {
-         uint8_t tmp_r[4][4];  /* [bh][bw][comps] */
-         uint8_t tmp_g[4][4];  /* [bh][bw][comps] */
-         for(j = 0; j < bh; ++j) {
-            for(i = 0; i < bw; ++i) {
-              tmp_r[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
-               tmp_g[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
-            }
-         }
-         util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
-         util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
-         dst += bytes_per_block;
-      }
-      dst_row += dst_stride / sizeof(*dst_row);
-   }
-}
-
-void
-util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_rxtc2_unorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height, 1);
-}
-
-void
-util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   unsigned x, y, i, j;
-   int block_size = 16;
-   for(y = 0; y < height; y += 4) {
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += 4) {
-         for(j = 0; j < 4; ++j) {
-            for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
-               uint8_t tmp_r, tmp_g;
-               util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
-               util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
-               dst[0] = ubyte_to_float(tmp_r);
-               dst[1] = ubyte_to_float(tmp_g);
-               dst[2] = 0.0;
-               dst[3] = 1.0;
-            }
-         }
-         src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp_r, tmp_g;
-   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
-   util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
-   dst[0] = ubyte_to_float(tmp_r);
-   dst[1] = ubyte_to_float(tmp_g);
-   dst[2] = 0.0;
-   dst[3] = 1.0;
-}
-
-
-void
-util_format_rgtc2_snorm_fetch_rgba_8unorm(UNUSED uint8_t *dst, UNUSED const uint8_t *src,
-                                          UNUSED unsigned i, UNUSED unsigned j)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc2_snorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                           UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                           UNUSED unsigned width, UNUSED unsigned height)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc2_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height)
-{
-   fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   unsigned x, y, i, j;
-   int block_size = 16;
-   for(y = 0; y < height; y += 4) {
-      const int8_t *src = (int8_t *)src_row;
-      for(x = 0; x < width; x += 4) {
-         for(j = 0; j < 4; ++j) {
-            for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
-               int8_t tmp_r, tmp_g;
-               util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
-               util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
-               dst[0] = byte_to_float_tex(tmp_r);
-               dst[1] = byte_to_float_tex(tmp_g);
-               dst[2] = 0.0;
-               dst[3] = 1.0;
-            }
-         }
-         src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off)
-{
-   const unsigned bw = 4, bh = 4, bytes_per_block = 16;
-   unsigned x, y, i, j;
-
-   for(y = 0; y < height; y += bh) {
-      int8_t *dst = (int8_t *)dst_row;
-      for(x = 0; x < width; x += bw) {
-         int8_t tmp_r[4][4];  /* [bh][bw][comps] */
-         int8_t tmp_g[4][4];  /* [bh][bw][comps] */
-         for(j = 0; j < bh; ++j) {
-            for(i = 0; i < bw; ++i) {
-              tmp_r[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
-               tmp_g[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
-            }
-         }
-         util_format_signed_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
-         util_format_signed_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
-         dst += bytes_per_block;
-      }
-      dst_row += dst_stride / sizeof(*dst_row);
-   }
-}
-
-void
-util_format_rgtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_rxtc2_snorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height, 1);
-}
-
-void
-util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   int8_t tmp_r, tmp_g;
-   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
-   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
-   dst[0] = byte_to_float_tex(tmp_r);
-   dst[1] = byte_to_float_tex(tmp_g);
-   dst[2] = 0.0;
-   dst[3] = 1.0;
-}
-
diff --git a/src/gallium/auxiliary/util/u_format_rgtc.h b/src/gallium/auxiliary/util/u_format_rgtc.h
deleted file mode 100644 (file)
index 67ac472..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2011 Red Hat Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-#ifndef U_FORMAT_RGTC_H_
-#define U_FORMAT_RGTC_H_
-
-void
-util_format_rgtc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_rgtc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-
-void
-util_format_rgtc1_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_rgtc1_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-void
-util_format_rgtc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_rgtc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off);
-
-void
-util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-void
-util_format_rgtc2_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_rgtc2_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off);
-
-void
-util_format_rgtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-#endif
diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c
deleted file mode 100644 (file)
index 69ca62a..0000000
+++ /dev/null
@@ -1,674 +0,0 @@
-/**************************************************************************
- *
- * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
- * Copyright (c) 2008 VMware, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "u_dl.h"
-#include "u_format.h"
-#include "u_format_s3tc.h"
-#include "util/format_srgb.h"
-#include "util/u_math.h"
-#include "../../../mesa/main/texcompress_s3tc_tmp.h"
-
-
-util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgb_dxt1;
-util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1;
-util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3;
-util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;
-
-util_format_dxtn_pack_t util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;
-
-
-/*
- * Pixel fetch.
- */
-
-void
-util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   util_format_dxt1_rgb_fetch(0, src, i, j, dst);
-}
-
-void
-util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   util_format_dxt1_rgba_fetch(0, src, i, j, dst);
-}
-
-void
-util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   util_format_dxt3_rgba_fetch(0, src, i, j, dst);
-}
-
-void
-util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   util_format_dxt5_rgba_fetch(0, src, i, j, dst);
-}
-
-void
-util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
-   dst[0] = ubyte_to_float(tmp[0]);
-   dst[1] = ubyte_to_float(tmp[1]);
-   dst[2] = ubyte_to_float(tmp[2]);
-   dst[3] = 1.0;
-}
-
-void
-util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
-   dst[0] = ubyte_to_float(tmp[0]);
-   dst[1] = ubyte_to_float(tmp[1]);
-   dst[2] = ubyte_to_float(tmp[2]);
-   dst[3] = ubyte_to_float(tmp[3]);
-}
-
-void
-util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
-   dst[0] = ubyte_to_float(tmp[0]);
-   dst[1] = ubyte_to_float(tmp[1]);
-   dst[2] = ubyte_to_float(tmp[2]);
-   dst[3] = ubyte_to_float(tmp[3]);
-}
-
-void
-util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
-   dst[0] = ubyte_to_float(tmp[0]);
-   dst[1] = ubyte_to_float(tmp[1]);
-   dst[2] = ubyte_to_float(tmp[2]);
-   dst[3] = ubyte_to_float(tmp[3]);
-}
-
-
-/*
- * Block decompression.
- */
-
-static inline void
-util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height,
-                                        util_format_dxtn_fetch_t fetch,
-                                        unsigned block_size, boolean srgb)
-{
-   const unsigned bw = 4, bh = 4, comps = 4;
-   unsigned x, y, i, j;
-   for(y = 0; y < height; y += bh) {
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += bw) {
-         for(j = 0; j < bh; ++j) {
-            for(i = 0; i < bw; ++i) {
-               uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
-               fetch(0, src, i, j, dst);
-               if (srgb) {
-                  dst[0] = util_format_srgb_to_linear_8unorm(dst[0]);
-                  dst[1] = util_format_srgb_to_linear_8unorm(dst[1]);
-                  dst[2] = util_format_srgb_to_linear_8unorm(dst[2]);
-               }
-            }
-         }
-         src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
-                                           src_row, src_stride,
-                                           width, height,
-                                           util_format_dxt1_rgb_fetch,
-                                           8, FALSE);
-}
-
-void
-util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
-                                           src_row, src_stride,
-                                           width, height,
-                                           util_format_dxt1_rgba_fetch,
-                                           8, FALSE);
-}
-
-void
-util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
-                                           src_row, src_stride,
-                                           width, height,
-                                           util_format_dxt3_rgba_fetch,
-                                           16, FALSE);
-}
-
-void
-util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
-                                           src_row, src_stride,
-                                           width, height,
-                                           util_format_dxt5_rgba_fetch,
-                                           16, FALSE);
-}
-
-static inline void
-util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height,
-                                       util_format_dxtn_fetch_t fetch,
-                                       unsigned block_size, boolean srgb)
-{
-   unsigned x, y, i, j;
-   for(y = 0; y < height; y += 4) {
-      const uint8_t *src = src_row;
-      for(x = 0; x < width; x += 4) {
-         for(j = 0; j < 4; ++j) {
-            for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
-               uint8_t tmp[4];
-               fetch(0, src, i, j, tmp);
-               if (srgb) {
-                  dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
-                  dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
-                  dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
-               }
-               else {
-                  dst[0] = ubyte_to_float(tmp[0]);
-                  dst[1] = ubyte_to_float(tmp[1]);
-                  dst[2] = ubyte_to_float(tmp[2]);
-               }
-               dst[3] = ubyte_to_float(tmp[3]);
-            }
-         }
-         src += block_size;
-      }
-      src_row += src_stride;
-   }
-}
-
-void
-util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-                                          src_row, src_stride,
-                                          width, height,
-                                          util_format_dxt1_rgb_fetch,
-                                          8, FALSE);
-}
-
-void
-util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-                                          src_row, src_stride,
-                                          width, height,
-                                          util_format_dxt1_rgba_fetch,
-                                          8, FALSE);
-}
-
-void
-util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-                                          src_row, src_stride,
-                                          width, height,
-                                          util_format_dxt3_rgba_fetch,
-                                          16, FALSE);
-}
-
-void
-util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-                                          src_row, src_stride,
-                                          width, height,
-                                          util_format_dxt5_rgba_fetch,
-                                          16, FALSE);
-}
-
-
-/*
- * Block compression.
- */
-
-static inline void
-util_format_dxtn_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                  const uint8_t *src, unsigned src_stride,
-                                  unsigned width, unsigned height,
-                                  enum util_format_dxtn format,
-                                  unsigned block_size, boolean srgb)
-{
-   const unsigned bw = 4, bh = 4, comps = 4;
-   unsigned x, y, i, j, k;
-   for(y = 0; y < height; y += bh) {
-      uint8_t *dst = dst_row;
-      for(x = 0; x < width; x += bw) {
-         uint8_t tmp[4][4][4];  /* [bh][bw][comps] */
-         for(j = 0; j < bh; ++j) {
-            for(i = 0; i < bw; ++i) {
-               uint8_t src_tmp;
-               for(k = 0; k < 3; ++k) {
-                  src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + k];
-                  if (srgb) {
-                     tmp[j][i][k] = util_format_linear_to_srgb_8unorm(src_tmp);
-                  }
-                  else {
-                     tmp[j][i][k] = src_tmp;
-                  }
-               }
-               /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
-               tmp[j][i][3] = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + 3];
-            }
-         }
-         /* even for dxt1_rgb have 4 src comps */
-         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
-         dst += block_size;
-      }
-      dst_row += dst_stride / sizeof(*dst_row);
-   }
-
-}
-
-void
-util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                      const uint8_t *src, unsigned src_stride,
-                                      unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
-                                     width, height, UTIL_FORMAT_DXT1_RGB,
-                                     8, FALSE);
-}
-
-void
-util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
-                                     width, height, UTIL_FORMAT_DXT1_RGBA,
-                                     8, FALSE);
-}
-
-void
-util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
-                                     width, height, UTIL_FORMAT_DXT3_RGBA,
-                                     16, FALSE);
-}
-
-void
-util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
-                                     width, height, UTIL_FORMAT_DXT5_RGBA,
-                                     16, FALSE);
-}
-
-static inline void
-util_format_dxtn_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                 const float *src, unsigned src_stride,
-                                 unsigned width, unsigned height,
-                                 enum util_format_dxtn format,
-                                 unsigned block_size, boolean srgb)
-{
-   unsigned x, y, i, j, k;
-   for(y = 0; y < height; y += 4) {
-      uint8_t *dst = dst_row;
-      for(x = 0; x < width; x += 4) {
-         uint8_t tmp[4][4][4];
-         for(j = 0; j < 4; ++j) {
-            for(i = 0; i < 4; ++i) {
-               float src_tmp;
-               for(k = 0; k < 3; ++k) {
-                  src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k];
-                  if (srgb) {
-                     tmp[j][i][k] = util_format_linear_float_to_srgb_8unorm(src_tmp);
-                  }
-                  else {
-                     tmp[j][i][k] = float_to_ubyte(src_tmp);
-                  }
-               }
-               /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
-               src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + 3];
-               tmp[j][i][3] = float_to_ubyte(src_tmp);
-            }
-         }
-         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
-         dst += block_size;
-      }
-      dst_row += 4*dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                     const float *src, unsigned src_stride,
-                                     unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
-                                    width, height, UTIL_FORMAT_DXT1_RGB,
-                                    8, FALSE);
-}
-
-void
-util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                      const float *src, unsigned src_stride,
-                                      unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
-                                    width, height, UTIL_FORMAT_DXT1_RGBA,
-                                    8, FALSE);
-}
-
-void
-util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                      const float *src, unsigned src_stride,
-                                      unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
-                                    width, height, UTIL_FORMAT_DXT3_RGBA,
-                                    16, FALSE);
-}
-
-void
-util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                      const float *src, unsigned src_stride,
-                                      unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
-                                    width, height, UTIL_FORMAT_DXT5_RGBA,
-                                    16, FALSE);
-}
-
-
-/*
- * SRGB variants.
- */
-
-void
-util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
-   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
-   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
-   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
-   dst[3] = 255;
-}
-
-void
-util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
-   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
-   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
-   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
-   dst[3] = tmp[3];
-}
-
-void
-util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
-   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
-   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
-   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
-   dst[3] = tmp[3];
-}
-
-void
-util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
-   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
-   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
-   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
-   dst[3] = tmp[3];
-}
-
-void
-util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
-   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
-   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
-   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
-   dst[3] = 1.0f;
-}
-
-void
-util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
-   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
-   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
-   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
-   dst[3] = ubyte_to_float(tmp[3]);
-}
-
-void
-util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
-   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
-   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
-   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
-   dst[3] = ubyte_to_float(tmp[3]);
-}
-
-void
-util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
-   uint8_t tmp[4];
-   util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
-   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
-   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
-   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
-   dst[3] = ubyte_to_float(tmp[3]);
-}
-
-void
-util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
-                                           src_row, src_stride,
-                                           width, height,
-                                           util_format_dxt1_rgb_fetch,
-                                           8, TRUE);
-}
-
-void
-util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
-                                           src_row, src_stride,
-                                           width, height,
-                                           util_format_dxt1_rgba_fetch,
-                                           8, TRUE);
-}
-
-void
-util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
-                                           src_row, src_stride,
-                                           width, height,
-                                           util_format_dxt3_rgba_fetch,
-                                           16, TRUE);
-}
-
-void
-util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
-                                           src_row, src_stride,
-                                           width, height,
-                                           util_format_dxt5_rgba_fetch,
-                                           16, TRUE);
-}
-
-void
-util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-                                          src_row, src_stride,
-                                          width, height,
-                                          util_format_dxt1_rgb_fetch,
-                                          8, TRUE);
-}
-
-void
-util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-                                          src_row, src_stride,
-                                          width, height,
-                                          util_format_dxt1_rgba_fetch,
-                                          8, TRUE);
-}
-
-void
-util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-                                          src_row, src_stride,
-                                          width, height,
-                                          util_format_dxt3_rgba_fetch,
-                                          16, TRUE);
-}
-
-void
-util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-                                          src_row, src_stride,
-                                          width, height,
-                                          util_format_dxt5_rgba_fetch,
-                                          16, TRUE);
-}
-
-void
-util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
-                                     width, height, UTIL_FORMAT_DXT1_RGB,
-                                     8, TRUE);
-}
-
-void
-util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
-                                     width, height, UTIL_FORMAT_DXT1_RGBA,
-                                     8, TRUE);
-}
-
-void
-util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
-                                     width, height, UTIL_FORMAT_DXT3_RGBA,
-                                     16, TRUE);
-}
-
-void
-util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
-                                     width, height, UTIL_FORMAT_DXT5_RGBA,
-                                     16, TRUE);
-}
-
-void
-util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
-                                    width, height, UTIL_FORMAT_DXT1_RGB,
-                                    8, TRUE);
-}
-
-void
-util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
-                                    width, height, UTIL_FORMAT_DXT1_RGBA,
-                                    8, TRUE);
-}
-
-void
-util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
-                                    width, height, UTIL_FORMAT_DXT3_RGBA,
-                                    16, TRUE);
-}
-
-void
-util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
-                                    width, height, UTIL_FORMAT_DXT5_RGBA,
-                                    16, TRUE);
-}
-
diff --git a/src/gallium/auxiliary/util/u_format_s3tc.h b/src/gallium/auxiliary/util/u_format_s3tc.h
deleted file mode 100644 (file)
index 6f188c6..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#ifndef U_FORMAT_S3TC_H_
-#define U_FORMAT_S3TC_H_
-
-
-#include "pipe/p_compiler.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum util_format_dxtn {
-  UTIL_FORMAT_DXT1_RGB = 0x83F0,
-  UTIL_FORMAT_DXT1_RGBA = 0x83F1,
-  UTIL_FORMAT_DXT3_RGBA = 0x83F2,
-  UTIL_FORMAT_DXT5_RGBA = 0x83F3
-};
-
-
-typedef void
-(*util_format_dxtn_fetch_t)( int src_stride,
-                             const uint8_t *src,
-                             int col, int row,
-                             uint8_t *dst );
-
-typedef void
-(*util_format_dxtn_pack_t)( int src_comps,
-                            int width, int height,
-                            const uint8_t *src,
-                            enum util_format_dxtn dst_format,
-                            uint8_t *dst,
-                            int dst_stride);
-
-extern util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch;
-extern util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch;
-extern util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch;
-extern util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch;
-
-extern util_format_dxtn_pack_t util_format_dxtn_pack;
-
-
-void
-util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-void
-util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* U_FORMAT_S3TC_H_ */
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
deleted file mode 100644 (file)
index 2bc82c3..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-from __future__ import print_function
-
-CopyRight = '''
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-'''
-
-
-import sys
-
-from u_format_parse import *
-import u_format_pack
-
-
-def layout_map(layout):
-    return 'UTIL_FORMAT_LAYOUT_' + str(layout).upper()
-
-
-def colorspace_map(colorspace):
-    return 'UTIL_FORMAT_COLORSPACE_' + str(colorspace).upper()
-
-
-colorspace_channels_map = {
-    'rgb': ['r', 'g', 'b', 'a'],
-    'srgb': ['sr', 'sg', 'sb', 'a'],
-    'zs': ['z', 's'],
-    'yuv': ['y', 'u', 'v'],
-}
-
-
-type_map = {
-    VOID:     "UTIL_FORMAT_TYPE_VOID",
-    UNSIGNED: "UTIL_FORMAT_TYPE_UNSIGNED",
-    SIGNED:   "UTIL_FORMAT_TYPE_SIGNED",
-    FIXED:    "UTIL_FORMAT_TYPE_FIXED",
-    FLOAT:    "UTIL_FORMAT_TYPE_FLOAT",
-}
-
-
-def bool_map(value):
-    if value:
-        return "TRUE"
-    else:
-        return "FALSE"
-
-
-swizzle_map = {
-    SWIZZLE_X:    "PIPE_SWIZZLE_X",
-    SWIZZLE_Y:    "PIPE_SWIZZLE_Y",
-    SWIZZLE_Z:    "PIPE_SWIZZLE_Z",
-    SWIZZLE_W:    "PIPE_SWIZZLE_W",
-    SWIZZLE_0:    "PIPE_SWIZZLE_0",
-    SWIZZLE_1:    "PIPE_SWIZZLE_1",
-    SWIZZLE_NONE: "PIPE_SWIZZLE_NONE",
-}
-
-
-def write_format_table(formats):
-    print('/* This file is autogenerated by u_format_table.py from u_format.csv. Do not edit directly. */')
-    print()
-    # This will print the copyright message on the top of this file
-    print(CopyRight.strip())
-    print()
-    print('#include "u_format.h"')
-    print('#include "u_format_bptc.h"')
-    print('#include "u_format_s3tc.h"')
-    print('#include "u_format_rgtc.h"')
-    print('#include "u_format_latc.h"')
-    print('#include "u_format_etc.h"')
-    print()
-    
-    u_format_pack.generate(formats)
-    
-    def do_channel_array(channels, swizzles):
-        print("   {")
-        for i in range(4):
-            channel = channels[i]
-            if i < 3:
-                sep = ","
-            else:
-                sep = ""
-            if channel.size:
-                print("      {%s, %s, %s, %u, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), channel.size, channel.shift, sep, "xyzw"[i], channel.name))
-            else:
-                print("      {0, 0, 0, 0, 0}%s" % (sep,))
-        print("   },")
-
-    def do_swizzle_array(channels, swizzles):
-        print("   {")
-        for i in range(4):
-            swizzle = swizzles[i]
-            if i < 3:
-                sep = ","
-            else:
-                sep = ""
-            try:
-                comment = colorspace_channels_map[format.colorspace][i]
-            except (KeyError, IndexError):
-                comment = 'ignored'
-            print("      %s%s\t/* %s */" % (swizzle_map[swizzle], sep, comment))
-        print("   },")
-
-    for format in formats:
-        print('const struct util_format_description')
-        print('util_format_%s_description = {' % (format.short_name(),))
-        print("   %s," % (format.name,))
-        print("   \"%s\"," % (format.name,))
-        print("   \"%s\"," % (format.short_name(),))
-        print("   {%u, %u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_depth, format.block_size()))
-        print("   %s," % (layout_map(format.layout),))
-        print("   %u,\t/* nr_channels */" % (format.nr_channels(),))
-        print("   %s,\t/* is_array */" % (bool_map(format.is_array()),))
-        print("   %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),))
-        print("   %s,\t/* is_mixed */" % (bool_map(format.is_mixed()),))
-        print("   %s,\t/* is_unorm */" % (bool_map(format.is_unorm()),))
-        print("   %s,\t/* is_snorm */" % (bool_map(format.is_snorm()),))
-        u_format_pack.print_channels(format, do_channel_array)
-        u_format_pack.print_channels(format, do_swizzle_array)
-        print("   %s," % (colorspace_map(format.colorspace),))
-        access = True
-        if format.layout in ('astc', 'atc', 'fxt1'):
-            access = False
-        if format.layout == 'etc' and format.short_name() != 'etc1_rgb8':
-            access = False
-        if format.colorspace != ZS and not format.is_pure_color() and access:
-            print("   &util_format_%s_unpack_rgba_8unorm," % format.short_name())
-            print("   &util_format_%s_pack_rgba_8unorm," % format.short_name())
-            if format.layout == 's3tc' or format.layout == 'rgtc':
-                print("   &util_format_%s_fetch_rgba_8unorm," % format.short_name())
-            else:
-                print("   NULL, /* fetch_rgba_8unorm */")
-            print("   &util_format_%s_unpack_rgba_float," % format.short_name())
-            print("   &util_format_%s_pack_rgba_float," % format.short_name())
-            print("   &util_format_%s_fetch_rgba_float," % format.short_name())
-        else:
-            print("   NULL, /* unpack_rgba_8unorm */")
-            print("   NULL, /* pack_rgba_8unorm */")
-            print("   NULL, /* fetch_rgba_8unorm */")
-            print("   NULL, /* unpack_rgba_float */")
-            print("   NULL, /* pack_rgba_float */")
-            print("   NULL, /* fetch_rgba_float */")
-        if format.has_depth():
-            print("   &util_format_%s_unpack_z_32unorm," % format.short_name())
-            print("   &util_format_%s_pack_z_32unorm," % format.short_name())
-            print("   &util_format_%s_unpack_z_float," % format.short_name())
-            print("   &util_format_%s_pack_z_float," % format.short_name())
-        else:
-            print("   NULL, /* unpack_z_32unorm */")
-            print("   NULL, /* pack_z_32unorm */")
-            print("   NULL, /* unpack_z_float */")
-            print("   NULL, /* pack_z_float */")
-        if format.has_stencil():
-            print("   &util_format_%s_unpack_s_8uint," % format.short_name())
-            print("   &util_format_%s_pack_s_8uint," % format.short_name())
-        else:
-            print("   NULL, /* unpack_s_8uint */")
-            print("   NULL, /* pack_s_8uint */")
-        if format.is_pure_unsigned():
-            print("   &util_format_%s_unpack_unsigned, /* unpack_rgba_uint */" % format.short_name())
-            print("   &util_format_%s_pack_unsigned, /* pack_rgba_uint */" % format.short_name())
-            print("   &util_format_%s_unpack_signed, /* unpack_rgba_sint */" % format.short_name())
-            print("   &util_format_%s_pack_signed,  /* pack_rgba_sint */" % format.short_name())
-            print("   &util_format_%s_fetch_unsigned,  /* fetch_rgba_uint */" % format.short_name())
-            print("   NULL  /* fetch_rgba_sint */")
-        elif format.is_pure_signed():
-            print("   &util_format_%s_unpack_unsigned, /* unpack_rgba_uint */" % format.short_name())
-            print("   &util_format_%s_pack_unsigned, /* pack_rgba_uint */" % format.short_name())
-            print("   &util_format_%s_unpack_signed, /* unpack_rgba_sint */" % format.short_name())
-            print("   &util_format_%s_pack_signed,  /* pack_rgba_sint */" % format.short_name())
-            print("   NULL,  /* fetch_rgba_uint */")
-            print("   &util_format_%s_fetch_signed  /* fetch_rgba_sint */" % format.short_name())
-        else:
-            print("   NULL, /* unpack_rgba_uint */")
-            print("   NULL, /* pack_rgba_uint */")
-            print("   NULL, /* unpack_rgba_sint */")
-            print("   NULL, /* pack_rgba_sint */")
-            print("   NULL, /* fetch_rgba_uint */")
-            print("   NULL  /* fetch_rgba_sint */")
-        print("};")
-        print()
-        
-    print("const struct util_format_description *")
-    print("util_format_description(enum pipe_format format)")
-    print("{")
-    print("   if (format >= PIPE_FORMAT_COUNT) {")
-    print("      return NULL;")
-    print("   }")
-    print()
-    print("   switch (format) {")
-    for format in formats:
-        print("   case %s:" % format.name)
-        print("      return &util_format_%s_description;" % (format.short_name(),))
-    print("   default:")
-    print("      return NULL;")
-    print("   }")
-    print("}")
-    print()
-
-
-def main():
-
-    formats = []
-    for arg in sys.argv[1:]:
-        formats.extend(parse(arg))
-    write_format_table(formats)
-
-
-if __name__ == '__main__':
-    main()
diff --git a/src/gallium/auxiliary/util/u_format_tests.c b/src/gallium/auxiliary/util/u_format_tests.c
deleted file mode 100644 (file)
index 94bea23..0000000
+++ /dev/null
@@ -1,1034 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009-2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include <math.h>
-#include <float.h>
-
-#include "pipe/p_config.h"
-#include "util/u_memory.h"
-#include "u_format_tests.h"
-
-
-/*
- * Helper macros to create the packed bytes for longer words.
- */
-
-#define PACKED_1x8(x)          {x, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_2x8(x, y)       {x, y, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_3x8(x, y, z)    {x, y, z, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_4x8(x, y, z, w) {x, y, z, w, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_8x8(a, b, c, d, e, f, g, h) {a, b, c, d, e, f, g, h, 0, 0, 0, 0, 0, 0, 0, 0}
-
-#define PACKED_1x16(x)          {(x) & 0xff, (x) >> 8,          0,        0,          0,        0,          0,        0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_2x16(x, y)       {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8,          0,        0,          0,        0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_3x16(x, y, z)    {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8,          0,        0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_4x16(x, y, z, w) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, (w) & 0xff, (w) >> 8, 0, 0, 0, 0, 0, 0, 0, 0}
-
-#define PACKED_1x32(x)          {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24,          0,                 0,                  0,         0,          0,                 0,                  0,         0,          0,                 0,                  0,         0}
-#define PACKED_2x32(x, y)       {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24,          0,                 0,                  0,         0,          0,                 0,                  0,         0}
-#define PACKED_3x32(x, y, z)    {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24,          0,                 0,                  0,         0}
-#define PACKED_4x32(x, y, z, w) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, (w) & 0xff, ((w) >> 8) & 0xff, ((w) >> 16) & 0xff, (w) >> 24}
-
-#define UNPACKED_1x1(r, g, b, a) \
-      {{{r, g, b, a}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
-       {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
-       {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
-       {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}}
-
-#define UNPACKED_2x1(r0, g0, b0, a0, r1, g1, b1, a1) \
-      {{{r0, g0, b0, a0}, {r1, g1, b1, a1}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
-       {{ 0,  0,  0,  0}, { 0,  0,  0,  0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
-       {{ 0,  0,  0,  0}, { 0,  0,  0,  0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
-       {{ 0,  0,  0,  0}, { 0,  0,  0,  0}, {0, 0, 0, 0}, {0, 0, 0, 0}}}
-
-
-/**
- * Test cases.
- *
- * These were manually entered. We could generate these
- *
- * To keep this to a we cover only the corner cases, which should produce
- * good enough coverage since that pixel format transformations are afine for
- * non SRGB formats.
- */
-const struct util_format_test_case
-util_format_test_cases[] =
-{
-
-   /*
-    * 32-bit rendertarget formats
-    */
-
-   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3fffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   /*
-    * 16-bit rendertarget formats
-    */
-
-   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x03e0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x7c00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x7fff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x03e0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0x003e), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0x07c0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0xf800), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0xfffe), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x003e), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x07c0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf800), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0001), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x000f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x00f0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x0f00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x0fff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00f0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0f00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x07e0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf800), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   /*
-    * Luminance/intensity/alpha formats
-    */
-
-   {PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x0f), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
-   {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xf0), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00ff), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
-   {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xff00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   /*
-    * SRGB formats
-    */
-
-   {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xbc), UNPACKED_1x1(0.502886458033, 0.502886458033, 0.502886458033, 1.0)},
-   {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xbc), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0x00bc), UNPACKED_1x1(0.502886458033, 0.502886458033, 0.502886458033, 0.0)},
-   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0x00ff), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
-   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0xcc00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
-   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0xff00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xbc, 0x00, 0x00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xbc, 0x00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xbc), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xbc, 0x00, 0x00, 0x00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xbc, 0x00, 0x00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xbc, 0x00), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xcc), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
-   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000bc), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xcc000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
-   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000bc), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000cc), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
-   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000cc), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
-   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   /*
-    * Mixed-signed formats
-    */
-
-   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x81, 0x00, 0x00, 0x00), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x81, 0x00, 0x00), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1( 0.0,  0.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0, 0.0)},
-   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000001ff), UNPACKED_1x1( 1.0,  0.0,  0.0, 0.0)},
-   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000201), UNPACKED_1x1(-1.0,  0.0,  0.0, 0.0)},
-   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0007fc00), UNPACKED_1x1( 0.0,  1.0,  0.0, 0.0)},
-   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00080400), UNPACKED_1x1( 0.0, -1.0,  0.0, 0.0)},
-   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x1ff00000), UNPACKED_1x1( 0.0,  0.0,  1.0, 0.0)},
-   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x20100000), UNPACKED_1x1( 0.0,  0.0, -1.0, 0.0)},
-   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), UNPACKED_1x1( 0.0,  0.0,  0.0, 1.0)},
-
-   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0011), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x01e0), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0220), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1( 0.0,  0.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0,  0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x81, 0x00), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x81), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
-
-   /*
-    * Depth-stencil formats
-    */
-
-   {PIPE_FORMAT_S8_UINT, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0,   0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_S8_UINT, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(0.0, 255.0, 0.0, 0.0)},
-
-   {PIPE_FORMAT_Z16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_Z16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-
-   {PIPE_FORMAT_Z32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_Z32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-
-   {PIPE_FORMAT_Z32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_Z32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x3f800000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-
-   {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0,   0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ffffff), UNPACKED_1x1(1.0,   0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 255.0, 0.0, 0.0)},
-   {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 255.0, 0.0, 0.0)},
-
-   {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0,   0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffff00), UNPACKED_1x1(1.0,   0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 255.0, 0.0, 0.0)},
-   {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 255.0, 0.0, 0.0)},
-
-   {PIPE_FORMAT_Z24X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_Z24X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-
-   {PIPE_FORMAT_X8Z24_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_X8Z24_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-
-   {PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, PACKED_2x32(0xffffffff, 0x000000ff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0,   0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, PACKED_2x32(0xffffffff, 0x000000ff), PACKED_2x32(0x3f800000, 0x00000000), UNPACKED_1x1( 1.0,   0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, PACKED_2x32(0xffffffff, 0x000000ff), PACKED_2x32(0x00000000, 0x000000ff), UNPACKED_1x1( 0.0, 255.0, 0.0, 0.0)},
-
-   /*
-    * YUV formats
-    */
-
-   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_2x1(1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_2x1(0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_2x1(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_2x1(1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_2x1(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
-
-   /*
-    * TODO: Exercise the UV channels as well.
-    */
-   {PIPE_FORMAT_UYVY, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x10, 0x80, 0x10), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_UYVY, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0xeb, 0x80, 0x10), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_UYVY, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x10, 0x80, 0xeb), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_YUYV, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x10, 0x80, 0x10, 0x80), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_YUYV, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xeb, 0x80, 0x10, 0x80), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_YUYV, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x10, 0x80, 0xeb, 0x80), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
-
-   /*
-    * Compressed formats
-    */
-
-   {
-      PIPE_FORMAT_DXT1_RGB,
-      PACKED_8x8(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
-      PACKED_8x8(0xf2, 0xd7, 0xb0, 0x20, 0xae, 0x2c, 0x6f, 0x97),
-      {
-         {
-            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
-            {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
-            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
-            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0}
-         },
-         {
-            {0xd6/255.0, 0xff/255.0, 0x94/255.0, 0xff/255.0},
-            {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
-            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
-            {0xd6/255.0, 0xff/255.0, 0x94/255.0, 0xff/255.0}
-         },
-         {
-            {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
-            {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
-            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
-            {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0}
-         },
-         {
-            {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
-            {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0},
-            {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0},
-            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0}
-         }
-      }
-   },
-   {
-      PIPE_FORMAT_DXT1_RGBA,
-      PACKED_8x8(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
-      PACKED_8x8(0xff, 0x2f, 0xa4, 0x72, 0xeb, 0xb2, 0xbd, 0xbe),
-      {
-         {
-            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
-            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
-            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
-            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0}
-         },
-         {
-            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
-            {0x29/255.0, 0xff/255.0, 0xff/255.0, 0xff/255.0},
-            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
-            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
-         },
-         {
-            {0x73/255.0, 0x55/255.0, 0x21/255.0, 0xff/255.0},
-            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
-            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
-            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
-         },
-         {
-            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
-            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
-            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
-            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
-         }
-      }
-   },
-   {
-      PIPE_FORMAT_DXT3_RGBA,
-      {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
-      {0xe7, 0x4a, 0x8f, 0x96, 0x5b, 0xc1, 0x1c, 0x84, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a},
-      {
-         {
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x77/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xee/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xaa/255.0},
-            {0x8c/255.0, 0xff/255.0, 0xb5/255.0, 0x44/255.0}
-         },
-         {
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xff/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x88/255.0},
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x66/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x99/255.0}
-         },
-         {
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0xbb/255.0},
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x55/255.0},
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x11/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xcc/255.0}
-         },
-         {
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xcc/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x11/255.0},
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x44/255.0},
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x88/255.0}
-         }
-      }
-   },
-   {
-      PIPE_FORMAT_DXT5_RGBA,
-      {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
-      {0xf8, 0x11, 0xc5, 0x0c, 0x9a, 0x73, 0xb4, 0x9c, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a},
-      {
-         {
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x74/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xf8/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xb6/255.0},
-            {0x8c/255.0, 0xff/255.0, 0xb5/255.0, 0x53/255.0}
-         },
-         {
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xf8/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x95/255.0},
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x53/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x95/255.0}
-         },
-         {
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0xb6/255.0},
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x53/255.0},
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x11/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xd7/255.0}
-         },
-         {
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xb6/255.0},
-            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x11/255.0},
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x32/255.0},
-            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x95/255.0}
-         }
-      }
-   },
-
-
-   /*
-    * Standard 8-bit integer formats
-    */
-
-   {PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(  0.0,   0.0,   0.0, 1.0)},
-   {PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(255.0,   0.0,   0.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1(  0.0,   0.0,   0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), UNPACKED_1x1(255.0,   0.0,   0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), UNPACKED_1x1(  0.0, 255.0,   0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), UNPACKED_1x1(255.0, 255.0,   0.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(  0.0,   0.0,   0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(255.0,   0.0,   0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1(  0.0, 255.0,   0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1(  0.0,   0.0, 255.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(255.0, 255.0, 255.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(  0.0,   0.0,   0.0,   0.0)},
-   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(255.0,   0.0,   0.0,   0.0)},
-   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1(  0.0, 255.0,   0.0,   0.0)},
-   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1(  0.0,   0.0, 255.0,   0.0)},
-   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1(  0.0,   0.0,   0.0, 255.0)},
-   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(255.0, 255.0, 255.0, 255.0)},
-
-   {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x7f), UNPACKED_1x1( 1.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x81), UNPACKED_1x1(-1.0,  0.0,  0.0,  1.0)},
-
-   {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 1.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x81, 0x00), UNPACKED_1x1(-1.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1( 0.0,  1.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x81), UNPACKED_1x1( 0.0, -1.0,  0.0,  1.0)},
-
-   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), UNPACKED_1x1( 1.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x81, 0x00, 0x00), UNPACKED_1x1(-1.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0,  1.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x81, 0x00), UNPACKED_1x1( 0.0, -1.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0,  0.0,  1.0,  1.0)},
-   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x81), UNPACKED_1x1( 0.0,  0.0, -1.0,  1.0)},
-
-   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 1.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x81, 0x00, 0x00, 0x00), UNPACKED_1x1(-1.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1( 0.0,  1.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x81, 0x00, 0x00), UNPACKED_1x1( 0.0, -1.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0,  0.0,  1.0,  0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x81, 0x00), UNPACKED_1x1( 0.0,  0.0, -1.0,  0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x81), UNPACKED_1x1( 0.0,  0.0,  0.0, -1.0)},
-
-   {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(   0.0,    0.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x7f), UNPACKED_1x1( 127.0,    0.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x80), UNPACKED_1x1(-128.0,    0.0,    0.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1(   0.0,    0.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 127.0,    0.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x80, 0x00), UNPACKED_1x1(-128.0,    0.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1(   0.0,  127.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x80), UNPACKED_1x1(   0.0, -128.0,    0.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(   0.0,    0.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), UNPACKED_1x1( 127.0,    0.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x80, 0x00, 0x00), UNPACKED_1x1(-128.0,    0.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), UNPACKED_1x1(   0.0,  127.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x80, 0x00), UNPACKED_1x1(   0.0, -128.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), UNPACKED_1x1(   0.0,    0.0,  127.0, 1.0)},
-   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x80), UNPACKED_1x1(   0.0,    0.0, -128.0, 1.0)},
-
-   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(   0.0,    0.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 127.0,    0.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x00, 0x00, 0x00), UNPACKED_1x1(-128.0,    0.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1(   0.0,  127.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x80, 0x00, 0x00), UNPACKED_1x1(   0.0, -128.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), UNPACKED_1x1(   0.0,    0.0,  127.0,    0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x80, 0x00), UNPACKED_1x1(   0.0,    0.0, -128.0,    0.0)},
-   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), UNPACKED_1x1(   0.0,    0.0,    0.0,  127.0)},
-   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x80), UNPACKED_1x1(   0.0,    0.0,    0.0, -128.0)},
-
-   /*
-    * Standard 16-bit integer formats
-    */
-
-   {PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(    0.0,     0.0,     0.0,   1.0)},
-   {PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(65535.0,     0.0,     0.0,   1.0)},
-
-   {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1(    0.0,     0.0,     0.0,   1.0)},
-   {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), UNPACKED_1x1(65535.0,     0.0,     0.0,   1.0)},
-   {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), UNPACKED_1x1(    0.0, 65535.0,     0.0,   1.0)},
-   {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0,     0.0,   1.0)},
-
-   {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1(    0.0,     0.0,     0.0,   1.0)},
-   {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), UNPACKED_1x1(65535.0,     0.0,     0.0,   1.0)},
-   {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), UNPACKED_1x1(    0.0, 65535.0,     0.0,   1.0)},
-   {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), UNPACKED_1x1(    0.0,     0.0, 65535.0,   1.0)},
-   {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0, 65535.0,   1.0)},
-
-   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(    0.0,     0.0,     0.0,     0.0)},
-   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(65535.0,     0.0,     0.0,     0.0)},
-   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), UNPACKED_1x1(    0.0, 65535.0,     0.0,     0.0)},
-   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), UNPACKED_1x1(    0.0,     0.0, 65535.0,     0.0)},
-   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), UNPACKED_1x1(    0.0,     0.0,     0.0, 65535.0)},
-   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0, 65535.0, 65535.0)},
-
-   {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8001), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
-
-   {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8001, 0x0000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), UNPACKED_1x1(   0.0,    1.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8001), UNPACKED_1x1(   0.0,   -1.0,    0.0,    1.0)},
-
-   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8001, 0x0000, 0x0000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), UNPACKED_1x1(   0.0,    1.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8001, 0x0000), UNPACKED_1x1(   0.0,   -1.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), UNPACKED_1x1(   0.0,    0.0,    1.0,    1.0)},
-   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8001), UNPACKED_1x1(   0.0,    0.0,   -1.0,    1.0)},
-
-   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(   0.0,    0.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(   1.0,    0.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8001, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), UNPACKED_1x1(   0.0,    1.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8001, 0x0000, 0x0000), UNPACKED_1x1(   0.0,   -1.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), UNPACKED_1x1(   0.0,    0.0,    1.0,    0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8001, 0x0000), UNPACKED_1x1(   0.0,    0.0,   -1.0,    0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8001), UNPACKED_1x1(   0.0,    0.0,    0.0,   -1.0)},
-
-   {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(     0.0,      0.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1( 32767.0,      0.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x8000), UNPACKED_1x1(-32768.0,      0.0,      0.0,   1.0)},
-
-   {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1(     0.0,      0.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), UNPACKED_1x1( 32767.0,      0.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8000, 0x0000), UNPACKED_1x1(-32768.0,      0.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), UNPACKED_1x1(     0.0,  32767.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8000), UNPACKED_1x1(     0.0, -32768.0,      0.0,   1.0)},
-
-   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1(     0.0,      0.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), UNPACKED_1x1( 32767.0,      0.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8000, 0x0000, 0x0000), UNPACKED_1x1(-32768.0,      0.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), UNPACKED_1x1(     0.0,  32767.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8000, 0x0000), UNPACKED_1x1(     0.0, -32768.0,      0.0,   1.0)},
-   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), UNPACKED_1x1(     0.0,      0.0,  32767.0,   1.0)},
-   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8000), UNPACKED_1x1(     0.0,      0.0, -32768.0,   1.0)},
-
-   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(     0.0,      0.0,      0.0,      0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 32767.0,      0.0,      0.0,      0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(-32768.0,      0.0,      0.0,      0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), UNPACKED_1x1(     0.0,  32767.0,      0.0,      0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8000, 0x0000, 0x0000), UNPACKED_1x1(     0.0, -32768.0,      0.0,      0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), UNPACKED_1x1(     0.0,      0.0,  32767.0,      0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8000, 0x0000), UNPACKED_1x1(     0.0,      0.0, -32768.0,      0.0)},
-   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), UNPACKED_1x1(     0.0,      0.0,      0.0,  32767.0)},
-   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8000), UNPACKED_1x1(     0.0,      0.0,      0.0, -32768.0)},
-
-   /*
-    * Standard 32-bit integer formats
-    *
-    * NOTE: We can't accurately represent integers larger than +/-0x1000000
-    * with single precision floats, so that's as far as we test.
-    */
-
-   {PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0x00000000, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xffffffff, 0x00000000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xffffffff, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
-   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xffffffff, 0x00000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
-   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
-   {PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(       0.0,        0.0,        0.0,   1.0)},
-   {PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), UNPACKED_1x1(16777216.0,        0.0,        0.0,   1.0)},
-
-   {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1(       0.0,        0.0,        0.0,   1.0)},
-   {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), UNPACKED_1x1(16777216.0,        0.0,        0.0,   1.0)},
-   {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), UNPACKED_1x1(       0.0, 16777216.0,        0.0,   1.0)},
-   {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0,        0.0,   1.0)},
-
-   {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(       0.0,        0.0,        0.0,   1.0)},
-   {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1(16777216.0,        0.0,        0.0,   1.0)},
-   {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1(       0.0, 16777216.0,        0.0,   1.0)},
-   {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1(       0.0,        0.0, 16777216.0,   1.0)},
-   {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0, 16777216.0,   1.0)},
-
-   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(       0.0,        0.0,        0.0,        0.0)},
-   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(16777216.0,        0.0,        0.0,        0.0)},
-   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1(       0.0, 16777216.0,        0.0,        0.0)},
-   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1(       0.0,        0.0, 16777216.0,        0.0)},
-   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1(       0.0,        0.0,        0.0, 16777216.0)},
-   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x01000000, 0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0, 16777216.0, 16777216.0)},
-
-   {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x7fffffff), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x80000001), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
-
-   {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x7fffffff, 0x00000000), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x80000001, 0x00000000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x7fffffff), UNPACKED_1x1(   0.0,    1.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x80000001), UNPACKED_1x1(   0.0,   -1.0,    0.0,    1.0)},
-
-   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x7fffffff, 0x00000000, 0x00000000), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x80000001, 0x00000000, 0x00000000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x7fffffff, 0x00000000), UNPACKED_1x1(   0.0,    1.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x80000001, 0x00000000), UNPACKED_1x1(   0.0,   -1.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x7fffffff), UNPACKED_1x1(   0.0,    0.0,    1.0,    1.0)},
-   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x80000001), UNPACKED_1x1(   0.0,    0.0,   -1.0,    1.0)},
-
-   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(   0.0,    0.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x7fffffff, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(   1.0,    0.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x80000001, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x7fffffff, 0x00000000, 0x00000000), UNPACKED_1x1(   0.0,    1.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x80000001, 0x00000000, 0x00000000), UNPACKED_1x1(   0.0,   -1.0,    0.0,    0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x7fffffff, 0x00000000), UNPACKED_1x1(   0.0,    0.0,    1.0,    0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x80000001, 0x00000000), UNPACKED_1x1(   0.0,    0.0,   -1.0,    0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x7fffffff), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
-   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x80000001), UNPACKED_1x1(   0.0,    0.0,    0.0,   -1.0)},
-
-   {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(        0.0,         0.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), UNPACKED_1x1( 16777216.0,         0.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(-16777216.0,         0.0,         0.0,   1.0)},
-
-   {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1(        0.0,         0.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), UNPACKED_1x1( 16777216.0,         0.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xff000000, 0x00000000), UNPACKED_1x1(-16777216.0,         0.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), UNPACKED_1x1(        0.0,  16777216.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xff000000), UNPACKED_1x1(        0.0, -16777216.0,         0.0,   1.0)},
-
-   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(        0.0,         0.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1( 16777216.0,         0.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xff000000, 0x00000000, 0x00000000), UNPACKED_1x1(-16777216.0,         0.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1(        0.0,  16777216.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xff000000, 0x00000000), UNPACKED_1x1(        0.0, -16777216.0,         0.0,   1.0)},
-   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1(        0.0,         0.0,  16777216.0,   1.0)},
-   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xff000000), UNPACKED_1x1(        0.0,         0.0, -16777216.0,   1.0)},
-
-   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(        0.0,         0.0,         0.0,         0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 16777216.0,         0.0,         0.0,         0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xff000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-16777216.0,         0.0,         0.0,         0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1(        0.0,  16777216.0,         0.0,         0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xff000000, 0x00000000, 0x00000000), UNPACKED_1x1(        0.0, -16777216.0,         0.0,         0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1(        0.0,         0.0,  16777216.0,         0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xff000000, 0x00000000), UNPACKED_1x1(        0.0,         0.0, -16777216.0,         0.0)},
-   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1(        0.0,         0.0,         0.0,  16777216.0)},
-   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xff000000), UNPACKED_1x1(        0.0,         0.0,         0.0, -16777216.0)},
-
-   /*
-    * Standard 32-bit float formats
-    */
-
-   {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(  0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x3f800000), UNPACKED_1x1(  1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0xbf800000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x00000000), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xbf800000, 0x00000000), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x3f800000), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xbf800000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0,  1.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xbf800000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x3f800000, 0x00000000), UNPACKED_1x1( 0.0,  1.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xbf800000, 0x00000000), UNPACKED_1x1( 0.0, -1.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x3f800000), UNPACKED_1x1( 0.0,  0.0,  1.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xbf800000), UNPACKED_1x1( 0.0,  0.0, -1.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0,  1.0,  1.0, 1.0)},
-
-   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xbf800000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x3f800000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  1.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xbf800000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -1.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x3f800000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  1.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xbf800000, 0x00000000), UNPACKED_1x1( 0.0,  0.0, -1.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x3f800000), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xbf800000), UNPACKED_1x1( 0.0,  0.0,  0.0, -1.0)},
-   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0,  1.0,  1.0,  1.0)},
-
-   /*
-    * Half float formats
-    */
-
-   /* Minimum positive normal */
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x0400), UNPACKED_1x1( 6.10352E-5, 0.0, 0.0, 1.0)},
-
-   /* XXX: Now that we disable denormals this test cases fails, except on
-    * IvyBridge processors which have intrinsics dedicated to half-float
-    * packing/unpacking. */
-#if 0
-   /* Max denormal */
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x03FF), UNPACKED_1x1( 6.09756E-5, 0.0, 0.0, 1.0)},
-#endif
-
-   /* Minimum positive denormal */
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x0001), UNPACKED_1x1( 5.96046E-8, 0.0, 0.0, 1.0)},
-
-   /* Min representable value */
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfbff), UNPACKED_1x1(   -65504.0, 0.0, 0.0, 1.0)},
-
-   /* Max representable value */
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7bff), UNPACKED_1x1(    65504.0, 0.0, 0.0, 1.0)},
-
-#if !defined(PIPE_CC_MSVC)
-
-   /* NaNs */
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c01), UNPACKED_1x1(        NAN, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc01), UNPACKED_1x1(       -NAN, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1(        NAN, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(       -NAN, 0.0, 0.0, 1.0)},
-
-   /* Inf */
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1(        INFINITY, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1(       -INFINITY, 0.0, 0.0, 1.0)},
-
-#endif
-
-   /* Zero, ignore sign */
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0x7fff), PACKED_1x16(0x8000), UNPACKED_1x1( -0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0x7fff), PACKED_1x16(0x0000), UNPACKED_1x1(  0.0, 0.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x3c00), UNPACKED_1x1(  1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xbc00), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1( 0.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x3c00, 0x0000), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xbc00, 0x0000), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x3c00), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xbc00), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x3c00, 0x3c00), UNPACKED_1x1( 1.0,  1.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x3c00, 0x0000, 0x0000), UNPACKED_1x1( 1.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xbc00, 0x0000, 0x0000), UNPACKED_1x1(-1.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x3c00, 0x0000), UNPACKED_1x1( 0.0,  1.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xbc00, 0x0000), UNPACKED_1x1( 0.0, -1.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x3c00), UNPACKED_1x1( 0.0,  0.0,  1.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xbc00), UNPACKED_1x1( 0.0,  0.0, -1.0, 1.0)},
-   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x3c00, 0x3c00, 0x3c00), UNPACKED_1x1( 1.0,  1.0,  1.0, 1.0)},
-
-   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x3c00, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 1.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xbc00, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(-1.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x3c00, 0x0000, 0x0000), UNPACKED_1x1( 0.0,  1.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xbc00, 0x0000, 0x0000), UNPACKED_1x1( 0.0, -1.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x3c00, 0x0000), UNPACKED_1x1( 0.0,  0.0,  1.0,  0.0)},
-   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xbc00, 0x0000), UNPACKED_1x1( 0.0,  0.0, -1.0,  0.0)},
-   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x3c00), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xbc00), UNPACKED_1x1( 0.0,  0.0,  0.0, -1.0)},
-   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x3c00, 0x3c00, 0x3c00, 0x3c00), UNPACKED_1x1( 1.0,  1.0,  1.0,  1.0)},
-
-   /*
-    * 32-bit fixed point formats
-    */
-
-   {PIPE_FORMAT_R32_FIXED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(  0.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32_FIXED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00010000), UNPACKED_1x1(  1.0, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32_FIXED, PACKED_1x32(0xffffffff), PACKED_1x32(0xffff0000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00010000, 0x00000000), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffff0000, 0x00000000), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00010000), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xffff0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00010000, 0x00010000), UNPACKED_1x1( 1.0,  1.0, 0.0, 1.0)},
-
-   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00010000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffff0000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00010000, 0x00000000), UNPACKED_1x1( 0.0,  1.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xffff0000, 0x00000000), UNPACKED_1x1( 0.0, -1.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00010000), UNPACKED_1x1( 0.0,  0.0,  1.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xffff0000), UNPACKED_1x1( 0.0,  0.0, -1.0, 1.0)},
-   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00010000, 0x00010000, 0x00010000), UNPACKED_1x1( 1.0,  1.0,  1.0, 1.0)},
-
-   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00010000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffff0000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0,  0.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00010000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  1.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xffff0000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -1.0,  0.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00010000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  1.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xffff0000, 0x00000000), UNPACKED_1x1( 0.0,  0.0, -1.0,  0.0)},
-   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00010000), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
-   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xffff0000), UNPACKED_1x1( 0.0,  0.0,  0.0, -1.0)},
-   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00010000, 0x00010000, 0x00010000, 0x00010000), UNPACKED_1x1( 1.0,  1.0,  1.0,  1.0)},
-
-   /*
-    * D3D9 specific vertex formats
-    */
-
-   {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(   0.0,    0.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(1023.0,    0.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(   0.0, 1023.0,    0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(   0.0,    0.0, 1023.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3fffffff), UNPACKED_1x1(1023.0, 1023.0, 1023.0, 1.0)},
-
-   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000001ff), UNPACKED_1x1( 1.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000201), UNPACKED_1x1(-1.0,  0.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x0007fc00), UNPACKED_1x1( 0.0,  1.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00080400), UNPACKED_1x1( 0.0, -1.0,  0.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x1ff00000), UNPACKED_1x1( 0.0,  0.0,  1.0, 1.0)},
-   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x20100000), UNPACKED_1x1( 0.0,  0.0, -1.0, 1.0)},
-
-   /*
-    * Special formats that not fit anywhere else
-    */
-
-};
-
-
-const unsigned util_format_nr_test_cases = ARRAY_SIZE(util_format_test_cases);
diff --git a/src/gallium/auxiliary/util/u_format_tests.h b/src/gallium/auxiliary/util/u_format_tests.h
deleted file mode 100644 (file)
index d5f0b34..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#ifndef U_FORMAT_TESTS_H_
-#define U_FORMAT_TESTS_H_
-
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_format.h"
-
-
-#define UTIL_FORMAT_MAX_PACKED_BYTES 32  // R64G64B64A64_FLOAT
-#define UTIL_FORMAT_MAX_UNPACKED_WIDTH 12  // ASTC 12x12
-#define UTIL_FORMAT_MAX_UNPACKED_HEIGHT 12
-
-
-/**
- * A (packed, unpacked) color pair.
- */
-struct util_format_test_case
-{
-   enum pipe_format format;
-
-   /**
-    * Mask of the bits that actually meaningful data. Used to mask out the
-    * "X" channels.
-    */
-   uint8_t mask[UTIL_FORMAT_MAX_PACKED_BYTES];
-
-   uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
-
-   /**
-    * RGBA.
-    */
-   double unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4];
-};
-
-
-extern const struct util_format_test_case
-util_format_test_cases[];
-
-
-extern const unsigned util_format_nr_test_cases;
-
-
-#endif /* U_FORMAT_TESTS_H_ */
diff --git a/src/gallium/auxiliary/util/u_format_yuv.c b/src/gallium/auxiliary/util/u_format_yuv.c
deleted file mode 100644 (file)
index e4e66fb..0000000
+++ /dev/null
@@ -1,1130 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-/**
- * @file
- * YUV and RGB subsampled formats conversion.
- *
- * @author Jose Fonseca <jfonseca@vmware.com>
- */
-
-
-#include "util/u_debug.h"
-#include "util/u_format_yuv.h"
-
-
-void
-util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      float *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      uint32_t value;
-      float r, g0, g1, b;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         value = util_cpu_to_le32(*src++);
-
-         r  = ubyte_to_float((value >>  0) & 0xff);
-         g0 = ubyte_to_float((value >>  8) & 0xff);
-         b  = ubyte_to_float((value >> 16) & 0xff);
-         g1 = ubyte_to_float((value >> 24) & 0xff);
-
-         dst[0] = r;    /* r */
-         dst[1] = g0;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 1.0f; /* a */
-         dst += 4;
-
-         dst[0] = r;    /* r */
-         dst[1] = g1;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 1.0f; /* a */
-         dst += 4;
-      }
-
-      if (x < width) {
-         value = util_cpu_to_le32(*src);
-
-         r  = ubyte_to_float((value >>  0) & 0xff);
-         g0 = ubyte_to_float((value >>  8) & 0xff);
-         b  = ubyte_to_float((value >> 16) & 0xff);
-         g1 = ubyte_to_float((value >> 24) & 0xff);
-
-         dst[0] = r;    /* r */
-         dst[1] = g0;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 1.0f; /* a */
-      }
-
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                          const uint8_t *src_row, unsigned src_stride,
-                                          unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      uint8_t *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      uint32_t value;
-      uint8_t r, g0, g1, b;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         value = util_cpu_to_le32(*src++);
-
-         r  = (value >>  0) & 0xff;
-         g0 = (value >>  8) & 0xff;
-         b  = (value >> 16) & 0xff;
-         g1 = (value >> 24) & 0xff;
-
-         dst[0] = r;    /* r */
-         dst[1] = g0;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 0xff; /* a */
-         dst += 4;
-
-         dst[0] = r;    /* r */
-         dst[1] = g1;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 0xff; /* a */
-         dst += 4;
-      }
-
-      if (x < width) {
-         value = util_cpu_to_le32(*src);
-
-         r  = (value >>  0) & 0xff;
-         g0 = (value >>  8) & 0xff;
-         b  = (value >> 16) & 0xff;
-         g1 = (value >> 24) & 0xff;
-
-         dst[0] = r;    /* r */
-         dst[1] = g0;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 0xff; /* a */
-      }
-
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                       const float *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      const float *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      float r, g0, g1, b;
-      uint32_t value;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         r  = 0.5f*(src[0] + src[4]);
-         g0 = src[1];
-         g1 = src[5];
-         b  = 0.5f*(src[2] + src[6]);
-
-         value  = (uint32_t)float_to_ubyte(r);
-         value |= (uint32_t)float_to_ubyte(g0) <<  8;
-         value |= (uint32_t)float_to_ubyte(b)  << 16;
-         value |= (uint32_t)float_to_ubyte(g1) << 24;
-
-         *dst++ = util_le32_to_cpu(value);
-
-         src += 8;
-      }
-
-      if (x < width) {
-         r  = src[0];
-         g0 = src[1];
-         g1 = 0;
-         b  = src[2];
-
-         value  = (uint32_t)float_to_ubyte(r);
-         value |= (uint32_t)float_to_ubyte(g0) <<  8;
-         value |= (uint32_t)float_to_ubyte(b)  << 16;
-         value |= (uint32_t)float_to_ubyte(g1) << 24;
-
-         *dst = util_le32_to_cpu(value);
-      }
-
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      const uint8_t *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      uint32_t r, g0, g1, b;
-      uint32_t value;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         r  = (src[0] + src[4] + 1) >> 1;
-         g0 = src[1];
-         g1 = src[5];
-         b  = (src[2] + src[6] + 1) >> 1;
-
-         value  = r;
-         value |= (uint32_t)g0 <<  8;
-         value |= (uint32_t)b  << 16;
-         value |= (uint32_t)g1 << 24;
-
-         *dst++ = util_le32_to_cpu(value);
-
-         src += 8;
-      }
-
-      if (x < width) {
-         r  = src[0];
-         g0 = src[1];
-         g1 = 0;
-         b  = src[2];
-
-         value  = r;
-         value |= (uint32_t)g0 <<  8;
-         value |= (uint32_t)b  << 16;
-         value |= (uint32_t)g1 << 24;
-
-         *dst = util_le32_to_cpu(value);
-      }
-
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        unsigned i, ASSERTED unsigned j)
-{
-   assert(i < 2);
-   assert(j < 1);
-
-   dst[0] = ubyte_to_float(src[0]);             /* r */
-   dst[1] = ubyte_to_float(src[1 + 2*i]);       /* g */
-   dst[2] = ubyte_to_float(src[2]);             /* b */
-   dst[3] = 1.0f;                               /* a */
-}
-
-
-void
-util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      float *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      uint32_t value;
-      float r, g0, g1, b;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         value = util_cpu_to_le32(*src++);
-
-         g0 = ubyte_to_float((value >>  0) & 0xff);
-         r  = ubyte_to_float((value >>  8) & 0xff);
-         g1 = ubyte_to_float((value >> 16) & 0xff);
-         b  = ubyte_to_float((value >> 24) & 0xff);
-
-         dst[0] = r;    /* r */
-         dst[1] = g0;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 1.0f; /* a */
-         dst += 4;
-
-         dst[0] = r;    /* r */
-         dst[1] = g1;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 1.0f; /* a */
-         dst += 4;
-      }
-
-      if (x < width) {
-         value = util_cpu_to_le32(*src);
-
-         g0 = ubyte_to_float((value >>  0) & 0xff);
-         r  = ubyte_to_float((value >>  8) & 0xff);
-         g1 = ubyte_to_float((value >> 16) & 0xff);
-         b  = ubyte_to_float((value >> 24) & 0xff);
-
-         dst[0] = r;    /* r */
-         dst[1] = g0;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 1.0f; /* a */
-      }
-
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                          const uint8_t *src_row, unsigned src_stride,
-                                          unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      uint8_t *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      uint32_t value;
-      uint8_t r, g0, g1, b;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         value = util_cpu_to_le32(*src++);
-
-         g0 = (value >>  0) & 0xff;
-         r  = (value >>  8) & 0xff;
-         g1 = (value >> 16) & 0xff;
-         b  = (value >> 24) & 0xff;
-
-         dst[0] = r;    /* r */
-         dst[1] = g0;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 0xff; /* a */
-         dst += 4;
-
-         dst[0] = r;    /* r */
-         dst[1] = g1;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 0xff; /* a */
-         dst += 4;
-      }
-
-      if (x < width) {
-         value = util_cpu_to_le32(*src);
-
-         g0 = (value >>  0) & 0xff;
-         r  = (value >>  8) & 0xff;
-         g1 = (value >> 16) & 0xff;
-         b  = (value >> 24) & 0xff;
-
-         dst[0] = r;    /* r */
-         dst[1] = g0;   /* g */
-         dst[2] = b;    /* b */
-         dst[3] = 0xff; /* a */
-      }
-
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                       const float *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      const float *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      float r, g0, g1, b;
-      uint32_t value;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         r  = 0.5f*(src[0] + src[4]);
-         g0 = src[1];
-         g1 = src[5];
-         b  = 0.5f*(src[2] + src[6]);
-
-         value  = (uint32_t)float_to_ubyte(g0);
-         value |= (uint32_t)float_to_ubyte(r)  <<  8;
-         value |= (uint32_t)float_to_ubyte(g1) << 16;
-         value |= (uint32_t)float_to_ubyte(b)  << 24;
-
-         *dst++ = util_le32_to_cpu(value);
-
-         src += 8;
-      }
-
-      if (x < width) {
-         r  = src[0];
-         g0 = src[1];
-         g1 = 0;
-         b  = src[2];
-
-         value  = (uint32_t)float_to_ubyte(g0);
-         value |= (uint32_t)float_to_ubyte(r)  <<  8;
-         value |= (uint32_t)float_to_ubyte(g1) << 16;
-         value |= (uint32_t)float_to_ubyte(b)  << 24;
-
-         *dst = util_le32_to_cpu(value);
-      }
-
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      const uint8_t *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      uint32_t r, g0, g1, b;
-      uint32_t value;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         r  = (src[0] + src[4] + 1) >> 1;
-         g0 = src[1];
-         g1 = src[5];
-         b  = (src[2] + src[6] + 1) >> 1;
-
-         value  = g0;
-         value |= (uint32_t)r  <<  8;
-         value |= (uint32_t)g1 << 16;
-         value |= (uint32_t)b  << 24;
-
-         *dst++ = util_le32_to_cpu(value);
-
-         src += 8;
-      }
-
-      if (x < width) {
-         r  = src[0];
-         g0 = src[1];
-         g1 = 0;
-         b  = src[2];
-
-         value  = g0;
-         value |= (uint32_t)r  <<  8;
-         value |= (uint32_t)g1 << 16;
-         value |= (uint32_t)b  << 24;
-
-         *dst = util_le32_to_cpu(value);
-      }
-
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        unsigned i, ASSERTED unsigned j)
-{
-   assert(i < 2);
-   assert(j < 1);
-
-   dst[0] = ubyte_to_float(src[1]);             /* r */
-   dst[1] = ubyte_to_float(src[0 + 2*i]);       /* g */
-   dst[2] = ubyte_to_float(src[3]);             /* b */
-   dst[3] = 1.0f;                               /* a */
-}
-
-
-void
-util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                              const uint8_t *src_row, unsigned src_stride,
-                              unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      float *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      uint32_t value;
-      uint8_t y0, y1, u, v;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         value = util_cpu_to_le32(*src++);
-
-         u  = (value >>  0) & 0xff;
-         y0 = (value >>  8) & 0xff;
-         v  = (value >> 16) & 0xff;
-         y1 = (value >> 24) & 0xff;
-
-         util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 1.0f; /* a */
-         dst += 4;
-
-         util_format_yuv_to_rgb_float(y1, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 1.0f; /* a */
-         dst += 4;
-      }
-
-      if (x < width) {
-         value = util_cpu_to_le32(*src);
-
-         u  = (value >>  0) & 0xff;
-         y0 = (value >>  8) & 0xff;
-         v  = (value >> 16) & 0xff;
-         y1 = (value >> 24) & 0xff;
-
-         util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 1.0f; /* a */
-      }
-
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_uyvy_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                               const uint8_t *src_row, unsigned src_stride,
-                               unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      uint8_t *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      uint32_t value;
-      uint8_t y0, y1, u, v;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         value = util_cpu_to_le32(*src++);
-
-         u  = (value >>  0) & 0xff;
-         y0 = (value >>  8) & 0xff;
-         v  = (value >> 16) & 0xff;
-         y1 = (value >> 24) & 0xff;
-
-         util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 0xff; /* a */
-         dst += 4;
-
-         util_format_yuv_to_rgb_8unorm(y1, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 0xff; /* a */
-         dst += 4;
-      }
-
-      if (x < width) {
-         value = util_cpu_to_le32(*src);
-
-         u  = (value >>  0) & 0xff;
-         y0 = (value >>  8) & 0xff;
-         v  = (value >> 16) & 0xff;
-         y1 = (value >> 24) & 0xff;
-
-         util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 0xff; /* a */
-      }
-
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_uyvy_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                            const float *src_row, unsigned src_stride,
-                            unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      const float *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      uint8_t y0, y1, u, v;
-      uint32_t value;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         uint8_t y0, y1, u0, u1, v0, v1, u, v;
-
-         util_format_rgb_float_to_yuv(src[0], src[1], src[2],
-                                      &y0, &u0, &v0);
-         util_format_rgb_float_to_yuv(src[4], src[5], src[6],
-                                      &y1, &u1, &v1);
-
-         u = (u0 + u1 + 1) >> 1;
-         v = (v0 + v1 + 1) >> 1;
-
-         value  = u;
-         value |= (uint32_t)y0 <<  8;
-         value |= (uint32_t)v  << 16;
-         value |= (uint32_t)y1 << 24;
-
-         *dst++ = util_le32_to_cpu(value);
-
-         src += 8;
-      }
-
-      if (x < width) {
-         util_format_rgb_float_to_yuv(src[0], src[1], src[2],
-                                      &y0, &u, &v);
-         y1 = 0;
-
-         value  = u;
-         value |= (uint32_t)y0 <<  8;
-         value |= (uint32_t)v  << 16;
-         value |= (uint32_t)y1 << 24;
-
-         *dst = util_le32_to_cpu(value);
-      }
-
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_uyvy_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      const uint8_t *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      uint8_t y0, y1, u, v;
-      uint32_t value;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         uint8_t y0, y1, u0, u1, v0, v1, u, v;
-
-         util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
-                                       &y0, &u0, &v0);
-         util_format_rgb_8unorm_to_yuv(src[4], src[5], src[6],
-                                       &y1, &u1, &v1);
-
-         u = (u0 + u1 + 1) >> 1;
-         v = (v0 + v1 + 1) >> 1;
-
-         value  = u;
-         value |= (uint32_t)y0 <<  8;
-         value |= (uint32_t)v  << 16;
-         value |= (uint32_t)y1 << 24;
-
-         *dst++ = util_le32_to_cpu(value);
-
-         src += 8;
-      }
-
-      if (x < width) {
-         util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
-                                       &y0, &u, &v);
-         y1 = 0;
-
-         value  = u;
-         value |= (uint32_t)y0 <<  8;
-         value |= (uint32_t)v  << 16;
-         value |= (uint32_t)y1 << 24;
-
-         *dst = util_le32_to_cpu(value);
-      }
-
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
-                             unsigned i, ASSERTED unsigned j)
-{
-   uint8_t y, u, v;
-
-   assert(i < 2);
-   assert(j < 1);
-
-   y = src[1 + i*2];
-   u = src[0];
-   v = src[2];
-
-   util_format_yuv_to_rgb_float(y, u, v, &dst[0], &dst[1], &dst[2]);
-
-   dst[3] = 1.0f;
-}
-
-
-void
-util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                              const uint8_t *src_row, unsigned src_stride,
-                              unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      float *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      uint32_t value;
-      uint8_t y0, y1, u, v;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         value = util_cpu_to_le32(*src++);
-
-         y0 = (value >>  0) & 0xff;
-         u  = (value >>  8) & 0xff;
-         y1 = (value >> 16) & 0xff;
-         v  = (value >> 24) & 0xff;
-
-         util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 1.0f; /* a */
-         dst += 4;
-
-         util_format_yuv_to_rgb_float(y1, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 1.0f; /* a */
-         dst += 4;
-      }
-
-      if (x < width) {
-         value = util_cpu_to_le32(*src);
-
-         y0 = (value >>  0) & 0xff;
-         u  = (value >>  8) & 0xff;
-         y1 = (value >> 16) & 0xff;
-         v  = (value >> 24) & 0xff;
-
-         util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 1.0f; /* a */
-      }
-
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_yuyv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                               const uint8_t *src_row, unsigned src_stride,
-                               unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      uint8_t *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      uint32_t value;
-      uint8_t y0, y1, u, v;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         value = util_cpu_to_le32(*src++);
-
-         y0 = (value >>  0) & 0xff;
-         u  = (value >>  8) & 0xff;
-         y1 = (value >> 16) & 0xff;
-         v  = (value >> 24) & 0xff;
-
-         util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 0xff; /* a */
-         dst += 4;
-
-         util_format_yuv_to_rgb_8unorm(y1, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 0xff; /* a */
-         dst += 4;
-      }
-
-      if (x < width) {
-         value = util_cpu_to_le32(*src);
-
-         y0 = (value >>  0) & 0xff;
-         u  = (value >>  8) & 0xff;
-         y1 = (value >> 16) & 0xff;
-         v  = (value >> 24) & 0xff;
-
-         util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
-         dst[3] = 0xff; /* a */
-      }
-
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-
-void
-util_format_yuyv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                            const float *src_row, unsigned src_stride,
-                            unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      const float *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      uint8_t y0, y1, u, v;
-      uint32_t value;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         uint8_t y0, y1, u0, u1, v0, v1, u, v;
-
-         util_format_rgb_float_to_yuv(src[0], src[1], src[2],
-                                      &y0, &u0, &v0);
-         util_format_rgb_float_to_yuv(src[4], src[5], src[6],
-                                      &y1, &u1, &v1);
-
-         u = (u0 + u1 + 1) >> 1;
-         v = (v0 + v1 + 1) >> 1;
-
-         value  = y0;
-         value |= (uint32_t)u  <<  8;
-         value |= (uint32_t)y1 << 16;
-         value |= (uint32_t)v  << 24;
-
-         *dst++ = util_le32_to_cpu(value);
-
-         src += 8;
-      }
-
-      if (x < width) {
-         util_format_rgb_float_to_yuv(src[0], src[1], src[2],
-                                      &y0, &u, &v);
-         y1 = 0;
-
-         value  = y0;
-         value |= (uint32_t)u  <<  8;
-         value |= (uint32_t)y1 << 16;
-         value |= (uint32_t)v  << 24;
-
-         *dst = util_le32_to_cpu(value);
-      }
-
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_yuyv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height)
-{
-   unsigned x, y;
-
-   for (y = 0; y < height; y += 1) {
-      const uint8_t *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      uint8_t y0, y1, u, v;
-      uint32_t value;
-
-      for (x = 0; x + 1 < width; x += 2) {
-         uint8_t y0, y1, u0, u1, v0, v1, u, v;
-
-         util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
-                                       &y0, &u0, &v0);
-         util_format_rgb_8unorm_to_yuv(src[4], src[5], src[6],
-                                       &y1, &u1, &v1);
-
-         u = (u0 + u1 + 1) >> 1;
-         v = (v0 + v1 + 1) >> 1;
-
-         value  = y0;
-         value |= (uint32_t)u  <<  8;
-         value |= (uint32_t)y1 << 16;
-         value |= (uint32_t)v  << 24;
-
-         *dst++ = util_le32_to_cpu(value);
-
-         src += 8;
-      }
-
-      if (x < width) {
-         util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
-                                       &y0, &u, &v);
-         y1 = 0;
-
-         value  = y0;
-         value |= (uint32_t)u  <<  8;
-         value |= (uint32_t)y1 << 16;
-         value |= (uint32_t)v  << 24;
-
-         *dst = util_le32_to_cpu(value);
-      }
-
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
-                             unsigned i, ASSERTED unsigned j)
-{
-   uint8_t y, u, v;
-
-   assert(i < 2);
-   assert(j < 1);
-
-   y = src[0 + i*2];
-   u = src[1];
-   v = src[3];
-
-   util_format_yuv_to_rgb_float(y, u, v, &dst[0], &dst[1], &dst[2]);
-
-   dst[3] = 1.0f;
-}
-
-/* XXX: Stubbed for now */
-void
-util_format_yv12_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_yv16_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_iyuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_nv12_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_nv21_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_p016_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                             UNUSED const float *src_row, UNUSED unsigned src_stride,
-                             UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                             UNUSED unsigned i, UNUSED unsigned j) {}
-
-void
-util_format_xyuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                          UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
-                                       UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                        UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                                        UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_ayuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                          UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
-                                       UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                        UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                                        UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_r8g8_r8b8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                          UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
-                                       UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                        UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                                        UNUSED unsigned i, UNUSED unsigned j) {}
-
-void
-util_format_g8r8_b8r8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
-                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                         UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                          UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
-                                       UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
-                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
-                                        UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
-                                        UNUSED unsigned i, UNUSED unsigned j) {}
diff --git a/src/gallium/auxiliary/util/u_format_yuv.h b/src/gallium/auxiliary/util/u_format_yuv.h
deleted file mode 100644 (file)
index 0acb174..0000000
+++ /dev/null
@@ -1,430 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-/**
- * @file
- * YUV colorspace conversion.
- *
- * @author Brian Paul <brianp@vmware.com>
- * @author Michal Krol <michal@vmware.com>
- * @author Jose Fonseca <jfonseca@vmware.com>
- *
- * See also:
- * - http://www.fourcc.org/fccyvrgb.php
- * - http://msdn.microsoft.com/en-us/library/ms893078
- * - http://en.wikipedia.org/wiki/YUV
- */
-
-
-#ifndef U_FORMAT_YUV_H_
-#define U_FORMAT_YUV_H_
-
-
-#include "pipe/p_compiler.h"
-#include "util/u_math.h"
-
-
-/*
- * TODO: Ensure we use consistent and right floating formulas, with enough
- * precision in the coefficients.
- */
-
-static inline void
-util_format_rgb_float_to_yuv(float r, float g, float b,
-                             uint8_t *y, uint8_t *u, uint8_t *v)
-{
-   const float _r = CLAMP(r, 0.0f, 1.0f);
-   const float _g = CLAMP(g, 0.0f, 1.0f);
-   const float _b = CLAMP(b, 0.0f, 1.0f);
-
-   const float scale = 255.0f;
-
-   const int _y = scale * ( (0.257f * _r) + (0.504f * _g) + (0.098f * _b));
-   const int _u = scale * (-(0.148f * _r) - (0.291f * _g) + (0.439f * _b));
-   const int _v = scale * ( (0.439f * _r) - (0.368f * _g) - (0.071f * _b));
-
-   *y = _y + 16; 
-   *u = _u + 128; 
-   *v = _v + 128; 
-}
-
-
-static inline void
-util_format_yuv_to_rgb_float(uint8_t y, uint8_t u, uint8_t v,
-                             float *r, float *g, float *b)
-{
-   const int _y = y - 16;
-   const int _u = u - 128;
-   const int _v = v - 128;
-
-   const float y_factor = 255.0f / 219.0f;
-
-   const float scale = 1.0f / 255.0f;
-
-   *r = scale * (y_factor * _y               + 1.596f * _v);
-   *g = scale * (y_factor * _y - 0.391f * _u - 0.813f * _v);
-   *b = scale * (y_factor * _y + 2.018f * _u              );
-}
-
-
-static inline void
-util_format_rgb_8unorm_to_yuv(uint8_t r, uint8_t g, uint8_t b,
-                             uint8_t *y, uint8_t *u, uint8_t *v)
-{
-   *y = ((  66 * r + 129 * g +  25 * b + 128) >> 8) +  16;
-   *u = (( -38 * r -  74 * g + 112 * b + 128) >> 8) + 128;
-   *v = (( 112 * r -  94 * g -  18 * b + 128) >> 8) + 128;
-}
-
-
-static inline void
-util_format_yuv_to_rgb_8unorm(uint8_t y, uint8_t u, uint8_t v,
-                              uint8_t *r, uint8_t *g, uint8_t *b)
-{
-   const int _y = y - 16;
-   const int _u = u - 128;
-   const int _v = v - 128;
-
-   const int _r = (298 * _y            + 409 * _v + 128) >> 8;
-   const int _g = (298 * _y - 100 * _u - 208 * _v + 128) >> 8;
-   const int _b = (298 * _y + 516 * _u            + 128) >> 8;
-
-   *r = CLAMP(_r, 0, 255);
-   *g = CLAMP(_g, 0, 255);
-   *b = CLAMP(_b, 0, 255);
-}
-
-
-
-void
-util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                              const uint8_t *src_row, unsigned src_stride,
-                              unsigned width, unsigned height);
-
-void
-util_format_uyvy_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                               const uint8_t *src_row, unsigned src_stride,
-                               unsigned width, unsigned height);
-
-void
-util_format_uyvy_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                            const float *src_row, unsigned src_stride,
-                            unsigned width, unsigned height);
-
-void
-util_format_uyvy_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-
-void
-util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
-                             unsigned i, unsigned j);
-
-void
-util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                              const uint8_t *src_row, unsigned src_stride,
-                              unsigned width, unsigned height);
-
-void
-util_format_yuyv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                               const uint8_t *src_row, unsigned src_stride,
-                               unsigned width, unsigned height);
-
-void
-util_format_yuyv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                            const float *src_row, unsigned src_stride,
-                            unsigned width, unsigned height);
-
-void
-util_format_yuyv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-
-void
-util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
-                             unsigned i, unsigned j);
-
-/* XXX: Stubbed for now */
-void
-util_format_yv12_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_yv12_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_yv12_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_yv12_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                             const float *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_yv12_fetch_rgba_float(float *dst, const uint8_t *src,
-                             unsigned i, unsigned j);
-void
-util_format_yv16_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_yv16_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_yv16_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_yv16_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                             const float *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_yv16_fetch_rgba_float(float *dst, const uint8_t *src,
-                             unsigned i, unsigned j);
-void
-util_format_iyuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_iyuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_iyuv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_iyuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                             const float *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_iyuv_fetch_rgba_float(float *dst, const uint8_t *src,
-                             unsigned i, unsigned j);
-void
-util_format_nv12_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_nv12_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_nv12_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_nv12_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                             const float *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_nv12_fetch_rgba_float(float *dst, const uint8_t *src,
-                             unsigned i, unsigned j);
-void
-util_format_nv21_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_nv21_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_nv21_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_nv21_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                             const float *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_nv21_fetch_rgba_float(float *dst, const uint8_t *src,
-                             unsigned i, unsigned j);
-void
-util_format_p016_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_p016_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_p016_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                             const uint8_t *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_p016_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                             const float *src_row, unsigned src_stride,
-                             unsigned width, unsigned height);
-void
-util_format_p016_fetch_rgba_float(float *dst, const uint8_t *src,
-                             unsigned i, unsigned j);
-
-void
-util_format_xyuv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height);
-
-void
-util_format_xyuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                          const uint8_t *src_row, unsigned src_stride,
-                                          unsigned width, unsigned height);
-
-void
-util_format_xyuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                       const float *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height);
-
-void
-util_format_xyuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height);
-
-void
-util_format_xyuv_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        unsigned i, unsigned j);
-void
-util_format_ayuv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height);
-
-void
-util_format_ayuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                          const uint8_t *src_row, unsigned src_stride,
-                                          unsigned width, unsigned height);
-
-void
-util_format_ayuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                       const float *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height);
-
-void
-util_format_ayuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height);
-
-void
-util_format_ayuv_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        unsigned i, unsigned j);
-void
-util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height);
-
-void
-util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                          const uint8_t *src_row, unsigned src_stride,
-                                          unsigned width, unsigned height);
-
-void
-util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                       const float *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height);
-
-void
-util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height);
-
-void
-util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        unsigned i, unsigned j);
-
-void
-util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height);
-
-void
-util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                          const uint8_t *src_row, unsigned src_stride,
-                                          unsigned width, unsigned height);
-
-void
-util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                       const float *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height);
-
-void
-util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height);
-
-void
-util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        unsigned i, unsigned j);
-
-void
-util_format_r8g8_r8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height);
-
-void
-util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                          const uint8_t *src_row, unsigned src_stride,
-                                          unsigned width, unsigned height);
-
-void
-util_format_r8g8_r8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                       const float *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height);
-
-void
-util_format_r8g8_r8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height);
-
-void
-util_format_r8g8_r8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        unsigned i, unsigned j);
-
-void
-util_format_g8r8_b8r8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height);
-
-void
-util_format_g8r8_b8r8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                          const uint8_t *src_row, unsigned src_stride,
-                                          unsigned width, unsigned height);
-
-void
-util_format_g8r8_b8r8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-                                       const float *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height);
-
-void
-util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-                                        const uint8_t *src_row, unsigned src_stride,
-                                        unsigned width, unsigned height);
-
-void
-util_format_g8r8_b8r8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
-                                        unsigned i, unsigned j);
-
-#endif /* U_FORMAT_YUV_H_ */
diff --git a/src/gallium/auxiliary/util/u_format_zs.c b/src/gallium/auxiliary/util/u_format_zs.c
deleted file mode 100644 (file)
index 98d758e..0000000
+++ /dev/null
@@ -1,896 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#include "u_format_zs.h"
-#include "util/u_math.h"
-
-
-/*
- * z32_unorm conversion functions
- */
-
-static inline uint16_t
-z32_unorm_to_z16_unorm(uint32_t z)
-{
-   /* z * 0xffff / 0xffffffff */
-   return z >> 16;
-}
-
-static inline uint32_t
-z16_unorm_to_z32_unorm(uint16_t z)
-{
-   /* z * 0xffffffff / 0xffff */
-   return ((uint32_t)z << 16) | z;
-}
-
-static inline uint32_t
-z32_unorm_to_z24_unorm(uint32_t z)
-{
-   /* z * 0xffffff / 0xffffffff */
-   return z >> 8;
-}
-
-static inline uint32_t
-z24_unorm_to_z32_unorm(uint32_t z)
-{
-   /* z * 0xffffffff / 0xffffff */
-   return (z << 8) | (z >> 16);
-}
-
-
-/*
- * z32_float conversion functions
- */
-
-static inline uint16_t
-z32_float_to_z16_unorm(float z)
-{
-   const float scale = 0xffff;
-   return (uint16_t)(z * scale + 0.5f);
-}
-
-static inline float
-z16_unorm_to_z32_float(uint16_t z)
-{
-   const float scale = 1.0 / 0xffff;
-   return (float)(z * scale);
-}
-
-static inline uint32_t
-z32_float_to_z24_unorm(float z)
-{
-   const double scale = 0xffffff;
-   return (uint32_t)(z * scale) & 0xffffff;
-}
-
-static inline float
-z24_unorm_to_z32_float(uint32_t z)
-{
-   const double scale = 1.0 / 0xffffff;
-   return (float)(z * scale);
-}
-
-static inline uint32_t
-z32_float_to_z32_unorm(float z)
-{
-   const double scale = 0xffffffff;
-   return (uint32_t)(z * scale);
-}
-
-static inline float
-z32_unorm_to_z32_float(uint32_t z)
-{
-   const double scale = 1.0 / 0xffffffff;
-   return (float)(z * scale);
-}
-
-
-void
-util_format_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   unsigned y;
-   for(y = 0; y < height; ++y) {
-      memcpy(dst_row, src_row, width);
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned y;
-   for(y = 0; y < height; ++y) {
-      memcpy(dst_row, src_row, width);
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z16_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
-                                     const uint8_t *src_row, unsigned src_stride,
-                                     unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      float *dst = dst_row;
-      const uint16_t *src = (const uint16_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint16_t value = util_cpu_to_le16(*src++);
-         *dst++ = z16_unorm_to_z32_float(value);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z16_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
-                                   const float *src_row, unsigned src_stride,
-                                   unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const float *src = src_row;
-      uint16_t *dst = (uint16_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint16_t value;
-         value = z32_float_to_z16_unorm(*src++);
-         *dst++ = util_le16_to_cpu(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z16_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      uint32_t *dst = dst_row;
-      const uint16_t *src = (const uint16_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint16_t value = util_cpu_to_le16(*src++);
-         *dst++ = z16_unorm_to_z32_unorm(value);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z16_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
-                                     const uint32_t *src_row, unsigned src_stride,
-                                     unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const uint32_t *src = src_row;
-      uint16_t *dst = (uint16_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint16_t value;
-         value = z32_unorm_to_z16_unorm(*src++);
-         *dst++ = util_le16_to_cpu(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z32_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
-                                     const uint8_t *src_row, unsigned src_stride,
-                                     unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      float *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_cpu_to_le32(*src++);
-         *dst++ = z32_unorm_to_z32_float(value);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z32_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
-                                   const float *src_row, unsigned src_stride,
-                                   unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const float *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value;
-         value = z32_float_to_z32_unorm(*src++);
-         *dst++ = util_le32_to_cpu(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z32_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned y;
-   for(y = 0; y < height; ++y) {
-      memcpy(dst_row, src_row, width * 4);
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z32_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
-                                     const uint32_t *src_row, unsigned src_stride,
-                                     unsigned width, unsigned height)
-{
-   unsigned y;
-   for(y = 0; y < height; ++y) {
-      memcpy(dst_row, src_row, width * 4);
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z32_float_unpack_z_float(float *dst_row, unsigned dst_stride,
-                                     const uint8_t *src_row, unsigned src_stride,
-                                     unsigned width, unsigned height)
-{
-   unsigned y;
-   for(y = 0; y < height; ++y) {
-      memcpy(dst_row, src_row, width * 4);
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z32_float_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
-                                   const float *src_row, unsigned src_stride,
-                                   unsigned width, unsigned height)
-{
-   unsigned y;
-   for(y = 0; y < height; ++y) {
-      memcpy(dst_row, src_row, width * 4);
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z32_float_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      uint32_t *dst = dst_row;
-      const float *src = (const float *)src_row;
-      for(x = 0; x < width; ++x) {
-         *dst++ = z32_float_to_z32_unorm(*src++);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z32_float_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
-                                     const uint32_t *src_row, unsigned src_stride,
-                                     unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const uint32_t *src = src_row;
-      float *dst = (float *)dst_row;
-      for(x = 0; x < width; ++x) {
-         *dst++ = z32_unorm_to_z32_float(*src++);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z24_unorm_s8_uint_unpack_z_float(float *dst_row, unsigned dst_stride,
-                                                const uint8_t *src_row, unsigned src_stride,
-                                                unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      float *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value =  util_cpu_to_le32(*src++);
-         *dst++ = z24_unorm_to_z32_float(value & 0xffffff);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z24_unorm_s8_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
-                                              const float *src_row, unsigned src_stride,
-                                              unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const float *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_le32_to_cpu(*dst);
-         value &= 0xff000000;
-         value |= z32_float_to_z24_unorm(*src++);
-         *dst++ = util_cpu_to_le32(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z24_unorm_s8_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
-                                                  const uint8_t *src_row, unsigned src_stride,
-                                                  unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      uint32_t *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_cpu_to_le32(*src++);
-         *dst++ = z24_unorm_to_z32_unorm(value & 0xffffff);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z24_unorm_s8_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
-                                                const uint32_t *src_row, unsigned src_stride,
-                                                unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const uint32_t *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_le32_to_cpu(*dst);
-         value &= 0xff000000;
-         value |= z32_unorm_to_z24_unorm(*src++);
-         *dst++ = util_cpu_to_le32(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z24_unorm_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
-                                                   const uint8_t *src_row, unsigned src_stride,
-                                                   unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      uint8_t *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_cpu_to_le32(*src++);
-         *dst++ = value >> 24;
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z24_unorm_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
-                                                 const uint8_t *src_row, unsigned src_stride,
-                                                 unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const uint8_t *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_le32_to_cpu(*dst);
-         value &= 0x00ffffff;
-         value |= (uint32_t)*src++ << 24;
-         *dst++ = util_cpu_to_le32(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z24_unorm_s8_uint_pack_separate(uint8_t *dst_row, unsigned dst_stride,
-                                            const uint32_t *z_src_row, unsigned z_src_stride,
-                                            const uint8_t *s_src_row, unsigned s_src_stride,
-                                            unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for (y = 0; y < height; ++y) {
-      const uint32_t *z_src = z_src_row;
-      const uint8_t *s_src = s_src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for (x = 0; x < width; ++x) {
-         *dst++ = (*z_src++ & 0x00ffffff) | ((uint32_t)*s_src++ << 24);
-      }
-      dst_row += dst_stride / sizeof(*dst_row);
-      z_src_row += z_src_stride / sizeof(*z_src_row);
-      s_src_row += s_src_stride / sizeof(*s_src_row);
-   }
-}
-
-void
-util_format_s8_uint_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
-                                                const uint8_t *src_row, unsigned src_stride,
-                                                unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      float *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_cpu_to_le32(*src++);
-         *dst++ = z24_unorm_to_z32_float(value >> 8);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_s8_uint_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
-                                              const float *src_row, unsigned src_stride,
-                                              unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const float *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_le32_to_cpu(*dst);
-         value &= 0x000000ff;
-         value |= z32_float_to_z24_unorm(*src++) << 8;
-         *dst++ = util_cpu_to_le32(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_s8_uint_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
-                                                  const uint8_t *src_row, unsigned src_stride,
-                                                  unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      uint32_t *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_cpu_to_le32(*src++);
-         *dst++ = z24_unorm_to_z32_unorm(value >> 8);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_s8_uint_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
-                                                const uint32_t *src_row, unsigned src_stride,
-                                                unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const uint32_t *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_le32_to_cpu(*dst);
-         value &= 0x000000ff;
-         value |= *src++ & 0xffffff00;
-         *dst++ = util_cpu_to_le32(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_s8_uint_z24_unorm_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
-                                                   const uint8_t *src_row, unsigned src_stride,
-                                                   unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      uint8_t *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_cpu_to_le32(*src++);
-         *dst++ = value & 0xff;
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_s8_uint_z24_unorm_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
-                                                 const uint8_t *src_row, unsigned src_stride,
-                                                 unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const uint8_t *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_le32_to_cpu(*dst);
-         value &= 0xffffff00;
-         value |= *src++;
-         *dst++ = util_cpu_to_le32(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z24x8_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      float *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_cpu_to_le32(*src++);
-         *dst++ = z24_unorm_to_z32_float(value & 0xffffff);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z24x8_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
-                                     const float *src_row, unsigned src_stride,
-                                     unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const float *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value;
-         value = z32_float_to_z24_unorm(*src++);
-         *dst++ = util_le32_to_cpu(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z24x8_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      uint32_t *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_cpu_to_le32(*src++);
-         *dst++ = z24_unorm_to_z32_unorm(value & 0xffffff);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z24x8_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint32_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const uint32_t *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value;
-         value = z32_unorm_to_z24_unorm(*src++);
-         *dst++ = util_cpu_to_le32(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_x8z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
-                                       const uint8_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      float *dst = dst_row;
-      const uint32_t *src = (uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_cpu_to_le32(*src++);
-         *dst++ = z24_unorm_to_z32_float(value >> 8);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_x8z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
-                                     const float *src_row, unsigned src_stride,
-                                     unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const float *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value;
-         value = z32_float_to_z24_unorm(*src++) << 8;
-         *dst++ = util_cpu_to_le32(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_x8z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
-                                         const uint8_t *src_row, unsigned src_stride,
-                                         unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      uint32_t *dst = dst_row;
-      const uint32_t *src = (const uint32_t *)src_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value = util_cpu_to_le32(*src++);
-         *dst++ = z24_unorm_to_z32_unorm(value >> 8);
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_x8z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
-                                       const uint32_t *src_row, unsigned src_stride,
-                                       unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const uint32_t *src = src_row;
-      uint32_t *dst = (uint32_t *)dst_row;
-      for(x = 0; x < width; ++x) {
-         uint32_t value;
-         value = z32_unorm_to_z24_unorm(*src++) << 8;
-         *dst++ = util_cpu_to_le32(value);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z32_float_s8x24_uint_unpack_z_float(float *dst_row, unsigned dst_stride,
-                                                   const uint8_t *src_row, unsigned src_stride,
-                                                   unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      float *dst = dst_row;
-      const float *src = (const float *)src_row;
-      for(x = 0; x < width; ++x) {
-         *dst = *src;
-         src += 2;
-         dst += 1;
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z32_float_s8x24_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
-                                                 const float *src_row, unsigned src_stride,
-                                                 unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const float *src = src_row;
-      float *dst = (float *)dst_row;
-      for(x = 0; x < width; ++x) {
-         *dst = *src;
-         src += 1;
-         dst += 2;
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z32_float_s8x24_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
-                                                     const uint8_t *src_row, unsigned src_stride,
-                                                     unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      uint32_t *dst = dst_row;
-      const float *src = (const float *)src_row;
-      for(x = 0; x < width; ++x) {
-         *dst = z32_float_to_z32_unorm(*src);
-         src += 2;
-         dst += 1;
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z32_float_s8x24_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
-                                                   const uint32_t *src_row, unsigned src_stride,
-                                                   unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const uint32_t *src = src_row;
-      float *dst = (float *)dst_row;
-      for(x = 0; x < width; ++x) {
-         *dst++ = z32_unorm_to_z32_float(*src++);
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-void
-util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
-                                                      const uint8_t *src_row, unsigned src_stride,
-                                                      unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      uint8_t *dst = dst_row;
-      const uint8_t *src = src_row + 4;
-      for(x = 0; x < width; ++x) {
-         *dst = *src;
-         src += 8;
-         dst += 1;
-      }
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
-   }
-}
-
-void
-util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
-                                                    const uint8_t *src_row, unsigned src_stride,
-                                                    unsigned width, unsigned height)
-{
-   unsigned x, y;
-   for(y = 0; y < height; ++y) {
-      const uint8_t *src = src_row;
-      uint32_t *dst = ((uint32_t *)dst_row) + 1;
-      for(x = 0; x < width; ++x) {
-         *dst = util_cpu_to_le32(*src);
-         src += 1;
-         dst += 2;
-      }
-      dst_row += dst_stride/sizeof(*dst_row);
-      src_row += src_stride/sizeof(*src_row);
-   }
-}
-
-
-void
-util_format_x24s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_z24_unorm_s8_uint_unpack_s_8uint(dst_row, dst_stride,
-                                                     src_row, src_stride,
-                                                     width, height);
-}
-
-void
-util_format_x24s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_z24_unorm_s8_uint_pack_s_8uint(dst_row, dst_stride,
-                                                   src_row, src_stride,
-                                                   width, height);
-}
-
-void
-util_format_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_s8_uint_z24_unorm_unpack_s_8uint(dst_row, dst_stride,
-                                                     src_row, src_stride,
-                                                     width, height);
-}
-
-void
-util_format_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
-   util_format_s8_uint_z24_unorm_pack_s_8uint(dst_row, dst_stride,
-                                                     src_row, src_stride,
-                                                     width, height);
-}
-
-void
-util_format_x32_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
-                                               const uint8_t *src_row, unsigned src_stride,
-                                               unsigned width, unsigned height)
-{
-   util_format_z32_float_s8x24_uint_unpack_s_8uint(dst_row, dst_stride,
-                                                        src_row, src_stride,
-                                                        width, height);
-
-}
-
-void
-util_format_x32_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
-                                             const uint8_t *src_row, unsigned src_stride,
-                                             unsigned width, unsigned height)
-{
-   util_format_z32_float_s8x24_uint_pack_s_8uint(dst_row, dst_stride,
-                                                       src_row, src_stride,
-                                                      width, height);
-}
diff --git a/src/gallium/auxiliary/util/u_format_zs.h b/src/gallium/auxiliary/util/u_format_zs.h
deleted file mode 100644 (file)
index bed3c51..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#ifndef U_FORMAT_ZS_H_
-#define U_FORMAT_ZS_H_
-
-
-#include "pipe/p_compiler.h"
-
-
-void
-util_format_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z16_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z16_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z16_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z16_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_z24_unorm_s8_uint_pack_separate(uint8_t *dst_row, unsigned dst_stride, const uint32_t *z_src_row, unsigned z_src_stride, const uint8_t *s_src_row, unsigned s_src_stride, unsigned width, unsigned height);
-
-void
-util_format_s8_uint_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_z24_unorm_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_z24_unorm_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24x8_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24x8_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24x8_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24x8_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_x8z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_x8z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_x8z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_x8z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_x24s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_x24s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_x32_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_x32_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_sride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-#endif /* U_FORMAT_ZS_H_ */
index 06737c58fe87f4931528d432eab3d2b58cbe0090..d8a5f2fc008027ad06869bab7d0559e2c2905bd0 100644 (file)
@@ -36,7 +36,7 @@
 
 
 #include "util/u_gen_mipmap.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 
 
index 0166126c56fca74b07cb574b1f556f89d7bb2f67..4bf1731da0b2a7892b9fe06401ad04432d6dcc69 100644 (file)
@@ -38,7 +38,7 @@
 #include "pipe/p_compiler.h"
 #include "pipe/p_format.h"
 #include "util/u_debug_gallium.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 
 
index 77b0458dc0301fa7b80fe9d086b6773c10e35fbd..c3c2ca81780a26a10dc874d55f799291233ee3ad 100644 (file)
@@ -45,7 +45,7 @@
 #include "pipe/p_shader_tokens.h"
 #include "util/u_inlines.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_pstipple.h"
 #include "util/u_sampler.h"
index ed6c1504fd8ca2e7d6d39fb0ab3de28ee11a9809..b27c3f3c80b7385b86ce6b9cf6079873dbce5ff7 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_resource.h"
 
index 5da1d5fdff2b65e67814576f75c0483911910858..2c823d45609c8f0933bb03aa34af662c8d38837a 100644 (file)
@@ -26,7 +26,7 @@
  **************************************************************************/
 
 
-#include "u_format.h"
+#include "util/format/u_format.h"
 #include "u_sampler.h"
 
 
index 5f07eb1cdaceff4cb5a9ede36c75454f024f00ae..718411d8d1f28cb4b984d9f6d95fb5bd7b6057f7 100644 (file)
@@ -36,7 +36,7 @@
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_rect.h"
 #include "util/u_surface.h"
@@ -57,59 +57,6 @@ u_surface_default_template(struct pipe_surface *surf,
 }
 
 
-/**
- * Copy 2D rect from one place to another.
- * Position and sizes are in pixels.
- * src_stride may be negative to do vertical flip of pixels from source.
- */
-void
-util_copy_rect(ubyte * dst,
-               enum pipe_format format,
-               unsigned dst_stride,
-               unsigned dst_x,
-               unsigned dst_y,
-               unsigned width,
-               unsigned height,
-               const ubyte * src,
-               int src_stride,
-               unsigned src_x,
-               unsigned src_y)
-{
-   unsigned i;
-   int src_stride_pos = src_stride < 0 ? -src_stride : src_stride;
-   int blocksize = util_format_get_blocksize(format);
-   int blockwidth = util_format_get_blockwidth(format);
-   int blockheight = util_format_get_blockheight(format);
-
-   assert(blocksize > 0);
-   assert(blockwidth > 0);
-   assert(blockheight > 0);
-
-   dst_x /= blockwidth;
-   dst_y /= blockheight;
-   width = (width + blockwidth - 1)/blockwidth;
-   height = (height + blockheight - 1)/blockheight;
-   src_x /= blockwidth;
-   src_y /= blockheight;
-
-   dst += dst_x * blocksize;
-   src += src_x * blocksize;
-   dst += dst_y * dst_stride;
-   src += src_y * src_stride_pos;
-   width *= blocksize;
-
-   if (width == dst_stride && width == (unsigned)src_stride)
-      memcpy(dst, src, height * width);
-   else {
-      for (i = 0; i < height; i++) {
-         memcpy(dst, src, width);
-         dst += dst_stride;
-         src += src_stride;
-      }
-   }
-}
-
-
 /**
  * Copy 3D box from one place to another.
  * Position and sizes are in pixels.
index f764abb04e506dcb72746795d43d755e8f5c2106..f6149563e81b49c61eef7222cd803e126c316a79 100644 (file)
@@ -44,12 +44,6 @@ extern void
 u_surface_default_template(struct pipe_surface *view,
                            const struct pipe_resource *texture);
 
-extern void
-util_copy_rect(ubyte * dst, enum pipe_format format,
-               unsigned dst_stride, unsigned dst_x, unsigned dst_y,
-               unsigned width, unsigned height, const ubyte * src,
-               int src_stride, unsigned src_x, unsigned src_y);
-
 extern void
 util_copy_box(ubyte * dst,
               enum pipe_format format,
index e8a93e9f98e06fa69e7ee497e92dbba72ecd2f78..efd290f89b45fd15ebb1daf2eae5d549b3ab52af 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_tests.h"
 
 #include "util/u_draw_quad.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_simple_shaders.h"
index 086700c88bf6911803e0745b09aed1fba82855cb..daed6c6950b21d270b9cca882cb947243339bbd7 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "util/u_threaded_context.h"
 #include "util/u_cpu_detect.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
index 0239b870482555aadefca288965936b7db8f3003..5a486af41aeb66015850bd9fd8e6256935209516 100644 (file)
@@ -34,8 +34,8 @@
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 
-#include "util/u_format.h"
-#include "util/u_format_bptc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_bptc.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_surface.h"
index f33d98b47a4a7af5fe366fd58792f8e35cf5a9f2..0ba8abdf7828f897bbd9e3e7fa10d533f6585924 100644 (file)
@@ -24,9 +24,9 @@
 #include "pipe/p_screen.h"
 
 #include "util/u_box.h"
-#include "util/u_format.h"
-#include "util/u_format_rgtc.h"
-#include "util/u_format_zs.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_rgtc.h"
+#include "util/format/u_format_zs.h"
 #include "util/u_inlines.h"
 #include "util/u_transfer_helper.h"
 
index 200bfffbd392e55758e1dc54508ecca6bcb26334..4b8dc8e4ae6c77002801bcc60a056151197f89f9 100644 (file)
@@ -88,7 +88,7 @@
 #include "util/u_vbuf.h"
 
 #include "util/u_dump.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
index dbd6be534e9be18fccef65423fd87c25802ddbc5..ab64cebf806d92d1bfe0cd35cb4600072d5411b1 100644 (file)
@@ -47,7 +47,7 @@
 #include "util/u_draw.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "vl_types.h"
 #include "vl_video_buffer.h"
index 45a9badce21b8a4cc48a57cba3b37d3a4dbe73fd..7e6fdfaaf56cbbb8a87778530b5cf008cd26fc58 100644 (file)
@@ -26,7 +26,7 @@
  **************************************************************************/
 
 #include <assert.h>
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "vl_vertex_buffers.h"
 #include "vl_types.h"
 
index b159007c2b91aebd88b762080293b37868d56b9b..ed331c94ad07e3382909c41e6011856664f4504c 100644 (file)
@@ -31,7 +31,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_sampler.h"
 #include "util/u_memory.h"
index 1bb9be12f1cbe73eb197c02f23f6b55da55c093d..17da615cb566039f2ff263194e49c820c40f2d4b 100644 (file)
@@ -29,7 +29,7 @@
 #include "etnaviv_resource.h"
 #include "etnaviv_screen.h"
 #include "hw/common.xml.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 bool
 etna_etc2_needs_patching(const struct pipe_resource *prsc)
index 1672d67b93d5475887b1afa202867261ae7a7b72..45b15370812b904f2778359679bc20a0ddeb6b16 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef ETNAVIV_FORMAT_H_
 #define ETNAVIV_FORMAT_H_
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include <stdint.h>
 
 #define ETNA_NO_MATCH (~0)
index 77a9abafa99dd7900d026af7a77e4c6b040bcdda..b0135c068ff58fdce588cfac34a06c234922f6be 100644 (file)
@@ -35,7 +35,7 @@
 #include "pipe/p_format.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_surface.h"
index 4e9b2d5249ad7a7058d174ec33b94d349ff3ce68..3c2aa3f79d2df02ae901f5cc30f779cf6e04bf4a 100644 (file)
@@ -36,7 +36,7 @@
 #include "hw/state.xml.h"
 #include "hw/state_3d.xml.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 
 /* Returned when there is no match of pipe value to etna value */
index 9efc473b4a7677c9325f8b3485665317ac03267d..b735535e7f77698db177c75365dcdef4d7213fa2 100644 (file)
@@ -29,7 +29,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "tgsi/tgsi_dump.h"
 #include "tgsi/tgsi_parse.h"
 #include "nir/tgsi_to_nir.h"
index 361660857eef7f2a910e6d6368387adca80f4fb0..79f4d5f951928a534624e75640992dac42078abc 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "pipe/p_screen.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd2_screen.h"
 #include "fd2_context.h"
index ed1bbb1368dada4f313490248f69b663db0d4fe9..c6e0c4a4d79cb2041f638ed9b0dd0c974584213b 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "pipe/p_defines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd2_util.h"
 
index 13b80ad8c930a72fe78cd0a8749f9e30560650aa..94dbd008a7dace6d3ce26969de7c7b62c027e54e 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_prim.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "freedreno_state.h"
 #include "freedreno_resource.h"
index ca0bad98cdc3054d2406097664159add5ed7fc0a..1c96eff1ad7a42cca64a78a3b60baefc9f7cd9e5 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_helpers.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_viewport.h"
 
 #include "freedreno_resource.h"
index b72a3751758e8dbc58583c45ca88dabfe6d1e1fe..d5e9b156ade07df8186db4c69d7cd94b06d6119f 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 #include "pipe/p_defines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd3_format.h"
 
index 7286770d8c99555de2181289cee894906c964437..48721c6d89153df9c2ac17374e4445a830005688 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef FD3_FORMAT_H_
 #define FD3_FORMAT_H_
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "freedreno_util.h"
 
 #include "a3xx.xml.h"
index 50a93c53cd540adcbdd6779006d20a81df89fa02..361dc356cf8115758e39d88336538c352b5124d5 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "freedreno_draw.h"
 #include "freedreno_state.h"
index 893518935c8abc21f565c2b07993ebd9065bf4ac..6c0f066e15a054cfd37e7742456180a58ee88847 100644 (file)
@@ -29,7 +29,7 @@
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "freedreno_program.h"
 
index 1c059104b59e26c47abb6115b88ef81f60ddf8fb..bdf8eaa06984a679aedba8ce30dca0e24723132e 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "pipe/p_screen.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd3_screen.h"
 #include "fd3_context.h"
index 13fa93489974e379275c5d45baeabb1bc909d73b..9fc91273b6d89d3c362ac3dace79c251aeb31eaf 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd3_texture.h"
 #include "fd3_format.h"
index 06d425b8957f869dfeff51462b12ea0c9415d6d6..0bf38924fb7f7a5d55e15b90b65e7891c5224b0c 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_helpers.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_viewport.h"
 
 #include "freedreno_resource.h"
index 0a36382b79d1fe28c1f0fd222debbdf37ca14f2f..a9768acb07b7485b0e5917af5f6aa98d858fa192 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "pipe/p_defines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd4_format.h"
 
index 663a49c69c88822c9cf2d8d412821186ad3cedb3..9121776ce6b236b1a8b1de0f8ff5a3875e55592c 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "freedreno_draw.h"
 #include "freedreno_state.h"
index 002de9f1923173d36347d7bbca0c6586209ca1a3..ae86c35fe452c8f5c523c5dde16cfe9cbc15a4f0 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "freedreno_program.h"
 
index c775ebfd1fc48c9fb8fbc30b05f2c5eda55bb895..98287b95145aaa08fd27962e34896ce77b3bacdc 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "pipe/p_screen.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd4_screen.h"
 #include "fd4_context.h"
index 306da8de15b9c6cfe2edf4bcb732d730891dbc0d..9ee4d8bd463317d937a1ec082fe7d31a476ae2a9 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd4_texture.h"
 #include "fd4_format.h"
index ce0bba60b476b0a1096a929a256fa35e79b61fe3..4de5d0aa62d596999ff7725d2234d58e64fc05bd 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_helpers.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_viewport.h"
 
 #include "freedreno_resource.h"
index f2091ad7cc06dffdd160ef09cbdb8d3f6be7feff..3686f1633f1348218efacdb8235776209788d02e 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "pipe/p_defines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd5_format.h"
 
index df9e85a8f310ccb5aeb4be2a5913be19d62a9573..9e2b48b1af1b9ca310cf1218da0054d0c6648d63 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "freedreno_draw.h"
 #include "freedreno_state.h"
index 8f6ee9a687e4d314b4addc47f41a7b00e819bb2a..53718db341b59181ab1dd5dec5f3eeb0fc69d2bd 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/bitset.h"
 
 #include "freedreno_program.h"
index 14f8ab77221121e27f6c7f7e2b75c98caa38d23d..0f84b208d69df42887caee77ed3eb6491f614450 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "pipe/p_screen.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd5_screen.h"
 #include "fd5_blitter.h"
index 1ebaa3a4587f5a3622e7b48d75493c8d82f1d163..23af2560cec247c57566c2e9ad4a605b245f8d6a 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd5_texture.h"
 #include "fd5_format.h"
index 8a548953e9bbee0cfdcf9ab4583c181f6109451f..d77ed112fcae1aef27047641bbcdb4d00e7fdf46 100644 (file)
@@ -29,7 +29,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_helpers.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_viewport.h"
 
 #include "freedreno_resource.h"
index 0e9078bd71a666b522a0868f814a0ce8e068e563..448f104f1243ba67de10ea9e8410347a3b42cf56 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #include "pipe/p_defines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd6_format.h"
 #include "freedreno_resource.h"
index 470e972f9e5fa40ad46e20a2784c868533c88c80..1b8bea6f684814a3a72cfbb3ed1335dee448a449 100644 (file)
@@ -31,7 +31,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "freedreno_draw.h"
 #include "freedreno_state.h"
index 213db91ff1ca3d5c32b8f90613083825b2512e88..a37d1431d6c3c564c925f2f3cc9f4419493b83b4 100644 (file)
@@ -29,7 +29,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/bitset.h"
 
 #include "freedreno_program.h"
index dddda98f1219435b839663142ea64bc84ed6d16b..056ba6e1382aba853b15d8eb8691e0fce71ee6e4 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "drm-uapi/drm_fourcc.h"
 #include "pipe/p_screen.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "fd6_screen.h"
 #include "fd6_blitter.h"
index 7508b6a44fb8b93ef396614a1e79b11e4427523b..5df197c62c9dcbb035cd4a88c03189f87736aeb7 100644 (file)
@@ -29,7 +29,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/hash_table.h"
 
 #include "fd6_texture.h"
index b738498c56baabdd7465c33ff05a17b596c85fc3..c1e0afad7e91a8945dc8e2564e6758207cd7b280 100644 (file)
@@ -29,7 +29,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_prim.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_helpers.h"
 
 #include "freedreno_blitter.h"
index 851abb9c6cc1f31558bb82558994a368380ad8c9..a8568a1ef93f10af39eeb8a6ff1566ab7f159d91 100644 (file)
@@ -28,7 +28,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "freedreno_gmem.h"
 #include "freedreno_context.h"
index d52f9441f6361cc1e898d5eb89b243a8803aaf36..082119b4e17b55b480acb8d6917428ee3f959727 100644 (file)
@@ -24,9 +24,9 @@
  *    Rob Clark <robclark@freedesktop.org>
  */
 
-#include "util/u_format.h"
-#include "util/u_format_rgtc.h"
-#include "util/u_format_zs.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_rgtc.h"
+#include "util/format/u_format_zs.h"
 #include "util/u_inlines.h"
 #include "util/u_transfer.h"
 #include "util/u_string.h"
index fb84bb9b6c5cc12964e3b0334bee9be45efbac5b..45454e8c066d4781d5b25fdebeab15f2ebc3cc17 100644 (file)
@@ -31,8 +31,8 @@
 
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_screen.h"
 #include "util/u_string.h"
 #include "util/u_debug.h"
index 74e9f9a7187c8c818b7b40a206e3059b51790cca..bf1e05ba740ac0f4089b1cfa0d3b44539f56d699 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "pipe/p_defines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "freedreno_util.h"
 
index 8d77c7357c397f7e2bad0d5a19404342210d438e..119f9660ac55f77c878e567c97697497eecc00de 100644 (file)
@@ -29,7 +29,7 @@
 #include "util/u_string.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "tgsi/tgsi_dump.h"
 #include "tgsi/tgsi_parse.h"
 
index a1af7891043aa1e10c04598673c361e1d096e96b..a1c3314f4e2a9c84692ca88a9e80822458b8a36a 100644 (file)
@@ -30,7 +30,7 @@
  */
 
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_pack_color.h"
 #include "i915_context.h"
 #include "i915_screen.h"
index 0521f2c4e297acf939c20f660f920bf98fd4d9a9..e16d2ac2f6a5eb9087febaa01c6fcf498afa7681 100644 (file)
@@ -34,7 +34,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_rect.h"
index 45d7ec94e0bc5d9e61fe38921b052464087502f1..a22eaa95abb5f974796a6c03fc1b0d5b075ed24f 100644 (file)
@@ -28,8 +28,8 @@
 
 #include "draw/draw_context.h"
 #include "util/os_misc.h"
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_screen.h"
index a407020f67a9d329490f48ba8842005c9cfc545b..9f0f9e33ca3fc84ea8645369e1ad2e2ac4b6aaab 100644 (file)
@@ -37,7 +37,7 @@
 #include "pipe/p_defines.h"
 #include "pipe/p_format.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
index 57e90c6ed23a8c2c672c5966cef606d3fda817be..bf5005cb01a356e88add0c652b66cab3bfd218d9 100644 (file)
@@ -34,7 +34,7 @@
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_pack_color.h"
 #include "util/u_surface.h"
index 4edec91fb08c6fc8955abd82c0625df6fe55f1aa..2d420894435a8d0a98dcc72143a1b20959314589 100644 (file)
@@ -25,7 +25,7 @@
 #include "pipe/p_state.h"
 #include "pipe/p_context.h"
 #include "pipe/p_screen.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/ralloc.h"
 #include "intel/blorp/blorp.h"
index 71657bb29e9cbb40640a1b49f32ccfd35d01fb87..bc6fe1ded0f5ba518d629adeefc7b78df3c75fd2 100644 (file)
@@ -27,7 +27,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_screen.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_upload_mgr.h"
 #include "util/ralloc.h"
 #include "iris_context.h"
index 7859b72efdcebeaa120037c93c0f6185ccbb8fa7..ebbb865a1508ab94d6a0431236e2a3311b470b4e 100644 (file)
@@ -26,7 +26,7 @@
 #include "pipe/p_state.h"
 #include "util/ralloc.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_upload_mgr.h"
 #include "drm-uapi/i915_drm.h"
 #include "iris_context.h"
index 94b89be84e0fc5937d7eb3d00389f15e50dfb091..5205365604d9b4b358ede44ce20bdda535a35be6 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "util/bitscan.h"
 #include "util/macros.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "iris_resource.h"
 #include "iris_screen.h"
index c65fd51764a92d1142ae891448601a284f439647..df1bf0f745126258d13245a927976e3d269ffe42 100644 (file)
@@ -37,7 +37,7 @@
 #include "util/os_memory.h"
 #include "util/u_cpu_detect.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_threaded_context.h"
 #include "util/u_transfer.h"
 #include "util/u_transfer_helper.h"
index f540d387f8b679afe7e92a47b76daf0e86a3b9d8..f1bb03de8f94ef570ea6d7a025343059a7365e2a 100644 (file)
@@ -39,7 +39,7 @@
 #include "pipe/p_screen.h"
 #include "util/debug.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_transfer_helper.h"
 #include "util/u_upload_mgr.h"
 #include "util/ralloc.h"
index 5a554f4bb1b01ad1de2c0e48d2a18d9d689e3aaa..da6c89260014dd7b0ebfb01629c87f5258637940 100644 (file)
@@ -90,7 +90,7 @@
 #include "pipe/p_screen.h"
 #include "util/u_dual_blend.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_framebuffer.h"
 #include "util/u_transfer.h"
 #include "util/u_upload_mgr.h"
index 773614879f906a2da40c3b8143782ce04b46347f..ea318a103d58dc9f47ec1e969a215d312b0c5ab4 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_debug.h"
 #include "util/u_half.h"
 #include "util/u_helpers.h"
index 5898670e397cf453ffbe4c8f3b8f0435c7327450..024ec41da44bd6ed59d2bf7a62854e8f7473b017 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "util/u_memory.h"
 #include "util/u_blitter.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_math.h"
 #include "util/u_debug.h"
index 6e2d0376dcded7c676c7a8c133e188b64f09c309..c7ab0168f602b58e15972568f3c50171191d0214 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 #include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "gallivm/lp_bld_type.h"
 #include "gallivm/lp_bld_const.h"
index c16ef1a2e918453d5305f5177beaaf2729e33399..985cda699b3d7be5774599dc30c3fb2b0eb025cd 100644 (file)
@@ -45,7 +45,7 @@
 
 #include "pipe/p_state.h"
 #include "util/u_debug.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "gallivm/lp_bld_type.h"
 #include "gallivm/lp_bld_const.h"
index d5d5c5a786e95bc5cc0add9272e8f629356a0444..63c2fb5d891757c073e8fa4ca8f1e9c28bca8b80 100644 (file)
@@ -50,7 +50,7 @@
  */
 
 #include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_cpu_detect.h"
 
 #include "gallivm/lp_bld_type.h"
index 59d3a2d8c88cbac5b3ae658f8e77ca61a3241952..4b5ca81926a092e263fed58d5367d936ad6141b1 100644 (file)
@@ -28,7 +28,7 @@
 #ifndef LP_RAST_PRIV_H
 #define LP_RAST_PRIV_H
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_thread.h"
 #include "gallivm/lp_bld_debug.h"
 #include "lp_memory.h"
index ef0136c4fd2eb40a2d65055c9e11dd27e5cfdff0..beab118ac497564a18ed9a02460ea5d53aabff73 100644 (file)
@@ -30,7 +30,7 @@
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/simple_list.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "lp_scene.h"
 #include "lp_fence.h"
 #include "lp_debug.h"
index 63c1793620db323aadc6ac6cd10fde067d0195e1..7c35d148d26e29a8431fa317ca19dc68bb9307db 100644 (file)
 #include "util/u_memory.h"
 #include "util/u_math.h"
 #include "util/u_cpu_detect.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_screen.h"
 #include "util/u_string.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format_s3tc.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
 #include "draw/draw_context.h"
index 19a9e4276943743865d18b0d72c5fce757e7597c..5831d935bd44c60ae163c31b229e77de07187dbd 100644 (file)
@@ -62,7 +62,7 @@
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_pointer.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_dump.h"
 #include "util/u_string.h"
 #include "util/simple_list.h"
index b20b9c5cdd5e0db9aa3916efc24c8f7734d57d12..9c698383ecc5d5ca5281a62c326bb34efa46334e 100644 (file)
@@ -39,7 +39,7 @@
 
 #include "draw/draw_context.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 
 /**
index 3d00b01253cae6d948d4b659b88acd21895bcd2d..ecd16c87d8ae386fa15907d4ef7be6459eba2a86 100644 (file)
@@ -44,7 +44,7 @@
 #include "gallivm/lp_bld.h"
 
 #include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_dump.h"
 
index a88272cdb3aebd624551dd5cd28c74a9a8177b6f..9877a219c48ed964ae418e284ad7f399f92b7388 100644 (file)
@@ -33,9 +33,9 @@
 #include "util/u_memory.h"
 #include "util/u_pointer.h"
 #include "util/u_string.h"
-#include "util/u_format.h"
-#include "util/u_format_tests.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_tests.h"
+#include "util/format/u_format_s3tc.h"
 
 #include "gallivm/lp_bld.h"
 #include "gallivm/lp_bld_debug.h"
index 3a182b67384dec2cb629543e68ac1fa095361786..0d5c4ac544d112aa54bcfa711d2fcd1508894f73 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "util/u_inlines.h"
 #include "util/u_cpu_detect.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/simple_list.h"
index 3552b831a857408b22d9a2e051c0292702662903..de9cce3812aa9c6aea382fb67f4452e2138876d1 100644 (file)
@@ -4,8 +4,8 @@
 
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_string.h"
 
 #include "util/os_time.h"
index 95d8866bae895d523d973b7dd9469fd6bec79f41..9394a6537695fc725c11e63165c0a4f523d4cc5f 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "nouveau_buffer.h"
 #include "util/u_video.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_sampler.h"
 
 static int
index d2e6945877bc7e2d82e50e4417a3957d829bd935..7c5ae25736da145306e0b78d12ded523d57f8a49 100644 (file)
@@ -32,7 +32,7 @@
 #include "nouveau_vp3_video.h"
 
 #include "util/u_video.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_sampler.h"
 
 static struct pipe_sampler_view **
index cdaffd433aa8f5733d903be86929978a387a756c..e4ed0dbd2a8b7f75fa043008ca0ddface6338ad7 100644 (file)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_surface.h"
 
index fc8520b89523564819c4099e5f27784389319074..13744c9dfa5e7050a8bf4e325cc51eba81a73412 100644 (file)
@@ -26,7 +26,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "translate/translate.h"
 
 #include "nv_object.xml.h"
index ff34f6e5f9fa47374a9b8c04d9cc1e473d40b440..85625cc8238b1dc19fcf2edd3efcb687805d16eb 100644 (file)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 
 #include "nv30/nv30_screen.h"
index 8572d46ee4403ca452f15289e701783ee4097ad9..c4b514cfa6185378e1ad6bfa6bf88aa64dee8ad4 100644 (file)
@@ -25,8 +25,8 @@
 
 #include <xf86drm.h>
 #include <nouveau_drm.h>
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_screen.h"
 
 #include "nv_object.xml.h"
index 19e10d31d92fba1a06360e78b80b3337beb582c9..09fdc80abc3a75f1b79857526e8efd7c3c5715e1 100644 (file)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_helpers.h"
 #include "util/u_inlines.h"
 
index 4ed94e0b4e424b9ba354ed1a6525f875a8956fd1..c67004bdf514b8c8d804c125a8641934756756b0 100644 (file)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_half.h"
 
index 358b3bbc32c514d98c579b4eb79431dc36ced9ab..dfea6dea3d7ca5d7357251b8e1fc09c32b4d3f7b 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "nv_object.xml.h"
 #include "nv30/nv30-40_3d.xml.h"
index 47797cae726404e575cf2af9902642794377a958..b083acfac3eee47591f519bac9c01d53bc8d2bb2 100644 (file)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_prim.h"
 #include "translate/translate.h"
index 01667bb5f6607ee777892c8d27bcb0eb634a923a..30c1f76132bd6d8bd49e89dde6d990b5c4c802f4 100644 (file)
@@ -3,7 +3,7 @@
 #define __NV50_BLIT_H__
 
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 void *
 nv50_blitter_make_fp(struct pipe_context *,
index 786d1803306b5ba59c2cf86e114b1f22bd100e26..400ce6c93263ebd7627b075d80f590ee87dbe805 100644 (file)
@@ -23,7 +23,7 @@
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "nv50/nv50_context.h"
 #include "nv50/nv50_resource.h"
index 15666d346c1a7337b685fccd724766cd30a7b6e3..d835e9d696a1a8db3afa4f2c920b027f6e396dd1 100644 (file)
@@ -2,7 +2,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "translate/translate.h"
 
 #include "nv50/nv50_context.h"
index aed8c6241d4b10deb1ae8fdb57d0c2739899f817..e26f10da262ec98316af78250b910b8024134225 100644 (file)
@@ -1,7 +1,7 @@
 
 #include "pipe/p_context.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "nouveau_screen.h"
 
index 062de628079040ccfc84a106b0f029eaa85e3ae3..ad35bd8cd4267730f2732c8a0a1b1e6734bcd83f 100644 (file)
@@ -23,8 +23,8 @@
 #include <errno.h>
 #include <xf86drm.h>
 #include <nouveau_drm.h>
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_screen.h"
 #include "pipe/p_screen.h"
 #include "compiler/nir/nir.h"
index 84e537c7cfa9fd7b2e504c0ff4c36277091cf633..c64be0a348f8defb38d6f48ee05b74258f01c4fa 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "util/u_inlines.h"
 #include "util/u_pack_color.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_surface.h"
 
index 741e350c2733f1cc5d17354615949e7eac097ef9..a9bf6c023d89ed812657a37a8cb68f6bd82e6d64 100644 (file)
@@ -25,7 +25,7 @@
 #include "nv50/g80_texture.xml.h"
 #include "nv50/g80_defs.xml.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 static inline uint32_t
 nv50_tic_swizzle(const struct nv50_format *fmt, unsigned swz, bool tex_int)
index 8209f1f1e826edd8222123b0b5ac3d2e50bf66aa..28dd02e7e56ef926db0327ab314e1772d965ad82 100644 (file)
@@ -1,5 +1,5 @@
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "nv50/nv50_context.h"
 
index ed041121a2658fb44b5fd41805349ce74a2b47cf..865d8b4359dc8b5ca7e15d54f4ae22faac2c09c4 100644 (file)
@@ -23,7 +23,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "translate/translate.h"
 
 #include "nv50/nv50_context.h"
index dbec1f786f152eb708b66ed83618fcb948b10fae..927f7a29f8e7cb4eba0b35334e158e5bbb979a02 100644 (file)
@@ -25,7 +25,7 @@
 #include <sys/types.h>
 #include <fcntl.h>
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_sampler.h"
 #include "vl/vl_zscan.h"
 
index e4b57358936498c187d61d26137f13066601b252..ab426d6f5e16e6cf7f8d808856c2b839abb98b9e 100644 (file)
@@ -23,7 +23,7 @@
 #include "nv50/nv98_video.h"
 
 #include "util/u_sampler.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include <nvif/class.h>
 
index e6847bac0ad04160a5f1dbec9d54faeab735a572..c897e4e8b97e22f8d6b7b7856572a100b9dfec57 100644 (file)
@@ -26,7 +26,7 @@
 #include "pipe/p_defines.h"
 #include "state_tracker/drm_driver.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "nvc0/nvc0_context.h"
 #include "nvc0/nvc0_resource.h"
index bbb0784190a503b99a7fbdc2720f05d7648bfcd3..cb3c5548427a6818538af1ad967e8f04f8e2fbb9 100644 (file)
@@ -23,8 +23,8 @@
 #include <xf86drm.h>
 #include <nouveau_drm.h>
 #include <nvif/class.h>
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_screen.h"
 #include "pipe/p_screen.h"
 #include "compiler/nir/nir.h"
index 85dcf80655c0feb95dfc87fb387c01aea57790ef..c7513f96f22c6600fa59a37c012cff5b05199988 100644 (file)
@@ -1,4 +1,4 @@
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_framebuffer.h"
 #include "util/u_math.h"
 #include "util/u_viewport.h"
index 7031aef6244e344728e2599567a25b68bf0fb013..5f6301498367c9163bba76ad9e2a47e44ea60949 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "util/u_inlines.h"
 #include "util/u_pack_color.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_surface.h"
 
 #include "os/os_thread.h"
index 4948a8f4cea7caf5c9a2dfb36de520f817ff9508..8cb9776d9cd6ac4b0c406c5bc84b58fb32d0d451 100644 (file)
@@ -27,7 +27,7 @@
 #include "nv50/g80_texture.xml.h"
 #include "nv50/g80_defs.xml.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #define NVE4_TIC_ENTRY_INVALID 0x000fffff
 #define NVE4_TSC_ENTRY_INVALID 0xfff00000
index 225b89471714029090870a0c2eced70eb0d2b416..74ce56a5c5593dc2087a8c0c0a65452b8fbe88e0 100644 (file)
@@ -1,5 +1,5 @@
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "nvc0/nvc0_context.h"
 
index 7d6be9382d1848f7815b923777ff5dce94ab5b25..6ed96509bf484798ac9f961fb6896760aa0465fd 100644 (file)
@@ -25,7 +25,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "translate/translate.h"
 
 #include "nvc0/nvc0_context.h"
index 64903fc5cf03ce2a82365ed791f14b09cbb12cc0..8aa7088dfec95270a5b48449edcfe468a1f17dba 100644 (file)
@@ -2,7 +2,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "translate/translate.h"
 
 #include "nvc0/nvc0_context.h"
index c5871f8a22111c3ddfb1dd34a9b7325eaff8bb19..f3531da2815df05364351906b87838e3cbca57b8 100644 (file)
@@ -23,7 +23,7 @@
 #include "nvc0/nvc0_video.h"
 
 #include "util/u_sampler.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 static void
 nvc0_decoder_begin_frame(struct pipe_video_codec *decoder,
index 60d02320fdf8338c5163cab2c3a9cc78f63aac63..6f0e7fe4b1eac833c862944cd113590cc415f25a 100644 (file)
@@ -41,7 +41,7 @@
 #include "compiler/nir/nir_builder.h"
 #include "compiler/nir/nir_format_convert.h"
 #include "nir_lower_blend.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 /* Determines the best NIR intrinsic to load a tile buffer of a given type,
  * using native format conversion where possible. RGBA8 UNORM has a fast path
index 23e1ec921dd35c997962f6e04025d4b56501d340..9de10e4ac4873a57578ce7e9c2cd142445764871 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "pan_resource.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 /* Arm FrameBuffer Compression (AFBC) is a lossless compression scheme natively
  * implemented in Mali GPUs (as well as many display controllers paired with
index 2788d213fef6f306abde923d0d1fdb08abf53783..297bd0f3fd978ed19c6cef1f3ef402b5a858e86b 100644 (file)
@@ -26,7 +26,7 @@
 #include "pan_blending.h"
 #include "pan_context.h"
 #include "gallium/auxiliary/util/u_blend.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 /*
  * Implements fixed-function blending on Midgard.
index 2d44f06227bf853fca728c5e1bac2e5712226a19..a9bad17bd45cf4b37233cd2da71a626eb0ca4de7 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 #include "pan_context.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 static void
 panfrost_blitter_save(
index 09a319ec2fbc41f5769d1c0c2d74ca88d33894f2..dba2517c92a05ef12b7af84fb9cde5a793c3abf2 100644 (file)
 #include "pan_format.h"
 
 #include "util/macros.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_upload_mgr.h"
 #include "util/u_memory.h"
 #include "util/u_vbuf.h"
 #include "util/half_float.h"
 #include "util/u_helpers.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_prim.h"
 #include "util/u_prim_restart.h"
 #include "indices/u_primconvert.h"
index a881b3721eec89fb613f874d62ddad18eeb37143..8468904da239f9356ee230f2a67fa2f0d52bd57e 100644 (file)
@@ -26,7 +26,7 @@
 #define __PAN_FORMAT_H__
 
 #include "pan_context.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 unsigned
 panfrost_translate_swizzle_4(const unsigned char swizzle[4]);
index 00ff363a1bba7a15e667265075db5955f00cbbec..9fe39d7c1bba2cd5309b453de5cecfadf14ffca3 100644 (file)
@@ -26,7 +26,7 @@
 #include "pan_util.h"
 #include "pan_format.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 /* Mark a surface as written */
 
index a0bc999f1ae9c114fa2bfaa03a175d23013b44c1..3df1cc226ee70c2a57798365c7478a1d7f90b326 100644 (file)
@@ -31,7 +31,7 @@
 #include "pan_context.h"
 #include "util/hash_table.h"
 #include "util/ralloc.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_pack_color.h"
 #include "pan_util.h"
 #include "pandecode/decode.h"
index 38b901a700d558211777ea6b6fa3d95e0920599f..10a27c9d8dd51ec6f8cde7b7c276482d5e1c0d14 100644 (file)
@@ -27,7 +27,7 @@
 #include "pan_util.h"
 #include "pan_format.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 static struct mali_rt_format
 panfrost_mfbd_format(struct pipe_surface *surf)
index 08a3713a84ce8efef1f30a8938f63fc2cd64650d..85c9824623ccc06593e89268302698206bb5579f 100644 (file)
@@ -34,7 +34,7 @@
 #include "drm-uapi/drm_fourcc.h"
 
 #include "state_tracker/winsys_handle.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_surface.h"
 #include "util/u_transfer.h"
index c9c50e4ef18a2e2d57d7a994c13a5dea838e2346..7519de4e2fc8d5a18d5ba583c40df9e28d425314 100644 (file)
@@ -28,8 +28,8 @@
 
 #include "util/u_debug.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_video.h"
 #include "util/u_screen.h"
 #include "util/os_time.h"
index dda8a68db7687703c448be95190c155846ffb9cd..3fe462ee37de74637c9061a4c66ecac0538256d8 100644 (file)
@@ -27,7 +27,7 @@
 #include "pan_util.h"
 #include "pan_format.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 static struct mali_sfbd_format
 panfrost_sfbd_format(struct pipe_surface *surf)
index cda702e78f27533f78b3f8e9107ed403828ed402..33344982c1ea53e1dd983fa1065902e96b3a82be 100644 (file)
@@ -25,7 +25,7 @@
 #include "r300_texture.h"
 #include "r300_reg.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_half.h"
 #include "util/u_pack_color.h"
 #include "util/u_surface.h"
index 80c959b95d0d3bb2c6c21136f65546fa0173eb1d..dc33aea95c2ce4602aca54979640d63a3dea586c 100644 (file)
@@ -23,7 +23,7 @@
 
 /* r300_emit: Functions for emitting state. */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 
 #include "r300_context.h"
index 7d76c06ed6b11f259a1bd51d157046e9c0ea73a9..ffb041e2488c735dfde0572c7780d298cb38d294 100644 (file)
@@ -22,7 +22,7 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
index d86819afa7c0ac6bdde36331e1cf9533368234a3..6e85ae43cad80ecbb0a5aee49f731602f003b2dd 100644 (file)
@@ -25,7 +25,7 @@
 #include "r300_reg.h"
 #include "r300_fs.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 /*
   HiZ rules - taken from various docs 
index c0d7e7ee0f8a93829fdc970fd1a0dab6eb5894b1..9c21023481c8c48325b492cafcc84ba9392ee068 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "util/u_inlines.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
 #include "util/u_prim.h"
index 0651a3ecdb14efbbbbe9fce358a42657e255bfef..1300596db27adf1c31305e943a8145c5510507c1 100644 (file)
@@ -21,8 +21,8 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_screen.h"
 #include "util/u_memory.h"
 #include "util/os_time.h"
index fbd91cda9fe4eadc459c7bbd560abfd540ac4c78..219c3073f0988232ba7d0f524ce0d44fc326ab33 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "draw/draw_vertex.h"
 #include "pipe/p_format.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "r300_reg.h"
 #include <stdio.h>
 
index f977dd14dc70fb9bd7d493fd1c0cefd2facd96d2..42b18752e49fa6aabd2014b1e1631a7ff4204a3e 100644 (file)
@@ -30,8 +30,8 @@
 #include "r300_transfer.h"
 #include "r300_screen.h"
 
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
index 37e7b5fc4e2882e0d3ed907ed04a3d26a6375511..5da35fba7e113aec4ce8397023c2672b9474e24b 100644 (file)
@@ -24,7 +24,7 @@
 #include "r300_texture_desc.h"
 #include "r300_context.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include <inttypes.h>
 
 /* Returns the number of pixels that the texture should be aligned to
index 9d00f4d937370a300768f748cfb6eca2804b357f..95cea7265512fb53b3d95b57c6e92058443b23ec 100644 (file)
@@ -26,7 +26,7 @@
 #include "r300_screen_buffer.h"
 
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_box.h"
 
 struct r300_transfer {
index 84f265b189ba2a4ad1ad567b284835d29df2b5a7..606b3892e3b387f7fce07e504a08b2aa9bd828e9 100644 (file)
@@ -24,7 +24,7 @@
 #include "compute_memory_pool.h"
 #include "evergreen_compute.h"
 #include "util/u_surface.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "evergreend.h"
 
 enum r600_blitter_op /* bitmask */
index 9533aaa137853e2d1070088682f4c6d72eb1d8a6..df9d1367bff9913e6c24269fd4b005544759add2 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef R600_FORMATS_H
 #define R600_FORMATS_H
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "r600_pipe.h"
 
 /* list of formats from R700 ISA document - apply across GPUs in different registers */
index 4c914fa082f63ae190b0050957ed5893cf82f68e..486e503422efcd61518969600f242ff7ce2df377 100644 (file)
@@ -30,7 +30,7 @@
 #include "util/list.h"
 #include "util/u_draw_quad.h"
 #include "util/u_memory.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_upload_mgr.h"
 #include "util/os_time.h"
 #include "vl/vl_decoder.h"
index d9309edf2797b70905ed749f9d9db6c587fa954e..fe17d10c201bfa55d3a96324a72329e69e37f93c 100644 (file)
@@ -28,7 +28,7 @@
 #include "r600_shader.h"
 #include "r600d.h"
 
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_index_modify.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
index fea8e609799dbbf0553e6bf49470525bcb031abe..518e92d9fe736d3d39e420484a04c75709971140 100644 (file)
@@ -27,7 +27,7 @@
 #include "r600_pipe_common.h"
 #include "r600_cs.h"
 #include "r600_query.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_log.h"
 #include "util/u_memory.h"
 #include "util/u_pack_color.h"
index 2a75c46337939caafbdfa5a7ae944d9d8b0e73ca..f08e759a35cfaf5c5b3f829e7eb62cd5d015e0a8 100644 (file)
@@ -63,7 +63,7 @@ $(intermediates)/radeonsi/si_driinfo.h: $(MERGE_DRIINFO) $(GEN_DRIINFO_INPUTS)
        $(hide) $(MESA_PYTHON2) $(MERGE_DRIINFO) $(GEN_DRIINFO_INPUTS) > $@ || ($(RM) $@; false)
 
 GEN10_FORMAT_TABLE_INPUTS := \
-       $(MESA_TOP)/src/gallium/auxiliary/util/u_format.csv \
+       $(MESA_TOP)/util/format/u_format.csv \
        $(MESA_TOP)/src/amd/registers/gfx10-rsrc.json
 
 GEN10_FORMAT_TABLE_DEP := \
index 48a2f8870ebcd214584e63188f247ae52ddd51e6..dd091e7d3626b5fdb868c5b3c00b9b19d5713449 100644 (file)
@@ -34,8 +34,8 @@ import re
 import sys
 
 AMD_REGISTERS = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../../../amd/registers"))
-GALLIUM_UTIL = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../../auxiliary/util"))
-sys.path.extend([AMD_REGISTERS, GALLIUM_UTIL])
+UTIL_FORMAT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../../../util/format"))
+sys.path.extend([AMD_REGISTERS, UTIL_FORMAT])
 
 from regdb import Object, RegisterDatabase
 from u_format_parse import *
index 600f632dfd0a884c9047891379e5b9037a540ceb..3baf70a020e9aaa5e7be1032d79d857d3cb91fdf 100644 (file)
@@ -105,7 +105,7 @@ gfx10_format_table_h = custom_target(
   'gfx10_format_table.h',
   input : files(
     'gfx10_format_table.py',
-    '../../auxiliary/util/u_format.csv', '../../../amd/registers/gfx10-rsrc.json'
+    '../../../util/format/u_format.csv', '../../../amd/registers/gfx10-rsrc.json'
   ),
   output : 'gfx10_format_table.h',
   command : [prog_python, '@INPUT@'],
index 858fc167c57f18f49b254b8fb15271bd68431e82..0afed60ae5ba358dc6c03f960141f74e2ba18f93 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "si_pipe.h"
 #include "si_compute.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_log.h"
 #include "util/u_surface.h"
 
index 63f73e189e0245dbc9bf53e972785da49f463d75..aab208c5ed6db7de1893d4c3a322423affbe811b 100644 (file)
@@ -25,7 +25,7 @@
 #include "si_pipe.h"
 #include "sid.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_pack_color.h"
 #include "util/u_surface.h"
 
index e07042adf3fe5e7951e12e95a02e781b6da4aa21..ff573c131f4e6a7d7076787c5ffa12db675ecd76 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "si_pipe.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/format_srgb.h"
 
 /* Note: Compute shaders always use SI_COMPUTE_DST_CACHE_POLICY for dst
index fa72e5780dc7bb2b611e5085f81da48d9fd0eb96..76c90a872ea48da9bda70670332150cb7aef80d5 100644 (file)
@@ -58,7 +58,7 @@
 
 #include "util/hash_table.h"
 #include "util/u_idalloc.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
 
index 1a5962ea78ba9a598f377b54723cd6088df47f8a..c277673c2dff3f5ec41cdb02cd24bb4aa8597957 100644 (file)
@@ -26,7 +26,7 @@
 #include "sid.h"
 #include "si_pipe.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 static void si_dma_copy_buffer(struct si_context *ctx,
                                struct pipe_resource *dst,
index 783ede89d0dd23599513ad0b0c9d1134487387d0..1339383610f560f8d2a07b1512a478995e740176 100644 (file)
@@ -27,8 +27,8 @@
 #include "si_query.h"
 
 #include "util/u_dual_blend.h"
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_memory.h"
 #include "util/u_resource.h"
 #include "util/u_upload_mgr.h"
index bbd87ee0b5fea10a4a5584a3a0f92ed77c8f3e34..eb17f6c82c4787117054a2e1a73c01b1d1a58be9 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "si_pipe.h"
 #include "si_query.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_log.h"
 #include "util/u_memory.h"
 #include "util/u_pack_color.h"
index 3ec738527af4095227fa85e36b244f1edd9e3119..99925c38042123ea46a088e3823a494bd64eccd2 100644 (file)
@@ -25,7 +25,7 @@
 #include "sp_buffer.h"
 #include "sp_texture.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 static bool
 get_dimensions(const struct pipe_shader_buffer *bview,
index 49b775cf0cc6b7e0c20240f67642500c8c7099cf..08673d465e5b39fbfac7f7c6da44d9568e878377 100644 (file)
@@ -25,7 +25,7 @@
 #include "sp_image.h"
 #include "sp_texture.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 /*
  * Get the offset into the base image
index 5b458450cd843b855f06020311d00c962d3947e3..975a760118f901c27557d83fe898634c4f51148e 100644 (file)
@@ -33,7 +33,7 @@
 #include "pipe/p_defines.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_dual_blend.h"
 #include "sp_context.h"
 #include "sp_state.h"
index 98dd36d21a394522ee7da2af92662cc52f5e2ed6..e8433814c34edd349b0480e6518f894eb892975a 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 #include "pipe/p_defines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "tgsi/tgsi_scan.h"
index b51e14470c11770ebfd4acc80875ee3383e5bad0..41910c10a31a32ab6729d825a028a3fed66e8af2 100644 (file)
@@ -27,8 +27,8 @@
 
 
 #include "util/u_memory.h"
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_screen.h"
 #include "util/u_video.h"
 #include "util/os_misc.h"
index fda638dcea1ce1aa4e38b54446e37acdd14bb10f..ec1572646a2e9cda15fc7c72074820013c2c2550 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "draw/draw_context.h"
 
index aa2f11880dd27d12f97e0d59dd5b9a865d539574..b0cb55a2625e55f295d2f4686fce7bdd9379cc79 100644 (file)
@@ -29,7 +29,7 @@
 #include "sp_state.h"
 #include "sp_texture.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "draw/draw_context.h"
 #include "pipebuffer/pb_buffer.h"
index dc4756146d74672c4d62dc17fdefd68660e26bbb..4a83709016bd015dca92a4bc5634d1e2a08d17d2 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "draw/draw_context.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 
 
index 3908411376d2b551c98639b38e8ef92e77c77662..e0a4841edb0050a12172b50c237b1e2b5062aaf3 100644 (file)
@@ -25,7 +25,7 @@
  * 
  **************************************************************************/
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_surface.h"
 #include "sp_context.h"
 #include "sp_surface.h"
index b11ab21a04b919a8ee2d43b0ba4ddc1ea6ce530d..d3f67c6426c5619db36980f68df918725651d62c 100644 (file)
@@ -38,7 +38,7 @@
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "sp_quad.h"   /* only for #define QUAD_* tokens */
index e510ac58c06d5b45b57ec01588d6abb6646f2b11..29801e7638e5e89a705b50f38891cc522d8735b0 100644 (file)
@@ -35,7 +35,7 @@
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_tile.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "sp_context.h"
 #include "sp_texture.h"
index 094b3f7c9457fd364bb3e575106f7e13a699fa8e..a8f0e6cee5a583491ef20db96284ad65e14168d5 100644 (file)
@@ -33,7 +33,7 @@
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_transfer.h"
index 075d322f8024e6e0ff265f7f4966ed5a52621838..f3637538269f927a09eff023fa879e58b249cb1f 100644 (file)
@@ -33,7 +33,7 @@
  */
 
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_tile.h"
 #include "sp_tile_cache.h"
index d51e348fc43e395509b0562998153efbcfd7e889..488c68785c193bb6217ed3a85b50c512a4afe302 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "pipe/p_format.h"
 #include "util/u_debug.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 
 #include "svga_winsys.h"
index da7899ff4321546a6ec6e26c74c2463dab9159d8..d889d4a13a8a1b7819c856265cde12eaf9d43e04 100644 (file)
@@ -32,7 +32,7 @@
 #include "svga_surface.h"
 
 //#include "util/u_blit_sw.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_surface.h"
 
 #define FILE_DEBUG_FLAG DEBUG_BLIT
index f1e68dd726a3e6ba509e2428b749e300899d45b4..2f8fedb7aa0380113f2de93da743260e04783c9b 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "pipe/p_defines.h"
 #include "util/u_bitmask.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
index 8fbe8a15d05dd8db2df337ec3e2b0b7c31fbd78b..346a13105b72b325528161d5c58204582cc694a4 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "pipe/p_defines.h"
 #include "util/u_bitmask.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_helpers.h"
 #include "util/u_inlines.h"
 #include "util/u_math.h"
index f1d16563efb05612e1d90f757ea9861e9c3ec3ab..31ac6a9b7305293449304388662c20aa832aaa23 100644 (file)
@@ -29,7 +29,7 @@
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
 #include "os/os_thread.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
index 8689897ae7abc3b4fced0bc45364dbec8b0b51bb..d382071fc4938102c21b27ae96050d7af9d78df2 100644 (file)
@@ -29,7 +29,7 @@
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 #include "os/os_thread.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
index b9cd9db5cbca6e7f089d8610078ad1fe3425df73..dc521cf3f9cddf835d8060a94c89736e3cfc8b38 100644 (file)
@@ -24,7 +24,7 @@
  **********************************************************/
 
 #include "git_sha1.h" /* For MESA_GIT_SHA1 */
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/u_screen.h"
index 0dfab92814df91bcab897709f28bfd34574112ef..3a7516945c60533350d617f354711695d8a56d2f 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "util/u_bitmask.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "svga_context.h"
 #include "svga_cmd.h"
 #include "svga_format.h"
index 2c1b7048673ece9546b0699967a67cb064032178..e2c5bf0163a6ca1883a18b439d94e1034a161cab 100644 (file)
@@ -24,7 +24,7 @@
  *
  **********************************************************/
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "pipe/p_defines.h"
index 0aabde71e0e53e205dd5cb51a6bf0d584ff962a3..99fede512543008bbf6be70d559fa8356a7c8dac 100644 (file)
@@ -26,7 +26,7 @@
 #include "util/u_inlines.h"
 #include "pipe/p_defines.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "svga_context.h"
 #include "svga_state.h"
index 74c19926bc99259cc64080219db551f225bca4b8..d55a799d435acc4469fd1812e69576fea93a0a8b 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "util/u_inlines.h"
 #include "pipe/p_defines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_bitmask.h"
index 786839f705189f0a056391142d256294f1c86e35..3c42b4e8595963ffdc8d2bec409fae429e184d12 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "pipe/p_defines.h"
 #include "util/u_bitmask.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
index dfc193549caa3cefb733d3deec50611877411bad..306c55dbb11778e7bc73102447a9b0cd27a1aa15 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "pipe/p_defines.h"
 #include "util/u_bitmask.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
index 5d1f369fa902d9cbae33032f8a807b21b957ba48..2c48a66186fd816494fa59803fe31cfc2261e71f 100644 (file)
@@ -30,7 +30,7 @@
 #include "util/u_inlines.h"
 #include "os/os_thread.h"
 #include "util/u_bitmask.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
index 1975e11a9b5a86724f8986435a0fb0331c5b4878..74516c80f9b703ba02833c6efa91dcca39b57256 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_atomic.h"
 #include "util/u_upload_mgr.h"
 #include "util/u_transfer.h"
index 480c1500a869f9fc73783103df1d1863bbc5baa8..23bc3541ba43921d69e4e2210ae8eed7698a0987 100644 (file)
 #include "pipe/p_screen.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_cpu_detect.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_string.h"
 #include "util/u_screen.h"
 
index 0fa44043191f5a839bb01eeef4a563d73c140cb1..fac2a5ea8c7d7c210a44a35c2c382fc40323d18f 100644 (file)
@@ -29,7 +29,7 @@
 #include "pipe/p_screen.h"
 #include "pipe/p_defines.h"
 #include "util/u_dl.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "api.h"
 
 #include "memory/TilingFunctions.h"
index 20e855b988d5a0fae3a59e8406882d7db0f7a92c..513e5300dd8758c848839bb56b44d3789a0b5ae7 100644 (file)
@@ -44,7 +44,7 @@
 #include "functionpasses/passes.h"
 
 #include "tgsi/tgsi_strings.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_prim.h"
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_flow.h"
index 94507b2f2d9d680b54427d670b74fcb3a3c37604..345fef4c856be0ac09a65302da499885308e9207 100644 (file)
@@ -43,7 +43,7 @@
 #include "core/state_funcs.h"
 
 #include "gallivm/lp_bld_tgsi.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
index 6c69f00b704f60b5820c43ab7494d7c9d68ee564..f91caa9a92f51655e98b59bb5fb34040ba523ac5 100644 (file)
@@ -21,7 +21,7 @@
  * IN THE SOFTWARE.
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_surface.h"
 #include "util/u_blitter.h"
 #include "v3d_context.h"
index 75022d86c211c1c77d97add627d4785806b73b26..0f7762f119d669104784d9941004b6b4381327a7 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <inttypes.h>
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/ralloc.h"
index c2590fac1e5fdfaafae791221ce7709eaf45e576..84f6b8c9122cc0ac7e82f61ac65c792d145ef564 100644 (file)
 #include "pipe/p_defines.h"
 #include "util/u_blit.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_surface.h"
 #include "util/u_transfer_helper.h"
 #include "util/u_upload_mgr.h"
-#include "util/u_format_zs.h"
+#include "util/format/u_format_zs.h"
 #include "util/u_drm.h"
 
 #include "drm-uapi/drm_fourcc.h"
index 0f9e306685e8d37dcb4f07b6034351e30b34533f..935f320723919695d516a9f346f4a2886d49c2b5 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "util/u_debug.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_hash_table.h"
 #include "util/u_screen.h"
 #include "util/u_transfer_helper.h"
index 3a5b1171020226ff18f756f24fcfa97bcd1f596d..5a89912c77956a8bb408ec1850b6c20bdb9cbf3f 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "util/u_blitter.h"
 #include "util/u_prim.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_pack_color.h"
 #include "util/u_prim_restart.h"
 #include "util/u_upload_mgr.h"
index a3d32f4b7d7bb1e35a360eff66d5d432012680f8..3bf0dac8e851f8993082823480524602038fefd9 100644 (file)
@@ -21,7 +21,7 @@
  * IN THE SOFTWARE.
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_half.h"
 #include "v3d_context.h"
 #include "broadcom/common/v3d_macros.h"
index 18a1a86fa66085ece534f75524e83844caef595b..dd5648fcd703c1e320d5341fe578db739d4a4cf5 100644 (file)
@@ -21,7 +21,7 @@
  * IN THE SOFTWARE.
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "v3d_context.h"
 #include "broadcom/cle/v3dx_pack.h"
index 0434fe848361db1cbcce9e020d76dd387cdf93a0..20fd6211bde901e7880d5d3051a09a9c680f22c7 100644 (file)
@@ -21,7 +21,7 @@
  * IN THE SOFTWARE.
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "v3d_context.h"
 #include "v3d_tiling.h"
 #include "broadcom/common/v3d_macros.h"
index 95b28048dd238925f501ca42f480b66134f1f683..eca3014f6fd7fd8d45d15fe14f3c4eba25caad9b 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 #include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_framebuffer.h"
 #include "util/u_inlines.h"
 #include "util/u_math.h"
index d379bcc1bb50d50bb59a83d28af947f6c057f8dc..93b1478ddd19c95cdc4ff3636dc8a523a1307af7 100644 (file)
@@ -21,7 +21,7 @@
  * IN THE SOFTWARE.
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_surface.h"
 #include "util/u_blitter.h"
 #include "compiler/nir/nir_builder.h"
index 5ac658c27ae4fa4274ce565cf813702386482a86..3d931807aec12107a32844dcae4b00b49554541e 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "util/u_blitter.h"
 #include "util/u_prim.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_pack_color.h"
 #include "util/u_upload_mgr.h"
 #include "indices/u_primconvert.h"
index 6d4a6249fbfa146c2c92a4c9cb3b590cee75ffcf..e9334dc3cfe1fb08b223098262b4c2362ce36473 100644 (file)
@@ -32,7 +32,7 @@
  * in our shader code, and this stores the table for doing so.
  */
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/macros.h"
 
 #include "vc4_context.h"
index ff6268f478a3929e14657bab11a5686b2a19d2cd..32991ac784530caa4060cd37bfd12c0a9190246b 100644 (file)
@@ -39,7 +39,7 @@
  * Lowers fixed-function blending to a load of the destination color and a
  * series of ALU operations before the store of the output.
  */
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "vc4_qir.h"
 #include "compiler/nir/nir_builder.h"
 #include "compiler/nir/nir_format_convert.h"
index 5dbc2c8e324c7a0891df2f56fc6bbe56f122485c..c82d99812259bf18d69038f88c2d2321350ed4e3 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "vc4_qir.h"
 #include "compiler/nir/nir_builder.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 /**
  * Walks the NIR generated by TGSI-to-NIR or GLSL-to-NIR to lower its io
index 3fabf4c7dc9743ead05e7462c86cc8ec310fe9be..0a6c43f0462618f8bbef7ffec03a9b7a13ef038b 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 #include <inttypes.h>
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/crc32.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
index bd233048c479eb08535839dcc5402c10db84a7e5..14a2fba70fc5bb904fd4290269771bf9d135178c 100644 (file)
@@ -25,7 +25,7 @@
 #include "pipe/p_defines.h"
 #include "util/u_blit.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_surface.h"
 #include "util/u_transfer_helper.h"
index be20dc90406df116b8862717ac126baa4d2f3b84..2be0b6c3fbed6ffe8dea11c4803c9acd9fe05137 100644 (file)
@@ -30,7 +30,7 @@
 #include "util/u_cpu_detect.h"
 #include "util/u_debug.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_hash_table.h"
 #include "util/u_screen.h"
 #include "util/u_transfer_helper.h"
index 0554570f1aa9e15740b1964990f0c06f46635548..d83bd7a40b77ee18ea5e78c330c9f3615115f872 100644 (file)
@@ -30,7 +30,7 @@
 #include "pipe/p_state.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_prim.h"
 #include "util/u_transfer.h"
 #include "util/u_helpers.h"
index 7a17a90c48d806e770a871e059ec647450639476..9f90345722e90173b62f55f77481903c4e59195e 100644 (file)
@@ -24,7 +24,7 @@
 #include <assert.h>
 #include <string.h>
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
 #include "pipe/p_state.h"
index b5d82bdde59407da1bf155c132e98529af9efa8d..e6d2935166013c0189c355aada0da88b579e20aa 100644 (file)
@@ -20,7 +20,7 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
index bfa42b5910295aa18f245fa1fc090a7ce508e023..869e25cc46c885269388380938122d3655e0d217 100644 (file)
@@ -21,8 +21,8 @@
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #include "util/u_memory.h"
-#include "util/u_format.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
 #include "util/u_screen.h"
 #include "util/u_video.h"
 #include "util/u_math.h"
index 1b39c6382dc05a738c2cd8174946e09317c77acd..23282587288d5da156cfbb29fcea93b059775ec8 100644 (file)
@@ -20,7 +20,7 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 
index 9319630761c8faa0e2ec7231770c0ab5950d8654..9ec6e1ebe78469e9dd0e812498f211fc016010c8 100644 (file)
@@ -4,7 +4,7 @@
 #include "zink_screen.h"
 
 #include "util/u_blitter.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 static bool
 blit_resolve(struct zink_context *ctx, const struct pipe_blit_info *info)
index 14937e334802723462bde1577a00ddc624585f5d..a9549ad1e98f4d82bfc8fa141774ddca79e8be64 100644 (file)
@@ -38,7 +38,7 @@
 #include "indices/u_primconvert.h"
 #include "util/u_blitter.h"
 #include "util/u_debug.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_framebuffer.h"
 #include "util/u_helpers.h"
 #include "util/u_inlines.h"
index b8af12ed5f4e02cd0cac1154ce9b56e30e487280..80367b0b3b8c188dfe7df404a87d05cbb2b32da6 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "util/slab.h"
 #include "util/u_debug.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 
index 7762471d248f2713c0fa2ad557064dd9eefb782d..22f96fda4cf6f30bce665d642f93359ab3c635fb 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "os/os_process.h"
 #include "util/u_debug.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/u_screen.h"
index 3c1fc4e7216e3dbd1ec6f3569e5814c724de9d98..e9c02af0c92afb694c08f996a6c67f8954d62691 100644 (file)
@@ -26,7 +26,7 @@
 #include "zink_screen.h"
 #include "zink_surface.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 
index b852e6896fedeea304131c8acc805ae7d7225b72..ed13d92c281e34610c58e6edfa7ebec877c40760 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "core/memory.hpp"
 #include "core/resource.hpp"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 using namespace clover;
 
index 79911771a00889566f35ebc79c7c821aaafeef03..dd207982588c2684336008aba52e6e9129f6d74e 100644 (file)
@@ -24,7 +24,7 @@
 #include "core/memory.hpp"
 #include "pipe/p_screen.h"
 #include "util/u_sampler.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 
 using namespace clover;
index 01646228c1980aada30f80970d7bc15f14bab4cd..620a972917a2135e5843a9c0ff447cd21ecbfbb8 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/disk_cache.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_debug.h"
 #include "state_tracker/drm_driver.h"
 #include "state_tracker/st_cb_bufferobjects.h"
index 42c48b50a82a27d6ac7e47d2349dea1a24dc0434..4b0ba5f6719c05b260542ed47b5cd5874a887cf5 100644 (file)
@@ -34,7 +34,7 @@
 #include "dri_drawable.h"
 
 #include "pipe/p_screen.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 
index 8e4d5ca52dfd21bd4dd25e5a9bee4a9e215acb2f..0da789643fc91b8b617b9ed029dd937f0e88fc0f 100644 (file)
@@ -43,7 +43,7 @@
 #include "state_tracker/drm_driver.h"
 
 #include "util/u_debug.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format_s3tc.h"
 
 #define MSAA_VISUAL_MAX_SAMPLES 32
 
index cf1e662f00c2ecb02c7a9ee810894a9d8fbba289..bf7ee6f9471354c0fd6e4299299ffb31ecb1d6e5 100644 (file)
@@ -26,7 +26,7 @@
  *
  **************************************************************************/
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/u_box.h"
index ac659a4f69ad04af72d0411823777df86941d8b1..f7dc7a6d3dbadbaf853a40382fcf83347c8d948d 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "pipe/p_format.h"
 #include "util/u_atomic.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "state_tracker/st_gl_api.h" /* for st_gl_api_create */
index 52ea8bff569ff9006a2fb986b9ef2abe203f378a..e8d4697986c4e1758066e468aee5592a0c346ab2 100644 (file)
@@ -27,7 +27,7 @@
 #include "nine_pipe.h"
 #include "nine_dump.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_dump.h"
 
 #include "pipe/p_screen.h"
index ba4deb4e3ad4c782c2b01ba8bb7a7d33a0a9e81a..c59bda5d2954125573f2b1ddfafe3cbbca0250b5 100644 (file)
@@ -33,7 +33,7 @@
 #include "nine_dump.h"
 #endif
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #define DBG_CHANNEL DBG_BASETEXTURE
 
index 0e3333a257d5bb518038994a028f2fc1ed13d6a3..bac92c445864483c67217a495632b236d654cf72 100644 (file)
@@ -47,7 +47,7 @@
 #include "util/u_math.h"
 #include "util/u_inlines.h"
 #include "util/u_hash_table.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_surface.h"
 #include "util/u_upload_mgr.h"
 #include "hud/hud_context.h"
index 0595da5535a4ce4615a8fc720563926aaa0e5de3..6a85c042db752f65495339fca2a2f42e8928f368 100644 (file)
@@ -29,7 +29,7 @@
 #include "pipe/p_state.h" /* pipe_box */
 #include "util/macros.h"
 #include "util/u_rect.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "nine_helpers.h"
 
 struct cso_context;
index e1256e2f6d5141b3f1cf98f7af2478bf4f53793c..9beeff290b3e3b5010f895818a9129868834f45d 100644 (file)
@@ -29,7 +29,7 @@
 #include "pipe/p_format.h"
 #include "pipe/p_context.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "translate/translate.h"
 
 #define DBG_CHANNEL DBG_VERTEXDECLARATION
index 7a844b28387cff64fe355b3162682e6c0ce56634..4a3d0c88f107379fa50f34e6c8fc7db5690bfb2f 100644 (file)
@@ -28,7 +28,7 @@
 #include "nine_pipe.h"
 #include "nine_dump.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_surface.h"
 
 #define DBG_CHANNEL DBG_VOLUME
index 36f0f98fbe82474251fae768964677b2cdf65e8c..f9be566eb764671b4fb0bb15e05fd80d645ef46d 100644 (file)
@@ -62,7 +62,7 @@
 #include "util/u_atomic.h"
 #include "util/u_box.h"
 #include "util/u_debug.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 
index c5a3eeb6b30367199a796c659d0f805c811d1a8b..5df30ea3c089f3c67d179f97562d22ef4ace650a 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "util/u_memory.h"
 #include "util/u_debug.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_sampler.h"
 
 #include "vdpau_private.h"
index 1f873daa8144ebb4e3d7972926670dddf897c149..cb0e2ffa57cf86e90c02ceb8afb2a19d7ef27d5c 100644 (file)
@@ -31,7 +31,7 @@
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 #include "util/u_sampler.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_surface.h"
 
 #include "vl/vl_csc.h"
index 7abbb80d12d7c221d3b366e3d3c36806d3fa6c8a..8fc6da1df2e1b799e42744e1785f5174bcce91a8 100644 (file)
@@ -42,7 +42,7 @@
 #include <GL/wglext.h>
 
 #include "pipe/p_compiler.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "stw_device.h"
 #include "stw_pixelformat.h"
index d4e7a94f36d64cb3c116541d3874f4271a76b735..3ad5dd21714f97977ccd434aead39bb57de7fe85 100644 (file)
@@ -29,7 +29,7 @@
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 
index 7a6dc89d8d8685df3d68e9917c933e57ff3534fa..f29bfcd7eee47026ca1543d6a913bbe56dcab169 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "util/u_memory.h"
 #include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_sampler.h"
 #include "util/u_surface.h"
 #include "util/u_rect.h"
index c919ec77198879fd3782bd2ff462af23c8cd4af2..7cd22416a9f019d58269b53245b9f11b58ed70f6 100644 (file)
@@ -11,7 +11,7 @@
 #include "util/u_debug.h"
 #include "util/u_debug_image.h"
 #include "util/u_draw_quad.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 
index 20e5a4f140c9918ebba48f32136bc4a86a2676b7..2047a524112b3f13ba11e75ca4fc22bddea5abfc 100644 (file)
@@ -36,7 +36,7 @@
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/u_sampler.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "tgsi/tgsi_text.h"
 #include "pipe-loader/pipe_loader.h"
 
index cc2f83a74ad39ce7d8970bcac9604c4a099906d0..8e96b7b7b6270fd2b9f359642adbb2e2afdfa5ee 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include "translate/translate.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_half.h"
 #include "util/u_cpu_detect.h"
 #include "rtasm/rtasm_cpu.h"
index de97bc270aee10dea721aacf96399a42661c6a94..6d3ce5efa8add7de8124285e08afcf26ef557dca 100644 (file)
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 
 static boolean
index 640214dfc50a673b8208bd844d68e60f75280c63..69e3b5aebfde8e790becd164a90e5164c9a9f952 100644 (file)
@@ -31,9 +31,9 @@
 #include <float.h>
 
 #include "util/u_half.h"
-#include "util/u_format.h"
-#include "util/u_format_tests.h"
-#include "util/u_format_s3tc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_tests.h"
+#include "util/format/u_format_s3tc.h"
 
 
 static boolean
index 4f410d5c88ef35d3aa0496318ebf68a72e468a7e..5313e177e4c900991e3ea2d654f4dfd009637266 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #include "amdgpu_winsys.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 static int amdgpu_surface_sanity(const struct pipe_resource *tex)
 {
index dff6209e1efda769eb2c680f6b5280472a760413..719c52a80c7c2c7fdb7cbb97491e1065e1b7aa08 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/u_hash_table.h"
index 4ca2d35ea33a551b67ff9c3723d81b74f4e82d40..3e790aa65d52ad18791514ba05df056d15e894ed 100644 (file)
@@ -3,7 +3,7 @@
 #include <fcntl.h>
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/u_hash_table.h"
index a49f3eb4ed8408b0d348bb291e384160c8f54b75..cd51fe707e761349ec841001c31bec08c16e76ba 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "radeon_drm_winsys.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include <radeon_surface.h>
 
 static unsigned cik_get_macro_tile_index(struct radeon_surf *surf)
index a85ee18e45b9492a24aa61e5add65f518eda5c7f..62d1b18b9e3473bc2cbb2fb5a9586a7975ac30f6 100644 (file)
@@ -27,7 +27,7 @@
 #include "pipe/p_compiler.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 #include "vmw_context.h"
 #include "vmw_screen.h"
index 761f5d19f54b645997800910e00c89d6bcbe8715..cbccf4d01dfb779a16317cd45f29863270916d75 100644 (file)
@@ -35,7 +35,7 @@
 #include "pipe/p_format.h"
 #include "pipe/p_state.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
index 675da401329f10efe8b6bcb68154b90ea676b93c..ed22e82ee6da684c9b1d048d04f11784a0cce369 100644 (file)
@@ -39,7 +39,7 @@
 #include "pipe/p_format.h"
 #include "pipe/p_context.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "state_tracker/sw_winsys.h"
index 9d37c5aacaec069839d1cd901ee80318b97af188..35e7137b549813f9a4ee1a06048b868412fb31a9 100644 (file)
@@ -31,7 +31,7 @@
 #include "pipe/p_defines.h"
 #include "pipe/p_format.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "state_tracker/st_api.h"
index e3108367ec9cd75928383442b96a446adebe8f0f..da11be2333aef7ecbdbafea42c4f75b8dc0e9b29 100644 (file)
@@ -45,7 +45,7 @@
 #include "pipe/p_format.h"
 #include "pipe/p_state.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "util/list.h"
index c14c9de4350ff7f3fe3ee22bb42e3728824b20d5..be28fae3df2ec3d47ccacdc22bf1ff5c57e3e767 100644 (file)
@@ -35,7 +35,7 @@
 #include "pipe/p_format.h"
 #include "pipe/p_context.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
index 0fe61bbe4659a635cb6c8c95d5aeedb5bcd6938f..940d118297601d5b9a6d22e372f75620af077884 100644 (file)
@@ -31,7 +31,7 @@
 #include "os/os_mman.h"
 #include "util/os_time.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_hash_table.h"
 #include "util/u_inlines.h"
 #include "state_tracker/drm_driver.h"
index 42a58a6dcc1350c6350b3bd38a2fca4c12bff902..463bff01f321ad5ce1e88c264d62880176101f43 100644 (file)
@@ -29,7 +29,7 @@
 #include <unistd.h>
 
 #include <os/os_process.h>
-#include <util/u_format.h>
+#include <util/format/u_format.h>
 
 #include "virgl_vtest_winsys.h"
 #include "virgl_vtest_public.h"
index 528692ffcb77618b32e44c7a5c40e07bfaa046cf..1bb5d387cec47f7f020e5449756cfe94eeffe0c5 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdio.h>
 #include "util/u_surface.h"
 #include "util/u_memory.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/os_time.h"
 #include "state_tracker/sw_winsys.h"
index 4a82c63e8dcc0d0f6adf4588312b56a6cc5046b2..fea537c406d70fbe31ad4cb39dd18d92bccaab3c 100644 (file)
@@ -43,7 +43,7 @@
 #include "cso_cache/cso_context.h"
 #include "util/u_math.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_framebuffer.h"
 #include "main/framebuffer.h"
 
index 758ace10b8a2e4c124a60bfd677b9e1a7a0e01d1..ad25d7a8cc153529c019841e7199804fc460117a 100644 (file)
@@ -50,7 +50,7 @@
 
 #include "cso_cache/cso_context.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 
 /**
index 8a881c24fb39597aece50cf12953ebe9ea5c5eec..fac61591b21de3b25aae496ffc2b77393e32212d 100644 (file)
@@ -47,7 +47,7 @@
 #include "st_format.h"
 #include "st_cb_texture.h"
 #include "pipe/p_context.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "cso_cache/cso_context.h"
 
index cc8649eb39295cbaa811e60aa13f635bb5e96a4a..91bf029faf2805861581284a4003737b1ac05939 100644 (file)
@@ -43,7 +43,7 @@
 #include "st_scissor.h"
 #include "st_util.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 
 static void
 st_BlitFramebuffer(struct gl_context *ctx,
index 1e28e27586a81932a305d4a5785639f51aa75393..8334e6dfcacbe76176681a5de3d92a8c35a5e12c 100644 (file)
@@ -56,7 +56,7 @@
 #include "pipe/p_shader_tokens.h"
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_simple_shaders.h"
 
index 8c5be5049856e74030c37ad370cb5e4c403ba8ec..a58cdf62703397640d310352c824b721ef0a5220 100644 (file)
@@ -30,7 +30,7 @@
 #include "state_tracker/st_util.h"
 
 #include "util/u_box.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 
 
index 6c650fd1962850c7a3ee21c22368a3c3824252c4..2a59566abeff31fdc40af34fc37c78300a9b1734 100644 (file)
@@ -71,7 +71,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "tgsi/tgsi_ureg.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_math.h"
 #include "util/u_simple_shaders.h"
index 4a58f2f48df055120619751fbdd3776de404eb0d..3b0460b6876c67489e1cdcb1ecf33ee515bd15c6 100644 (file)
@@ -29,7 +29,7 @@
 #include "main/texobj.h"
 #include "main/teximage.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "st_cb_eglimage.h"
 #include "st_cb_fbo.h"
 #include "st_context.h"
index 7cb4a3e1650be7699e1c464a1cafc64fa7ab6b82..d6174edd6bf167d581c2debfaa51a3113e68c9b4 100644 (file)
@@ -56,7 +56,7 @@
 #include "st_util.h"
 #include "st_manager.h"
 
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_surface.h"
 
index 71a11be03f348c1a87dcc0a703fc8456979656a7..33a29aa12828390814e5aba420985247b197ddf8 100644 (file)
@@ -33,7 +33,7 @@
 #include "main/enums.h"
 #include "main/framebuffer.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "cso_cache/cso_context.h"
 
 #include "st_cb_fbo.h"
index d189d7c1762737b9f2eff345132dc18058bf1ef5..5954d424249df4410bdc81321888743c5e165e0f 100644 (file)
@@ -70,7 +70,7 @@
 #include "util/u_upload_mgr.h"
 #include "pipe/p_shader_tokens.h"
 #include "util/u_tile.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_surface.h"
 #include "util/u_sampler.h"
 #include "util/u_math.h"
index a5e93186bf5e0f74a62d8ce87680b5cd8efe4cf7..3ff52b0a5e39d58d12c42857a15aa598cf7dc475 100644 (file)
@@ -61,7 +61,7 @@
 #include "pipe/p_defines.h"
 #include "util/u_cpu_detect.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_prim.h"
 #include "util/u_draw.h"
 #include "util/u_upload_mgr.h"
index f0096a2cc48634c4038e083d3ee7d8dbe2aaa0b3..d2199d5af597d5eb8c3293ab05183d220bf8ee0f 100644 (file)
@@ -48,7 +48,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "st_cb_texture.h"
 #include "st_context.h"
 #include "st_format.h"
index 9c7d955a45b353b41d21815113fda66b9132d127..d267b7a30552e084a7c16c8f8783b423b1b64638 100644 (file)
@@ -34,7 +34,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_gen_mipmap.h"
 
 #include "st_debug.h"
index 0879f4912c2166a6f3e4e91362b0cf73873f62ec..a194f529a2997405a8382e9f08fda36ded541da0 100644 (file)
@@ -55,7 +55,7 @@
 
 #include "pipe/p_context.h"
 #include "pipe/p_screen.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_helpers.h"
 #include "util/u_pointer.h"
 #include "util/u_inlines.h"
index ddea8ec29e169562e786289109542aae1d5cfa29..ea5ea43d054a272286391567c25afb23966e1153 100644 (file)
@@ -38,7 +38,7 @@
 #include "pipe/p_screen.h"
 #include "cso_cache/cso_context.h"
 #include "tgsi/tgsi_ureg.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_upload_mgr.h"
 
index 664295dd8525be327df98813f34b19c12c1b9195..ed84b0932665d66b36c25e218e28bb8f442e953f 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "pipe/p_context.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_inlines.h"
 
 #include "main/context.h"
index 56d01d39bf042b9e2163ec1209836e4399b670b3..72fc4a0c09b0e7197299115af877ebe66ffce9f1 100644 (file)
@@ -37,7 +37,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include "util/u_rect.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
index 26725f8417696921062e90d89100ae3f06906673..0def5ff3359fbd409e41be642bb5590eef0d43fe 100644 (file)
@@ -32,7 +32,7 @@
 #include "state_tracker/st_context.h"
 #include "state_tracker/st_format.h"
 #include "state_tracker/st_texture.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
 #include <stdbool.h>
 
 static bool
index 13e44f97c2a2469b1ad0e58a4f81df65ca3ebde3..9addbb8694b5724452be1eae91b42ef356e01eb4 100644 (file)
@@ -68,6 +68,10 @@ LOCAL_GENERATED_SOURCES := $(UTIL_GENERATED_SOURCES)
 MESA_DRI_OPTIONS_H := $(intermediates)/xmlpool/options.h
 LOCAL_GENERATED_SOURCES += $(MESA_DRI_OPTIONS_H)
 
+
+$(intermediates)/format/u_format_table.c: $(intermediates)/%.c: $(LOCAL_PATH)/%.py $(LOCAL_PATH)/format/u_format.csv
+       $(transform-generated-source)
+
 #
 # Generate options.h from gettext translations.
 #
index 73d4f7106b07a42709e6d98db6c5674b25aa759e..dbdcbede6275c71349d44fece3ee3169e9e2d89f 100644 (file)
@@ -21,6 +21,26 @@ MESA_UTIL_FILES := \
        double.h \
        fast_idiv_by_const.c \
        fast_idiv_by_const.h \
+       format/u_format.c \
+       format/u_format.h \
+       format/u_format_bptc.c \
+       format/u_format_bptc.h \
+       format/u_format_etc.c \
+       format/u_format_etc.h \
+       format/u_format_latc.c \
+       format/u_format_latc.h \
+       format/u_format_other.c \
+       format/u_format_other.h \
+       format/u_format_rgtc.c \
+       format/u_format_rgtc.h \
+       format/u_format_s3tc.c \
+       format/u_format_s3tc.h \
+       format/u_format_tests.c \
+       format/u_format_tests.h \
+       format/u_format_yuv.c \
+       format/u_format_yuv.h \
+       format/u_format_zs.c \
+       format/u_format_zs.h \
        format_r11g11b10f.h \
        format_rgb9e5.h \
        format_srgb.h \
@@ -96,7 +116,8 @@ MESA_UTIL_FILES := \
        vma.h
 
 MESA_UTIL_GENERATED_FILES = \
-       format_srgb.c
+       format_srgb.c \
+       format/u_format_table.c
 
 XMLCONFIG_FILES := \
        xmlconfig.c \
index 66a0d1c04ff1fb8178ab029ac70062544319e9b4..f0437694347f423f2925a5ce623ef16144372188 100644 (file)
@@ -17,6 +17,7 @@ env.Prepend(CPPPATH = [
     '#src/gallium/include',
     '#src/gallium/auxiliary',
     '#src/util',
+    '#src/util/format',
 ])
 
 env.CodeGenerate(
@@ -26,6 +27,18 @@ env.CodeGenerate(
     command = python_cmd + ' $SCRIPT > $TARGET'
 )
 
+env.CodeGenerate(
+    target = 'format/u_format_table.c',
+    script = 'format/u_format_table.py',
+    source = ['format/u_format.csv'],
+    command = python_cmd + ' $SCRIPT $SOURCE > $TARGET'
+)
+
+env.Depends('format/u_format_table.c', [
+    'format/u_format_parse.py',
+    'format/u_format_pack.py',
+])
+
 # parse Makefile.sources
 source_lists = env.ParseSourceList('Makefile.sources')
 
diff --git a/src/util/format/meson.build b/src/util/format/meson.build
new file mode 100644 (file)
index 0000000..b5e75e4
--- /dev/null
@@ -0,0 +1,50 @@
+# Copyright © 2019 Google LLC
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_mesa_format = [
+  'u_format.c',
+  'u_format_bptc.c',
+  'u_format_etc.c',
+  'u_format_latc.c',
+  'u_format_other.c',
+  'u_format_rgtc.c',
+  'u_format_s3tc.c',
+  'u_format_tests.c',
+  'u_format_yuv.c',
+  'u_format_zs.c',
+]
+
+u_format_table_c = custom_target(
+  'u_format_table.c',
+  input : ['u_format_table.py', 'u_format.csv'],
+  output : 'u_format_table.c',
+  command : [prog_python, '@INPUT@'],
+  depend_files : files('u_format_pack.py', 'u_format_parse.py'),
+  capture : true,
+)
+
+libmesa_format = static_library(
+  'mesa_format',
+  [files_mesa_format, u_format_table_c],
+  include_directories : inc_common,
+  dependencies : dep_m,
+  c_args : [c_msvc_compat_args, c_vis_args],
+  build_by_default : false
+)
diff --git a/src/util/format/u_format.c b/src/util/format/u_format.c
new file mode 100644 (file)
index 0000000..d968741
--- /dev/null
@@ -0,0 +1,1042 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Pixel format accessor functions.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
+#include "util/u_math.h"
+
+#include "pipe/p_defines.h"
+#include "pipe/p_screen.h"
+
+
+/**
+ * Copy 2D rect from one place to another.
+ * Position and sizes are in pixels.
+ * src_stride may be negative to do vertical flip of pixels from source.
+ */
+void
+util_copy_rect(ubyte * dst,
+               enum pipe_format format,
+               unsigned dst_stride,
+               unsigned dst_x,
+               unsigned dst_y,
+               unsigned width,
+               unsigned height,
+               const ubyte * src,
+               int src_stride,
+               unsigned src_x,
+               unsigned src_y)
+{
+   unsigned i;
+   int src_stride_pos = src_stride < 0 ? -src_stride : src_stride;
+   int blocksize = util_format_get_blocksize(format);
+   int blockwidth = util_format_get_blockwidth(format);
+   int blockheight = util_format_get_blockheight(format);
+
+   assert(blocksize > 0);
+   assert(blockwidth > 0);
+   assert(blockheight > 0);
+
+   dst_x /= blockwidth;
+   dst_y /= blockheight;
+   width = (width + blockwidth - 1)/blockwidth;
+   height = (height + blockheight - 1)/blockheight;
+   src_x /= blockwidth;
+   src_y /= blockheight;
+
+   dst += dst_x * blocksize;
+   src += src_x * blocksize;
+   dst += dst_y * dst_stride;
+   src += src_y * src_stride_pos;
+   width *= blocksize;
+
+   if (width == dst_stride && width == (unsigned)src_stride)
+      memcpy(dst, src, height * width);
+   else {
+      for (i = 0; i < height; i++) {
+         memcpy(dst, src, width);
+         dst += dst_stride;
+         src += src_stride;
+      }
+   }
+}
+
+
+boolean
+util_format_is_float(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   int i;
+
+   assert(desc);
+   if (!desc) {
+      return FALSE;
+   }
+
+   i = util_format_get_first_non_void_channel(format);
+   if (i < 0) {
+      return FALSE;
+   }
+
+   return desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT ? TRUE : FALSE;
+}
+
+
+/** Test if the format contains RGB, but not alpha */
+boolean
+util_format_has_alpha(enum pipe_format format)
+{
+   const struct util_format_description *desc =
+      util_format_description(format);
+
+   return (desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
+           desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
+          desc->swizzle[3] != PIPE_SWIZZLE_1;
+}
+
+
+boolean
+util_format_is_luminance(enum pipe_format format)
+{
+   const struct util_format_description *desc =
+      util_format_description(format);
+
+   if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
+        desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
+       desc->swizzle[0] == PIPE_SWIZZLE_X &&
+       desc->swizzle[1] == PIPE_SWIZZLE_X &&
+       desc->swizzle[2] == PIPE_SWIZZLE_X &&
+       desc->swizzle[3] == PIPE_SWIZZLE_1) {
+      return TRUE;
+   }
+   return FALSE;
+}
+
+boolean
+util_format_is_alpha(enum pipe_format format)
+{
+   const struct util_format_description *desc =
+      util_format_description(format);
+
+   if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
+        desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
+       desc->swizzle[0] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[1] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[2] == PIPE_SWIZZLE_0 &&
+       desc->swizzle[3] == PIPE_SWIZZLE_X) {
+      return TRUE;
+   }
+   return FALSE;
+}
+
+boolean
+util_format_is_pure_integer(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   int i;
+
+   /* Find the first non-void channel. */
+   i = util_format_get_first_non_void_channel(format);
+   if (i == -1)
+      return FALSE;
+
+   return desc->channel[i].pure_integer ? TRUE : FALSE;
+}
+
+boolean
+util_format_is_pure_sint(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   int i;
+
+   i = util_format_get_first_non_void_channel(format);
+   if (i == -1)
+      return FALSE;
+
+   return (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE;
+}
+
+boolean
+util_format_is_pure_uint(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   int i;
+
+   i = util_format_get_first_non_void_channel(format);
+   if (i == -1)
+      return FALSE;
+
+   return (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE;
+}
+
+/**
+ * Returns true if the format contains normalized signed channels.
+ */
+boolean
+util_format_is_snorm(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   return desc->is_snorm;
+}
+
+/**
+ * Returns true if the format contains normalized unsigned channels.
+ */
+boolean
+util_format_is_unorm(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   return desc->is_unorm;
+}
+
+boolean
+util_format_is_snorm8(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   int i;
+
+   if (desc->is_mixed)
+      return FALSE;
+
+   i = util_format_get_first_non_void_channel(format);
+   if (i == -1)
+      return FALSE;
+
+   return desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED &&
+          !desc->channel[i].pure_integer &&
+          desc->channel[i].normalized &&
+          desc->channel[i].size == 8;
+}
+
+boolean
+util_format_is_luminance_alpha(enum pipe_format format)
+{
+   const struct util_format_description *desc =
+      util_format_description(format);
+
+   if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
+        desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
+       desc->swizzle[0] == PIPE_SWIZZLE_X &&
+       desc->swizzle[1] == PIPE_SWIZZLE_X &&
+       desc->swizzle[2] == PIPE_SWIZZLE_X &&
+       desc->swizzle[3] == PIPE_SWIZZLE_Y) {
+      return TRUE;
+   }
+   return FALSE;
+}
+
+
+boolean
+util_format_is_intensity(enum pipe_format format)
+{
+   const struct util_format_description *desc =
+      util_format_description(format);
+
+   if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
+        desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
+       desc->swizzle[0] == PIPE_SWIZZLE_X &&
+       desc->swizzle[1] == PIPE_SWIZZLE_X &&
+       desc->swizzle[2] == PIPE_SWIZZLE_X &&
+       desc->swizzle[3] == PIPE_SWIZZLE_X) {
+      return TRUE;
+   }
+   return FALSE;
+}
+
+boolean
+util_format_is_subsampled_422(enum pipe_format format)
+{
+   const struct util_format_description *desc =
+      util_format_description(format);
+
+   return desc->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED &&
+      desc->block.width == 2 &&
+      desc->block.height == 1 &&
+      desc->block.bits == 32;
+}
+
+/**
+ * Calculates the MRD for the depth format. MRD is used in depth bias
+ * for UNORM and unbound depth buffers. When the depth buffer is floating
+ * point, the depth bias calculation does not use the MRD. However, the
+ * default MRD will be 1.0 / ((1 << 24) - 1).
+ */
+double
+util_get_depth_format_mrd(const struct util_format_description *desc)
+{
+   /*
+    * Depth buffer formats without a depth component OR scenarios
+    * without a bound depth buffer default to D24.
+    */
+   double mrd = 1.0 / ((1 << 24) - 1);
+   unsigned depth_channel;
+
+   assert(desc);
+
+   /*
+    * Some depth formats do not store the depth component in the first
+    * channel, detect the format and adjust the depth channel. Get the
+    * swizzled depth component channel.
+    */
+   depth_channel = desc->swizzle[0];
+
+   if (desc->channel[depth_channel].type == UTIL_FORMAT_TYPE_UNSIGNED &&
+       desc->channel[depth_channel].normalized) {
+      int depth_bits;
+
+      depth_bits = desc->channel[depth_channel].size;
+      mrd = 1.0 / ((1ULL << depth_bits) - 1);
+   }
+
+   return mrd;
+}
+
+
+void
+util_format_read_4f(enum pipe_format format,
+                    float *dst, unsigned dst_stride,
+                    const void *src, unsigned src_stride,
+                    unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   const struct util_format_description *format_desc;
+   const uint8_t *src_row;
+   float *dst_row;
+
+   format_desc = util_format_description(format);
+
+   assert(x % format_desc->block.width == 0);
+   assert(y % format_desc->block.height == 0);
+
+   src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
+   dst_row = dst;
+
+   format_desc->unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+
+void
+util_format_write_4f(enum pipe_format format,
+                     const float *src, unsigned src_stride,
+                     void *dst, unsigned dst_stride,
+                     unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   const struct util_format_description *format_desc;
+   uint8_t *dst_row;
+   const float *src_row;
+
+   format_desc = util_format_description(format);
+
+   assert(x % format_desc->block.width == 0);
+   assert(y % format_desc->block.height == 0);
+
+   dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
+   src_row = src;
+
+   format_desc->pack_rgba_float(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+
+void
+util_format_read_4ub(enum pipe_format format, uint8_t *dst, unsigned dst_stride, const void *src, unsigned src_stride, unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   const struct util_format_description *format_desc;
+   const uint8_t *src_row;
+   uint8_t *dst_row;
+
+   format_desc = util_format_description(format);
+
+   assert(x % format_desc->block.width == 0);
+   assert(y % format_desc->block.height == 0);
+
+   src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
+   dst_row = dst;
+
+   format_desc->unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+
+void
+util_format_write_4ub(enum pipe_format format, const uint8_t *src, unsigned src_stride, void *dst, unsigned dst_stride, unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   const struct util_format_description *format_desc;
+   uint8_t *dst_row;
+   const uint8_t *src_row;
+
+   format_desc = util_format_description(format);
+
+   assert(x % format_desc->block.width == 0);
+   assert(y % format_desc->block.height == 0);
+
+   dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
+   src_row = src;
+
+   format_desc->pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+void
+util_format_read_4ui(enum pipe_format format,
+                     unsigned *dst, unsigned dst_stride,
+                     const void *src, unsigned src_stride,
+                     unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   const struct util_format_description *format_desc;
+   const uint8_t *src_row;
+   uint32_t *dst_row;
+
+   format_desc = util_format_description(format);
+
+   assert(x % format_desc->block.width == 0);
+   assert(y % format_desc->block.height == 0);
+
+   src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
+   dst_row = dst;
+
+   format_desc->unpack_rgba_uint(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+void
+util_format_write_4ui(enum pipe_format format,
+                      const unsigned int *src, unsigned src_stride,
+                      void *dst, unsigned dst_stride,
+                      unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   const struct util_format_description *format_desc;
+   uint8_t *dst_row;
+   const uint32_t *src_row;
+
+   format_desc = util_format_description(format);
+
+   assert(x % format_desc->block.width == 0);
+   assert(y % format_desc->block.height == 0);
+
+   dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
+   src_row = src;
+
+   format_desc->pack_rgba_uint(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+void
+util_format_read_4i(enum pipe_format format,
+                    int *dst, unsigned dst_stride,
+                    const void *src, unsigned src_stride,
+                    unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   const struct util_format_description *format_desc;
+   const uint8_t *src_row;
+   int32_t *dst_row;
+
+   format_desc = util_format_description(format);
+
+   assert(x % format_desc->block.width == 0);
+   assert(y % format_desc->block.height == 0);
+
+   src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
+   dst_row = dst;
+
+   format_desc->unpack_rgba_sint(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+void
+util_format_write_4i(enum pipe_format format,
+                      const int *src, unsigned src_stride,
+                      void *dst, unsigned dst_stride,
+                      unsigned x, unsigned y, unsigned w, unsigned h)
+{
+   const struct util_format_description *format_desc;
+   uint8_t *dst_row;
+   const int32_t *src_row;
+
+   format_desc = util_format_description(format);
+
+   assert(x % format_desc->block.width == 0);
+   assert(y % format_desc->block.height == 0);
+
+   dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
+   src_row = src;
+
+   format_desc->pack_rgba_sint(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+/**
+ * Check if we can safely memcopy from the source format to the dest format.
+ * This basically covers the cases of a "used" channel copied to a typeless
+ * channel, plus some 1-channel cases.
+ * Examples of compatible copy formats include:
+ *    b8g8r8a8_unorm -> b8g8r8x8_unorm
+ *    a8r8g8b8_unorm -> x8r8g8b8_unorm
+ *    b5g5r5a1_unorm -> b5g5r5x1_unorm
+ *    b4g4r4a4_unorm -> b4g4r4x4_unorm
+ *    l8_unorm -> r8_unorm
+ *    i8_unorm -> l8_unorm
+ *    i8_unorm -> a8_unorm
+ *    i8_unorm -> r8_unorm
+ *    l16_unorm -> r16_unorm
+ *    z24_unorm_s8_uint -> z24x8_unorm
+ *    s8_uint_z24_unorm -> x8z24_unorm
+ *    r8g8b8a8_unorm -> r8g8b8x8_unorm
+ *    a8b8g8r8_srgb -> x8b8g8r8_srgb
+ *    b8g8r8a8_srgb -> b8g8r8x8_srgb
+ *    a8r8g8b8_srgb -> x8r8g8b8_srgb
+ *    a8b8g8r8_unorm -> x8b8g8r8_unorm
+ *    r10g10b10a2_uscaled -> r10g10b10x2_uscaled
+ *    r10sg10sb10sa2u_norm -> r10g10b10x2_snorm
+ */
+boolean
+util_is_format_compatible(const struct util_format_description *src_desc,
+                          const struct util_format_description *dst_desc)
+{
+   unsigned chan;
+
+   if (src_desc->format == dst_desc->format) {
+      return TRUE;
+   }
+
+   if (src_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN ||
+       dst_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
+      return FALSE;
+   }
+
+   if (src_desc->block.bits != dst_desc->block.bits ||
+       src_desc->nr_channels != dst_desc->nr_channels ||
+       src_desc->colorspace != dst_desc->colorspace) {
+      return FALSE;
+   }
+
+   for (chan = 0; chan < 4; ++chan) {
+      if (src_desc->channel[chan].size !=
+          dst_desc->channel[chan].size) {
+         return FALSE;
+      }
+   }
+
+   for (chan = 0; chan < 4; ++chan) {
+      enum pipe_swizzle swizzle = dst_desc->swizzle[chan];
+
+      if (swizzle < 4) {
+         if (src_desc->swizzle[chan] != swizzle) {
+            return FALSE;
+         }
+         if ((src_desc->channel[swizzle].type !=
+              dst_desc->channel[swizzle].type) ||
+             (src_desc->channel[swizzle].normalized !=
+              dst_desc->channel[swizzle].normalized)) {
+            return FALSE;
+         }
+      }
+   }
+
+   return TRUE;
+}
+
+
+boolean
+util_format_fits_8unorm(const struct util_format_description *format_desc)
+{
+   unsigned chan;
+
+   /*
+    * After linearized sRGB values require more than 8bits.
+    */
+
+   if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
+      return FALSE;
+   }
+
+   switch (format_desc->layout) {
+
+   case UTIL_FORMAT_LAYOUT_S3TC:
+      /*
+       * These are straight forward.
+       */
+      return TRUE;
+   case UTIL_FORMAT_LAYOUT_RGTC:
+      if (format_desc->format == PIPE_FORMAT_RGTC1_SNORM ||
+          format_desc->format == PIPE_FORMAT_RGTC2_SNORM ||
+          format_desc->format == PIPE_FORMAT_LATC1_SNORM ||
+          format_desc->format == PIPE_FORMAT_LATC2_SNORM)
+         return FALSE;
+      return TRUE;
+   case UTIL_FORMAT_LAYOUT_BPTC:
+      if (format_desc->format == PIPE_FORMAT_BPTC_RGBA_UNORM)
+         return TRUE;
+      return FALSE;
+
+   case UTIL_FORMAT_LAYOUT_ETC:
+      if (format_desc->format == PIPE_FORMAT_ETC1_RGB8)
+         return TRUE;
+      return FALSE;
+
+   case UTIL_FORMAT_LAYOUT_PLAIN:
+      /*
+       * For these we can find a generic rule.
+       */
+
+      for (chan = 0; chan < format_desc->nr_channels; ++chan) {
+         switch (format_desc->channel[chan].type) {
+         case UTIL_FORMAT_TYPE_VOID:
+            break;
+         case UTIL_FORMAT_TYPE_UNSIGNED:
+            if (!format_desc->channel[chan].normalized ||
+                format_desc->channel[chan].size > 8) {
+               return FALSE;
+            }
+            break;
+         default:
+            return FALSE;
+         }
+      }
+      return TRUE;
+
+   default:
+      /*
+       * Handle all others on a case by case basis.
+       */
+
+      switch (format_desc->format) {
+      case PIPE_FORMAT_R1_UNORM:
+      case PIPE_FORMAT_UYVY:
+      case PIPE_FORMAT_YUYV:
+      case PIPE_FORMAT_R8G8_B8G8_UNORM:
+      case PIPE_FORMAT_G8R8_G8B8_UNORM:
+         return TRUE;
+
+      default:
+         return FALSE;
+      }
+   }
+}
+
+
+boolean
+util_format_translate(enum pipe_format dst_format,
+                      void *dst, unsigned dst_stride,
+                      unsigned dst_x, unsigned dst_y,
+                      enum pipe_format src_format,
+                      const void *src, unsigned src_stride,
+                      unsigned src_x, unsigned src_y,
+                      unsigned width, unsigned height)
+{
+   const struct util_format_description *dst_format_desc;
+   const struct util_format_description *src_format_desc;
+   uint8_t *dst_row;
+   const uint8_t *src_row;
+   unsigned x_step, y_step;
+   unsigned dst_step;
+   unsigned src_step;
+
+   dst_format_desc = util_format_description(dst_format);
+   src_format_desc = util_format_description(src_format);
+
+   if (util_is_format_compatible(src_format_desc, dst_format_desc)) {
+      /*
+       * Trivial case.
+       */
+
+      util_copy_rect(dst, dst_format, dst_stride,  dst_x, dst_y,
+                     width, height, src, (int)src_stride,
+                     src_x, src_y);
+      return TRUE;
+   }
+
+   assert(dst_x % dst_format_desc->block.width == 0);
+   assert(dst_y % dst_format_desc->block.height == 0);
+   assert(src_x % src_format_desc->block.width == 0);
+   assert(src_y % src_format_desc->block.height == 0);
+
+   dst_row = (uint8_t *)dst + dst_y*dst_stride + dst_x*(dst_format_desc->block.bits/8);
+   src_row = (const uint8_t *)src + src_y*src_stride + src_x*(src_format_desc->block.bits/8);
+
+   /*
+    * This works because all pixel formats have pixel blocks with power of two
+    * sizes.
+    */
+
+   y_step = MAX2(dst_format_desc->block.height, src_format_desc->block.height);
+   x_step = MAX2(dst_format_desc->block.width, src_format_desc->block.width);
+   assert(y_step % dst_format_desc->block.height == 0);
+   assert(y_step % src_format_desc->block.height == 0);
+
+   dst_step = y_step / dst_format_desc->block.height * dst_stride;
+   src_step = y_step / src_format_desc->block.height * src_stride;
+
+   /*
+    * TODO: double formats will loose precision
+    * TODO: Add a special case for formats that are mere swizzles of each other
+    */
+
+   if (src_format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS ||
+       dst_format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
+      float *tmp_z = NULL;
+      uint8_t *tmp_s = NULL;
+
+      assert(x_step == 1);
+      assert(y_step == 1);
+
+      if (src_format_desc->unpack_z_float &&
+          dst_format_desc->pack_z_float) {
+         tmp_z = malloc(width * sizeof *tmp_z);
+      }
+
+      if (src_format_desc->unpack_s_8uint &&
+          dst_format_desc->pack_s_8uint) {
+         tmp_s = malloc(width * sizeof *tmp_s);
+      }
+
+      while (height--) {
+         if (tmp_z) {
+            src_format_desc->unpack_z_float(tmp_z, 0, src_row, src_stride, width, 1);
+            dst_format_desc->pack_z_float(dst_row, dst_stride, tmp_z, 0, width, 1);
+         }
+
+         if (tmp_s) {
+            src_format_desc->unpack_s_8uint(tmp_s, 0, src_row, src_stride, width, 1);
+            dst_format_desc->pack_s_8uint(dst_row, dst_stride, tmp_s, 0, width, 1);
+         }
+
+         dst_row += dst_step;
+         src_row += src_step;
+      }
+
+      free(tmp_s);
+
+      free(tmp_z);
+
+      return TRUE;
+   }
+
+   if (util_format_fits_8unorm(src_format_desc) ||
+       util_format_fits_8unorm(dst_format_desc)) {
+      unsigned tmp_stride;
+      uint8_t *tmp_row;
+
+      if (!src_format_desc->unpack_rgba_8unorm ||
+          !dst_format_desc->pack_rgba_8unorm) {
+         return FALSE;
+      }
+
+      tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
+      tmp_row = malloc(y_step * tmp_stride);
+      if (!tmp_row)
+         return FALSE;
+
+      while (height >= y_step) {
+         src_format_desc->unpack_rgba_8unorm(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
+         dst_format_desc->pack_rgba_8unorm(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
+
+         dst_row += dst_step;
+         src_row += src_step;
+         height -= y_step;
+      }
+
+      if (height) {
+         src_format_desc->unpack_rgba_8unorm(tmp_row, tmp_stride, src_row, src_stride, width, height);
+         dst_format_desc->pack_rgba_8unorm(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
+      }
+
+      free(tmp_row);
+   }
+   else if (util_format_is_pure_sint(src_format) ||
+            util_format_is_pure_sint(dst_format)) {
+      unsigned tmp_stride;
+      int *tmp_row;
+
+      if (!src_format_desc->unpack_rgba_sint ||
+          !dst_format_desc->pack_rgba_sint) {
+         return FALSE;
+      }
+
+      tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
+      tmp_row = malloc(y_step * tmp_stride);
+      if (!tmp_row)
+         return FALSE;
+
+      while (height >= y_step) {
+         src_format_desc->unpack_rgba_sint(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
+         dst_format_desc->pack_rgba_sint(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
+
+         dst_row += dst_step;
+         src_row += src_step;
+         height -= y_step;
+      }
+
+      if (height) {
+         src_format_desc->unpack_rgba_sint(tmp_row, tmp_stride, src_row, src_stride, width, height);
+         dst_format_desc->pack_rgba_sint(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
+      }
+
+      free(tmp_row);
+   }
+   else if (util_format_is_pure_uint(src_format) ||
+            util_format_is_pure_uint(dst_format)) {
+      unsigned tmp_stride;
+      unsigned int *tmp_row;
+
+      if (!src_format_desc->unpack_rgba_uint ||
+          !dst_format_desc->pack_rgba_uint) {
+         return FALSE;
+      }
+
+      tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
+      tmp_row = malloc(y_step * tmp_stride);
+      if (!tmp_row)
+         return FALSE;
+
+      while (height >= y_step) {
+         src_format_desc->unpack_rgba_uint(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
+         dst_format_desc->pack_rgba_uint(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
+
+         dst_row += dst_step;
+         src_row += src_step;
+         height -= y_step;
+      }
+
+      if (height) {
+         src_format_desc->unpack_rgba_uint(tmp_row, tmp_stride, src_row, src_stride, width, height);
+         dst_format_desc->pack_rgba_uint(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
+      }
+
+      free(tmp_row);
+   }
+   else {
+      unsigned tmp_stride;
+      float *tmp_row;
+
+      if (!src_format_desc->unpack_rgba_float ||
+          !dst_format_desc->pack_rgba_float) {
+         return FALSE;
+      }
+
+      tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
+      tmp_row = malloc(y_step * tmp_stride);
+      if (!tmp_row)
+         return FALSE;
+
+      while (height >= y_step) {
+         src_format_desc->unpack_rgba_float(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
+         dst_format_desc->pack_rgba_float(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
+
+         dst_row += dst_step;
+         src_row += src_step;
+         height -= y_step;
+      }
+
+      if (height) {
+         src_format_desc->unpack_rgba_float(tmp_row, tmp_stride, src_row, src_stride, width, height);
+         dst_format_desc->pack_rgba_float(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
+      }
+
+      free(tmp_row);
+   }
+   return TRUE;
+}
+
+boolean
+util_format_translate_3d(enum pipe_format dst_format,
+                         void *dst, unsigned dst_stride,
+                         unsigned dst_slice_stride,
+                         unsigned dst_x, unsigned dst_y,
+                         unsigned dst_z,
+                         enum pipe_format src_format,
+                         const void *src, unsigned src_stride,
+                         unsigned src_slice_stride,
+                         unsigned src_x, unsigned src_y,
+                         unsigned src_z, unsigned width,
+                         unsigned height, unsigned depth)
+{
+   uint8_t *dst_layer;
+   const uint8_t *src_layer;
+   unsigned z;
+   dst_layer = dst;
+   src_layer = src;
+   dst_layer += dst_z * dst_slice_stride;
+   src_layer += src_z * src_slice_stride;
+   for (z = 0; z < depth; ++z) {
+      if (!util_format_translate(dst_format, dst_layer, dst_stride,
+                                 dst_x, dst_y,
+                                 src_format, src_layer, src_stride,
+                                 src_x, src_y,
+                                 width, height))
+          return FALSE;
+
+      dst_layer += dst_slice_stride;
+      src_layer += src_slice_stride;
+   }
+   return TRUE;
+}
+
+void util_format_compose_swizzles(const unsigned char swz1[4],
+                                  const unsigned char swz2[4],
+                                  unsigned char dst[4])
+{
+   unsigned i;
+
+   for (i = 0; i < 4; i++) {
+      dst[i] = swz2[i] <= PIPE_SWIZZLE_W ?
+               swz1[swz2[i]] : swz2[i];
+   }
+}
+
+void util_format_apply_color_swizzle(union pipe_color_union *dst,
+                                     const union pipe_color_union *src,
+                                     const unsigned char swz[4],
+                                     const boolean is_integer)
+{
+   unsigned c;
+
+   if (is_integer) {
+      for (c = 0; c < 4; ++c) {
+         switch (swz[c]) {
+         case PIPE_SWIZZLE_X:   dst->ui[c] = src->ui[0]; break;
+         case PIPE_SWIZZLE_Y: dst->ui[c] = src->ui[1]; break;
+         case PIPE_SWIZZLE_Z:  dst->ui[c] = src->ui[2]; break;
+         case PIPE_SWIZZLE_W: dst->ui[c] = src->ui[3]; break;
+         default:
+            dst->ui[c] = (swz[c] == PIPE_SWIZZLE_1) ? 1 : 0;
+            break;
+         }
+      }
+   } else {
+      for (c = 0; c < 4; ++c) {
+         switch (swz[c]) {
+         case PIPE_SWIZZLE_X:   dst->f[c] = src->f[0]; break;
+         case PIPE_SWIZZLE_Y: dst->f[c] = src->f[1]; break;
+         case PIPE_SWIZZLE_Z:  dst->f[c] = src->f[2]; break;
+         case PIPE_SWIZZLE_W: dst->f[c] = src->f[3]; break;
+         default:
+            dst->f[c] = (swz[c] == PIPE_SWIZZLE_1) ? 1.0f : 0.0f;
+            break;
+         }
+      }
+   }
+}
+
+void pipe_swizzle_4f(float *dst, const float *src,
+                            const unsigned char swz[4])
+{
+   unsigned i;
+
+   for (i = 0; i < 4; i++) {
+      if (swz[i] <= PIPE_SWIZZLE_W)
+         dst[i] = src[swz[i]];
+      else if (swz[i] == PIPE_SWIZZLE_0)
+         dst[i] = 0;
+      else if (swz[i] == PIPE_SWIZZLE_1)
+         dst[i] = 1;
+   }
+}
+
+void util_format_unswizzle_4f(float *dst, const float *src,
+                              const unsigned char swz[4])
+{
+   unsigned i;
+
+   for (i = 0; i < 4; i++) {
+      switch (swz[i]) {
+      case PIPE_SWIZZLE_X:
+         dst[0] = src[i];
+         break;
+      case PIPE_SWIZZLE_Y:
+         dst[1] = src[i];
+         break;
+      case PIPE_SWIZZLE_Z:
+         dst[2] = src[i];
+         break;
+      case PIPE_SWIZZLE_W:
+         dst[3] = src[i];
+         break;
+      }
+   }
+}
+
+enum pipe_format
+util_format_snorm8_to_sint8(enum pipe_format format)
+{
+   switch (format) {
+   case PIPE_FORMAT_R8_SNORM:
+      return PIPE_FORMAT_R8_SINT;
+   case PIPE_FORMAT_R8G8_SNORM:
+      return PIPE_FORMAT_R8G8_SINT;
+   case PIPE_FORMAT_R8G8B8_SNORM:
+      return PIPE_FORMAT_R8G8B8_SINT;
+   case PIPE_FORMAT_R8G8B8A8_SNORM:
+      return PIPE_FORMAT_R8G8B8A8_SINT;
+
+   case PIPE_FORMAT_A8_SNORM:
+      return PIPE_FORMAT_A8_SINT;
+   case PIPE_FORMAT_L8_SNORM:
+      return PIPE_FORMAT_L8_SINT;
+   case PIPE_FORMAT_L8A8_SNORM:
+      return PIPE_FORMAT_L8A8_SINT;
+   case PIPE_FORMAT_I8_SNORM:
+      return PIPE_FORMAT_I8_SINT;
+
+   case PIPE_FORMAT_R8G8B8X8_SNORM:
+      return PIPE_FORMAT_R8G8B8X8_SINT;
+   case PIPE_FORMAT_R8A8_SNORM:
+      return PIPE_FORMAT_R8A8_SINT;
+   case PIPE_FORMAT_G8R8_SNORM:
+      return PIPE_FORMAT_G8R8_SINT;
+   case PIPE_FORMAT_A8B8G8R8_SNORM:
+      return PIPE_FORMAT_A8B8G8R8_SINT;
+   case PIPE_FORMAT_X8B8G8R8_SNORM:
+      return PIPE_FORMAT_X8B8G8R8_SINT;
+
+   default:
+      return format;
+   }
+}
+
+bool
+util_format_planar_is_supported(struct pipe_screen *screen,
+                                enum pipe_format format,
+                                enum pipe_texture_target target,
+                                unsigned sample_count,
+                                unsigned storage_sample_count,
+                                unsigned bind)
+{
+   unsigned num_planes = util_format_get_num_planes(format);
+   assert(num_planes >= 2);
+
+   for (unsigned i = 0; i < num_planes; i++) {
+      if (!screen->is_format_supported(screen,
+                                       util_format_get_plane_format(format, i),
+                                       target, sample_count,
+                                       storage_sample_count, bind))
+         return false;
+   }
+
+   return true;
+}
diff --git a/src/util/format/u_format.csv b/src/util/format/u_format.csv
new file mode 100644 (file)
index 0000000..61ad815
--- /dev/null
@@ -0,0 +1,511 @@
+###########################################################################
+# 
+# Copyright 2009-2010 VMware, Inc.
+# All Rights Reserved.
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sub license, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+# 
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial portions
+# of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+# 
+###########################################################################
+
+# This CSV file has the input data for u_format.h's struct
+# util_format_description. It is also used as input for radeonsi's format
+# mapping.
+#
+# Each format entry contains:
+# - name, per enum pipe_format
+# - layout, per enum util_format_layout, in shortened lower caps
+# - pixel block's width
+# - pixel block's height
+# - channel encoding (only meaningful for plain layout), containing for each
+#   channel the following information:
+#   - type, one of
+#     - 'x': void
+#     - 'u': unsigned
+#     - 's': signed
+#     - 'h': fixed
+#     - 'f': FLOAT
+#   - optionally followed by 'n' if it is normalized
+#   - optionally followed by 'p' if it is pure
+#   - number of bits
+# - channel swizzle 
+# - color space: rgb, srgb, yuv, zs
+# - (optional) channel encoding for big-endian targets
+# - (optional) channel swizzle for big-endian targets
+#
+# See also:
+# - http://msdn.microsoft.com/en-us/library/bb172558.aspx (D3D9)
+# - http://msdn.microsoft.com/en-us/library/bb205073.aspx#mapping_texture_formats (D3D9 -> D3D10)
+# - http://msdn.microsoft.com/en-us/library/bb173059.aspx (D3D10)
+#
+# Note that GL doesn't really specify the layout of internal formats. See
+# OpenGL 2.1 specification, Table 3.16, on the "Correspondence of sized
+# internal formats to base in- ternal formats, and desired component
+# resolutions for each sized internal format."
+
+# None
+# Described as regular uint_8 bytes, i.e. PIPE_FORMAT_R8_USCALED
+PIPE_FORMAT_NONE                    , plain, 1, 1, 1, u8  ,     ,     ,     , x001, rgb
+
+# Typical rendertarget formats
+PIPE_FORMAT_B8G8R8A8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , un8 , zyxw, rgb
+PIPE_FORMAT_B8G8R8X8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , x8  , zyx1, rgb
+PIPE_FORMAT_A8R8G8B8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , un8 , yzwx, rgb
+PIPE_FORMAT_X8R8G8B8_UNORM          , plain, 1, 1, 1, x8  , un8 , un8 , un8 , yzw1, rgb
+PIPE_FORMAT_A8B8G8R8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , un8 , wzyx, rgb
+PIPE_FORMAT_X8B8G8R8_UNORM          , plain, 1, 1, 1, x8  , un8 , un8 , un8 , wzy1, rgb
+# PIPE_FORMAT_R8G8B8A8_UNORM is below
+PIPE_FORMAT_R8G8B8X8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , x8  , xyz1, rgb
+PIPE_FORMAT_R5G5B5A1_UNORM          , plain, 1, 1, 1, un5 , un5 , un5 , un1 , xyzw, rgb, un1 , un5 , un5 , un5 , wzyx
+PIPE_FORMAT_B5G5R5X1_UNORM          , plain, 1, 1, 1, un5 , un5 , un5 , x1  , zyx1, rgb, x1  , un5 , un5 , un5 , yzw1
+PIPE_FORMAT_B5G5R5A1_UNORM          , plain, 1, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb, un1 , un5 , un5 , un5 , yzwx
+PIPE_FORMAT_X1B5G5R5_UNORM          , plain, 1, 1, 1, x1  , un5 , un5 , un5 , wzy1, rgb, un5 , un5 , un5 ,  x1 , xyz1
+PIPE_FORMAT_A1R5G5B5_UNORM          , plain, 1, 1, 1, un1 , un5 , un5 , un5 , yzwx, rgb, un5 , un5 , un5 , un1 , zyxw
+PIPE_FORMAT_A1B5G5R5_UNORM          , plain, 1, 1, 1, un1 , un5 , un5 , un5 , wzyx, rgb, un5 , un5 , un5 , un1 , xyzw
+PIPE_FORMAT_R4G4B4A4_UNORM          , plain, 1, 1, 1, un4 , un4 , un4 , un4 , xyzw, rgb, un4 , un4 , un4 , un4 , wzyx
+PIPE_FORMAT_B4G4R4A4_UNORM          , plain, 1, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb, un4 , un4 , un4 , un4 , yzwx
+PIPE_FORMAT_B4G4R4X4_UNORM          , plain, 1, 1, 1, un4 , un4 , un4 , x4  , zyx1, rgb, x4  , un4 , un4 , un4 , yzw1
+PIPE_FORMAT_A4R4G4B4_UNORM          , plain, 1, 1, 1, un4 , un4 , un4 , un4 , yzwx, rgb, un4 , un4 , un4 , un4 , zyxw
+PIPE_FORMAT_A4B4G4R4_UNORM          , plain, 1, 1, 1, un4 , un4 , un4 , un4 , wzyx, rgb, un4 , un4 , un4 , un4 , xyzw
+PIPE_FORMAT_R5G6B5_UNORM            , plain, 1, 1, 1, un5 , un6 , un5 ,     , xyz1, rgb, un5 , un6 , un5 ,     , zyx1
+PIPE_FORMAT_B5G6R5_UNORM            , plain, 1, 1, 1, un5 , un6 , un5 ,     , zyx1, rgb, un5 , un6 , un5 ,     , xyz1
+PIPE_FORMAT_R10G10B10A2_UNORM       , plain, 1, 1, 1, un10, un10, un10, un2 , xyzw, rgb, un2 , un10, un10, un10, wzyx
+PIPE_FORMAT_R10G10B10X2_UNORM       , plain, 1, 1, 1, un10, un10, un10, x2,   xyz1, rgb, x2  , un10, un10, un10, wzy1
+PIPE_FORMAT_B10G10R10A2_UNORM       , plain, 1, 1, 1, un10, un10, un10, un2 , zyxw, rgb, un2 , un10, un10, un10, yzwx
+PIPE_FORMAT_A2R10G10B10_UNORM       , plain, 1, 1, 1, un2 , un10, un10, un10, yzwx, rgb, un10, un10, un10, un2 , zyxw
+PIPE_FORMAT_A2B10G10R10_UNORM       , plain, 1, 1, 1, un2 , un10, un10, un10, wzyx, rgb, un10, un10, un10, un2 , xyzw
+PIPE_FORMAT_R3G3B2_UNORM            , plain, 1, 1, 1, un3 , un3 , un2 ,     , xyz1, rgb, un3 , un3 , un2 ,     , zyx1
+PIPE_FORMAT_B2G3R3_UNORM            , plain, 1, 1, 1, un2 , un3 , un3 ,     , zyx1, rgb, un3 , un3 , un2 ,     , xyz1
+
+# Luminance/Intensity/Alpha formats
+PIPE_FORMAT_L8_UNORM                , plain, 1, 1, 1, un8 ,     ,     ,     , xxx1, rgb
+PIPE_FORMAT_A8_UNORM                , plain, 1, 1, 1, un8 ,     ,     ,     , 000x, rgb
+PIPE_FORMAT_I8_UNORM                , plain, 1, 1, 1, un8 ,     ,     ,     , xxxx, rgb
+PIPE_FORMAT_L4A4_UNORM              , plain, 1, 1, 1, un4 , un4 ,     ,     , xxxy, rgb, un4 , un4 ,     ,     , yyyx
+PIPE_FORMAT_L8A8_UNORM              , plain, 1, 1, 1, un8 , un8 ,     ,     , xxxy, rgb
+PIPE_FORMAT_L16_UNORM               , plain, 1, 1, 1, un16,     ,     ,     , xxx1, rgb
+PIPE_FORMAT_A16_UNORM               , plain, 1, 1, 1, un16,     ,     ,     , 000x, rgb
+PIPE_FORMAT_I16_UNORM               , plain, 1, 1, 1, un16,     ,     ,     , xxxx, rgb
+PIPE_FORMAT_L16A16_UNORM            , plain, 1, 1, 1, un16, un16,     ,     , xxxy, rgb
+PIPE_FORMAT_A8_SNORM                , plain, 1, 1, 1, sn8 ,     ,     ,     , 000x, rgb
+PIPE_FORMAT_L8_SNORM                , plain, 1, 1, 1, sn8 ,     ,     ,     , xxx1, rgb
+PIPE_FORMAT_L8A8_SNORM              , plain, 1, 1, 1, sn8 , sn8 ,     ,     , xxxy, rgb
+PIPE_FORMAT_I8_SNORM                , plain, 1, 1, 1, sn8 ,     ,     ,     , xxxx, rgb
+PIPE_FORMAT_A16_SNORM               , plain, 1, 1, 1, sn16,     ,     ,     , 000x, rgb
+PIPE_FORMAT_L16_SNORM               , plain, 1, 1, 1, sn16,     ,     ,     , xxx1, rgb
+PIPE_FORMAT_L16A16_SNORM            , plain, 1, 1, 1, sn16, sn16,     ,     , xxxy, rgb
+PIPE_FORMAT_I16_SNORM               , plain, 1, 1, 1, sn16,     ,     ,     , xxxx, rgb
+PIPE_FORMAT_A16_FLOAT               , plain, 1, 1, 1, f16 ,     ,     ,     , 000x, rgb
+PIPE_FORMAT_L16_FLOAT               , plain, 1, 1, 1, f16 ,     ,     ,     , xxx1, rgb
+PIPE_FORMAT_L16A16_FLOAT            , plain, 1, 1, 1, f16 , f16 ,     ,     , xxxy, rgb
+PIPE_FORMAT_I16_FLOAT               , plain, 1, 1, 1, f16 ,     ,     ,     , xxxx, rgb
+PIPE_FORMAT_A32_FLOAT               , plain, 1, 1, 1, f32 ,     ,     ,     , 000x, rgb
+PIPE_FORMAT_L32_FLOAT               , plain, 1, 1, 1, f32 ,     ,     ,     , xxx1, rgb
+PIPE_FORMAT_L32A32_FLOAT            , plain, 1, 1, 1, f32 , f32 ,     ,     , xxxy, rgb
+PIPE_FORMAT_I32_FLOAT               , plain, 1, 1, 1, f32 ,     ,     ,     , xxxx, rgb
+
+# SRGB formats
+PIPE_FORMAT_L8_SRGB                 , plain, 1, 1, 1, un8 ,     ,     ,     , xxx1, srgb 
+PIPE_FORMAT_R8_SRGB                 , plain, 1, 1, 1, un8 ,     ,     ,     , x001, srgb
+PIPE_FORMAT_L8A8_SRGB               , plain, 1, 1, 1, un8 , un8 ,     ,     , xxxy, srgb 
+PIPE_FORMAT_R8G8B8_SRGB             , plain, 1, 1, 1, un8 , un8 , un8 ,     , xyz1, srgb 
+PIPE_FORMAT_R8G8B8A8_SRGB           , plain, 1, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb 
+PIPE_FORMAT_A8B8G8R8_SRGB           , plain, 1, 1, 1, un8 , un8 , un8 , un8 , wzyx, srgb
+PIPE_FORMAT_X8B8G8R8_SRGB           , plain, 1, 1, 1, x8  , un8 , un8 , un8 , wzy1, srgb
+PIPE_FORMAT_B8G8R8A8_SRGB           , plain, 1, 1, 1, un8 , un8 , un8 , un8 , zyxw, srgb
+PIPE_FORMAT_B8G8R8X8_SRGB           , plain, 1, 1, 1, un8 , un8 , un8 , x8  , zyx1, srgb
+PIPE_FORMAT_A8R8G8B8_SRGB           , plain, 1, 1, 1, un8 , un8 , un8 , un8 , yzwx, srgb
+PIPE_FORMAT_X8R8G8B8_SRGB           , plain, 1, 1, 1, x8  , un8 , un8 , un8 , yzw1, srgb
+
+# Mixed-sign formats (typically used for bump map textures)
+PIPE_FORMAT_R8SG8SB8UX8U_NORM       , plain, 1, 1, 1, sn8 , sn8 , un8 , x8  , xyz1, rgb
+PIPE_FORMAT_R10SG10SB10SA2U_NORM    , plain, 1, 1, 1, sn10, sn10, sn10, un2 , xyzw, rgb, un2 , sn10, sn10, sn10, wzyx
+PIPE_FORMAT_R5SG5SB6U_NORM          , plain, 1, 1, 1, sn5 , sn5 , un6 ,     , xyz1, rgb, un6 , sn5 , sn5 ,     , zyx1
+
+# Depth-stencil formats
+PIPE_FORMAT_S8_UINT                 , plain, 1, 1, 1, up8 ,     ,     ,     , _x__, zs
+PIPE_FORMAT_Z16_UNORM               , plain, 1, 1, 1, un16,     ,     ,     , x___, zs
+PIPE_FORMAT_Z32_UNORM               , plain, 1, 1, 1, un32,     ,     ,     , x___, zs
+PIPE_FORMAT_Z32_FLOAT               , plain, 1, 1, 1, f32 ,     ,     ,     , x___, zs
+PIPE_FORMAT_Z24_UNORM_S8_UINT       , plain, 1, 1, 1, un24, up8 ,     ,     , xy__, zs,    up8 , un24,     ,     , yx__
+PIPE_FORMAT_S8_UINT_Z24_UNORM       , plain, 1, 1, 1, up8 , un24,     ,     , yx__, zs,    un24, up8 ,     ,     , xy__
+PIPE_FORMAT_X24S8_UINT              , plain, 1, 1, 1, x24 , up8 ,     ,     , _y__, zs,    up8 , x24 ,     ,     , _x__
+PIPE_FORMAT_S8X24_UINT              , plain, 1, 1, 1, up8 , x24 ,     ,     , _x__, zs,    x24 , up8 ,     ,     , _y__
+PIPE_FORMAT_Z24X8_UNORM             , plain, 1, 1, 1, un24, x8  ,     ,     , x___, zs,    x8  , un24,     ,     , y___
+PIPE_FORMAT_X8Z24_UNORM             , plain, 1, 1, 1, x8  , un24,     ,     , y___, zs,    un24, x8  ,     ,     , x___
+PIPE_FORMAT_Z32_FLOAT_S8X24_UINT    , plain, 1, 1, 1, f32 , up8 ,  x24,     , xy__, zs,    f32 , x24 ,  up8,     , xz__
+PIPE_FORMAT_X32_S8X24_UINT          , plain, 1, 1, 1, x32 , up8 ,  x24,     , _y__, zs,    x32 , x24 ,  up8,     , _z__
+
+# Depth-stencil formats equivalent to blitting PIPE_FORMAT_Z24_UNORM_S8_UINT
+# as PIPE_FORMAT_R8G8B8A8_*, in that it is an equivalent size to the z/s
+# format.  This is mainly for hw that has some sort of bandwidth compressed
+# format where the compression for z24s8 is not equivalent to r8g8b8a8,
+# and therefore some special handling is required for blits.
+PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8 , plain, 1, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb
+
+# YUV formats
+# http://www.fourcc.org/yuv.php#UYVY
+PIPE_FORMAT_UYVY                     , subsampled, 2, 1, 1, x32 ,     ,     ,     , xyz1, yuv
+# http://www.fourcc.org/yuv.php#YUYV (a.k.a http://www.fourcc.org/yuv.php#YUY2)
+PIPE_FORMAT_YUYV                     , subsampled, 2, 1, 1, x32 ,     ,     ,     , xyz1, yuv
+
+PIPE_FORMAT_AYUV                    , other, 4, 4, 1, un8 ,     ,     ,     , xyzw, yuv
+PIPE_FORMAT_XYUV                    , other, 4, 4, 1, un8 ,     ,     ,     , xyz1, yuv
+
+# same subsampling but with rgb channels
+PIPE_FORMAT_R8G8_B8G8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , xyz1, rgb
+PIPE_FORMAT_G8R8_G8B8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , xyz1, rgb
+PIPE_FORMAT_G8R8_B8R8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , yxz1, rgb
+PIPE_FORMAT_R8G8_R8B8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , yxz1, rgb
+
+# some special formats not fitting anywhere else
+PIPE_FORMAT_R11G11B10_FLOAT         , other,     1, 1, 1, f11 , f11 , f10 ,     , xyz1, rgb
+PIPE_FORMAT_R9G9B9E5_FLOAT          , other,     1, 1, 1, f9  , f9  , f9  , x5  , xyz1, rgb
+PIPE_FORMAT_R1_UNORM                , other,     8, 1, 1, x8  ,     ,     ,     , x001, rgb
+# A.k.a. D3DFMT_CxV8U8
+PIPE_FORMAT_R8G8Bx_SNORM            , other,     1, 1, 1, sn8 , sn8 ,     ,     , xyz1, rgb
+
+# Compressed formats
+# - http://en.wikipedia.org/wiki/S3_Texture_Compression
+# - http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt
+# - http://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
+# - http://www.opengl.org/registry/specs/EXT/texture_compression_latc.txt
+# - http://www.opengl.org/registry/specs/ARB/texture_compression_bptc.txt
+# - http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
+# - http://msdn.microsoft.com/en-us/library/bb694531.aspx
+PIPE_FORMAT_DXT1_RGB                , s3tc, 4, 4, 1, x64 ,     ,     ,     , xyz1, rgb
+PIPE_FORMAT_DXT1_RGBA               , s3tc, 4, 4, 1, x64 ,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_DXT3_RGBA               , s3tc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_DXT5_RGBA               , s3tc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_DXT1_SRGB               , s3tc, 4, 4, 1, x64 ,     ,     ,     , xyz1, srgb
+PIPE_FORMAT_DXT1_SRGBA              , s3tc, 4, 4, 1, x64 ,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_DXT3_SRGBA              , s3tc, 4, 4, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_DXT5_SRGBA              , s3tc, 4, 4, 1, x128,     ,     ,     , xyzw, srgb
+
+# FXT1 compressed formats
+PIPE_FORMAT_FXT1_RGB              , fxt1, 8, 4, 1, x128,     ,     ,     , xyz1, rgb
+PIPE_FORMAT_FXT1_RGBA             , fxt1, 8, 4, 1, x128,     ,     ,     , xyzw, rgb
+
+PIPE_FORMAT_RGTC1_UNORM             , rgtc, 4, 4, 1, x64,      ,     ,     , x001, rgb
+PIPE_FORMAT_RGTC1_SNORM             , rgtc, 4, 4, 1, x64,      ,     ,     , x001, rgb
+PIPE_FORMAT_RGTC2_UNORM             , rgtc, 4, 4, 1, x128,     ,     ,     , xy01, rgb
+PIPE_FORMAT_RGTC2_SNORM             , rgtc, 4, 4, 1, x128,     ,     ,     , xy01, rgb
+
+PIPE_FORMAT_LATC1_UNORM             , rgtc, 4, 4, 1, x64,      ,     ,     , xxx1, rgb
+PIPE_FORMAT_LATC1_SNORM             , rgtc, 4, 4, 1, x64,      ,     ,     , xxx1, rgb
+PIPE_FORMAT_LATC2_UNORM             , rgtc, 4, 4, 1, x128,     ,     ,     , xxxy, rgb
+PIPE_FORMAT_LATC2_SNORM             , rgtc, 4, 4, 1, x128,     ,     ,     , xxxy, rgb
+
+PIPE_FORMAT_ETC1_RGB8               ,  etc, 4, 4, 1, x64,      ,     ,     , xyz1, rgb
+
+PIPE_FORMAT_ETC2_RGB8               ,  etc, 4, 4, 1, x64,      ,     ,     , xyz1, rgb
+PIPE_FORMAT_ETC2_SRGB8              ,  etc, 4, 4, 1, x64,      ,     ,     , xyz1, srgb
+PIPE_FORMAT_ETC2_RGB8A1             ,  etc, 4, 4, 1, x64,      ,     ,     , xyzw, rgb
+PIPE_FORMAT_ETC2_SRGB8A1            ,  etc, 4, 4, 1, x64,      ,     ,     , xyzw, srgb
+PIPE_FORMAT_ETC2_RGBA8              ,  etc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ETC2_SRGBA8             ,  etc, 4, 4, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ETC2_R11_UNORM          ,  etc, 4, 4, 1, x64,      ,     ,     , x001, rgb
+PIPE_FORMAT_ETC2_R11_SNORM          ,  etc, 4, 4, 1, x64,      ,     ,     , x001, rgb
+PIPE_FORMAT_ETC2_RG11_UNORM         ,  etc, 4, 4, 1, x128,     ,     ,     , xy01, rgb
+PIPE_FORMAT_ETC2_RG11_SNORM         ,  etc, 4, 4, 1, x128,     ,     ,     , xy01, rgb
+
+PIPE_FORMAT_BPTC_RGBA_UNORM         , bptc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_BPTC_SRGBA              , bptc, 4, 4, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_BPTC_RGB_FLOAT          , bptc, 4, 4, 1, x128,     ,     ,     , xyz1, rgb
+PIPE_FORMAT_BPTC_RGB_UFLOAT         , bptc, 4, 4, 1, x128,     ,     ,     , xyz1, rgb
+
+PIPE_FORMAT_ASTC_4x4                , astc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_5x4                , astc, 5, 4, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_5x5                , astc, 5, 5, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_6x5                , astc, 6, 5, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_6x6                , astc, 6, 6, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_8x5                , astc, 8, 5, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_8x6                , astc, 8, 6, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_8x8                , astc, 8, 8, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_10x5               , astc,10, 5, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_10x6               , astc,10, 6, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_10x8               , astc,10, 8, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_10x10              , astc,10,10, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_12x10              , astc,12,10, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_12x12              , astc,12,12, 1, x128,     ,     ,     , xyzw, rgb
+
+PIPE_FORMAT_ASTC_4x4_SRGB           , astc, 4, 4, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_5x4_SRGB           , astc, 5, 4, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_5x5_SRGB           , astc, 5, 5, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_6x5_SRGB           , astc, 6, 5, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_6x6_SRGB           , astc, 6, 6, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_8x5_SRGB           , astc, 8, 5, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_8x6_SRGB           , astc, 8, 6, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_8x8_SRGB           , astc, 8, 8, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_10x5_SRGB          , astc,10, 5, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_10x6_SRGB          , astc,10, 6, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_10x8_SRGB          , astc,10, 8, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_10x10_SRGB         , astc,10,10, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_12x10_SRGB         , astc,12,10, 1, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_12x12_SRGB         , astc,12,12, 1, x128,     ,     ,     , xyzw, srgb
+
+PIPE_FORMAT_ASTC_3x3x3              , astc, 3, 3, 3, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_4x3x3              , astc, 4, 3, 3, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_4x4x3              , astc, 4, 4, 3, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_4x4x4              , astc, 4, 4, 4, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_5x4x4              , astc, 5, 4, 4, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_5x5x4              , astc, 5, 5, 4, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_5x5x5              , astc, 5, 5, 5, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_6x5x5              , astc, 6, 5, 5, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_6x6x5              , astc, 6, 6, 5, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_6x6x6              , astc, 6, 6, 6, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ASTC_3x3x3_SRGB         , astc, 3, 3, 3, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_4x3x3_SRGB         , astc, 4, 3, 3, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_4x4x3_SRGB         , astc, 4, 4, 3, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_4x4x4_SRGB         , astc, 4, 4, 4, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_5x4x4_SRGB         , astc, 5, 4, 4, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_5x5x4_SRGB         , astc, 5, 5, 4, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_5x5x5_SRGB         , astc, 5, 5, 5, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_6x5x5_SRGB         , astc, 6, 5, 5, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_6x6x5_SRGB         , astc, 6, 6, 5, x128,     ,     ,     , xyzw, srgb
+PIPE_FORMAT_ASTC_6x6x6_SRGB         , astc, 6, 6, 6, x128,     ,     ,     , xyzw, srgb
+
+PIPE_FORMAT_ATC_RGB                 ,  atc, 4, 4, 1, x64,      ,     ,     , xyz1, rgb
+PIPE_FORMAT_ATC_RGBA_EXPLICIT       ,  atc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ATC_RGBA_INTERPOLATED   ,  atc, 4, 4, 1, x128,     ,     ,     , xyzw, rgb
+
+# Straightforward D3D10-like formats (also used for 
+# vertex buffer element description)
+# 
+# See also:
+# - src/gallium/auxiliary/translate/translate_generic.c
+# - src/mesa/state_tracker/st_draw.c
+PIPE_FORMAT_R64_FLOAT               , plain, 1, 1, 1, f64 ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R64G64_FLOAT            , plain, 1, 1, 1, f64 , f64 ,     ,     , xy01, rgb
+PIPE_FORMAT_R64G64B64_FLOAT         , plain, 1, 1, 1, f64 , f64 , f64 ,     , xyz1, rgb
+PIPE_FORMAT_R64G64B64A64_FLOAT      , plain, 1, 1, 1, f64 , f64 , f64 , f64 , xyzw, rgb
+PIPE_FORMAT_R32_FLOAT               , plain, 1, 1, 1, f32 ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R32G32_FLOAT            , plain, 1, 1, 1, f32 , f32 ,     ,     , xy01, rgb
+PIPE_FORMAT_R32G32B32_FLOAT         , plain, 1, 1, 1, f32 , f32 , f32 ,     , xyz1, rgb
+PIPE_FORMAT_R32G32B32A32_FLOAT      , plain, 1, 1, 1, f32 , f32 , f32 , f32 , xyzw, rgb
+PIPE_FORMAT_R32_UNORM               , plain, 1, 1, 1, un32,     ,     ,     , x001, rgb
+PIPE_FORMAT_R32G32_UNORM            , plain, 1, 1, 1, un32, un32,     ,     , xy01, rgb
+PIPE_FORMAT_R32G32B32_UNORM         , plain, 1, 1, 1, un32, un32, un32,     , xyz1, rgb
+PIPE_FORMAT_R32G32B32A32_UNORM      , plain, 1, 1, 1, un32, un32, un32, un32, xyzw, rgb
+PIPE_FORMAT_R32_USCALED             , plain, 1, 1, 1, u32 ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R32G32_USCALED          , plain, 1, 1, 1, u32 , u32 ,     ,     , xy01, rgb
+PIPE_FORMAT_R32G32B32_USCALED       , plain, 1, 1, 1, u32 , u32 , u32 ,     , xyz1, rgb
+PIPE_FORMAT_R32G32B32A32_USCALED    , plain, 1, 1, 1, u32 , u32 , u32 , u32 , xyzw, rgb
+PIPE_FORMAT_R32_SNORM               , plain, 1, 1, 1, sn32,     ,     ,     , x001, rgb
+PIPE_FORMAT_R32G32_SNORM            , plain, 1, 1, 1, sn32, sn32,     ,     , xy01, rgb
+PIPE_FORMAT_R32G32B32_SNORM         , plain, 1, 1, 1, sn32, sn32, sn32,     , xyz1, rgb
+PIPE_FORMAT_R32G32B32A32_SNORM      , plain, 1, 1, 1, sn32, sn32, sn32, sn32, xyzw, rgb
+PIPE_FORMAT_R32_SSCALED             , plain, 1, 1, 1, s32 ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R32G32_SSCALED          , plain, 1, 1, 1, s32 , s32 ,     ,     , xy01, rgb
+PIPE_FORMAT_R32G32B32_SSCALED       , plain, 1, 1, 1, s32 , s32 , s32 ,     , xyz1, rgb
+PIPE_FORMAT_R32G32B32A32_SSCALED    , plain, 1, 1, 1, s32 , s32 , s32 , s32 , xyzw, rgb
+PIPE_FORMAT_R16_FLOAT               , plain, 1, 1, 1, f16 ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R16G16_FLOAT            , plain, 1, 1, 1, f16 , f16 ,     ,     , xy01, rgb
+PIPE_FORMAT_R16G16B16_FLOAT         , plain, 1, 1, 1, f16 , f16 , f16 ,     , xyz1, rgb
+PIPE_FORMAT_R16G16B16A16_FLOAT      , plain, 1, 1, 1, f16 , f16 , f16 , f16 , xyzw, rgb
+PIPE_FORMAT_R16_UNORM               , plain, 1, 1, 1, un16,     ,     ,     , x001, rgb
+PIPE_FORMAT_R16G16_UNORM            , plain, 1, 1, 1, un16, un16,     ,     , xy01, rgb
+PIPE_FORMAT_R16G16B16_UNORM         , plain, 1, 1, 1, un16, un16, un16,     , xyz1, rgb
+PIPE_FORMAT_R16G16B16A16_UNORM      , plain, 1, 1, 1, un16, un16, un16, un16, xyzw, rgb
+PIPE_FORMAT_R16_USCALED             , plain, 1, 1, 1, u16 ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R16G16_USCALED          , plain, 1, 1, 1, u16 , u16 ,     ,     , xy01, rgb
+PIPE_FORMAT_R16G16B16_USCALED       , plain, 1, 1, 1, u16 , u16 , u16 ,     , xyz1, rgb
+PIPE_FORMAT_R16G16B16A16_USCALED    , plain, 1, 1, 1, u16 , u16 , u16 , u16 , xyzw, rgb
+PIPE_FORMAT_R16_SNORM               , plain, 1, 1, 1, sn16,     ,     ,     , x001, rgb
+PIPE_FORMAT_R16G16_SNORM            , plain, 1, 1, 1, sn16, sn16,     ,     , xy01, rgb
+PIPE_FORMAT_R16G16B16_SNORM         , plain, 1, 1, 1, sn16, sn16, sn16,     , xyz1, rgb
+PIPE_FORMAT_R16G16B16A16_SNORM      , plain, 1, 1, 1, sn16, sn16, sn16, sn16, xyzw, rgb
+PIPE_FORMAT_R16_SSCALED             , plain, 1, 1, 1, s16 ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R16G16_SSCALED          , plain, 1, 1, 1, s16 , s16 ,     ,     , xy01, rgb
+PIPE_FORMAT_R16G16B16_SSCALED       , plain, 1, 1, 1, s16 , s16 , s16 ,     , xyz1, rgb
+PIPE_FORMAT_R16G16B16A16_SSCALED    , plain, 1, 1, 1, s16 , s16 , s16 , s16 , xyzw, rgb
+PIPE_FORMAT_R8_UNORM                , plain, 1, 1, 1, un8 ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R8G8_UNORM              , plain, 1, 1, 1, un8 , un8 ,     ,     , xy01, rgb
+PIPE_FORMAT_R8G8B8_UNORM            , plain, 1, 1, 1, un8 , un8 , un8 ,     , xyz1, rgb
+PIPE_FORMAT_B8G8R8_UNORM            , plain, 1, 1, 1, un8 , un8 , un8 ,     , zyx1, rgb
+PIPE_FORMAT_R8G8B8A8_UNORM          , plain, 1, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb
+PIPE_FORMAT_R8_USCALED              , plain, 1, 1, 1, u8  ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R8G8_USCALED            , plain, 1, 1, 1, u8  , u8  ,     ,     , xy01, rgb
+PIPE_FORMAT_R8G8B8_USCALED          , plain, 1, 1, 1, u8  , u8  , u8  ,     , xyz1, rgb
+PIPE_FORMAT_R8G8B8A8_USCALED        , plain, 1, 1, 1, u8  , u8  , u8  , u8  , xyzw, rgb
+PIPE_FORMAT_R8_SNORM                , plain, 1, 1, 1, sn8 ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R8G8_SNORM              , plain, 1, 1, 1, sn8 , sn8 ,     ,     , xy01, rgb
+PIPE_FORMAT_R8G8B8_SNORM            , plain, 1, 1, 1, sn8 , sn8 , sn8 ,     , xyz1, rgb
+PIPE_FORMAT_R8G8B8A8_SNORM          , plain, 1, 1, 1, sn8 , sn8 , sn8 , sn8 , xyzw, rgb
+PIPE_FORMAT_R8_SSCALED              , plain, 1, 1, 1, s8  ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R8G8_SSCALED            , plain, 1, 1, 1, s8  , s8  ,     ,     , xy01, rgb
+PIPE_FORMAT_R8G8B8_SSCALED          , plain, 1, 1, 1, s8  , s8  , s8  ,     , xyz1, rgb
+PIPE_FORMAT_R8G8B8A8_SSCALED        , plain, 1, 1, 1, s8  , s8  , s8  , s8  , xyzw, rgb
+
+# GL-specific vertex buffer element formats
+# A.k.a. GL_FIXED
+PIPE_FORMAT_R32_FIXED               , plain, 1, 1, 1, h32 ,     ,     ,     , x001, rgb
+PIPE_FORMAT_R32G32_FIXED            , plain, 1, 1, 1, h32 , h32 ,     ,     , xy01, rgb
+PIPE_FORMAT_R32G32B32_FIXED         , plain, 1, 1, 1, h32 , h32 , h32 ,     , xyz1, rgb
+PIPE_FORMAT_R32G32B32A32_FIXED      , plain, 1, 1, 1, h32 , h32 , h32 , h32 , xyzw, rgb
+
+# D3D9-specific vertex buffer element formats
+# See also:
+# - http://msdn.microsoft.com/en-us/library/bb172533.aspx
+# A.k.a. D3DDECLTYPE_UDEC3
+PIPE_FORMAT_R10G10B10X2_USCALED     , plain, 1, 1, 1, u10 , u10 , u10  , x2 , xyz1, rgb, x2  , u10 , u10 , u10 , wzy1
+# A.k.a. D3DDECLTYPE_DEC3N
+PIPE_FORMAT_R10G10B10X2_SNORM       , plain, 1, 1, 1, sn10, sn10, sn10 , x2 , xyz1, rgb, x2  , sn10, sn10, sn10, wzy1
+
+PIPE_FORMAT_YV12                  , planar3, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
+PIPE_FORMAT_YV16                  , planar3, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
+PIPE_FORMAT_IYUV                  , planar3, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
+PIPE_FORMAT_NV12                  , planar2, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
+PIPE_FORMAT_NV21                  , planar2, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
+
+PIPE_FORMAT_P016                  , planar2, 1, 1, 1,     ,     ,     ,     , xyzw, yuv
+
+# Usually used to implement IA44 and AI44 formats in video decoding
+PIPE_FORMAT_A4R4_UNORM              , plain, 1, 1, 1, un4 , un4 ,     ,     , y00x, rgb, un4, un4 ,     ,     , x00y
+PIPE_FORMAT_R4A4_UNORM              , plain, 1, 1, 1, un4 , un4 ,     ,     , x00y, rgb, un4, un4 ,     ,     , y00x
+PIPE_FORMAT_R8A8_UNORM              , plain, 1, 1, 1, un8 , un8 ,     ,     , x00y, rgb
+PIPE_FORMAT_A8R8_UNORM              , plain, 1, 1, 1, un8 , un8 ,     ,     , y00x, rgb
+
+# ARB_vertex_type_10_10_10_2_REV
+PIPE_FORMAT_R10G10B10A2_USCALED     , plain, 1, 1, 1, u10 , u10 , u10 , u2  , xyzw, rgb, u2  , u10 , u10 , u10 , wzyx
+PIPE_FORMAT_R10G10B10A2_SSCALED     , plain, 1, 1, 1, s10 , s10 , s10 , s2  , xyzw, rgb, s2  , s10 , s10 , s10 , wzyx
+PIPE_FORMAT_R10G10B10A2_SNORM       , plain, 1, 1, 1, sn10, sn10, sn10, sn2 , xyzw, rgb, sn2 , sn10, sn10, sn10, wzyx
+PIPE_FORMAT_B10G10R10A2_USCALED     , plain, 1, 1, 1, u10 , u10 , u10 , u2  , zyxw, rgb, u2  , u10 , u10 , u10 , yzwx
+PIPE_FORMAT_B10G10R10A2_SSCALED     , plain, 1, 1, 1, s10 , s10 , s10 , s2  , zyxw, rgb, s2  , s10 , s10 , s10 , yzwx
+PIPE_FORMAT_B10G10R10A2_SNORM       , plain, 1, 1, 1, sn10, sn10, sn10, sn2 , zyxw, rgb, sn2 , sn10, sn10, sn10, yzwx
+
+PIPE_FORMAT_R8_UINT                 , plain, 1, 1, 1, up8, , , , x001, rgb
+PIPE_FORMAT_R8G8_UINT               , plain, 1, 1, 1, up8, up8, , , xy01, rgb
+PIPE_FORMAT_R8G8B8_UINT             , plain, 1, 1, 1, up8, up8, up8, , xyz1, rgb
+PIPE_FORMAT_R8G8B8A8_UINT           , plain, 1, 1, 1, up8, up8, up8, up8, xyzw, rgb
+
+PIPE_FORMAT_R8_SINT                 , plain, 1, 1, 1, sp8, , , , x001, rgb
+PIPE_FORMAT_R8G8_SINT               , plain, 1, 1, 1, sp8, sp8, , , xy01, rgb
+PIPE_FORMAT_R8G8B8_SINT             , plain, 1, 1, 1, sp8, sp8, sp8, , xyz1, rgb
+PIPE_FORMAT_R8G8B8A8_SINT           , plain, 1, 1, 1, sp8, sp8, sp8, sp8, xyzw, rgb
+
+PIPE_FORMAT_R16_UINT                , plain, 1, 1, 1, up16, , , , x001, rgb
+PIPE_FORMAT_R16G16_UINT             , plain, 1, 1, 1, up16, up16, , , xy01, rgb
+PIPE_FORMAT_R16G16B16_UINT          , plain, 1, 1, 1, up16, up16, up16, , xyz1, rgb
+PIPE_FORMAT_R16G16B16A16_UINT       , plain, 1, 1, 1, up16, up16, up16, up16, xyzw, rgb
+
+PIPE_FORMAT_R16_SINT                , plain, 1, 1, 1, sp16, , , , x001, rgb
+PIPE_FORMAT_R16G16_SINT             , plain, 1, 1, 1, sp16, sp16, , , xy01, rgb
+PIPE_FORMAT_R16G16B16_SINT          , plain, 1, 1, 1, sp16, sp16, sp16, , xyz1, rgb
+PIPE_FORMAT_R16G16B16A16_SINT       , plain, 1, 1, 1, sp16, sp16, sp16, sp16, xyzw, rgb
+
+PIPE_FORMAT_R32_UINT                , plain, 1, 1, 1, up32, , , , x001, rgb
+PIPE_FORMAT_R32G32_UINT             , plain, 1, 1, 1, up32, up32, , , xy01, rgb
+PIPE_FORMAT_R32G32B32_UINT          , plain, 1, 1, 1, up32, up32, up32, , xyz1, rgb
+PIPE_FORMAT_R32G32B32A32_UINT       , plain, 1, 1, 1, up32, up32, up32, up32, xyzw, rgb
+
+PIPE_FORMAT_R32_SINT                , plain, 1, 1, 1, sp32, , , , x001, rgb
+PIPE_FORMAT_R32G32_SINT             , plain, 1, 1, 1, sp32, sp32, , , xy01, rgb
+PIPE_FORMAT_R32G32B32_SINT          , plain, 1, 1, 1, sp32, sp32, sp32, , xyz1, rgb
+PIPE_FORMAT_R32G32B32A32_SINT       , plain, 1, 1, 1, sp32, sp32, sp32, sp32, xyzw, rgb
+
+PIPE_FORMAT_A8_UINT                 , plain, 1, 1, 1, up8, , , , 000x, rgb
+PIPE_FORMAT_I8_UINT                 , plain, 1, 1, 1, up8, , , , xxxx, rgb
+PIPE_FORMAT_L8_UINT                 , plain, 1, 1, 1, up8, , , , xxx1, rgb
+PIPE_FORMAT_L8A8_UINT               , plain, 1, 1, 1, up8, up8, , , xxxy, rgb
+
+PIPE_FORMAT_A8_SINT                 , plain, 1, 1, 1, sp8, , , , 000x, rgb
+PIPE_FORMAT_I8_SINT                 , plain, 1, 1, 1, sp8, , , , xxxx, rgb
+PIPE_FORMAT_L8_SINT                 , plain, 1, 1, 1, sp8, , , , xxx1, rgb
+PIPE_FORMAT_L8A8_SINT               , plain, 1, 1, 1, sp8, sp8, , , xxxy, rgb
+
+PIPE_FORMAT_A16_UINT                , plain, 1, 1, 1, up16, , , , 000x, rgb
+PIPE_FORMAT_I16_UINT                , plain, 1, 1, 1, up16, , , , xxxx, rgb
+PIPE_FORMAT_L16_UINT                , plain, 1, 1, 1, up16, , , , xxx1, rgb
+PIPE_FORMAT_L16A16_UINT             , plain, 1, 1, 1, up16, up16, , , xxxy, rgb
+
+PIPE_FORMAT_A16_SINT                , plain, 1, 1, 1, sp16, , , , 000x, rgb
+PIPE_FORMAT_I16_SINT                , plain, 1, 1, 1, sp16, , , , xxxx, rgb
+PIPE_FORMAT_L16_SINT                , plain, 1, 1, 1, sp16, , , , xxx1, rgb
+PIPE_FORMAT_L16A16_SINT             , plain, 1, 1, 1, sp16, sp16, , , xxxy, rgb
+
+PIPE_FORMAT_A32_UINT                , plain, 1, 1, 1, up32, , , , 000x, rgb
+PIPE_FORMAT_I32_UINT                , plain, 1, 1, 1, up32, , , , xxxx, rgb
+PIPE_FORMAT_L32_UINT                , plain, 1, 1, 1, up32, , , , xxx1, rgb
+PIPE_FORMAT_L32A32_UINT             , plain, 1, 1, 1, up32, up32, , , xxxy, rgb
+
+PIPE_FORMAT_A32_SINT                , plain, 1, 1, 1, sp32, , , , 000x, rgb
+PIPE_FORMAT_I32_SINT                , plain, 1, 1, 1, sp32, , , , xxxx, rgb
+PIPE_FORMAT_L32_SINT                , plain, 1, 1, 1, sp32, , , , xxx1, rgb
+PIPE_FORMAT_L32A32_SINT             , plain, 1, 1, 1, sp32, sp32, , , xxxy, rgb
+
+PIPE_FORMAT_B8G8R8A8_UINT           , plain, 1, 1, 1, up8 , up8 , up8 , up8 , zyxw, rgb
+PIPE_FORMAT_A8R8G8B8_UINT           , plain, 1, 1, 1, up8 , up8 , up8 , up8 , yzwx, rgb
+PIPE_FORMAT_A8B8G8R8_UINT           , plain, 1, 1, 1, up8 , up8 , up8 , up8 , wzyx, rgb
+PIPE_FORMAT_A2R10G10B10_UINT        , plain, 1, 1, 1, up2 , up10, up10, up10, yzwx, rgb, up10, up10, up10, up2 , zyxw
+PIPE_FORMAT_A2B10G10R10_UINT        , plain, 1, 1, 1, up2 , up10, up10, up10, wzyx, rgb, up10, up10, up10, up2 , xyzw
+PIPE_FORMAT_B10G10R10A2_UINT        , plain, 1, 1, 1, up10, up10, up10, up2, zyxw, rgb, up2 , up10, up10, up10, yzwx
+PIPE_FORMAT_R5G6B5_UINT             , plain, 1, 1, 1, up5 , up6 , up5 ,     , xyz1, rgb, up5 , up6 , up5 ,     , zyx1
+PIPE_FORMAT_B5G6R5_UINT             , plain, 1, 1, 1, up5 , up6 , up5 ,     , zyx1, rgb, up5 , up6 , up5 ,     , xyz1
+PIPE_FORMAT_R3G3B2_UINT             , plain, 1, 1, 1, up3 , up3 , up2 ,     , xyz1, rgb, up3 , up3 , up2 ,     , zyx1
+PIPE_FORMAT_B2G3R3_UINT             , plain, 1, 1, 1, up2 , up3 , up3 ,     , zyx1, rgb, up3 , up3 , up2 ,     , xyz1
+PIPE_FORMAT_R4G4B4A4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , xyzw, rgb, up4 , up4 , up4 , up4 , wzyx
+PIPE_FORMAT_B4G4R4A4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , zyxw, rgb, up4 , up4 , up4 , up4 , yzwx
+PIPE_FORMAT_A4R4G4B4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , yzwx, rgb, up4 , up4 , up4 , up4 , zyxw
+PIPE_FORMAT_A4B4G4R4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , wzyx, rgb, up4 , up4 , up4 , up4 , xyzw
+PIPE_FORMAT_A1R5G5B5_UINT           , plain, 1, 1, 1, up1 , up5 , up5 , up5 , wzyx, rgb, up5 , up5 , up5 , up1 , zyxw
+PIPE_FORMAT_A1B5G5R5_UINT           , plain, 1, 1, 1, up1 , up5 , up5 , up5 , wzyx, rgb, up5 , up5 , up5 , up1 , xyzw
+PIPE_FORMAT_R5G5B5A1_UINT           , plain, 1, 1, 1, up5 , up5 , up5 , up1 , xyzw, rgb, up5 , up5 , up5 , up1 , wzyx
+PIPE_FORMAT_B5G5R5A1_UINT           , plain, 1, 1, 1, up5 , up5 , up5 , up1 , zyxw, rgb, up1 , up5 , up5 , up5 , yzwx
+
+PIPE_FORMAT_R8G8B8X8_SNORM          , plain, 1, 1, 1, sn8,  sn8,  sn8,  x8,  xyz1, rgb
+PIPE_FORMAT_R8G8B8X8_SRGB           , plain, 1, 1, 1, un8,  un8,  un8,  x8,  xyz1, srgb
+PIPE_FORMAT_R8G8B8X8_UINT           , plain, 1, 1, 1, up8,  up8,  up8,  x8,  xyz1, rgb
+PIPE_FORMAT_R8G8B8X8_SINT           , plain, 1, 1, 1, sp8,  sp8,  sp8,  x8,  xyz1, rgb
+PIPE_FORMAT_B10G10R10X2_UNORM       , plain, 1, 1, 1, un10, un10, un10, x2,  zyx1, rgb, x2  , un10, un10, un10, yzw1
+PIPE_FORMAT_R16G16B16X16_UNORM      , plain, 1, 1, 1, un16, un16, un16, x16, xyz1, rgb
+PIPE_FORMAT_R16G16B16X16_SNORM      , plain, 1, 1, 1, sn16, sn16, sn16, x16, xyz1, rgb
+PIPE_FORMAT_R16G16B16X16_FLOAT      , plain, 1, 1, 1, f16,  f16,  f16,  x16, xyz1, rgb
+PIPE_FORMAT_R16G16B16X16_UINT       , plain, 1, 1, 1, up16, up16, up16, x16, xyz1, rgb
+PIPE_FORMAT_R16G16B16X16_SINT       , plain, 1, 1, 1, sp16, sp16, sp16, x16, xyz1, rgb
+PIPE_FORMAT_R32G32B32X32_FLOAT      , plain, 1, 1, 1, f32,  f32,  f32,  x32, xyz1, rgb
+PIPE_FORMAT_R32G32B32X32_UINT       , plain, 1, 1, 1, up32, up32, up32, x32, xyz1, rgb
+PIPE_FORMAT_R32G32B32X32_SINT       , plain, 1, 1, 1, sp32, sp32, sp32, x32, xyz1, rgb
+
+PIPE_FORMAT_R8A8_SNORM              , plain, 1, 1, 1, sn8  ,  sn8 ,     ,     , x00y, rgb
+PIPE_FORMAT_R16A16_UNORM            , plain, 1, 1, 1, un16 , un16 ,     ,     , x00y, rgb
+PIPE_FORMAT_R16A16_SNORM            , plain, 1, 1, 1, sn16 , sn16 ,     ,     , x00y, rgb
+PIPE_FORMAT_R16A16_FLOAT            , plain, 1, 1, 1, f16  , f16  ,     ,     , x00y, rgb
+PIPE_FORMAT_R32A32_FLOAT            , plain, 1, 1, 1, f32  , f32  ,     ,     , x00y, rgb
+PIPE_FORMAT_R8A8_UINT               , plain, 1, 1, 1, up8  , up8  ,     ,     , x00y, rgb
+PIPE_FORMAT_R8A8_SINT               , plain, 1, 1, 1, sp8  , sp8  ,     ,     , x00y, rgb
+PIPE_FORMAT_R16A16_UINT             , plain, 1, 1, 1, up16 , up16 ,     ,     , x00y, rgb
+PIPE_FORMAT_R16A16_SINT             , plain, 1, 1, 1, sp16 , sp16 ,     ,     , x00y, rgb
+PIPE_FORMAT_R32A32_UINT             , plain, 1, 1, 1, up32 , up32 ,     ,     , x00y, rgb
+PIPE_FORMAT_R32A32_SINT             , plain, 1, 1, 1, sp32 , sp32 ,     ,     , x00y, rgb
+PIPE_FORMAT_R10G10B10A2_UINT        , plain, 1, 1, 1, up10 , up10 , up10, up2 , xyzw, rgb, up2 , up10, up10, up10, wzyx
+
+PIPE_FORMAT_B5G6R5_SRGB             , plain, 1, 1, 1, un5 , un6 , un5 ,     , zyx1, srgb, un5 , un6 , un5 ,     , xyz1
+
+PIPE_FORMAT_G8R8_UNORM              , plain, 1, 1, 1, un8 , un8 , , , yx01, rgb
+PIPE_FORMAT_G8R8_SNORM              , plain, 1, 1, 1, sn8 , sn8 , , , yx01, rgb
+PIPE_FORMAT_G8R8_SINT               , plain, 1, 1, 1, sp8 , sp8 , , , yx01, rgb
+PIPE_FORMAT_G16R16_UNORM            , plain, 1, 1, 1, un16, un16, , , yx01, rgb
+PIPE_FORMAT_G16R16_SNORM            , plain, 1, 1, 1, sn16, sn16, , , yx01, rgb
+
+PIPE_FORMAT_A8B8G8R8_SNORM          , plain, 1, 1, 1, sn8 , sn8 , sn8 , sn8 , wzyx, rgb
+PIPE_FORMAT_A8B8G8R8_SINT           , plain, 1, 1, 1, sp8 , sp8 , sp8 , sp8 , wzyx, rgb
+PIPE_FORMAT_X8B8G8R8_SNORM          , plain, 1, 1, 1, x8,   sn8,  sn8,  sn8,  wzy1, rgb
+PIPE_FORMAT_X8B8G8R8_SINT           , plain, 1, 1, 1, x8,   sp8,  sp8,  sp8,  wzy1, rgb
diff --git a/src/util/format/u_format.h b/src/util/format/u_format.h
new file mode 100644 (file)
index 0000000..eec7a18
--- /dev/null
@@ -0,0 +1,1517 @@
+/**************************************************************************
+ *
+ * Copyright 2009-2010 Vmware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#ifndef U_FORMAT_H
+#define U_FORMAT_H
+
+
+#include "pipe/p_format.h"
+#include "pipe/p_defines.h"
+#include "util/u_debug.h"
+
+union pipe_color_union;
+struct pipe_screen;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * Describe how to pack/unpack pixels into/from the prescribed format.
+ *
+ * XXX: This could be renamed to something like util_format_pack, or broke down
+ * in flags inside util_format_block that said exactly what we want.
+ */
+enum util_format_layout {
+   /**
+    * Formats with util_format_block::width == util_format_block::height == 1
+    * that can be described as an ordinary data structure.
+    */
+   UTIL_FORMAT_LAYOUT_PLAIN,
+
+   /**
+    * Formats with sub-sampled channels.
+    *
+    * This is for formats like YVYU where there is less than one sample per
+    * pixel.
+    */
+   UTIL_FORMAT_LAYOUT_SUBSAMPLED,
+
+   /**
+    * S3 Texture Compression formats.
+    */
+   UTIL_FORMAT_LAYOUT_S3TC,
+
+   /**
+    * Red-Green Texture Compression formats.
+    */
+   UTIL_FORMAT_LAYOUT_RGTC,
+
+   /**
+    * Ericsson Texture Compression
+    */
+   UTIL_FORMAT_LAYOUT_ETC,
+
+   /**
+    * BC6/7 Texture Compression
+    */
+   UTIL_FORMAT_LAYOUT_BPTC,
+
+   UTIL_FORMAT_LAYOUT_ASTC,
+
+   UTIL_FORMAT_LAYOUT_ATC,
+
+   /** Formats with 2 or more planes. */
+   UTIL_FORMAT_LAYOUT_PLANAR2,
+   UTIL_FORMAT_LAYOUT_PLANAR3,
+
+   UTIL_FORMAT_LAYOUT_FXT1 = 10,
+
+   /**
+    * Everything else that doesn't fit in any of the above layouts.
+    */
+   UTIL_FORMAT_LAYOUT_OTHER,
+};
+
+
+struct util_format_block
+{
+   /** Block width in pixels */
+   unsigned width;
+   
+   /** Block height in pixels */
+   unsigned height;
+
+   /** Block depth in pixels */
+   unsigned depth;
+
+   /** Block size in bits */
+   unsigned bits;
+};
+
+
+enum util_format_type {
+   UTIL_FORMAT_TYPE_VOID = 0,
+   UTIL_FORMAT_TYPE_UNSIGNED = 1,
+   UTIL_FORMAT_TYPE_SIGNED = 2,
+   UTIL_FORMAT_TYPE_FIXED = 3,
+   UTIL_FORMAT_TYPE_FLOAT = 4
+};
+
+
+enum util_format_colorspace {
+   UTIL_FORMAT_COLORSPACE_RGB = 0,
+   UTIL_FORMAT_COLORSPACE_SRGB = 1,
+   UTIL_FORMAT_COLORSPACE_YUV = 2,
+   UTIL_FORMAT_COLORSPACE_ZS = 3
+};
+
+
+struct util_format_channel_description
+{
+   unsigned type:5;        /**< UTIL_FORMAT_TYPE_x */
+   unsigned normalized:1;
+   unsigned pure_integer:1;
+   unsigned size:9;        /**< bits per channel */
+   unsigned shift:16;      /** number of bits from lsb */
+};
+
+
+struct util_format_description
+{
+   enum pipe_format format;
+
+   const char *name;
+
+   /**
+    * Short name, striped of the prefix, lower case.
+    */
+   const char *short_name;
+
+   /**
+    * Pixel block dimensions.
+    */
+   struct util_format_block block;
+
+   enum util_format_layout layout;
+
+   /**
+    * The number of channels.
+    */
+   unsigned nr_channels:3;
+
+   /**
+    * Whether all channels have the same number of (whole) bytes and type.
+    */
+   unsigned is_array:1;
+
+   /**
+    * Whether the pixel format can be described as a bitfield structure.
+    *
+    * In particular:
+    * - pixel depth must be 8, 16, or 32 bits;
+    * - all channels must be unsigned, signed, or void
+    */
+   unsigned is_bitmask:1;
+
+   /**
+    * Whether channels have mixed types (ignoring UTIL_FORMAT_TYPE_VOID).
+    */
+   unsigned is_mixed:1;
+
+   /**
+    * Whether the format contains UNORM channels
+    */
+   unsigned is_unorm:1;
+
+   /**
+    * Whether the format contains SNORM channels
+    */
+   unsigned is_snorm:1;
+
+   /**
+    * Input channel description, in the order XYZW.
+    *
+    * Only valid for UTIL_FORMAT_LAYOUT_PLAIN formats.
+    *
+    * If each channel is accessed as an individual N-byte value, X is always
+    * at the lowest address in memory, Y is always next, and so on.  For all
+    * currently-defined formats, the N-byte value has native endianness.
+    *
+    * If instead a group of channels is accessed as a single N-byte value,
+    * the order of the channels within that value depends on endianness.
+    * For big-endian targets, X is the most significant subvalue,
+    * otherwise it is the least significant one.
+    *
+    * For example, if X is 8 bits and Y is 24 bits, the memory order is:
+    *
+    *                 0  1  2  3
+    *  little-endian: X  Yl Ym Yu    (l = lower, m = middle, u = upper)
+    *  big-endian:    X  Yu Ym Yl
+    *
+    * If X is 5 bits, Y is 5 bits, Z is 5 bits and W is 1 bit, the layout is:
+    *
+    *                        0        1
+    *                 msb  lsb msb  lsb
+    *  little-endian: YYYXXXXX WZZZZZYY
+    *  big-endian:    XXXXXYYY YYZZZZZW
+    */
+   struct util_format_channel_description channel[4];
+
+   /**
+    * Output channel swizzle.
+    *
+    * The order is either:
+    * - RGBA
+    * - YUV(A)
+    * - ZS
+    * depending on the colorspace.
+    */
+   unsigned char swizzle[4];
+
+   /**
+    * Colorspace transformation.
+    */
+   enum util_format_colorspace colorspace;
+
+   /**
+    * Unpack pixel blocks to R8G8B8A8_UNORM.
+    * Note: strides are in bytes.
+    *
+    * Only defined for non-depth-stencil formats.
+    */
+   void
+   (*unpack_rgba_8unorm)(uint8_t *dst, unsigned dst_stride,
+                         const uint8_t *src, unsigned src_stride,
+                         unsigned width, unsigned height);
+
+   /**
+    * Pack pixel blocks from R8G8B8A8_UNORM.
+    * Note: strides are in bytes.
+    *
+    * Only defined for non-depth-stencil formats.
+    */
+   void
+   (*pack_rgba_8unorm)(uint8_t *dst, unsigned dst_stride,
+                       const uint8_t *src, unsigned src_stride,
+                       unsigned width, unsigned height);
+
+   /**
+    * Fetch a single pixel (i, j) from a block.
+    *
+    * XXX: Only defined for a very few select formats.
+    */
+   void
+   (*fetch_rgba_8unorm)(uint8_t *dst,
+                        const uint8_t *src,
+                        unsigned i, unsigned j);
+
+   /**
+    * Unpack pixel blocks to R32G32B32A32_FLOAT.
+    * Note: strides are in bytes.
+    *
+    * Only defined for non-depth-stencil formats.
+    */
+   void
+   (*unpack_rgba_float)(float *dst, unsigned dst_stride,
+                        const uint8_t *src, unsigned src_stride,
+                        unsigned width, unsigned height);
+
+   /**
+    * Pack pixel blocks from R32G32B32A32_FLOAT.
+    * Note: strides are in bytes.
+    *
+    * Only defined for non-depth-stencil formats.
+    */
+   void
+   (*pack_rgba_float)(uint8_t *dst, unsigned dst_stride,
+                      const float *src, unsigned src_stride,
+                      unsigned width, unsigned height);
+
+   /**
+    * Fetch a single pixel (i, j) from a block.
+    *
+    * Only defined for non-depth-stencil and non-integer formats.
+    */
+   void
+   (*fetch_rgba_float)(float *dst,
+                       const uint8_t *src,
+                       unsigned i, unsigned j);
+
+   /**
+    * Unpack pixels to Z32_UNORM.
+    * Note: strides are in bytes.
+    *
+    * Only defined for depth formats.
+    */
+   void
+   (*unpack_z_32unorm)(uint32_t *dst, unsigned dst_stride,
+                       const uint8_t *src, unsigned src_stride,
+                       unsigned width, unsigned height);
+
+   /**
+    * Pack pixels from Z32_FLOAT.
+    * Note: strides are in bytes.
+    *
+    * Only defined for depth formats.
+    */
+   void
+   (*pack_z_32unorm)(uint8_t *dst, unsigned dst_stride,
+                     const uint32_t *src, unsigned src_stride,
+                     unsigned width, unsigned height);
+
+   /**
+    * Unpack pixels to Z32_FLOAT.
+    * Note: strides are in bytes.
+    *
+    * Only defined for depth formats.
+    */
+   void
+   (*unpack_z_float)(float *dst, unsigned dst_stride,
+                     const uint8_t *src, unsigned src_stride,
+                     unsigned width, unsigned height);
+
+   /**
+    * Pack pixels from Z32_FLOAT.
+    * Note: strides are in bytes.
+    *
+    * Only defined for depth formats.
+    */
+   void
+   (*pack_z_float)(uint8_t *dst, unsigned dst_stride,
+                   const float *src, unsigned src_stride,
+                   unsigned width, unsigned height);
+
+   /**
+    * Unpack pixels to S8_UINT.
+    * Note: strides are in bytes.
+    *
+    * Only defined for stencil formats.
+    */
+   void
+   (*unpack_s_8uint)(uint8_t *dst, unsigned dst_stride,
+                     const uint8_t *src, unsigned src_stride,
+                     unsigned width, unsigned height);
+
+   /**
+    * Pack pixels from S8_UINT.
+    * Note: strides are in bytes.
+    *
+    * Only defined for stencil formats.
+    */
+   void
+   (*pack_s_8uint)(uint8_t *dst, unsigned dst_stride,
+                   const uint8_t *src, unsigned src_stride,
+                   unsigned width, unsigned height);
+
+  /**
+    * Unpack pixel blocks to R32G32B32A32_UINT.
+    * Note: strides are in bytes.
+    *
+    * Only defined for INT formats.
+    */
+   void
+   (*unpack_rgba_uint)(uint32_t *dst, unsigned dst_stride,
+                       const uint8_t *src, unsigned src_stride,
+                       unsigned width, unsigned height);
+
+   void
+   (*pack_rgba_uint)(uint8_t *dst, unsigned dst_stride,
+                     const uint32_t *src, unsigned src_stride,
+                     unsigned width, unsigned height);
+
+  /**
+    * Unpack pixel blocks to R32G32B32A32_SINT.
+    * Note: strides are in bytes.
+    *
+    * Only defined for INT formats.
+    */
+   void
+   (*unpack_rgba_sint)(int32_t *dst, unsigned dst_stride,
+                       const uint8_t *src, unsigned src_stride,
+                       unsigned width, unsigned height);
+
+   void
+   (*pack_rgba_sint)(uint8_t *dst, unsigned dst_stride,
+                     const int32_t *src, unsigned src_stride,
+                     unsigned width, unsigned height);
+
+   /**
+    * Fetch a single pixel (i, j) from a block.
+    *
+    * Only defined for unsigned (pure) integer formats.
+    */
+   void
+   (*fetch_rgba_uint)(uint32_t *dst,
+                      const uint8_t *src,
+                      unsigned i, unsigned j);
+
+   /**
+    * Fetch a single pixel (i, j) from a block.
+    *
+    * Only defined for signed (pure) integer formats.
+    */
+   void
+   (*fetch_rgba_sint)(int32_t *dst,
+                      const uint8_t *src,
+                      unsigned i, unsigned j);
+};
+
+
+extern const struct util_format_description 
+util_format_description_table[];
+
+
+const struct util_format_description *
+util_format_description(enum pipe_format format);
+
+
+/*
+ * Format query functions.
+ */
+
+static inline const char *
+util_format_name(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return "PIPE_FORMAT_???";
+   }
+
+   return desc->name;
+}
+
+static inline const char *
+util_format_short_name(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return "???";
+   }
+
+   return desc->short_name;
+}
+
+/**
+ * Whether this format is plain, see UTIL_FORMAT_LAYOUT_PLAIN for more info.
+ */
+static inline boolean
+util_format_is_plain(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   if (!format) {
+      return FALSE;
+   }
+
+   return desc->layout == UTIL_FORMAT_LAYOUT_PLAIN ? TRUE : FALSE;
+}
+
+static inline boolean 
+util_format_is_compressed(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return FALSE;
+   }
+
+   switch (desc->layout) {
+   case UTIL_FORMAT_LAYOUT_S3TC:
+   case UTIL_FORMAT_LAYOUT_RGTC:
+   case UTIL_FORMAT_LAYOUT_ETC:
+   case UTIL_FORMAT_LAYOUT_BPTC:
+   case UTIL_FORMAT_LAYOUT_ASTC:
+   case UTIL_FORMAT_LAYOUT_ATC:
+      /* XXX add other formats in the future */
+      return TRUE;
+   default:
+      return FALSE;
+   }
+}
+
+static inline boolean 
+util_format_is_s3tc(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return FALSE;
+   }
+
+   return desc->layout == UTIL_FORMAT_LAYOUT_S3TC ? TRUE : FALSE;
+}
+
+static inline boolean
+util_format_is_etc(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return FALSE;
+   }
+
+   return desc->layout == UTIL_FORMAT_LAYOUT_ETC ? TRUE : FALSE;
+}
+
+static inline boolean 
+util_format_is_srgb(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   return desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB;
+}
+
+static inline boolean
+util_format_has_depth(const struct util_format_description *desc)
+{
+   return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
+          desc->swizzle[0] != PIPE_SWIZZLE_NONE;
+}
+
+static inline boolean
+util_format_has_stencil(const struct util_format_description *desc)
+{
+   return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
+          desc->swizzle[1] != PIPE_SWIZZLE_NONE;
+}
+
+static inline boolean
+util_format_is_depth_or_stencil(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return FALSE;
+   }
+
+   return util_format_has_depth(desc) ||
+          util_format_has_stencil(desc);
+}
+
+static inline boolean
+util_format_is_depth_and_stencil(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return FALSE;
+   }
+
+   return util_format_has_depth(desc) &&
+          util_format_has_stencil(desc);
+}
+
+/**
+ * For depth-stencil formats, return the equivalent depth-only format.
+ */
+static inline enum pipe_format
+util_format_get_depth_only(enum pipe_format format)
+{
+   switch (format) {
+   case PIPE_FORMAT_Z24_UNORM_S8_UINT:
+      return PIPE_FORMAT_Z24X8_UNORM;
+
+   case PIPE_FORMAT_S8_UINT_Z24_UNORM:
+      return PIPE_FORMAT_X8Z24_UNORM;
+
+   case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
+      return PIPE_FORMAT_Z32_FLOAT;
+
+   default:
+      return format;
+   }
+}
+
+static inline boolean
+util_format_is_yuv(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return FALSE;
+   }
+
+   return desc->colorspace == UTIL_FORMAT_COLORSPACE_YUV;
+}
+
+/**
+ * Calculates the depth format type based upon the incoming format description.
+ */
+static inline unsigned
+util_get_depth_format_type(const struct util_format_description *desc)
+{
+   unsigned depth_channel = desc->swizzle[0];
+   if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
+       depth_channel != PIPE_SWIZZLE_NONE) {
+      return desc->channel[depth_channel].type;
+   } else {
+      return UTIL_FORMAT_TYPE_VOID;
+   }
+}
+
+
+/**
+ * Calculates the MRD for the depth format. MRD is used in depth bias
+ * for UNORM and unbound depth buffers. When the depth buffer is floating
+ * point, the depth bias calculation does not use the MRD. However, the
+ * default MRD will be 1.0 / ((1 << 24) - 1).
+ */
+double
+util_get_depth_format_mrd(const struct util_format_description *desc);
+
+
+/**
+ * Return whether this is an RGBA, Z, S, or combined ZS format.
+ * Useful for initializing pipe_blit_info::mask.
+ */
+static inline unsigned
+util_format_get_mask(enum pipe_format format)
+{
+   const struct util_format_description *desc =
+      util_format_description(format);
+
+   if (!desc)
+      return 0;
+
+   if (util_format_has_depth(desc)) {
+      if (util_format_has_stencil(desc)) {
+         return PIPE_MASK_ZS;
+      } else {
+         return PIPE_MASK_Z;
+      }
+   } else {
+      if (util_format_has_stencil(desc)) {
+         return PIPE_MASK_S;
+      } else {
+         return PIPE_MASK_RGBA;
+      }
+   }
+}
+
+/**
+ * Give the RGBA colormask of the channels that can be represented in this
+ * format.
+ *
+ * That is, the channels whose values are preserved.
+ */
+static inline unsigned
+util_format_colormask(const struct util_format_description *desc)
+{
+   unsigned colormask;
+   unsigned chan;
+
+   switch (desc->colorspace) {
+   case UTIL_FORMAT_COLORSPACE_RGB:
+   case UTIL_FORMAT_COLORSPACE_SRGB:
+   case UTIL_FORMAT_COLORSPACE_YUV:
+      colormask = 0;
+      for (chan = 0; chan < 4; ++chan) {
+         if (desc->swizzle[chan] < 4) {
+            colormask |= (1 << chan);
+         }
+      }
+      return colormask;
+   case UTIL_FORMAT_COLORSPACE_ZS:
+      return 0;
+   default:
+      assert(0);
+      return 0;
+   }
+}
+
+
+/**
+ * Checks if color mask covers every channel for the specified format
+ *
+ * @param desc       a format description to check colormask with
+ * @param colormask  a bit mask for channels, matches format of PIPE_MASK_RGBA
+ */
+static inline boolean
+util_format_colormask_full(const struct util_format_description *desc, unsigned colormask)
+{
+   return (~colormask & util_format_colormask(desc)) == 0;
+}
+
+
+boolean
+util_format_is_float(enum pipe_format format);
+
+
+boolean
+util_format_has_alpha(enum pipe_format format);
+
+
+boolean
+util_format_is_luminance(enum pipe_format format);
+
+boolean
+util_format_is_alpha(enum pipe_format format);
+
+boolean
+util_format_is_luminance_alpha(enum pipe_format format);
+
+
+boolean
+util_format_is_intensity(enum pipe_format format);
+
+boolean
+util_format_is_subsampled_422(enum pipe_format format);
+
+boolean
+util_format_is_pure_integer(enum pipe_format format);
+
+boolean
+util_format_is_pure_sint(enum pipe_format format);
+
+boolean
+util_format_is_pure_uint(enum pipe_format format);
+
+boolean
+util_format_is_snorm(enum pipe_format format);
+
+boolean
+util_format_is_unorm(enum pipe_format format);
+
+boolean
+util_format_is_snorm8(enum pipe_format format);
+
+/**
+ * Check if the src format can be blitted to the destination format with
+ * a simple memcpy.  For example, blitting from RGBA to RGBx is OK, but not
+ * the reverse.
+ */
+boolean
+util_is_format_compatible(const struct util_format_description *src_desc,
+                          const struct util_format_description *dst_desc);
+
+/**
+ * Whether this format is a rgab8 variant.
+ *
+ * That is, any format that matches the
+ *
+ *   PIPE_FORMAT_?8?8?8?8_UNORM
+ */
+static inline boolean
+util_format_is_rgba8_variant(const struct util_format_description *desc)
+{
+   unsigned chan;
+
+   if(desc->block.width != 1 ||
+      desc->block.height != 1 ||
+      desc->block.bits != 32)
+      return FALSE;
+
+   for(chan = 0; chan < 4; ++chan) {
+      if(desc->channel[chan].type != UTIL_FORMAT_TYPE_UNSIGNED &&
+         desc->channel[chan].type != UTIL_FORMAT_TYPE_VOID)
+         return FALSE;
+      if(desc->channel[chan].type == UTIL_FORMAT_TYPE_UNSIGNED &&
+         !desc->channel[chan].normalized)
+         return FALSE;
+      if(desc->channel[chan].size != 8)
+         return FALSE;
+   }
+
+   return TRUE;
+}
+
+/**
+ * Return total bits needed for the pixel format per block.
+ */
+static inline uint
+util_format_get_blocksizebits(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return 0;
+   }
+
+   return desc->block.bits;
+}
+
+/**
+ * Return bytes per block (not pixel) for the given format.
+ */
+static inline uint
+util_format_get_blocksize(enum pipe_format format)
+{
+   uint bits = util_format_get_blocksizebits(format);
+   uint bytes = bits / 8;
+
+   assert(bits % 8 == 0);
+   assert(bytes > 0);
+   if (bytes == 0) {
+      bytes = 1;
+   }
+
+   return bytes;
+}
+
+static inline uint
+util_format_get_blockwidth(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return 1;
+   }
+
+   return desc->block.width;
+}
+
+static inline uint
+util_format_get_blockheight(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return 1;
+   }
+
+   return desc->block.height;
+}
+
+static inline uint
+util_format_get_blockdepth(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(desc);
+   if (!desc) {
+      return 1;
+   }
+
+   return desc->block.depth;
+}
+
+static inline unsigned
+util_format_get_nblocksx(enum pipe_format format,
+                         unsigned x)
+{
+   unsigned blockwidth = util_format_get_blockwidth(format);
+   return (x + blockwidth - 1) / blockwidth;
+}
+
+static inline unsigned
+util_format_get_nblocksy(enum pipe_format format,
+                         unsigned y)
+{
+   unsigned blockheight = util_format_get_blockheight(format);
+   return (y + blockheight - 1) / blockheight;
+}
+
+static inline unsigned
+util_format_get_nblocksz(enum pipe_format format,
+                         unsigned z)
+{
+   unsigned blockdepth = util_format_get_blockdepth(format);
+   return (z + blockdepth - 1) / blockdepth;
+}
+
+static inline unsigned
+util_format_get_nblocks(enum pipe_format format,
+                        unsigned width,
+                        unsigned height)
+{
+   assert(util_format_get_blockdepth(format) == 1);
+   return util_format_get_nblocksx(format, width) * util_format_get_nblocksy(format, height);
+}
+
+static inline size_t
+util_format_get_stride(enum pipe_format format,
+                       unsigned width)
+{
+   return (size_t)util_format_get_nblocksx(format, width) * util_format_get_blocksize(format);
+}
+
+static inline size_t
+util_format_get_2d_size(enum pipe_format format,
+                        size_t stride,
+                        unsigned height)
+{
+   return util_format_get_nblocksy(format, height) * stride;
+}
+
+static inline uint
+util_format_get_component_bits(enum pipe_format format,
+                               enum util_format_colorspace colorspace,
+                               uint component)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   enum util_format_colorspace desc_colorspace;
+
+   assert(format);
+   if (!format) {
+      return 0;
+   }
+
+   assert(component < 4);
+
+   /* Treat RGB and SRGB as equivalent. */
+   if (colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
+      colorspace = UTIL_FORMAT_COLORSPACE_RGB;
+   }
+   if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
+      desc_colorspace = UTIL_FORMAT_COLORSPACE_RGB;
+   } else {
+      desc_colorspace = desc->colorspace;
+   }
+
+   if (desc_colorspace != colorspace) {
+      return 0;
+   }
+
+   switch (desc->swizzle[component]) {
+   case PIPE_SWIZZLE_X:
+      return desc->channel[0].size;
+   case PIPE_SWIZZLE_Y:
+      return desc->channel[1].size;
+   case PIPE_SWIZZLE_Z:
+      return desc->channel[2].size;
+   case PIPE_SWIZZLE_W:
+      return desc->channel[3].size;
+   default:
+      return 0;
+   }
+}
+
+/**
+ * Given a linear RGB colorspace format, return the corresponding SRGB
+ * format, or PIPE_FORMAT_NONE if none.
+ */
+static inline enum pipe_format
+util_format_srgb(enum pipe_format format)
+{
+   if (util_format_is_srgb(format))
+      return format;
+
+   switch (format) {
+   case PIPE_FORMAT_L8_UNORM:
+      return PIPE_FORMAT_L8_SRGB;
+   case PIPE_FORMAT_R8_UNORM:
+      return PIPE_FORMAT_R8_SRGB;
+   case PIPE_FORMAT_L8A8_UNORM:
+      return PIPE_FORMAT_L8A8_SRGB;
+   case PIPE_FORMAT_R8G8B8_UNORM:
+      return PIPE_FORMAT_R8G8B8_SRGB;
+   case PIPE_FORMAT_A8B8G8R8_UNORM:
+      return PIPE_FORMAT_A8B8G8R8_SRGB;
+   case PIPE_FORMAT_X8B8G8R8_UNORM:
+      return PIPE_FORMAT_X8B8G8R8_SRGB;
+   case PIPE_FORMAT_B8G8R8A8_UNORM:
+      return PIPE_FORMAT_B8G8R8A8_SRGB;
+   case PIPE_FORMAT_B8G8R8X8_UNORM:
+      return PIPE_FORMAT_B8G8R8X8_SRGB;
+   case PIPE_FORMAT_A8R8G8B8_UNORM:
+      return PIPE_FORMAT_A8R8G8B8_SRGB;
+   case PIPE_FORMAT_X8R8G8B8_UNORM:
+      return PIPE_FORMAT_X8R8G8B8_SRGB;
+   case PIPE_FORMAT_R8G8B8A8_UNORM:
+      return PIPE_FORMAT_R8G8B8A8_SRGB;
+   case PIPE_FORMAT_R8G8B8X8_UNORM:
+      return PIPE_FORMAT_R8G8B8X8_SRGB;
+   case PIPE_FORMAT_DXT1_RGB:
+      return PIPE_FORMAT_DXT1_SRGB;
+   case PIPE_FORMAT_DXT1_RGBA:
+      return PIPE_FORMAT_DXT1_SRGBA;
+   case PIPE_FORMAT_DXT3_RGBA:
+      return PIPE_FORMAT_DXT3_SRGBA;
+   case PIPE_FORMAT_DXT5_RGBA:
+      return PIPE_FORMAT_DXT5_SRGBA;
+   case PIPE_FORMAT_B5G6R5_UNORM:
+      return PIPE_FORMAT_B5G6R5_SRGB;
+   case PIPE_FORMAT_BPTC_RGBA_UNORM:
+      return PIPE_FORMAT_BPTC_SRGBA;
+   case PIPE_FORMAT_ETC2_RGB8:
+      return PIPE_FORMAT_ETC2_SRGB8;
+   case PIPE_FORMAT_ETC2_RGB8A1:
+      return PIPE_FORMAT_ETC2_SRGB8A1;
+   case PIPE_FORMAT_ETC2_RGBA8:
+      return PIPE_FORMAT_ETC2_SRGBA8;
+   case PIPE_FORMAT_ASTC_4x4:
+      return PIPE_FORMAT_ASTC_4x4_SRGB;
+   case PIPE_FORMAT_ASTC_5x4:
+      return PIPE_FORMAT_ASTC_5x4_SRGB;
+   case PIPE_FORMAT_ASTC_5x5:
+      return PIPE_FORMAT_ASTC_5x5_SRGB;
+   case PIPE_FORMAT_ASTC_6x5:
+      return PIPE_FORMAT_ASTC_6x5_SRGB;
+   case PIPE_FORMAT_ASTC_6x6:
+      return PIPE_FORMAT_ASTC_6x6_SRGB;
+   case PIPE_FORMAT_ASTC_8x5:
+      return PIPE_FORMAT_ASTC_8x5_SRGB;
+   case PIPE_FORMAT_ASTC_8x6:
+      return PIPE_FORMAT_ASTC_8x6_SRGB;
+   case PIPE_FORMAT_ASTC_8x8:
+      return PIPE_FORMAT_ASTC_8x8_SRGB;
+   case PIPE_FORMAT_ASTC_10x5:
+      return PIPE_FORMAT_ASTC_10x5_SRGB;
+   case PIPE_FORMAT_ASTC_10x6:
+      return PIPE_FORMAT_ASTC_10x6_SRGB;
+   case PIPE_FORMAT_ASTC_10x8:
+      return PIPE_FORMAT_ASTC_10x8_SRGB;
+   case PIPE_FORMAT_ASTC_10x10:
+      return PIPE_FORMAT_ASTC_10x10_SRGB;
+   case PIPE_FORMAT_ASTC_12x10:
+      return PIPE_FORMAT_ASTC_12x10_SRGB;
+   case PIPE_FORMAT_ASTC_12x12:
+      return PIPE_FORMAT_ASTC_12x12_SRGB;
+
+   default:
+      return PIPE_FORMAT_NONE;
+   }
+}
+
+/**
+ * Given an sRGB format, return the corresponding linear colorspace format.
+ * For non sRGB formats, return the format unchanged.
+ */
+static inline enum pipe_format
+util_format_linear(enum pipe_format format)
+{
+   switch (format) {
+   case PIPE_FORMAT_L8_SRGB:
+      return PIPE_FORMAT_L8_UNORM;
+   case PIPE_FORMAT_R8_SRGB:
+      return PIPE_FORMAT_R8_UNORM;
+   case PIPE_FORMAT_L8A8_SRGB:
+      return PIPE_FORMAT_L8A8_UNORM;
+   case PIPE_FORMAT_R8G8B8_SRGB:
+      return PIPE_FORMAT_R8G8B8_UNORM;
+   case PIPE_FORMAT_A8B8G8R8_SRGB:
+      return PIPE_FORMAT_A8B8G8R8_UNORM;
+   case PIPE_FORMAT_X8B8G8R8_SRGB:
+      return PIPE_FORMAT_X8B8G8R8_UNORM;
+   case PIPE_FORMAT_B8G8R8A8_SRGB:
+      return PIPE_FORMAT_B8G8R8A8_UNORM;
+   case PIPE_FORMAT_B8G8R8X8_SRGB:
+      return PIPE_FORMAT_B8G8R8X8_UNORM;
+   case PIPE_FORMAT_A8R8G8B8_SRGB:
+      return PIPE_FORMAT_A8R8G8B8_UNORM;
+   case PIPE_FORMAT_X8R8G8B8_SRGB:
+      return PIPE_FORMAT_X8R8G8B8_UNORM;
+   case PIPE_FORMAT_R8G8B8A8_SRGB:
+      return PIPE_FORMAT_R8G8B8A8_UNORM;
+   case PIPE_FORMAT_R8G8B8X8_SRGB:
+      return PIPE_FORMAT_R8G8B8X8_UNORM;
+   case PIPE_FORMAT_DXT1_SRGB:
+      return PIPE_FORMAT_DXT1_RGB;
+   case PIPE_FORMAT_DXT1_SRGBA:
+      return PIPE_FORMAT_DXT1_RGBA;
+   case PIPE_FORMAT_DXT3_SRGBA:
+      return PIPE_FORMAT_DXT3_RGBA;
+   case PIPE_FORMAT_DXT5_SRGBA:
+      return PIPE_FORMAT_DXT5_RGBA;
+   case PIPE_FORMAT_B5G6R5_SRGB:
+      return PIPE_FORMAT_B5G6R5_UNORM;
+   case PIPE_FORMAT_BPTC_SRGBA:
+      return PIPE_FORMAT_BPTC_RGBA_UNORM;
+   case PIPE_FORMAT_ETC2_SRGB8:
+      return PIPE_FORMAT_ETC2_RGB8;
+   case PIPE_FORMAT_ETC2_SRGB8A1:
+      return PIPE_FORMAT_ETC2_RGB8A1;
+   case PIPE_FORMAT_ETC2_SRGBA8:
+      return PIPE_FORMAT_ETC2_RGBA8;
+   case PIPE_FORMAT_ASTC_4x4_SRGB:
+      return PIPE_FORMAT_ASTC_4x4;
+   case PIPE_FORMAT_ASTC_5x4_SRGB:
+      return PIPE_FORMAT_ASTC_5x4;
+   case PIPE_FORMAT_ASTC_5x5_SRGB:
+      return PIPE_FORMAT_ASTC_5x5;
+   case PIPE_FORMAT_ASTC_6x5_SRGB:
+      return PIPE_FORMAT_ASTC_6x5;
+   case PIPE_FORMAT_ASTC_6x6_SRGB:
+      return PIPE_FORMAT_ASTC_6x6;
+   case PIPE_FORMAT_ASTC_8x5_SRGB:
+      return PIPE_FORMAT_ASTC_8x5;
+   case PIPE_FORMAT_ASTC_8x6_SRGB:
+      return PIPE_FORMAT_ASTC_8x6;
+   case PIPE_FORMAT_ASTC_8x8_SRGB:
+      return PIPE_FORMAT_ASTC_8x8;
+   case PIPE_FORMAT_ASTC_10x5_SRGB:
+      return PIPE_FORMAT_ASTC_10x5;
+   case PIPE_FORMAT_ASTC_10x6_SRGB:
+      return PIPE_FORMAT_ASTC_10x6;
+   case PIPE_FORMAT_ASTC_10x8_SRGB:
+      return PIPE_FORMAT_ASTC_10x8;
+   case PIPE_FORMAT_ASTC_10x10_SRGB:
+      return PIPE_FORMAT_ASTC_10x10;
+   case PIPE_FORMAT_ASTC_12x10_SRGB:
+      return PIPE_FORMAT_ASTC_12x10;
+   case PIPE_FORMAT_ASTC_12x12_SRGB:
+      return PIPE_FORMAT_ASTC_12x12;
+   default:
+      return format;
+   }
+}
+
+/**
+ * Given a depth-stencil format, return the corresponding stencil-only format.
+ * For stencil-only formats, return the format unchanged.
+ */
+static inline enum pipe_format
+util_format_stencil_only(enum pipe_format format)
+{
+   switch (format) {
+   /* mask out the depth component */
+   case PIPE_FORMAT_Z24_UNORM_S8_UINT:
+      return PIPE_FORMAT_X24S8_UINT;
+   case PIPE_FORMAT_S8_UINT_Z24_UNORM:
+      return PIPE_FORMAT_S8X24_UINT;
+   case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
+      return PIPE_FORMAT_X32_S8X24_UINT;
+
+   /* stencil only formats */
+   case PIPE_FORMAT_X24S8_UINT:
+   case PIPE_FORMAT_S8X24_UINT:
+   case PIPE_FORMAT_X32_S8X24_UINT:
+   case PIPE_FORMAT_S8_UINT:
+      return format;
+
+   default:
+      assert(0);
+      return PIPE_FORMAT_NONE;
+   }
+}
+
+/**
+ * Converts PIPE_FORMAT_*I* to PIPE_FORMAT_*R*.
+ * This is identity for non-intensity formats.
+ */
+static inline enum pipe_format
+util_format_intensity_to_red(enum pipe_format format)
+{
+   switch (format) {
+   case PIPE_FORMAT_I8_UNORM:
+      return PIPE_FORMAT_R8_UNORM;
+   case PIPE_FORMAT_I8_SNORM:
+      return PIPE_FORMAT_R8_SNORM;
+   case PIPE_FORMAT_I16_UNORM:
+      return PIPE_FORMAT_R16_UNORM;
+   case PIPE_FORMAT_I16_SNORM:
+      return PIPE_FORMAT_R16_SNORM;
+   case PIPE_FORMAT_I16_FLOAT:
+      return PIPE_FORMAT_R16_FLOAT;
+   case PIPE_FORMAT_I32_FLOAT:
+      return PIPE_FORMAT_R32_FLOAT;
+   case PIPE_FORMAT_I8_UINT:
+      return PIPE_FORMAT_R8_UINT;
+   case PIPE_FORMAT_I8_SINT:
+      return PIPE_FORMAT_R8_SINT;
+   case PIPE_FORMAT_I16_UINT:
+      return PIPE_FORMAT_R16_UINT;
+   case PIPE_FORMAT_I16_SINT:
+      return PIPE_FORMAT_R16_SINT;
+   case PIPE_FORMAT_I32_UINT:
+      return PIPE_FORMAT_R32_UINT;
+   case PIPE_FORMAT_I32_SINT:
+      return PIPE_FORMAT_R32_SINT;
+   default:
+      assert(!util_format_is_intensity(format));
+      return format;
+   }
+}
+
+/**
+ * Converts PIPE_FORMAT_*L* to PIPE_FORMAT_*R*.
+ * This is identity for non-luminance formats.
+ */
+static inline enum pipe_format
+util_format_luminance_to_red(enum pipe_format format)
+{
+   switch (format) {
+   case PIPE_FORMAT_L8_UNORM:
+      return PIPE_FORMAT_R8_UNORM;
+   case PIPE_FORMAT_L8_SNORM:
+      return PIPE_FORMAT_R8_SNORM;
+   case PIPE_FORMAT_L16_UNORM:
+      return PIPE_FORMAT_R16_UNORM;
+   case PIPE_FORMAT_L16_SNORM:
+      return PIPE_FORMAT_R16_SNORM;
+   case PIPE_FORMAT_L16_FLOAT:
+      return PIPE_FORMAT_R16_FLOAT;
+   case PIPE_FORMAT_L32_FLOAT:
+      return PIPE_FORMAT_R32_FLOAT;
+   case PIPE_FORMAT_L8_UINT:
+      return PIPE_FORMAT_R8_UINT;
+   case PIPE_FORMAT_L8_SINT:
+      return PIPE_FORMAT_R8_SINT;
+   case PIPE_FORMAT_L16_UINT:
+      return PIPE_FORMAT_R16_UINT;
+   case PIPE_FORMAT_L16_SINT:
+      return PIPE_FORMAT_R16_SINT;
+   case PIPE_FORMAT_L32_UINT:
+      return PIPE_FORMAT_R32_UINT;
+   case PIPE_FORMAT_L32_SINT:
+      return PIPE_FORMAT_R32_SINT;
+
+   case PIPE_FORMAT_LATC1_UNORM:
+      return PIPE_FORMAT_RGTC1_UNORM;
+   case PIPE_FORMAT_LATC1_SNORM:
+      return PIPE_FORMAT_RGTC1_SNORM;
+
+   case PIPE_FORMAT_L4A4_UNORM:
+      return PIPE_FORMAT_R4A4_UNORM;
+
+   case PIPE_FORMAT_L8A8_UNORM:
+      return PIPE_FORMAT_R8A8_UNORM;
+   case PIPE_FORMAT_L8A8_SNORM:
+      return PIPE_FORMAT_R8A8_SNORM;
+   case PIPE_FORMAT_L16A16_UNORM:
+      return PIPE_FORMAT_R16A16_UNORM;
+   case PIPE_FORMAT_L16A16_SNORM:
+      return PIPE_FORMAT_R16A16_SNORM;
+   case PIPE_FORMAT_L16A16_FLOAT:
+      return PIPE_FORMAT_R16A16_FLOAT;
+   case PIPE_FORMAT_L32A32_FLOAT:
+      return PIPE_FORMAT_R32A32_FLOAT;
+   case PIPE_FORMAT_L8A8_UINT:
+      return PIPE_FORMAT_R8A8_UINT;
+   case PIPE_FORMAT_L8A8_SINT:
+      return PIPE_FORMAT_R8A8_SINT;
+   case PIPE_FORMAT_L16A16_UINT:
+      return PIPE_FORMAT_R16A16_UINT;
+   case PIPE_FORMAT_L16A16_SINT:
+      return PIPE_FORMAT_R16A16_SINT;
+   case PIPE_FORMAT_L32A32_UINT:
+      return PIPE_FORMAT_R32A32_UINT;
+   case PIPE_FORMAT_L32A32_SINT:
+      return PIPE_FORMAT_R32A32_SINT;
+
+   /* We don't have compressed red-alpha variants for these. */
+   case PIPE_FORMAT_LATC2_UNORM:
+   case PIPE_FORMAT_LATC2_SNORM:
+      return PIPE_FORMAT_NONE;
+
+   default:
+      assert(!util_format_is_luminance(format) &&
+            !util_format_is_luminance_alpha(format));
+      return format;
+   }
+}
+
+static inline unsigned
+util_format_get_num_planes(enum pipe_format format)
+{
+   switch (util_format_description(format)->layout) {
+   case UTIL_FORMAT_LAYOUT_PLANAR3:
+      return 3;
+   case UTIL_FORMAT_LAYOUT_PLANAR2:
+      return 2;
+   default:
+      return 1;
+   }
+}
+
+static inline enum pipe_format
+util_format_get_plane_format(enum pipe_format format, unsigned plane)
+{
+   switch (format) {
+   case PIPE_FORMAT_YV12:
+   case PIPE_FORMAT_YV16:
+   case PIPE_FORMAT_IYUV:
+      return PIPE_FORMAT_R8_UNORM;
+   case PIPE_FORMAT_NV12:
+      return !plane ? PIPE_FORMAT_R8_UNORM : PIPE_FORMAT_RG88_UNORM;
+   case PIPE_FORMAT_NV21:
+      return !plane ? PIPE_FORMAT_R8_UNORM : PIPE_FORMAT_GR88_UNORM;
+   case PIPE_FORMAT_P016:
+      return !plane ? PIPE_FORMAT_R16_UNORM : PIPE_FORMAT_R16G16_UNORM;
+   default:
+      return format;
+   }
+}
+
+static inline unsigned
+util_format_get_plane_width(enum pipe_format format, unsigned plane,
+                            unsigned width)
+{
+   switch (format) {
+   case PIPE_FORMAT_YV12:
+   case PIPE_FORMAT_YV16:
+   case PIPE_FORMAT_IYUV:
+   case PIPE_FORMAT_NV12:
+   case PIPE_FORMAT_NV21:
+   case PIPE_FORMAT_P016:
+      return !plane ? width : (width + 1) / 2;
+   default:
+      return width;
+   }
+}
+
+static inline unsigned
+util_format_get_plane_height(enum pipe_format format, unsigned plane,
+                             unsigned height)
+{
+   switch (format) {
+   case PIPE_FORMAT_YV12:
+   case PIPE_FORMAT_IYUV:
+   case PIPE_FORMAT_NV12:
+   case PIPE_FORMAT_NV21:
+   case PIPE_FORMAT_P016:
+      return !plane ? height : (height + 1) / 2;
+   case PIPE_FORMAT_YV16:
+   default:
+      return height;
+   }
+}
+
+bool util_format_planar_is_supported(struct pipe_screen *screen,
+                                     enum pipe_format format,
+                                     enum pipe_texture_target target,
+                                     unsigned sample_count,
+                                     unsigned storage_sample_count,
+                                     unsigned bind);
+
+/**
+ * Return the number of components stored.
+ * Formats with block size != 1x1 will always have 1 component (the block).
+ */
+static inline unsigned
+util_format_get_nr_components(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   return desc->nr_channels;
+}
+
+/**
+ * Return the index of the first non-void channel
+ * -1 if no non-void channels
+ */
+static inline int
+util_format_get_first_non_void_channel(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+   int i;
+
+   for (i = 0; i < 4; i++)
+      if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID)
+         break;
+
+   if (i == 4)
+       return -1;
+
+   return i;
+}
+
+/**
+ * Whether this format is any 8-bit UNORM variant. Looser than
+ * util_is_rgba8_variant (also includes alpha textures, for instance).
+ */
+
+static inline bool
+util_format_is_unorm8(const struct util_format_description *desc)
+{
+   int c = util_format_get_first_non_void_channel(desc->format);
+
+   if (c == -1)
+      return false;
+
+   return desc->is_unorm && desc->is_array && desc->channel[c].size == 8;
+}
+
+/*
+ * Format access functions.
+ */
+
+void
+util_format_read_4f(enum pipe_format format,
+                    float *dst, unsigned dst_stride, 
+                    const void *src, unsigned src_stride, 
+                    unsigned x, unsigned y, unsigned w, unsigned h);
+
+void
+util_format_write_4f(enum pipe_format format,
+                     const float *src, unsigned src_stride, 
+                     void *dst, unsigned dst_stride, 
+                     unsigned x, unsigned y, unsigned w, unsigned h);
+
+void
+util_format_read_4ub(enum pipe_format format,
+                     uint8_t *dst, unsigned dst_stride, 
+                     const void *src, unsigned src_stride, 
+                     unsigned x, unsigned y, unsigned w, unsigned h);
+
+void
+util_format_write_4ub(enum pipe_format format,
+                      const uint8_t *src, unsigned src_stride, 
+                      void *dst, unsigned dst_stride, 
+                      unsigned x, unsigned y, unsigned w, unsigned h);
+
+void
+util_format_read_4ui(enum pipe_format format,
+                     unsigned *dst, unsigned dst_stride,
+                     const void *src, unsigned src_stride,
+                     unsigned x, unsigned y, unsigned w, unsigned h);
+
+void
+util_format_write_4ui(enum pipe_format format,
+                      const unsigned int *src, unsigned src_stride,
+                      void *dst, unsigned dst_stride,
+                      unsigned x, unsigned y, unsigned w, unsigned h);
+
+void
+util_format_read_4i(enum pipe_format format,
+                    int *dst, unsigned dst_stride,
+                    const void *src, unsigned src_stride,
+                    unsigned x, unsigned y, unsigned w, unsigned h);
+
+void
+util_format_write_4i(enum pipe_format format,
+                     const int *src, unsigned src_stride,
+                     void *dst, unsigned dst_stride,
+                     unsigned x, unsigned y, unsigned w, unsigned h);
+
+/*
+ * Generic format conversion;
+ */
+
+boolean
+util_format_fits_8unorm(const struct util_format_description *format_desc);
+
+boolean
+util_format_translate(enum pipe_format dst_format,
+                      void *dst, unsigned dst_stride,
+                      unsigned dst_x, unsigned dst_y,
+                      enum pipe_format src_format,
+                      const void *src, unsigned src_stride,
+                      unsigned src_x, unsigned src_y,
+                      unsigned width, unsigned height);
+
+boolean
+util_format_translate_3d(enum pipe_format dst_format,
+                         void *dst, unsigned dst_stride,
+                         unsigned dst_slice_stride,
+                         unsigned dst_x, unsigned dst_y,
+                         unsigned dst_z,
+                         enum pipe_format src_format,
+                         const void *src, unsigned src_stride,
+                         unsigned src_slice_stride,
+                         unsigned src_x, unsigned src_y,
+                         unsigned src_z, unsigned width,
+                         unsigned height, unsigned depth);
+
+/*
+ * Swizzle operations.
+ */
+
+/* Compose two sets of swizzles.
+ * If V is a 4D vector and the function parameters represent functions that
+ * swizzle vector components, this holds:
+ *     swz2(swz1(V)) = dst(V)
+ */
+void util_format_compose_swizzles(const unsigned char swz1[4],
+                                  const unsigned char swz2[4],
+                                  unsigned char dst[4]);
+
+/* Apply the swizzle provided in \param swz (which is one of PIPE_SWIZZLE_x)
+ * to \param src and store the result in \param dst.
+ * \param is_integer determines the value written for PIPE_SWIZZLE_1.
+ */
+void util_format_apply_color_swizzle(union pipe_color_union *dst,
+                                     const union pipe_color_union *src,
+                                     const unsigned char swz[4],
+                                     const boolean is_integer);
+
+void pipe_swizzle_4f(float *dst, const float *src,
+                            const unsigned char swz[4]);
+
+void util_format_unswizzle_4f(float *dst, const float *src,
+                              const unsigned char swz[4]);
+
+enum pipe_format
+util_format_snorm8_to_sint8(enum pipe_format format);
+
+
+extern void
+util_copy_rect(ubyte * dst, enum pipe_format format,
+               unsigned dst_stride, unsigned dst_x, unsigned dst_y,
+               unsigned width, unsigned height, const ubyte * src,
+               int src_stride, unsigned src_x, unsigned src_y);
+
+#ifdef __cplusplus
+} // extern "C" {
+#endif
+
+#endif /* ! U_FORMAT_H */
diff --git a/src/util/format/u_format_bptc.c b/src/util/format/u_format_bptc.c
new file mode 100644 (file)
index 0000000..2d02e11
--- /dev/null
@@ -0,0 +1,279 @@
+/**************************************************************************
+ *
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "util/format/u_format.h"
+#include "util/format/u_format_bptc.h"
+#include "util/format_srgb.h"
+#include "util/u_math.h"
+
+#define BPTC_BLOCK_DECODE
+#include "../../mesa/main/texcompress_bptc_tmp.h"
+
+void
+util_format_bptc_rgba_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                               const uint8_t *src_row, unsigned src_stride,
+                                               unsigned width, unsigned height)
+{
+  decompress_rgba_unorm(width, height,
+                        src_row, src_stride,
+                        dst_row, dst_stride);
+}
+
+void
+util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                             const uint8_t *src_row, unsigned src_stride,
+                                             unsigned width, unsigned height)
+{
+   compress_rgba_unorm(width, height,
+                       src_row, src_stride,
+                       dst_row, dst_stride);
+}
+
+void
+util_format_bptc_rgba_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                              const uint8_t *src_row, unsigned src_stride,
+                                              unsigned width, unsigned height)
+{
+   uint8_t *temp_block;
+   temp_block = malloc(width * height * 4 * sizeof(uint8_t));
+   decompress_rgba_unorm(width, height,
+                         src_row, src_stride,
+                         temp_block, width * 4 * sizeof(uint8_t));
+   util_format_read_4f(PIPE_FORMAT_R8G8B8A8_UNORM,
+                       dst_row, dst_stride,
+                       temp_block, width * 4 * sizeof(uint8_t),
+                       0, 0, width, height);
+   free((void *) temp_block);
+}
+
+void
+util_format_bptc_rgba_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                            const float *src_row, unsigned src_stride,
+                                            unsigned width, unsigned height)
+{
+   uint8_t *temp_block;
+   temp_block = malloc(width * height * 4 * sizeof(uint8_t));
+   util_format_read_4ub(PIPE_FORMAT_R32G32B32A32_FLOAT,
+                        temp_block, width * 4 * sizeof(uint8_t),
+                        src_row, src_stride,
+                        0, 0, width, height);
+   compress_rgba_unorm(width, height,
+                       temp_block, width * 4 * sizeof(uint8_t),
+                       dst_row, dst_stride);
+   free((void *) temp_block);
+}
+
+void
+util_format_bptc_rgba_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                             unsigned width, unsigned height)
+{
+   uint8_t temp_block[4];
+
+   fetch_rgba_unorm_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
+                               temp_block, (width % 4) + (height % 4) * 4);
+
+   util_format_read_4f(PIPE_FORMAT_R8G8B8A8_UNORM,
+                       dst, 4 * sizeof(float),
+                       temp_block, 4 * sizeof(uint8_t),
+                       0, 0, 1, 1);
+}
+
+void
+util_format_bptc_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                          const uint8_t *src_row, unsigned src_stride,
+                                          unsigned width, unsigned height)
+{
+   decompress_rgba_unorm(width, height,
+                         src_row, src_stride,
+                         dst_row, dst_stride);
+}
+
+void
+util_format_bptc_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height)
+{
+   compress_rgba_unorm(width, height,
+                       src_row, src_stride,
+                       dst_row, dst_stride);
+}
+
+void
+util_format_bptc_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   uint8_t *temp_block;
+   temp_block = malloc(width * height * 4 * sizeof(uint8_t));
+   decompress_rgba_unorm(width, height,
+                         src_row, src_stride,
+                         temp_block, width * 4 * sizeof(uint8_t));
+   util_format_read_4f(PIPE_FORMAT_R8G8B8A8_SRGB,
+                       dst_row, dst_stride,
+                       temp_block, width * 4 * sizeof(uint8_t),
+                       0, 0, width, height);
+   free((void *) temp_block);
+}
+
+void
+util_format_bptc_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                       const float *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   compress_rgb_float(width, height,
+                      src_row, src_stride,
+                      dst_row, dst_stride,
+                      true);
+}
+
+void
+util_format_bptc_srgba_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        unsigned width, unsigned height)
+{
+   uint8_t temp_block[4];
+
+   fetch_rgba_unorm_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
+                               temp_block, (width % 4) + (height % 4) * 4);
+   util_format_read_4f(PIPE_FORMAT_R8G8B8A8_SRGB,
+                       dst, 4 * sizeof(float),
+                       temp_block, width * 4 * sizeof(uint8_t),
+                       0, 0, 1, 1);
+}
+
+void
+util_format_bptc_rgb_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                              const uint8_t *src_row, unsigned src_stride,
+                                              unsigned width, unsigned height)
+{
+   float *temp_block;
+   temp_block = malloc(width * height * 4 * sizeof(float));
+   decompress_rgb_float(width, height,
+                        src_row, src_stride,
+                        temp_block, width * 4 * sizeof(float),
+                        true);
+   util_format_read_4ub(PIPE_FORMAT_R32G32B32A32_FLOAT,
+                        dst_row, dst_stride,
+                        temp_block, width * 4 * sizeof(float),
+                        0, 0, width, height);
+   free((void *) temp_block);
+}
+
+void
+util_format_bptc_rgb_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                            const uint8_t *src_row, unsigned src_stride,
+                                            unsigned width, unsigned height)
+{
+   compress_rgba_unorm(width, height,
+                       src_row, src_stride,
+                       dst_row, dst_stride);
+}
+
+void
+util_format_bptc_rgb_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                             const uint8_t *src_row, unsigned src_stride,
+                                             unsigned width, unsigned height)
+{
+   decompress_rgb_float(width, height,
+                        src_row, src_stride,
+                        dst_row, dst_stride,
+                        true);
+}
+
+void
+util_format_bptc_rgb_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                           const float *src_row, unsigned src_stride,
+                                           unsigned width, unsigned height)
+{
+   compress_rgb_float(width, height,
+                      src_row, src_stride,
+                      dst_row, dst_stride,
+                      true);
+}
+
+void
+util_format_bptc_rgb_float_fetch_rgba_float(float *dst, const uint8_t *src,
+                                            unsigned width, unsigned height)
+{
+   fetch_rgb_float_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
+                              dst, (width % 4) + (height % 4) * 4, true);
+}
+
+void
+util_format_bptc_rgb_ufloat_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                               const uint8_t *src_row, unsigned src_stride,
+                                               unsigned width, unsigned height)
+{
+   float *temp_block;
+   temp_block = malloc(width * height * 4 * sizeof(float));
+   decompress_rgb_float(width, height,
+                        src_row, src_stride,
+                        temp_block, width * 4 * sizeof(float),
+                        false);
+   util_format_read_4ub(PIPE_FORMAT_R32G32B32A32_FLOAT,
+                        dst_row, dst_stride,
+                        temp_block, width * 4 * sizeof(float),
+                        0, 0, width, height);
+   free((void *) temp_block);
+}
+
+void
+util_format_bptc_rgb_ufloat_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                             const uint8_t *src_row, unsigned src_stride,
+                                             unsigned width, unsigned height)
+{
+   compress_rgba_unorm(width, height,
+                       src_row, src_stride,
+                       dst_row, dst_stride);
+}
+
+void
+util_format_bptc_rgb_ufloat_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                              const uint8_t *src_row, unsigned src_stride,
+                                              unsigned width, unsigned height)
+{
+   decompress_rgb_float(width, height,
+                        src_row, src_stride,
+                        dst_row, dst_stride,
+                        false);
+}
+
+void
+util_format_bptc_rgb_ufloat_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                            const float *src_row, unsigned src_stride,
+                                            unsigned width, unsigned height)
+{
+   compress_rgb_float(width, height,
+                      src_row, src_stride,
+                      dst_row, dst_stride,
+                      false);
+}
+
+void
+util_format_bptc_rgb_ufloat_fetch_rgba_float(float *dst, const uint8_t *src,
+                                             unsigned width, unsigned height)
+{
+   fetch_rgb_float_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
+                              dst, (width % 4) + (height % 4) * 4, false);
+}
diff --git a/src/util/format/u_format_bptc.h b/src/util/format/u_format_bptc.h
new file mode 100644 (file)
index 0000000..eaf3ec3
--- /dev/null
@@ -0,0 +1,122 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#ifndef U_FORMAT_BPTC_H_
+#define U_FORMAT_BPTC_H_
+
+
+#include "pipe/p_compiler.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void
+util_format_bptc_rgba_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                               const uint8_t *src_row, unsigned src_stride,
+                                               unsigned width, unsigned height);
+void
+util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                             const uint8_t *src_row, unsigned src_stride,
+                                             unsigned width, unsigned height);
+void
+util_format_bptc_rgba_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                              const uint8_t *src_row, unsigned src_stride,
+                                              unsigned width, unsigned height);
+void
+util_format_bptc_rgba_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                            const float *src_row, unsigned src_stride,
+                                            unsigned width, unsigned height);
+void
+util_format_bptc_rgba_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                             unsigned width, unsigned height);
+
+void
+util_format_bptc_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                          const uint8_t *src_row, unsigned src_stride,
+                                          unsigned width, unsigned height);
+void
+util_format_bptc_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height);
+void
+util_format_bptc_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height);
+void
+util_format_bptc_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                       const float *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height);
+void
+util_format_bptc_srgba_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        unsigned width, unsigned height);
+
+void
+util_format_bptc_rgb_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                              const uint8_t *src_row, unsigned src_stride,
+                                              unsigned width, unsigned height);
+void
+util_format_bptc_rgb_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                            const uint8_t *src_row, unsigned src_stride,
+                                            unsigned width, unsigned height);
+void
+util_format_bptc_rgb_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                             const uint8_t *src_row, unsigned src_stride,
+                                             unsigned width, unsigned height);
+void
+util_format_bptc_rgb_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                           const float *src_row, unsigned src_stride,
+                                           unsigned width, unsigned height);
+void
+util_format_bptc_rgb_float_fetch_rgba_float(float *dst, const uint8_t *src,
+                                            unsigned width, unsigned height);
+
+void
+util_format_bptc_rgb_ufloat_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                               const uint8_t *src_row, unsigned src_stride,
+                                               unsigned width, unsigned height);
+void
+util_format_bptc_rgb_ufloat_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                             const uint8_t *src_row, unsigned src_stride,
+                                             unsigned width, unsigned height);
+void
+util_format_bptc_rgb_ufloat_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                              const uint8_t *src_row, unsigned src_stride,
+                                              unsigned width, unsigned height);
+void
+util_format_bptc_rgb_ufloat_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                            const float *src_row, unsigned src_stride,
+                                            unsigned width, unsigned height);
+void
+util_format_bptc_rgb_ufloat_fetch_rgba_float(float *dst, const uint8_t *src,
+                                             unsigned width, unsigned height);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* U_FORMAT_BPTC_H_ */
diff --git a/src/util/format/u_format_etc.c b/src/util/format/u_format_etc.c
new file mode 100644 (file)
index 0000000..505e57b
--- /dev/null
@@ -0,0 +1,84 @@
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+#include "util/u_math.h"
+#include "util/format/u_format_etc.h"
+
+/* define etc1_parse_block and etc. */
+#define UINT8_TYPE uint8_t
+#define TAG(x) x
+#include "../../mesa/main/texcompress_etc_tmp.h"
+#undef TAG
+#undef UINT8_TYPE
+
+void
+util_format_etc1_rgb8_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   etc1_unpack_rgba8888(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_etc1_rgb8_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                       UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                       UNUSED unsigned width, UNUSED unsigned height)
+{
+   assert(0);
+}
+
+void
+util_format_etc1_rgb8_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   const unsigned bw = 4, bh = 4, bs = 8, comps = 4;
+   struct etc1_block block;
+   unsigned x, y, i, j;
+
+   for (y = 0; y < height; y += bh) {
+      const uint8_t *src = src_row;
+
+      for (x = 0; x < width; x+= bw) {
+         etc1_parse_block(&block, src);
+
+         for (j = 0; j < bh; j++) {
+            float *dst = dst_row + (y + j) * dst_stride / sizeof(*dst_row) + x * comps;
+            uint8_t tmp[3];
+
+            for (i = 0; i < bw; i++) {
+               etc1_fetch_texel(&block, i, j, tmp);
+               dst[0] = ubyte_to_float(tmp[0]);
+               dst[1] = ubyte_to_float(tmp[1]);
+               dst[2] = ubyte_to_float(tmp[2]);
+               dst[3] = 1.0f;
+               dst += comps;
+            }
+         }
+
+         src += bs;
+      }
+
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_etc1_rgb8_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                      UNUSED const float *src_row, UNUSED unsigned src_stride,
+                                      UNUSED unsigned width, UNUSED unsigned height)
+{
+   assert(0);
+}
+
+void
+util_format_etc1_rgb8_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   struct etc1_block block;
+   uint8_t tmp[3];
+
+   assert(i < 4 && j < 4); /* check i, j against 4x4 block size */
+
+   etc1_parse_block(&block, src);
+   etc1_fetch_texel(&block, i, j, tmp);
+
+   dst[0] = ubyte_to_float(tmp[0]);
+   dst[1] = ubyte_to_float(tmp[1]);
+   dst[2] = ubyte_to_float(tmp[2]);
+   dst[3] = 1.0f;
+}
diff --git a/src/util/format/u_format_etc.h b/src/util/format/u_format_etc.h
new file mode 100644 (file)
index 0000000..30c3dcb
--- /dev/null
@@ -0,0 +1,46 @@
+/**************************************************************************
+ *
+ * Copyright 2011 LunarG, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+#ifndef U_FORMAT_ETC1_H_
+#define U_FORMAT_ETC1_H_
+
+void
+util_format_etc1_rgb8_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_etc1_rgb8_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_etc1_rgb8_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_etc1_rgb8_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_etc1_rgb8_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+#endif /* U_FORMAT_ETC1_H_ */
diff --git a/src/util/format/u_format_latc.c b/src/util/format/u_format_latc.c
new file mode 100644 (file)
index 0000000..1f26cb1
--- /dev/null
@@ -0,0 +1,306 @@
+/**************************************************************************
+ *
+ * Copyright (C) 2011 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include <stdio.h>
+#include "util/format/u_format.h"
+#include "util/format/u_format_rgtc.h"
+#include "util/format/u_format_latc.h"
+#include "util/rgtc.h"
+#include "util/u_math.h"
+
+void
+util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   /* Fix warnings here: */
+   (void) util_format_unsigned_encode_rgtc_ubyte;
+   (void) util_format_signed_encode_rgtc_ubyte;
+
+   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
+   dst[1] = dst[0];
+   dst[2] = dst[0];
+   dst[3] = 255;
+}
+
+void
+util_format_latc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_rgtc1_unorm_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_latc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row,
+                                        unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_rgtc1_unorm_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   unsigned x, y, i, j;
+   int block_size = 8;
+
+   for(y = 0; y < height; y += 4) {
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += 4) {
+         for(j = 0; j < 4; ++j) {
+            for(i = 0; i < 4; ++i) {
+               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               uint8_t tmp_r;
+               util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+               dst[0] =
+               dst[1] =
+               dst[2] = ubyte_to_float(tmp_r);
+               dst[3] = 1.0;
+            }
+         }
+         src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_latc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_rgtc1_unorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_latc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp_r;
+
+   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+   dst[0] =
+   dst[1] =
+   dst[2] = ubyte_to_float(tmp_r);
+   dst[3] = 1.0;
+}
+
+void
+util_format_latc1_snorm_fetch_rgba_8unorm(UNUSED uint8_t *dst, UNUSED const uint8_t *src,
+                                          UNUSED unsigned i, UNUSED unsigned j)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_latc1_snorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                           UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                           UNUSED unsigned width, UNUSED unsigned height)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_latc1_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                         UNUSED unsigned width, UNUSED unsigned height)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_latc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_rgtc1_snorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   unsigned x, y, i, j;
+   int block_size = 8;
+
+   for(y = 0; y < height; y += 4) {
+      const int8_t *src = (int8_t *)src_row;
+      for(x = 0; x < width; x += 4) {
+         for(j = 0; j < 4; ++j) {
+            for(i = 0; i < 4; ++i) {
+               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               int8_t tmp_r;
+               util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+               dst[0] =
+               dst[1] =
+               dst[2] = byte_to_float_tex(tmp_r);
+               dst[3] = 1.0;
+            }
+         }
+         src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   int8_t tmp_r;
+
+   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
+   dst[0] =
+   dst[1] =
+   dst[2] = byte_to_float_tex(tmp_r);
+   dst[3] = 1.0;
+}
+
+
+void
+util_format_latc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
+   dst[1] = dst[0];
+   dst[2] = dst[0];
+   util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 3, 2);
+}
+
+void
+util_format_latc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_rgtc2_unorm_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_latc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_rgtc2_unorm_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_latc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_rxtc2_unorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height, 3);
+}
+
+void
+util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   unsigned x, y, i, j;
+   int block_size = 16;
+
+   for(y = 0; y < height; y += 4) {
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += 4) {
+         for(j = 0; j < 4; ++j) {
+            for(i = 0; i < 4; ++i) {
+               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               uint8_t tmp_r, tmp_g;
+               util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+               util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+               dst[0] =
+               dst[1] =
+               dst[2] = ubyte_to_float(tmp_r);
+               dst[3] = ubyte_to_float(tmp_g);
+            }
+         }
+         src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_latc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp_r, tmp_g;
+
+   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+   util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+   dst[0] =
+   dst[1] =
+   dst[2] = ubyte_to_float(tmp_r);
+   dst[3] = ubyte_to_float(tmp_g);
+}
+
+
+void
+util_format_latc2_snorm_fetch_rgba_8unorm(UNUSED uint8_t *dst, UNUSED const uint8_t *src,
+                                          UNUSED unsigned i, UNUSED unsigned j)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_latc2_snorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                           UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                           UNUSED unsigned width, UNUSED unsigned height)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_latc2_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                         UNUSED unsigned width, UNUSED unsigned height)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   unsigned x, y, i, j;
+   int block_size = 16;
+
+   for(y = 0; y < height; y += 4) {
+      const int8_t *src = (int8_t *)src_row;
+      for(x = 0; x < width; x += 4) {
+         for(j = 0; j < 4; ++j) {
+            for(i = 0; i < 4; ++i) {
+               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               int8_t tmp_r, tmp_g;
+               util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+               util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+               dst[0] =
+               dst[1] =
+               dst[2] = byte_to_float_tex(tmp_r);
+               dst[3] = byte_to_float_tex(tmp_g);
+            }
+         }
+         src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_latc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_rxtc2_snorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height, 3);
+}
+
+void
+util_format_latc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   int8_t tmp_r, tmp_g;
+
+   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
+   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
+   dst[0] =
+   dst[1] =
+   dst[2] = byte_to_float_tex(tmp_r);
+   dst[3] = byte_to_float_tex(tmp_g);
+}
+
diff --git a/src/util/format/u_format_latc.h b/src/util/format/u_format_latc.h
new file mode 100644 (file)
index 0000000..1f08887
--- /dev/null
@@ -0,0 +1,108 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Red Hat Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+#ifndef U_FORMAT_LATC_H_
+#define U_FORMAT_LATC_H_
+
+void
+util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_latc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+
+void
+util_format_latc1_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_latc1_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc1_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+void
+util_format_latc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_latc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+void
+util_format_latc2_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_latc2_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_latc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+#endif
diff --git a/src/util/format/u_format_other.c b/src/util/format/u_format_other.c
new file mode 100644 (file)
index 0000000..5599bfd
--- /dev/null
@@ -0,0 +1,422 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#include "util/format/u_format_other.h"
+#include "util/u_math.h"
+#include "util/format_rgb9e5.h"
+#include "util/format_r11g11b10f.h"
+
+
+void
+util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; y += 1) {
+      float *dst = dst_row;
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += 1) {
+         uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
+         rgb9e5_to_float3(value, dst);
+         dst[3] = 1; /* a */
+         src += 4;
+         dst += 4;
+      }
+      src_row += src_stride;
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                      const float *src_row, unsigned src_stride,
+                                      unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; y += 1) {
+      const float *src = src_row;
+      uint8_t *dst = dst_row;
+      for(x = 0; x < width; x += 1) {
+         uint32_t value = util_cpu_to_le32(float3_to_rgb9e5(src));
+         *(uint32_t *)dst = value;
+         src += 4;
+         dst += 4;
+      }
+      dst_row += dst_stride;
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src,
+                                       UNUSED unsigned i, UNUSED unsigned j)
+{
+   uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
+   rgb9e5_to_float3(value, dst);
+   dst[3] = 1; /* a */
+}
+
+
+void
+util_format_r9g9b9e5_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   unsigned x, y;
+   float p[3];
+   for(y = 0; y < height; y += 1) {
+      uint8_t *dst = dst_row;
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += 1) {
+         uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
+         rgb9e5_to_float3(value, p);
+         dst[0] = float_to_ubyte(p[0]); /* r */
+         dst[1] = float_to_ubyte(p[1]); /* g */
+         dst[2] = float_to_ubyte(p[2]); /* b */
+         dst[3] = 255; /* a */
+         src += 4;
+         dst += 4;
+      }
+      src_row += src_stride;
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+   float p[3];
+   for(y = 0; y < height; y += 1) {
+      const uint8_t *src = src_row;
+      uint8_t *dst = dst_row;
+      for(x = 0; x < width; x += 1) {
+         uint32_t value;
+         p[0] = ubyte_to_float(src[0]);
+         p[1] = ubyte_to_float(src[1]);
+         p[2] = ubyte_to_float(src[2]);
+         value = util_cpu_to_le32(float3_to_rgb9e5(p));
+         *(uint32_t *)dst = value;
+         src += 4;
+         dst += 4;
+      }
+      dst_row += dst_stride;
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; y += 1) {
+      float *dst = dst_row;
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += 1) {
+         uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
+         r11g11b10f_to_float3(value, dst);
+         dst[3] = 1; /* a */
+         src += 4;
+         dst += 4;
+      }
+      src_row += src_stride;
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_r11g11b10_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                      const float *src_row, unsigned src_stride,
+                                      unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; y += 1) {
+      const float *src = src_row;
+      uint8_t *dst = dst_row;
+      for(x = 0; x < width; x += 1) {
+         uint32_t value = util_cpu_to_le32(float3_to_r11g11b10f(src));
+         *(uint32_t *)dst = value;
+         src += 4;
+         dst += 4;
+      }
+      dst_row += dst_stride;
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        UNUSED unsigned i, UNUSED unsigned j)
+{
+   uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
+   r11g11b10f_to_float3(value, dst);
+   dst[3] = 1; /* a */
+}
+
+
+void
+util_format_r11g11b10_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   unsigned x, y;
+   float p[3];
+   for(y = 0; y < height; y += 1) {
+      uint8_t *dst = dst_row;
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += 1) {
+         uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
+         r11g11b10f_to_float3(value, p);
+         dst[0] = float_to_ubyte(p[0]); /* r */
+         dst[1] = float_to_ubyte(p[1]); /* g */
+         dst[2] = float_to_ubyte(p[2]); /* b */
+         dst[3] = 255; /* a */
+         src += 4;
+         dst += 4;
+      }
+      src_row += src_stride;
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+   float p[3];
+   for(y = 0; y < height; y += 1) {
+      const uint8_t *src = src_row;
+      uint8_t *dst = dst_row;
+      for(x = 0; x < width; x += 1) {
+         uint32_t value;
+         p[0] = ubyte_to_float(src[0]);
+         p[1] = ubyte_to_float(src[1]);
+         p[2] = ubyte_to_float(src[2]);
+         value = util_cpu_to_le32(float3_to_r11g11b10f(p));
+         *(uint32_t *)dst = value;
+         src += 4;
+         dst += 4;
+      }
+      dst_row += dst_stride;
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_r1_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                                  UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                  UNUSED unsigned width, UNUSED unsigned height)
+{
+
+}
+
+
+void
+util_format_r1_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                UNUSED const float *src_row, UNUSED unsigned src_stride,
+                                UNUSED unsigned width, UNUSED unsigned height)
+{
+
+}
+
+
+void
+util_format_r1_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                                 UNUSED unsigned i, UNUSED unsigned j)
+{
+
+}
+
+
+void
+util_format_r1_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                   UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                   UNUSED unsigned width, UNUSED unsigned height)
+{
+
+}
+
+
+void
+util_format_r1_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                 UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                 UNUSED unsigned width, UNUSED unsigned height)
+{
+}
+
+
+/*
+ * PIPE_FORMAT_R8G8Bx_SNORM
+ *
+ * A.k.a. D3DFMT_CxV8U8
+ */
+
+static uint8_t
+r8g8bx_derive(int16_t r, int16_t g)
+{
+   /* Derive blue from red and green components.
+    * Apparently, we must always use integers to perform calculations,
+    * otherwise the results won't match D3D's CxV8U8 definition.
+    */
+   return (uint8_t)sqrtf(0x7f * 0x7f - r * r - g * g) * 0xff / 0x7f;
+}
+
+void
+util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                      const uint8_t *src_row, unsigned src_stride,
+                                      unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for(y = 0; y < height; y += 1) {
+      float *dst = dst_row;
+      const uint16_t *src = (const uint16_t *)src_row;
+      for(x = 0; x < width; x += 1) {
+         uint16_t value = util_cpu_to_le16(*src++);
+         int16_t r, g;
+
+         r = ((int16_t)(value << 8)) >> 8;
+         g = ((int16_t)(value << 0)) >> 8;
+
+         dst[0] = (float)(r * (1.0f/0x7f)); /* r */
+         dst[1] = (float)(g * (1.0f/0x7f)); /* g */
+         dst[2] = r8g8bx_derive(r, g) * (1.0f/0xff); /* b */
+         dst[3] = 1.0f; /* a */
+         dst += 4;
+      }
+      src_row += src_stride;
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; y += 1) {
+      uint8_t *dst = dst_row;
+      const uint16_t *src = (const uint16_t *)src_row;
+      for(x = 0; x < width; x += 1) {
+         uint16_t value = util_cpu_to_le16(*src++);
+         int16_t r, g;
+
+         r = ((int16_t)(value << 8)) >> 8;
+         g = ((int16_t)(value << 0)) >> 8;
+
+         dst[0] = (uint8_t)(((uint16_t)MAX2(r, 0)) * 0xff / 0x7f); /* r */
+         dst[1] = (uint8_t)(((uint16_t)MAX2(g, 0)) * 0xff / 0x7f); /* g */
+         dst[2] = r8g8bx_derive(r, g); /* b */
+         dst[3] = 255; /* a */
+         dst += 4;
+      }
+      src_row += src_stride;
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                    const float *src_row, unsigned src_stride,
+                                    unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; y += 1) {
+      const float *src = src_row;
+      uint16_t *dst = (uint16_t *)dst_row;
+      for(x = 0; x < width; x += 1) {
+         uint16_t value = 0;
+
+         value |= (uint16_t)(((int8_t)(CLAMP(src[0], -1, 1) * 0x7f)) & 0xff) ;
+         value |= (uint16_t)((((int8_t)(CLAMP(src[1], -1, 1) * 0x7f)) & 0xff) << 8) ;
+
+         *dst++ = util_le16_to_cpu(value);
+
+         src += 4;
+      }
+      dst_row += dst_stride;
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                     const uint8_t *src_row, unsigned src_stride,
+                                     unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for(y = 0; y < height; y += 1) {
+      const uint8_t *src = src_row;
+      uint16_t *dst = (uint16_t *)dst_row;
+      for(x = 0; x < width; x += 1) {
+         uint16_t value = 0;
+
+         value |= src[0] >> 1;
+         value |= (src[1] >> 1) << 8;
+
+         *dst++ = util_le16_to_cpu(value);
+
+         src += 4;
+      }
+      dst_row += dst_stride;
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                     UNUSED unsigned i, UNUSED unsigned j)
+{
+   uint16_t value = util_cpu_to_le16(*(const uint16_t *)src);
+   int16_t r, g;
+
+   r = ((int16_t)(value << 8)) >> 8;
+   g = ((int16_t)(value << 0)) >> 8;
+
+   dst[0] = r * (1.0f/0x7f); /* r */
+   dst[1] = g * (1.0f/0x7f); /* g */
+   dst[2] = r8g8bx_derive(r, g) * (1.0f/0xff); /* b */
+   dst[3] = 1.0f; /* a */
+}
diff --git a/src/util/format/u_format_other.h b/src/util/format/u_format_other.h
new file mode 100644 (file)
index 0000000..2f6a908
--- /dev/null
@@ -0,0 +1,134 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#ifndef U_FORMAT_OTHER_H_
+#define U_FORMAT_OTHER_H_
+
+
+#include "pipe/p_compiler.h"
+
+
+void
+util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height);
+
+void
+util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                      const float *src_row, unsigned src_stride,
+                                      unsigned width, unsigned height);
+
+void
+util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src,
+                                       unsigned i, unsigned j);
+
+void
+util_format_r9g9b9e5_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height);
+
+void
+util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height);
+
+
+void
+util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height);
+
+void
+util_format_r11g11b10_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                      const float *src_row, unsigned src_stride,
+                                      unsigned width, unsigned height);
+
+void
+util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src,
+                                       unsigned i, unsigned j);
+
+void
+util_format_r11g11b10_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height);
+
+void
+util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height);
+
+
+void
+util_format_r1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                  const uint8_t *src_row, unsigned src_stride,
+                                  unsigned width, unsigned height);
+
+void
+util_format_r1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                const float *src_row, unsigned src_stride,
+                                unsigned width, unsigned height);
+
+void
+util_format_r1_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                 unsigned i, unsigned j);
+
+void
+util_format_r1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                   const uint8_t *src_row, unsigned src_stride,
+                                   unsigned width, unsigned height);
+
+void
+util_format_r1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                 const uint8_t *src_row, unsigned src_stride,
+                                 unsigned width, unsigned height);
+
+void
+util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                      const uint8_t *src_row, unsigned src_stride,
+                                      unsigned width, unsigned height);
+
+void
+util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                    const float *src_row, unsigned src_stride,
+                                    unsigned width, unsigned height);
+
+void
+util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                     unsigned i, unsigned j);
+
+void
+util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height);
+
+void
+util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                     const uint8_t *src_row, unsigned src_stride,
+                                     unsigned width, unsigned height);
+
+#endif /* U_FORMAT_OTHER_H_ */
diff --git a/src/util/format/u_format_pack.py b/src/util/format/u_format_pack.py
new file mode 100644 (file)
index 0000000..0653e5e
--- /dev/null
@@ -0,0 +1,761 @@
+
+'''
+/**************************************************************************
+ *
+ * Copyright 2009-2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Pixel format packing and unpacking functions.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+'''
+
+
+from __future__ import division, print_function
+
+import sys
+
+from u_format_parse import *
+
+
+if sys.version_info < (3, 0):
+    integer_types = (int, long)
+
+else:
+    integer_types = (int, )
+
+
+def inv_swizzles(swizzles):
+    '''Return an array[4] of inverse swizzle terms'''
+    '''Only pick the first matching value to avoid l8 getting blue and i8 getting alpha'''
+    inv_swizzle = [None]*4
+    for i in range(4):
+        swizzle = swizzles[i]
+        if swizzle < 4 and inv_swizzle[swizzle] == None:
+            inv_swizzle[swizzle] = i
+    return inv_swizzle
+
+def print_channels(format, func):
+    if format.nr_channels() <= 1:
+        func(format.le_channels, format.le_swizzles)
+    else:
+        if (format.le_channels == format.be_channels and
+            [c.shift for c in format.le_channels] ==
+            [c.shift for c in format.be_channels] and
+            format.le_swizzles == format.be_swizzles):
+            func(format.le_channels, format.le_swizzles)
+        else:
+            print('#if UTIL_ARCH_BIG_ENDIAN')
+            func(format.be_channels, format.be_swizzles)
+            print('#else')
+            func(format.le_channels, format.le_swizzles)
+            print('#endif')
+
+def generate_format_type(format):
+    '''Generate a structure that describes the format.'''
+
+    assert format.layout == PLAIN
+    
+    def generate_bitfields(channels, swizzles):
+        for channel in channels:
+            if channel.type == VOID:
+                if channel.size:
+                    print('   unsigned %s:%u;' % (channel.name, channel.size))
+            elif channel.type == UNSIGNED:
+                print('   unsigned %s:%u;' % (channel.name, channel.size))
+            elif channel.type in (SIGNED, FIXED):
+                print('   int %s:%u;' % (channel.name, channel.size))
+            elif channel.type == FLOAT:
+                if channel.size == 64:
+                    print('   double %s;' % (channel.name))
+                elif channel.size == 32:
+                    print('   float %s;' % (channel.name))
+                else:
+                    print('   unsigned %s:%u;' % (channel.name, channel.size))
+            else:
+                assert 0
+
+    def generate_full_fields(channels, swizzles):
+        for channel in channels:
+            assert channel.size % 8 == 0 and is_pot(channel.size)
+            if channel.type == VOID:
+                if channel.size:
+                    print('   uint%u_t %s;' % (channel.size, channel.name))
+            elif channel.type == UNSIGNED:
+                print('   uint%u_t %s;' % (channel.size, channel.name))
+            elif channel.type in (SIGNED, FIXED):
+                print('   int%u_t %s;' % (channel.size, channel.name))
+            elif channel.type == FLOAT:
+                if channel.size == 64:
+                    print('   double %s;' % (channel.name))
+                elif channel.size == 32:
+                    print('   float %s;' % (channel.name))
+                elif channel.size == 16:
+                    print('   uint16_t %s;' % (channel.name))
+                else:
+                    assert 0
+            else:
+                assert 0
+
+    use_bitfields = False
+    for channel in format.le_channels:
+        if channel.size % 8 or not is_pot(channel.size):
+            use_bitfields = True
+
+    print('struct util_format_%s {' % format.short_name())
+    if use_bitfields:
+        print_channels(format, generate_bitfields)
+    else:
+        print_channels(format, generate_full_fields)
+    print('};')
+    print()
+
+
+def is_format_supported(format):
+    '''Determines whether we actually have the plumbing necessary to generate the 
+    to read/write to/from this format.'''
+
+    # FIXME: Ideally we would support any format combination here.
+
+    if format.layout != PLAIN:
+        return False
+
+    for i in range(4):
+        channel = format.le_channels[i]
+        if channel.type not in (VOID, UNSIGNED, SIGNED, FLOAT, FIXED):
+            return False
+        if channel.type == FLOAT and channel.size not in (16, 32, 64):
+            return False
+
+    return True
+
+def native_type(format):
+    '''Get the native appropriate for a format.'''
+
+    if format.name == 'PIPE_FORMAT_R11G11B10_FLOAT':
+        return 'uint32_t'
+    if format.name == 'PIPE_FORMAT_R9G9B9E5_FLOAT':
+        return 'uint32_t'
+
+    if format.layout == PLAIN:
+        if not format.is_array():
+            # For arithmetic pixel formats return the integer type that matches the whole pixel
+            return 'uint%u_t' % format.block_size()
+        else:
+            # For array pixel formats return the integer type that matches the color channel
+            channel = format.array_element()
+            if channel.type in (UNSIGNED, VOID):
+                return 'uint%u_t' % channel.size
+            elif channel.type in (SIGNED, FIXED):
+                return 'int%u_t' % channel.size
+            elif channel.type == FLOAT:
+                if channel.size == 16:
+                    return 'uint16_t'
+                elif channel.size == 32:
+                    return 'float'
+                elif channel.size == 64:
+                    return 'double'
+                else:
+                    assert False
+            else:
+                assert False
+    else:
+        assert False
+
+
+def intermediate_native_type(bits, sign):
+    '''Find a native type adequate to hold intermediate results of the request bit size.'''
+
+    bytes = 4 # don't use anything smaller than 32bits
+    while bytes * 8 < bits:
+        bytes *= 2
+    bits = bytes*8
+
+    if sign:
+        return 'int%u_t' % bits
+    else:
+        return 'uint%u_t' % bits
+
+
+def get_one_shift(type):
+    '''Get the number of the bit that matches unity for this type.'''
+    if type.type == 'FLOAT':
+        assert False
+    if not type.norm:
+        return 0
+    if type.type == UNSIGNED:
+        return type.size
+    if type.type == SIGNED:
+        return type.size - 1
+    if type.type == FIXED:
+        return type.size / 2
+    assert False
+
+
+def truncate_mantissa(x, bits):
+    '''Truncate an integer so it can be represented exactly with a floating
+    point mantissa'''
+
+    assert isinstance(x, integer_types)
+
+    s = 1
+    if x < 0:
+        s = -1
+        x = -x
+
+    # We can represent integers up to mantissa + 1 bits exactly
+    mask = (1 << (bits + 1)) - 1
+
+    # Slide the mask until the MSB matches
+    shift = 0
+    while (x >> shift) & ~mask:
+        shift += 1
+
+    x &= mask << shift
+    x *= s
+    return x
+
+
+def value_to_native(type, value):
+    '''Get the value of unity for this type.'''
+    if type.type == FLOAT:
+        if type.size <= 32 \
+            and isinstance(value, integer_types):
+            return truncate_mantissa(value, 23)
+        return value
+    if type.type == FIXED:
+        return int(value * (1 << (type.size // 2)))
+    if not type.norm:
+        return int(value)
+    if type.type == UNSIGNED:
+        return int(value * ((1 << type.size) - 1))
+    if type.type == SIGNED:
+        return int(value * ((1 << (type.size - 1)) - 1))
+    assert False
+
+
+def native_to_constant(type, value):
+    '''Get the value of unity for this type.'''
+    if type.type == FLOAT:
+        if type.size <= 32:
+            return "%.1ff" % float(value)
+        else:
+            return "%.1f" % float(value)
+    else:
+        return str(int(value))
+
+
+def get_one(type):
+    '''Get the value of unity for this type.'''
+    return value_to_native(type, 1)
+
+
+def clamp_expr(src_channel, dst_channel, dst_native_type, value):
+    '''Generate the expression to clamp the value in the source type to the
+    destination type range.'''
+
+    if src_channel == dst_channel:
+        return value
+
+    src_min = src_channel.min()
+    src_max = src_channel.max()
+    dst_min = dst_channel.min()
+    dst_max = dst_channel.max()
+    
+    # Translate the destination range to the src native value
+    dst_min_native = native_to_constant(src_channel, value_to_native(src_channel, dst_min))
+    dst_max_native = native_to_constant(src_channel, value_to_native(src_channel, dst_max))
+
+    if src_min < dst_min and src_max > dst_max:
+        return 'CLAMP(%s, %s, %s)' % (value, dst_min_native, dst_max_native)
+
+    if src_max > dst_max:
+        return 'MIN2(%s, %s)' % (value, dst_max_native)
+        
+    if src_min < dst_min:
+        return 'MAX2(%s, %s)' % (value, dst_min_native)
+
+    return value
+
+
+def conversion_expr(src_channel, 
+                    dst_channel, dst_native_type, 
+                    value, 
+                    clamp=True, 
+                    src_colorspace = RGB, 
+                    dst_colorspace = RGB):
+    '''Generate the expression to convert a value between two types.'''
+
+    if src_colorspace != dst_colorspace:
+        if src_colorspace == SRGB:
+            assert src_channel.type == UNSIGNED
+            assert src_channel.norm
+            assert src_channel.size <= 8
+            assert src_channel.size >= 4
+            assert dst_colorspace == RGB
+            if src_channel.size < 8:
+                value = '%s << %x | %s >> %x' % (value, 8 - src_channel.size, value, 2 * src_channel.size - 8)
+            if dst_channel.type == FLOAT:
+                return 'util_format_srgb_8unorm_to_linear_float(%s)' % value
+            else:
+                assert dst_channel.type == UNSIGNED
+                assert dst_channel.norm
+                assert dst_channel.size == 8
+                return 'util_format_srgb_to_linear_8unorm(%s)' % value
+        elif dst_colorspace == SRGB:
+            assert dst_channel.type == UNSIGNED
+            assert dst_channel.norm
+            assert dst_channel.size <= 8
+            assert src_colorspace == RGB
+            if src_channel.type == FLOAT:
+                value =  'util_format_linear_float_to_srgb_8unorm(%s)' % value
+            else:
+                assert src_channel.type == UNSIGNED
+                assert src_channel.norm
+                assert src_channel.size == 8
+                value = 'util_format_linear_to_srgb_8unorm(%s)' % value
+            # XXX rounding is all wrong.
+            if dst_channel.size < 8:
+                return '%s >> %x' % (value, 8 - dst_channel.size)
+            else:
+                return value
+        elif src_colorspace == ZS:
+            pass
+        elif dst_colorspace == ZS:
+            pass
+        else:
+            assert 0
+
+    if src_channel == dst_channel:
+        return value
+
+    src_type = src_channel.type
+    src_size = src_channel.size
+    src_norm = src_channel.norm
+    src_pure = src_channel.pure
+
+    # Promote half to float
+    if src_type == FLOAT and src_size == 16:
+        value = 'util_half_to_float(%s)' % value
+        src_size = 32
+
+    # Special case for float <-> ubytes for more accurate results
+    # Done before clamping since these functions already take care of that
+    if src_type == UNSIGNED and src_norm and src_size == 8 and dst_channel.type == FLOAT and dst_channel.size == 32:
+        return 'ubyte_to_float(%s)' % value
+    if src_type == FLOAT and src_size == 32 and dst_channel.type == UNSIGNED and dst_channel.norm and dst_channel.size == 8:
+        return 'float_to_ubyte(%s)' % value
+
+    if clamp:
+        if dst_channel.type != FLOAT or src_type != FLOAT:
+            value = clamp_expr(src_channel, dst_channel, dst_native_type, value)
+
+    if src_type in (SIGNED, UNSIGNED) and dst_channel.type in (SIGNED, UNSIGNED):
+        if not src_norm and not dst_channel.norm:
+            # neither is normalized -- just cast
+            return '(%s)%s' % (dst_native_type, value)
+
+        src_one = get_one(src_channel)
+        dst_one = get_one(dst_channel)
+
+        if src_one > dst_one and src_norm and dst_channel.norm:
+            # We can just bitshift
+            src_shift = get_one_shift(src_channel)
+            dst_shift = get_one_shift(dst_channel)
+            value = '(%s >> %s)' % (value, src_shift - dst_shift)
+        else:
+            # We need to rescale using an intermediate type big enough to hold the multiplication of both
+            tmp_native_type = intermediate_native_type(src_size + dst_channel.size, src_channel.sign and dst_channel.sign)
+            value = '((%s)%s)' % (tmp_native_type, value)
+            value = '(%s * 0x%x / 0x%x)' % (value, dst_one, src_one)
+        value = '(%s)%s' % (dst_native_type, value)
+        return value
+
+    # Promote to either float or double
+    if src_type != FLOAT:
+        if src_norm or src_type == FIXED:
+            one = get_one(src_channel)
+            if src_size <= 23:
+                value = '(%s * (1.0f/0x%x))' % (value, one)
+                if dst_channel.size <= 32:
+                    value = '(float)%s' % value
+                src_size = 32
+            else:
+                # bigger than single precision mantissa, use double
+                value = '(%s * (1.0/0x%x))' % (value, one)
+                src_size = 64
+            src_norm = False
+        else:
+            if src_size <= 23 or dst_channel.size <= 32:
+                value = '(float)%s' % value
+                src_size = 32
+            else:
+                # bigger than single precision mantissa, use double
+                value = '(double)%s' % value
+                src_size = 64
+        src_type = FLOAT
+
+    # Convert double or float to non-float
+    if dst_channel.type != FLOAT:
+        if dst_channel.norm or dst_channel.type == FIXED:
+            dst_one = get_one(dst_channel)
+            if dst_channel.size <= 23:
+                value = 'util_iround(%s * 0x%x)' % (value, dst_one)
+            else:
+                # bigger than single precision mantissa, use double
+                value = '(%s * (double)0x%x)' % (value, dst_one)
+        value = '(%s)%s' % (dst_native_type, value)
+    else:
+        # Cast double to float when converting to either half or float
+        if dst_channel.size <= 32 and src_size > 32:
+            value = '(float)%s' % value
+            src_size = 32
+
+        if dst_channel.size == 16:
+            value = 'util_float_to_half(%s)' % value
+        elif dst_channel.size == 64 and src_size < 64:
+            value = '(double)%s' % value
+
+    return value
+
+
+def generate_unpack_kernel(format, dst_channel, dst_native_type):
+
+    if not is_format_supported(format):
+        return
+    
+    assert format.layout == PLAIN
+
+    def unpack_from_bitmask(channels, swizzles):
+        depth = format.block_size()
+        print('         uint%u_t value = *(const uint%u_t *)src;' % (depth, depth)) 
+
+        # Declare the intermediate variables
+        for i in range(format.nr_channels()):
+            src_channel = channels[i]
+            if src_channel.type == UNSIGNED:
+                print('         uint%u_t %s;' % (depth, src_channel.name))
+            elif src_channel.type == SIGNED:
+                print('         int%u_t %s;' % (depth, src_channel.name))
+
+        # Compute the intermediate unshifted values 
+        for i in range(format.nr_channels()):
+            src_channel = channels[i]
+            value = 'value'
+            shift = src_channel.shift
+            if src_channel.type == UNSIGNED:
+                if shift:
+                    value = '%s >> %u' % (value, shift)
+                if shift + src_channel.size < depth:
+                    value = '(%s) & 0x%x' % (value, (1 << src_channel.size) - 1)
+            elif src_channel.type == SIGNED:
+                if shift + src_channel.size < depth:
+                    # Align the sign bit
+                    lshift = depth - (shift + src_channel.size)
+                    value = '%s << %u' % (value, lshift)
+                # Cast to signed
+                value = '(int%u_t)(%s) ' % (depth, value)
+                if src_channel.size < depth:
+                    # Align the LSB bit
+                    rshift = depth - src_channel.size
+                    value = '(%s) >> %u' % (value, rshift)
+            else:
+                value = None
+                
+            if value is not None:
+                print('         %s = %s;' % (src_channel.name, value))
+                
+        # Convert, swizzle, and store final values
+        for i in range(4):
+            swizzle = swizzles[i]
+            if swizzle < 4:
+                src_channel = channels[swizzle]
+                src_colorspace = format.colorspace
+                if src_colorspace == SRGB and i == 3:
+                    # Alpha channel is linear
+                    src_colorspace = RGB
+                value = src_channel.name
+                value = conversion_expr(src_channel, 
+                                        dst_channel, dst_native_type, 
+                                        value,
+                                        src_colorspace = src_colorspace)
+            elif swizzle == SWIZZLE_0:
+                value = '0'
+            elif swizzle == SWIZZLE_1:
+                value = get_one(dst_channel)
+            elif swizzle == SWIZZLE_NONE:
+                value = '0'
+            else:
+                assert False
+            print('         dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i]))
+        
+    def unpack_from_struct(channels, swizzles):
+        print('         struct util_format_%s pixel;' % format.short_name())
+        print('         memcpy(&pixel, src, sizeof pixel);')
+    
+        for i in range(4):
+            swizzle = swizzles[i]
+            if swizzle < 4:
+                src_channel = channels[swizzle]
+                src_colorspace = format.colorspace
+                if src_colorspace == SRGB and i == 3:
+                    # Alpha channel is linear
+                    src_colorspace = RGB
+                value = 'pixel.%s' % src_channel.name
+                value = conversion_expr(src_channel, 
+                                        dst_channel, dst_native_type, 
+                                        value,
+                                        src_colorspace = src_colorspace)
+            elif swizzle == SWIZZLE_0:
+                value = '0'
+            elif swizzle == SWIZZLE_1:
+                value = get_one(dst_channel)
+            elif swizzle == SWIZZLE_NONE:
+                value = '0'
+            else:
+                assert False
+            print('         dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i]))
+    
+    if format.is_bitmask():
+        print_channels(format, unpack_from_bitmask)
+    else:
+        print_channels(format, unpack_from_struct)
+
+
+def generate_pack_kernel(format, src_channel, src_native_type):
+
+    if not is_format_supported(format):
+        return
+    
+    dst_native_type = native_type(format)
+
+    assert format.layout == PLAIN
+
+    def pack_into_bitmask(channels, swizzles):
+        inv_swizzle = inv_swizzles(swizzles)
+
+        depth = format.block_size()
+        print('         uint%u_t value = 0;' % depth) 
+
+        for i in range(4):
+            dst_channel = channels[i]
+            shift = dst_channel.shift
+            if inv_swizzle[i] is not None:
+                value ='src[%u]' % inv_swizzle[i]
+                dst_colorspace = format.colorspace
+                if dst_colorspace == SRGB and inv_swizzle[i] == 3:
+                    # Alpha channel is linear
+                    dst_colorspace = RGB
+                value = conversion_expr(src_channel, 
+                                        dst_channel, dst_native_type, 
+                                        value,
+                                        dst_colorspace = dst_colorspace)
+                if dst_channel.type in (UNSIGNED, SIGNED):
+                    if shift + dst_channel.size < depth:
+                        value = '(%s) & 0x%x' % (value, (1 << dst_channel.size) - 1)
+                    if shift:
+                        value = '(uint32_t)(%s) << %u' % (value, shift)
+                    if dst_channel.type == SIGNED:
+                        # Cast to unsigned
+                        value = '(uint%u_t)(%s) ' % (depth, value)
+                else:
+                    value = None
+                if value is not None:
+                    print('         value |= %s;' % (value))
+                
+        print('         *(uint%u_t *)dst = value;' % depth) 
+
+    def pack_into_struct(channels, swizzles):
+        inv_swizzle = inv_swizzles(swizzles)
+
+        print('         struct util_format_%s pixel;' % format.short_name())
+    
+        for i in range(4):
+            dst_channel = channels[i]
+            width = dst_channel.size
+            if inv_swizzle[i] is None:
+                continue
+            dst_colorspace = format.colorspace
+            if dst_colorspace == SRGB and inv_swizzle[i] == 3:
+                # Alpha channel is linear
+                dst_colorspace = RGB
+            value ='src[%u]' % inv_swizzle[i]
+            value = conversion_expr(src_channel, 
+                                    dst_channel, dst_native_type, 
+                                    value, 
+                                    dst_colorspace = dst_colorspace)
+            print('         pixel.%s = %s;' % (dst_channel.name, value))
+    
+        print('         memcpy(dst, &pixel, sizeof pixel);')
+    
+    if format.is_bitmask():
+        print_channels(format, pack_into_bitmask)
+    else:
+        print_channels(format, pack_into_struct)
+
+
+def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
+    '''Generate the function to unpack pixels from a particular format'''
+
+    name = format.short_name()
+
+    print('static inline void')
+    print('util_format_%s_unpack_%s(%s *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)' % (name, dst_suffix, dst_native_type))
+    print('{')
+
+    if is_format_supported(format):
+        print('   unsigned x, y;')
+        print('   for(y = 0; y < height; y += %u) {' % (format.block_height,))
+        print('      %s *dst = dst_row;' % (dst_native_type))
+        print('      const uint8_t *src = src_row;')
+        print('      for(x = 0; x < width; x += %u) {' % (format.block_width,))
+        
+        generate_unpack_kernel(format, dst_channel, dst_native_type)
+    
+        print('         src += %u;' % (format.block_size() / 8,))
+        print('         dst += 4;')
+        print('      }')
+        print('      src_row += src_stride;')
+        print('      dst_row += dst_stride/sizeof(*dst_row);')
+        print('   }')
+
+    print('}')
+    print()
+    
+
+def generate_format_pack(format, src_channel, src_native_type, src_suffix):
+    '''Generate the function to pack pixels to a particular format'''
+
+    name = format.short_name()
+
+    print('static inline void')
+    print('util_format_%s_pack_%s(uint8_t *dst_row, unsigned dst_stride, const %s *src_row, unsigned src_stride, unsigned width, unsigned height)' % (name, src_suffix, src_native_type))
+    print('{')
+    
+    if is_format_supported(format):
+        print('   unsigned x, y;')
+        print('   for(y = 0; y < height; y += %u) {' % (format.block_height,))
+        print('      const %s *src = src_row;' % (src_native_type))
+        print('      uint8_t *dst = dst_row;')
+        print('      for(x = 0; x < width; x += %u) {' % (format.block_width,))
+    
+        generate_pack_kernel(format, src_channel, src_native_type)
+            
+        print('         src += 4;')
+        print('         dst += %u;' % (format.block_size() / 8,))
+        print('      }')
+        print('      dst_row += dst_stride;')
+        print('      src_row += src_stride/sizeof(*src_row);')
+        print('   }')
+        
+    print('}')
+    print()
+    
+
+def generate_format_fetch(format, dst_channel, dst_native_type, dst_suffix):
+    '''Generate the function to unpack pixels from a particular format'''
+
+    name = format.short_name()
+
+    print('static inline void')
+    print('util_format_%s_fetch_%s(%s *dst, const uint8_t *src, UNUSED unsigned i, UNUSED unsigned j)' % (name, dst_suffix, dst_native_type))
+    print('{')
+
+    if is_format_supported(format):
+        generate_unpack_kernel(format, dst_channel, dst_native_type)
+
+    print('}')
+    print()
+
+
+def is_format_hand_written(format):
+    return format.layout != PLAIN or format.colorspace == ZS
+
+
+def generate(formats):
+    print()
+    print('#include "pipe/p_compiler.h"')
+    print('#include "util/u_math.h"')
+    print('#include "util/u_half.h"')
+    print('#include "u_format.h"')
+    print('#include "u_format_other.h"')
+    print('#include "util/format_srgb.h"')
+    print('#include "u_format_yuv.h"')
+    print('#include "u_format_zs.h"')
+    print()
+
+    for format in formats:
+        if not is_format_hand_written(format):
+            
+            if is_format_supported(format) and not format.is_bitmask():
+                generate_format_type(format)
+
+            if format.is_pure_unsigned():
+                native_type = 'unsigned'
+                suffix = 'unsigned'
+                channel = Channel(UNSIGNED, False, True, 32)
+
+                generate_format_unpack(format, channel, native_type, suffix)
+                generate_format_pack(format, channel, native_type, suffix)
+                generate_format_fetch(format, channel, native_type, suffix)
+
+                channel = Channel(SIGNED, False, True, 32)
+                native_type = 'int'
+                suffix = 'signed'
+                generate_format_unpack(format, channel, native_type, suffix)
+                generate_format_pack(format, channel, native_type, suffix)   
+            elif format.is_pure_signed():
+                native_type = 'int'
+                suffix = 'signed'
+                channel = Channel(SIGNED, False, True, 32)
+
+                generate_format_unpack(format, channel, native_type, suffix)
+                generate_format_pack(format, channel, native_type, suffix)   
+                generate_format_fetch(format, channel, native_type, suffix)
+
+                native_type = 'unsigned'
+                suffix = 'unsigned'
+                channel = Channel(UNSIGNED, False, True, 32)
+                generate_format_unpack(format, channel, native_type, suffix)
+                generate_format_pack(format, channel, native_type, suffix)   
+            else:
+                channel = Channel(FLOAT, False, False, 32)
+                native_type = 'float'
+                suffix = 'rgba_float'
+
+                generate_format_unpack(format, channel, native_type, suffix)
+                generate_format_pack(format, channel, native_type, suffix)
+                generate_format_fetch(format, channel, native_type, suffix)
+
+                channel = Channel(UNSIGNED, True, False, 8)
+                native_type = 'uint8_t'
+                suffix = 'rgba_8unorm'
+
+                generate_format_unpack(format, channel, native_type, suffix)
+                generate_format_pack(format, channel, native_type, suffix)
+
diff --git a/src/util/format/u_format_parse.py b/src/util/format/u_format_parse.py
new file mode 100644 (file)
index 0000000..541ae69
--- /dev/null
@@ -0,0 +1,405 @@
+
+'''
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+'''
+
+
+from __future__ import division
+
+
+VOID, UNSIGNED, SIGNED, FIXED, FLOAT = range(5)
+
+SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_0, SWIZZLE_1, SWIZZLE_NONE, = range(7)
+
+PLAIN = 'plain'
+
+RGB = 'rgb'
+SRGB = 'srgb'
+YUV = 'yuv'
+ZS = 'zs'
+
+
+def is_pot(x):
+   return (x & (x - 1)) == 0
+
+
+VERY_LARGE = 99999999999999999999999
+
+
+class Channel:
+    '''Describe the channel of a color channel.'''
+    
+    def __init__(self, type, norm, pure, size, name = ''):
+        self.type = type
+        self.norm = norm
+        self.pure = pure
+        self.size = size
+        self.sign = type in (SIGNED, FIXED, FLOAT)
+        self.name = name
+
+    def __str__(self):
+        s = str(self.type)
+        if self.norm:
+            s += 'n'
+        if self.pure:
+            s += 'p'
+        s += str(self.size)
+        return s
+
+    def __eq__(self, other):
+        if other is None:
+            return False
+
+        return self.type == other.type and self.norm == other.norm and self.pure == other.pure and self.size == other.size
+
+    def __ne__(self, other):
+        return not self == other
+
+    def max(self):
+        '''Maximum representable number.'''
+        if self.type == FLOAT:
+            return VERY_LARGE
+        if self.type == FIXED:
+            return (1 << (self.size // 2)) - 1
+        if self.norm:
+            return 1
+        if self.type == UNSIGNED:
+            return (1 << self.size) - 1
+        if self.type == SIGNED:
+            return (1 << (self.size - 1)) - 1
+        assert False
+    
+    def min(self):
+        '''Minimum representable number.'''
+        if self.type == FLOAT:
+            return -VERY_LARGE
+        if self.type == FIXED:
+            return -(1 << (self.size // 2))
+        if self.type == UNSIGNED:
+            return 0
+        if self.norm:
+            return -1
+        if self.type == SIGNED:
+            return -(1 << (self.size - 1))
+        assert False
+
+
+class Format:
+    '''Describe a pixel format.'''
+
+    def __init__(self, name, layout, block_width, block_height, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace):
+        self.name = name
+        self.layout = layout
+        self.block_width = block_width
+        self.block_height = block_height
+        self.block_depth = block_depth
+        self.le_channels = le_channels
+        self.le_swizzles = le_swizzles
+        self.be_channels = be_channels
+        self.be_swizzles = be_swizzles
+        self.name = name
+        self.colorspace = colorspace
+
+    def __str__(self):
+        return self.name
+
+    def short_name(self):
+        '''Make up a short norm for a format, suitable to be used as suffix in
+        function names.'''
+
+        name = self.name
+        if name.startswith('PIPE_FORMAT_'):
+            name = name[len('PIPE_FORMAT_'):]
+        name = name.lower()
+        return name
+
+    def block_size(self):
+        size = 0
+        for channel in self.le_channels:
+            size += channel.size
+        return size
+
+    def nr_channels(self):
+        nr_channels = 0
+        for channel in self.le_channels:
+            if channel.size:
+                nr_channels += 1
+        return nr_channels
+
+    def array_element(self):
+        if self.layout != PLAIN:
+            return None
+        ref_channel = self.le_channels[0]
+        if ref_channel.type == VOID:
+           ref_channel = self.le_channels[1]
+        for channel in self.le_channels:
+            if channel.size and (channel.size != ref_channel.size or channel.size % 8):
+                return None
+            if channel.type != VOID:
+                if channel.type != ref_channel.type:
+                    return None
+                if channel.norm != ref_channel.norm:
+                    return None
+                if channel.pure != ref_channel.pure:
+                    return None
+        return ref_channel
+
+    def is_array(self):
+        return self.array_element() != None
+
+    def is_mixed(self):
+        if self.layout != PLAIN:
+            return False
+        ref_channel = self.le_channels[0]
+        if ref_channel.type == VOID:
+           ref_channel = self.le_channels[1]
+        for channel in self.le_channels[1:]:
+            if channel.type != VOID:
+                if channel.type != ref_channel.type:
+                    return True
+                if channel.norm != ref_channel.norm:
+                    return True
+                if channel.pure != ref_channel.pure:
+                    return True
+        return False
+
+    def is_compressed(self):
+        for channel in self.le_channels:
+            if channel.type != VOID:
+                return False
+        return True
+
+    def is_unorm(self):
+        # Non-compressed formats all have unorm or srgb in their name.
+        for keyword in ['_UNORM', '_SRGB']:
+            if keyword in self.name:
+                return True
+
+        # All the compressed formats in GLES3.2 and GL4.6 ("Table 8.14: Generic
+        # and specific compressed internal formats.") that aren't snorm for
+        # border colors are unorm, other than BPTC_*_FLOAT.
+        return self.is_compressed() and not ('FLOAT' in self.name or self.is_snorm())
+
+    def is_snorm(self):
+        return '_SNORM' in self.name
+
+    def is_pot(self):
+        return is_pot(self.block_size())
+
+    def is_int(self):
+        if self.layout != PLAIN:
+            return False
+        for channel in self.le_channels:
+            if channel.type not in (VOID, UNSIGNED, SIGNED):
+                return False
+        return True
+
+    def is_float(self):
+        if self.layout != PLAIN:
+            return False
+        for channel in self.le_channels:
+            if channel.type not in (VOID, FLOAT):
+                return False
+        return True
+
+    def is_bitmask(self):
+        if self.layout != PLAIN:
+            return False
+        if self.block_size() not in (8, 16, 32):
+            return False
+        for channel in self.le_channels:
+            if channel.type not in (VOID, UNSIGNED, SIGNED):
+                return False
+        return True
+
+    def is_pure_color(self):
+        if self.layout != PLAIN or self.colorspace == ZS:
+            return False
+        pures = [channel.pure
+                 for channel in self.le_channels
+                 if channel.type != VOID]
+        for x in pures:
+           assert x == pures[0]
+        return pures[0]
+
+    def channel_type(self):
+        types = [channel.type
+                 for channel in self.le_channels
+                 if channel.type != VOID]
+        for x in types:
+           assert x == types[0]
+        return types[0]
+
+    def is_pure_signed(self):
+        return self.is_pure_color() and self.channel_type() == SIGNED
+
+    def is_pure_unsigned(self):
+        return self.is_pure_color() and self.channel_type() == UNSIGNED
+
+    def has_channel(self, id):
+        return self.le_swizzles[id] != SWIZZLE_NONE
+
+    def has_depth(self):
+        return self.colorspace == ZS and self.has_channel(0)
+
+    def has_stencil(self):
+        return self.colorspace == ZS and self.has_channel(1)
+
+    def stride(self):
+        return self.block_size()/8
+
+
+_type_parse_map = {
+    '':  VOID,
+    'x': VOID,
+    'u': UNSIGNED,
+    's': SIGNED,
+    'h': FIXED,
+    'f': FLOAT,
+}
+
+_swizzle_parse_map = {
+    'x': SWIZZLE_X,
+    'y': SWIZZLE_Y,
+    'z': SWIZZLE_Z,
+    'w': SWIZZLE_W,
+    '0': SWIZZLE_0,
+    '1': SWIZZLE_1,
+    '_': SWIZZLE_NONE,
+}
+
+def _parse_channels(fields, layout, colorspace, swizzles):
+    if layout == PLAIN:
+        names = ['']*4
+        if colorspace in (RGB, SRGB):
+            for i in range(4):
+                swizzle = swizzles[i]
+                if swizzle < 4:
+                    names[swizzle] += 'rgba'[i]
+        elif colorspace == ZS:
+            for i in range(4):
+                swizzle = swizzles[i]
+                if swizzle < 4:
+                    names[swizzle] += 'zs'[i]
+        else:
+            assert False
+        for i in range(4):
+            if names[i] == '':
+                names[i] = 'x'
+    else:
+        names = ['x', 'y', 'z', 'w']
+
+    channels = []
+    for i in range(0, 4):
+        field = fields[i]
+        if field:
+            type = _type_parse_map[field[0]]
+            if field[1] == 'n':
+                norm = True
+                pure = False
+                size = int(field[2:])
+            elif field[1] == 'p':
+                pure = True
+                norm = False
+                size = int(field[2:])
+            else:
+                norm = False
+                pure = False
+                size = int(field[1:])
+        else:
+            type = VOID
+            norm = False
+            pure = False
+            size = 0
+        channel = Channel(type, norm, pure, size, names[i])
+        channels.append(channel)
+
+    return channels
+
+def parse(filename):
+    '''Parse the format description in CSV format in terms of the
+    Channel and Format classes above.'''
+
+    stream = open(filename)
+    formats = []
+    for line in stream:
+        try:
+            comment = line.index('#')
+        except ValueError:
+            pass
+        else:
+            line = line[:comment]
+        line = line.strip()
+        if not line:
+            continue
+
+        fields = [field.strip() for field in line.split(',')]
+        if len (fields) == 11:
+            fields += fields[5:10]
+        assert len (fields) == 16
+
+        name = fields[0]
+        layout = fields[1]
+        block_width, block_height, block_depth = map(int, fields[2:5])
+        colorspace = fields[10]
+
+        le_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[9]]
+        le_channels = _parse_channels(fields[5:9], layout, colorspace, le_swizzles)
+
+        be_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[15]]
+        be_channels = _parse_channels(fields[11:15], layout, colorspace, be_swizzles)
+
+        le_shift = 0
+        for channel in le_channels:
+            channel.shift = le_shift
+            le_shift += channel.size
+
+        for i in range(4):
+            assert (le_swizzles[i] != SWIZZLE_NONE) == (be_swizzles[i] != SWIZZLE_NONE)
+
+        format = Format(name, layout, block_width, block_height, block_depth, le_channels, le_swizzles, be_channels, be_swizzles, colorspace)
+
+        if format.is_array() and not format.is_bitmask():
+            # Formats accessed as arrays by the pack functions (R32G32_FLOAT or
+            # R8G8B8_UNORM, for example) should not be channel-ordering-reversed
+            # for BE.
+            # Note that __eq__ on channels ignores .shift!
+            assert(format.be_channels == format.le_channels)
+            assert(format.be_swizzles == format.le_swizzles)
+            format.be_channels = format.le_channels
+        else:
+            be_shift = 0
+            for channel in format.be_channels[3::-1]:
+                channel.shift = be_shift
+                be_shift += channel.size
+
+            assert le_shift == be_shift
+
+        formats.append(format)
+    return formats
+
diff --git a/src/util/format/u_format_rgtc.c b/src/util/format/u_format_rgtc.c
new file mode 100644 (file)
index 0000000..a663b8a
--- /dev/null
@@ -0,0 +1,448 @@
+/**************************************************************************
+ *
+ * Copyright (C) 2011 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include <stdio.h>
+#include "util/format/u_format.h"
+#include "util/format/u_format_rgtc.h"
+#include "util/u_math.h"
+#include "util/rgtc.h"
+
+void
+util_format_rgtc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
+   dst[1] = 0;
+   dst[2] = 0;
+   dst[3] = 255;
+}
+
+void
+util_format_rgtc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   const unsigned bw = 4, bh = 4, comps = 4;
+   unsigned x, y, i, j;
+   unsigned block_size = 8;
+
+   for(y = 0; y < height; y += bh) {
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += bw) {
+         for(j = 0; j < bh; ++j) {
+            for(i = 0; i < bw; ++i) {
+               uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
+              util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
+              dst[1] = 0;
+              dst[2] = 0;
+              dst[3] = 255;
+           }
+        }
+        src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, 
+                                        unsigned src_stride, unsigned width, unsigned height)
+{
+   const unsigned bw = 4, bh = 4, bytes_per_block = 8;
+   unsigned x, y, i, j;
+
+   for(y = 0; y < height; y += bh) {
+      uint8_t *dst = dst_row;
+      for(x = 0; x < width; x += bw) {
+         uint8_t tmp[4][4];  /* [bh][bw][comps] */
+         for(j = 0; j < bh; ++j) {
+            for(i = 0; i < bw; ++i) {
+              tmp[j][i] = src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4];
+            }
+         }
+         util_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
+         dst += bytes_per_block;
+      }
+      dst_row += dst_stride / sizeof(*dst_row);
+   }
+}
+
+void
+util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   unsigned x, y, i, j;
+   int block_size = 8;
+   for(y = 0; y < height; y += 4) {
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += 4) {
+         for(j = 0; j < 4; ++j) {
+            for(i = 0; i < 4; ++i) {
+               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               uint8_t tmp_r;
+               util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+               dst[0] = ubyte_to_float(tmp_r);
+               dst[1] = 0.0;
+               dst[2] = 0.0;
+               dst[3] = 1.0;
+            }
+         }
+         src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   const unsigned bw = 4, bh = 4, bytes_per_block = 8;
+   unsigned x, y, i, j;
+
+   for(y = 0; y < height; y += bh) {
+      uint8_t *dst = dst_row;
+      for(x = 0; x < width; x += bw) {
+         uint8_t tmp[4][4];  /* [bh][bw][comps] */
+         for(j = 0; j < bh; ++j) {
+            for(i = 0; i < bw; ++i) {
+              tmp[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
+            }
+         }
+         util_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
+         dst += bytes_per_block;
+      }
+      dst_row += dst_stride / sizeof(*dst_row);
+   }
+}
+
+void
+util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp_r;
+   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+   dst[0] = ubyte_to_float(tmp_r);
+   dst[1] = 0.0;
+   dst[2] = 0.0;
+   dst[3] = 1.0;
+}
+
+void
+util_format_rgtc1_snorm_fetch_rgba_8unorm(UNUSED uint8_t *dst, UNUSED const uint8_t *src,
+                                          UNUSED unsigned i, UNUSED unsigned j)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_rgtc1_snorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                           UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                           UNUSED unsigned width, UNUSED unsigned height)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_rgtc1_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                         UNUSED unsigned width, UNUSED unsigned height)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   const unsigned bw = 4, bh = 4, bytes_per_block = 8;
+   unsigned x, y, i, j;
+
+   for(y = 0; y < height; y += bh) {
+      int8_t *dst = (int8_t *)dst_row;
+      for(x = 0; x < width; x += bw) {
+         int8_t tmp[4][4];  /* [bh][bw][comps] */
+         for(j = 0; j < bh; ++j) {
+            for(i = 0; i < bw; ++i) {
+              tmp[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
+            }
+         }
+         util_format_signed_encode_rgtc_ubyte(dst, tmp, 4, 4);
+         dst += bytes_per_block;
+      }
+      dst_row += dst_stride / sizeof(*dst_row);
+   }
+}
+
+void
+util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   unsigned x, y, i, j;
+   int block_size = 8;
+   for(y = 0; y < height; y += 4) {
+      const int8_t *src = (int8_t *)src_row;
+      for(x = 0; x < width; x += 4) {
+         for(j = 0; j < 4; ++j) {
+            for(i = 0; i < 4; ++i) {
+               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               int8_t tmp_r;
+               util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
+               dst[0] = byte_to_float_tex(tmp_r);
+               dst[1] = 0.0;
+               dst[2] = 0.0;
+               dst[3] = 1.0;
+            }
+         }
+         src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   int8_t tmp_r;
+   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
+   dst[0] = byte_to_float_tex(tmp_r);
+   dst[1] = 0.0;
+   dst[2] = 0.0;
+   dst[3] = 1.0;
+}
+
+
+void
+util_format_rgtc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
+   util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2);
+   dst[2] = 0;
+   dst[3] = 255;
+}
+
+void
+util_format_rgtc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   const unsigned bw = 4, bh = 4, comps = 4;
+   unsigned x, y, i, j;
+   unsigned block_size = 16;
+
+   for(y = 0; y < height; y += bh) {
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += bw) {
+         for(j = 0; j < bh; ++j) {
+            for(i = 0; i < bw; ++i) {
+               uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
+              util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
+              util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2);
+              dst[2] = 0;
+              dst[3] = 255;
+           }
+        }
+        src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   const unsigned bw = 4, bh = 4, bytes_per_block = 16;
+   unsigned x, y, i, j;
+
+   for(y = 0; y < height; y += bh) {
+      uint8_t *dst = dst_row;
+      for(x = 0; x < width; x += bw) {
+         uint8_t tmp_r[4][4];  /* [bh][bw] */
+         uint8_t tmp_g[4][4];  /* [bh][bw] */
+         for(j = 0; j < bh; ++j) {
+            for(i = 0; i < bw; ++i) {
+              tmp_r[j][i] = src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4];
+              tmp_g[j][i] = src_row[((y + j)*src_stride/sizeof(*src_row) + (x + i)*4) + 1];
+            }
+         }
+         util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
+         util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
+         dst += bytes_per_block;
+      }
+      dst_row += dst_stride / sizeof(*dst_row);
+   }
+}
+
+void
+util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off)
+{
+   const unsigned bw = 4, bh = 4, bytes_per_block = 16;
+   unsigned x, y, i, j;
+
+   for(y = 0; y < height; y += bh) {
+      uint8_t *dst = dst_row;
+      for(x = 0; x < width; x += bw) {
+         uint8_t tmp_r[4][4];  /* [bh][bw][comps] */
+         uint8_t tmp_g[4][4];  /* [bh][bw][comps] */
+         for(j = 0; j < bh; ++j) {
+            for(i = 0; i < bw; ++i) {
+              tmp_r[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
+               tmp_g[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
+            }
+         }
+         util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
+         util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
+         dst += bytes_per_block;
+      }
+      dst_row += dst_stride / sizeof(*dst_row);
+   }
+}
+
+void
+util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_rxtc2_unorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height, 1);
+}
+
+void
+util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   unsigned x, y, i, j;
+   int block_size = 16;
+   for(y = 0; y < height; y += 4) {
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += 4) {
+         for(j = 0; j < 4; ++j) {
+            for(i = 0; i < 4; ++i) {
+               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               uint8_t tmp_r, tmp_g;
+               util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+               util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+               dst[0] = ubyte_to_float(tmp_r);
+               dst[1] = ubyte_to_float(tmp_g);
+               dst[2] = 0.0;
+               dst[3] = 1.0;
+            }
+         }
+         src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp_r, tmp_g;
+   util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+   util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+   dst[0] = ubyte_to_float(tmp_r);
+   dst[1] = ubyte_to_float(tmp_g);
+   dst[2] = 0.0;
+   dst[3] = 1.0;
+}
+
+
+void
+util_format_rgtc2_snorm_fetch_rgba_8unorm(UNUSED uint8_t *dst, UNUSED const uint8_t *src,
+                                          UNUSED unsigned i, UNUSED unsigned j)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_rgtc2_snorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                           UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                           UNUSED unsigned width, UNUSED unsigned height)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_rgtc2_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                         UNUSED unsigned width, UNUSED unsigned height)
+{
+   fprintf(stderr,"%s\n", __func__);
+}
+
+void
+util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   unsigned x, y, i, j;
+   int block_size = 16;
+   for(y = 0; y < height; y += 4) {
+      const int8_t *src = (int8_t *)src_row;
+      for(x = 0; x < width; x += 4) {
+         for(j = 0; j < 4; ++j) {
+            for(i = 0; i < 4; ++i) {
+               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               int8_t tmp_r, tmp_g;
+               util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
+               util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
+               dst[0] = byte_to_float_tex(tmp_r);
+               dst[1] = byte_to_float_tex(tmp_g);
+               dst[2] = 0.0;
+               dst[3] = 1.0;
+            }
+         }
+         src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off)
+{
+   const unsigned bw = 4, bh = 4, bytes_per_block = 16;
+   unsigned x, y, i, j;
+
+   for(y = 0; y < height; y += bh) {
+      int8_t *dst = (int8_t *)dst_row;
+      for(x = 0; x < width; x += bw) {
+         int8_t tmp_r[4][4];  /* [bh][bw][comps] */
+         int8_t tmp_g[4][4];  /* [bh][bw][comps] */
+         for(j = 0; j < bh; ++j) {
+            for(i = 0; i < bw; ++i) {
+              tmp_r[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
+               tmp_g[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
+            }
+         }
+         util_format_signed_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
+         util_format_signed_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
+         dst += bytes_per_block;
+      }
+      dst_row += dst_stride / sizeof(*dst_row);
+   }
+}
+
+void
+util_format_rgtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_rxtc2_snorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height, 1);
+}
+
+void
+util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   int8_t tmp_r, tmp_g;
+   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
+   util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
+   dst[0] = byte_to_float_tex(tmp_r);
+   dst[1] = byte_to_float_tex(tmp_g);
+   dst[2] = 0.0;
+   dst[3] = 1.0;
+}
+
diff --git a/src/util/format/u_format_rgtc.h b/src/util/format/u_format_rgtc.h
new file mode 100644 (file)
index 0000000..67ac472
--- /dev/null
@@ -0,0 +1,114 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Red Hat Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+#ifndef U_FORMAT_RGTC_H_
+#define U_FORMAT_RGTC_H_
+
+void
+util_format_rgtc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_rgtc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+
+void
+util_format_rgtc1_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_rgtc1_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc1_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+void
+util_format_rgtc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_rgtc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off);
+
+void
+util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+void
+util_format_rgtc2_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_rgtc2_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off);
+
+void
+util_format_rgtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+#endif
diff --git a/src/util/format/u_format_s3tc.c b/src/util/format/u_format_s3tc.c
new file mode 100644 (file)
index 0000000..4980398
--- /dev/null
@@ -0,0 +1,673 @@
+/**************************************************************************
+ *
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "util/format/u_format.h"
+#include "util/format/u_format_s3tc.h"
+#include "util/format_srgb.h"
+#include "util/u_math.h"
+#include "../../mesa/main/texcompress_s3tc_tmp.h"
+
+
+util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgb_dxt1;
+util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1;
+util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3;
+util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;
+
+util_format_dxtn_pack_t util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;
+
+
+/*
+ * Pixel fetch.
+ */
+
+void
+util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   util_format_dxt1_rgb_fetch(0, src, i, j, dst);
+}
+
+void
+util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   util_format_dxt1_rgba_fetch(0, src, i, j, dst);
+}
+
+void
+util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   util_format_dxt3_rgba_fetch(0, src, i, j, dst);
+}
+
+void
+util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   util_format_dxt5_rgba_fetch(0, src, i, j, dst);
+}
+
+void
+util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
+   dst[0] = ubyte_to_float(tmp[0]);
+   dst[1] = ubyte_to_float(tmp[1]);
+   dst[2] = ubyte_to_float(tmp[2]);
+   dst[3] = 1.0;
+}
+
+void
+util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
+   dst[0] = ubyte_to_float(tmp[0]);
+   dst[1] = ubyte_to_float(tmp[1]);
+   dst[2] = ubyte_to_float(tmp[2]);
+   dst[3] = ubyte_to_float(tmp[3]);
+}
+
+void
+util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
+   dst[0] = ubyte_to_float(tmp[0]);
+   dst[1] = ubyte_to_float(tmp[1]);
+   dst[2] = ubyte_to_float(tmp[2]);
+   dst[3] = ubyte_to_float(tmp[3]);
+}
+
+void
+util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
+   dst[0] = ubyte_to_float(tmp[0]);
+   dst[1] = ubyte_to_float(tmp[1]);
+   dst[2] = ubyte_to_float(tmp[2]);
+   dst[3] = ubyte_to_float(tmp[3]);
+}
+
+
+/*
+ * Block decompression.
+ */
+
+static inline void
+util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height,
+                                        util_format_dxtn_fetch_t fetch,
+                                        unsigned block_size, boolean srgb)
+{
+   const unsigned bw = 4, bh = 4, comps = 4;
+   unsigned x, y, i, j;
+   for(y = 0; y < height; y += bh) {
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += bw) {
+         for(j = 0; j < bh; ++j) {
+            for(i = 0; i < bw; ++i) {
+               uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
+               fetch(0, src, i, j, dst);
+               if (srgb) {
+                  dst[0] = util_format_srgb_to_linear_8unorm(dst[0]);
+                  dst[1] = util_format_srgb_to_linear_8unorm(dst[1]);
+                  dst[2] = util_format_srgb_to_linear_8unorm(dst[2]);
+               }
+            }
+         }
+         src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
+                                           src_row, src_stride,
+                                           width, height,
+                                           util_format_dxt1_rgb_fetch,
+                                           8, FALSE);
+}
+
+void
+util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
+                                           src_row, src_stride,
+                                           width, height,
+                                           util_format_dxt1_rgba_fetch,
+                                           8, FALSE);
+}
+
+void
+util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
+                                           src_row, src_stride,
+                                           width, height,
+                                           util_format_dxt3_rgba_fetch,
+                                           16, FALSE);
+}
+
+void
+util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
+                                           src_row, src_stride,
+                                           width, height,
+                                           util_format_dxt5_rgba_fetch,
+                                           16, FALSE);
+}
+
+static inline void
+util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height,
+                                       util_format_dxtn_fetch_t fetch,
+                                       unsigned block_size, boolean srgb)
+{
+   unsigned x, y, i, j;
+   for(y = 0; y < height; y += 4) {
+      const uint8_t *src = src_row;
+      for(x = 0; x < width; x += 4) {
+         for(j = 0; j < 4; ++j) {
+            for(i = 0; i < 4; ++i) {
+               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               uint8_t tmp[4];
+               fetch(0, src, i, j, tmp);
+               if (srgb) {
+                  dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
+                  dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
+                  dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
+               }
+               else {
+                  dst[0] = ubyte_to_float(tmp[0]);
+                  dst[1] = ubyte_to_float(tmp[1]);
+                  dst[2] = ubyte_to_float(tmp[2]);
+               }
+               dst[3] = ubyte_to_float(tmp[3]);
+            }
+         }
+         src += block_size;
+      }
+      src_row += src_stride;
+   }
+}
+
+void
+util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
+                                          src_row, src_stride,
+                                          width, height,
+                                          util_format_dxt1_rgb_fetch,
+                                          8, FALSE);
+}
+
+void
+util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
+                                          src_row, src_stride,
+                                          width, height,
+                                          util_format_dxt1_rgba_fetch,
+                                          8, FALSE);
+}
+
+void
+util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
+                                          src_row, src_stride,
+                                          width, height,
+                                          util_format_dxt3_rgba_fetch,
+                                          16, FALSE);
+}
+
+void
+util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
+                                          src_row, src_stride,
+                                          width, height,
+                                          util_format_dxt5_rgba_fetch,
+                                          16, FALSE);
+}
+
+
+/*
+ * Block compression.
+ */
+
+static inline void
+util_format_dxtn_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                  const uint8_t *src, unsigned src_stride,
+                                  unsigned width, unsigned height,
+                                  enum util_format_dxtn format,
+                                  unsigned block_size, boolean srgb)
+{
+   const unsigned bw = 4, bh = 4, comps = 4;
+   unsigned x, y, i, j, k;
+   for(y = 0; y < height; y += bh) {
+      uint8_t *dst = dst_row;
+      for(x = 0; x < width; x += bw) {
+         uint8_t tmp[4][4][4];  /* [bh][bw][comps] */
+         for(j = 0; j < bh; ++j) {
+            for(i = 0; i < bw; ++i) {
+               uint8_t src_tmp;
+               for(k = 0; k < 3; ++k) {
+                  src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + k];
+                  if (srgb) {
+                     tmp[j][i][k] = util_format_linear_to_srgb_8unorm(src_tmp);
+                  }
+                  else {
+                     tmp[j][i][k] = src_tmp;
+                  }
+               }
+               /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
+               tmp[j][i][3] = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + 3];
+            }
+         }
+         /* even for dxt1_rgb have 4 src comps */
+         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
+         dst += block_size;
+      }
+      dst_row += dst_stride / sizeof(*dst_row);
+   }
+
+}
+
+void
+util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                      const uint8_t *src, unsigned src_stride,
+                                      unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
+                                     width, height, UTIL_FORMAT_DXT1_RGB,
+                                     8, FALSE);
+}
+
+void
+util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
+                                     width, height, UTIL_FORMAT_DXT1_RGBA,
+                                     8, FALSE);
+}
+
+void
+util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
+                                     width, height, UTIL_FORMAT_DXT3_RGBA,
+                                     16, FALSE);
+}
+
+void
+util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
+                                     width, height, UTIL_FORMAT_DXT5_RGBA,
+                                     16, FALSE);
+}
+
+static inline void
+util_format_dxtn_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                 const float *src, unsigned src_stride,
+                                 unsigned width, unsigned height,
+                                 enum util_format_dxtn format,
+                                 unsigned block_size, boolean srgb)
+{
+   unsigned x, y, i, j, k;
+   for(y = 0; y < height; y += 4) {
+      uint8_t *dst = dst_row;
+      for(x = 0; x < width; x += 4) {
+         uint8_t tmp[4][4][4];
+         for(j = 0; j < 4; ++j) {
+            for(i = 0; i < 4; ++i) {
+               float src_tmp;
+               for(k = 0; k < 3; ++k) {
+                  src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k];
+                  if (srgb) {
+                     tmp[j][i][k] = util_format_linear_float_to_srgb_8unorm(src_tmp);
+                  }
+                  else {
+                     tmp[j][i][k] = float_to_ubyte(src_tmp);
+                  }
+               }
+               /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
+               src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + 3];
+               tmp[j][i][3] = float_to_ubyte(src_tmp);
+            }
+         }
+         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
+         dst += block_size;
+      }
+      dst_row += 4*dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                     const float *src, unsigned src_stride,
+                                     unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
+                                    width, height, UTIL_FORMAT_DXT1_RGB,
+                                    8, FALSE);
+}
+
+void
+util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                      const float *src, unsigned src_stride,
+                                      unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
+                                    width, height, UTIL_FORMAT_DXT1_RGBA,
+                                    8, FALSE);
+}
+
+void
+util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                      const float *src, unsigned src_stride,
+                                      unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
+                                    width, height, UTIL_FORMAT_DXT3_RGBA,
+                                    16, FALSE);
+}
+
+void
+util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                      const float *src, unsigned src_stride,
+                                      unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
+                                    width, height, UTIL_FORMAT_DXT5_RGBA,
+                                    16, FALSE);
+}
+
+
+/*
+ * SRGB variants.
+ */
+
+void
+util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
+   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
+   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
+   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
+   dst[3] = 255;
+}
+
+void
+util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
+   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
+   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
+   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
+   dst[3] = tmp[3];
+}
+
+void
+util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
+   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
+   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
+   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
+   dst[3] = tmp[3];
+}
+
+void
+util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
+   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
+   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
+   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
+   dst[3] = tmp[3];
+}
+
+void
+util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
+   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
+   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
+   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
+   dst[3] = 1.0f;
+}
+
+void
+util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
+   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
+   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
+   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
+   dst[3] = ubyte_to_float(tmp[3]);
+}
+
+void
+util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
+   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
+   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
+   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
+   dst[3] = ubyte_to_float(tmp[3]);
+}
+
+void
+util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+   uint8_t tmp[4];
+   util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
+   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
+   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
+   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
+   dst[3] = ubyte_to_float(tmp[3]);
+}
+
+void
+util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
+                                           src_row, src_stride,
+                                           width, height,
+                                           util_format_dxt1_rgb_fetch,
+                                           8, TRUE);
+}
+
+void
+util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
+                                           src_row, src_stride,
+                                           width, height,
+                                           util_format_dxt1_rgba_fetch,
+                                           8, TRUE);
+}
+
+void
+util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
+                                           src_row, src_stride,
+                                           width, height,
+                                           util_format_dxt3_rgba_fetch,
+                                           16, TRUE);
+}
+
+void
+util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
+                                           src_row, src_stride,
+                                           width, height,
+                                           util_format_dxt5_rgba_fetch,
+                                           16, TRUE);
+}
+
+void
+util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
+                                          src_row, src_stride,
+                                          width, height,
+                                          util_format_dxt1_rgb_fetch,
+                                          8, TRUE);
+}
+
+void
+util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
+                                          src_row, src_stride,
+                                          width, height,
+                                          util_format_dxt1_rgba_fetch,
+                                          8, TRUE);
+}
+
+void
+util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
+                                          src_row, src_stride,
+                                          width, height,
+                                          util_format_dxt3_rgba_fetch,
+                                          16, TRUE);
+}
+
+void
+util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
+                                          src_row, src_stride,
+                                          width, height,
+                                          util_format_dxt5_rgba_fetch,
+                                          16, TRUE);
+}
+
+void
+util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
+                                     width, height, UTIL_FORMAT_DXT1_RGB,
+                                     8, TRUE);
+}
+
+void
+util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
+                                     width, height, UTIL_FORMAT_DXT1_RGBA,
+                                     8, TRUE);
+}
+
+void
+util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
+                                     width, height, UTIL_FORMAT_DXT3_RGBA,
+                                     16, TRUE);
+}
+
+void
+util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
+                                     width, height, UTIL_FORMAT_DXT5_RGBA,
+                                     16, TRUE);
+}
+
+void
+util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
+                                    width, height, UTIL_FORMAT_DXT1_RGB,
+                                    8, TRUE);
+}
+
+void
+util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
+                                    width, height, UTIL_FORMAT_DXT1_RGBA,
+                                    8, TRUE);
+}
+
+void
+util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
+                                    width, height, UTIL_FORMAT_DXT3_RGBA,
+                                    16, TRUE);
+}
+
+void
+util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
+                                    width, height, UTIL_FORMAT_DXT5_RGBA,
+                                    16, TRUE);
+}
+
diff --git a/src/util/format/u_format_s3tc.h b/src/util/format/u_format_s3tc.h
new file mode 100644 (file)
index 0000000..6f188c6
--- /dev/null
@@ -0,0 +1,218 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#ifndef U_FORMAT_S3TC_H_
+#define U_FORMAT_S3TC_H_
+
+
+#include "pipe/p_compiler.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum util_format_dxtn {
+  UTIL_FORMAT_DXT1_RGB = 0x83F0,
+  UTIL_FORMAT_DXT1_RGBA = 0x83F1,
+  UTIL_FORMAT_DXT3_RGBA = 0x83F2,
+  UTIL_FORMAT_DXT5_RGBA = 0x83F3
+};
+
+
+typedef void
+(*util_format_dxtn_fetch_t)( int src_stride,
+                             const uint8_t *src,
+                             int col, int row,
+                             uint8_t *dst );
+
+typedef void
+(*util_format_dxtn_pack_t)( int src_comps,
+                            int width, int height,
+                            const uint8_t *src,
+                            enum util_format_dxtn dst_format,
+                            uint8_t *dst,
+                            int dst_stride);
+
+extern util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch;
+extern util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch;
+extern util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch;
+extern util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch;
+
+extern util_format_dxtn_pack_t util_format_dxtn_pack;
+
+
+void
+util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+void
+util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* U_FORMAT_S3TC_H_ */
diff --git a/src/util/format/u_format_table.py b/src/util/format/u_format_table.py
new file mode 100644 (file)
index 0000000..2bc82c3
--- /dev/null
@@ -0,0 +1,233 @@
+from __future__ import print_function
+
+CopyRight = '''
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+'''
+
+
+import sys
+
+from u_format_parse import *
+import u_format_pack
+
+
+def layout_map(layout):
+    return 'UTIL_FORMAT_LAYOUT_' + str(layout).upper()
+
+
+def colorspace_map(colorspace):
+    return 'UTIL_FORMAT_COLORSPACE_' + str(colorspace).upper()
+
+
+colorspace_channels_map = {
+    'rgb': ['r', 'g', 'b', 'a'],
+    'srgb': ['sr', 'sg', 'sb', 'a'],
+    'zs': ['z', 's'],
+    'yuv': ['y', 'u', 'v'],
+}
+
+
+type_map = {
+    VOID:     "UTIL_FORMAT_TYPE_VOID",
+    UNSIGNED: "UTIL_FORMAT_TYPE_UNSIGNED",
+    SIGNED:   "UTIL_FORMAT_TYPE_SIGNED",
+    FIXED:    "UTIL_FORMAT_TYPE_FIXED",
+    FLOAT:    "UTIL_FORMAT_TYPE_FLOAT",
+}
+
+
+def bool_map(value):
+    if value:
+        return "TRUE"
+    else:
+        return "FALSE"
+
+
+swizzle_map = {
+    SWIZZLE_X:    "PIPE_SWIZZLE_X",
+    SWIZZLE_Y:    "PIPE_SWIZZLE_Y",
+    SWIZZLE_Z:    "PIPE_SWIZZLE_Z",
+    SWIZZLE_W:    "PIPE_SWIZZLE_W",
+    SWIZZLE_0:    "PIPE_SWIZZLE_0",
+    SWIZZLE_1:    "PIPE_SWIZZLE_1",
+    SWIZZLE_NONE: "PIPE_SWIZZLE_NONE",
+}
+
+
+def write_format_table(formats):
+    print('/* This file is autogenerated by u_format_table.py from u_format.csv. Do not edit directly. */')
+    print()
+    # This will print the copyright message on the top of this file
+    print(CopyRight.strip())
+    print()
+    print('#include "u_format.h"')
+    print('#include "u_format_bptc.h"')
+    print('#include "u_format_s3tc.h"')
+    print('#include "u_format_rgtc.h"')
+    print('#include "u_format_latc.h"')
+    print('#include "u_format_etc.h"')
+    print()
+    
+    u_format_pack.generate(formats)
+    
+    def do_channel_array(channels, swizzles):
+        print("   {")
+        for i in range(4):
+            channel = channels[i]
+            if i < 3:
+                sep = ","
+            else:
+                sep = ""
+            if channel.size:
+                print("      {%s, %s, %s, %u, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), channel.size, channel.shift, sep, "xyzw"[i], channel.name))
+            else:
+                print("      {0, 0, 0, 0, 0}%s" % (sep,))
+        print("   },")
+
+    def do_swizzle_array(channels, swizzles):
+        print("   {")
+        for i in range(4):
+            swizzle = swizzles[i]
+            if i < 3:
+                sep = ","
+            else:
+                sep = ""
+            try:
+                comment = colorspace_channels_map[format.colorspace][i]
+            except (KeyError, IndexError):
+                comment = 'ignored'
+            print("      %s%s\t/* %s */" % (swizzle_map[swizzle], sep, comment))
+        print("   },")
+
+    for format in formats:
+        print('const struct util_format_description')
+        print('util_format_%s_description = {' % (format.short_name(),))
+        print("   %s," % (format.name,))
+        print("   \"%s\"," % (format.name,))
+        print("   \"%s\"," % (format.short_name(),))
+        print("   {%u, %u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_depth, format.block_size()))
+        print("   %s," % (layout_map(format.layout),))
+        print("   %u,\t/* nr_channels */" % (format.nr_channels(),))
+        print("   %s,\t/* is_array */" % (bool_map(format.is_array()),))
+        print("   %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),))
+        print("   %s,\t/* is_mixed */" % (bool_map(format.is_mixed()),))
+        print("   %s,\t/* is_unorm */" % (bool_map(format.is_unorm()),))
+        print("   %s,\t/* is_snorm */" % (bool_map(format.is_snorm()),))
+        u_format_pack.print_channels(format, do_channel_array)
+        u_format_pack.print_channels(format, do_swizzle_array)
+        print("   %s," % (colorspace_map(format.colorspace),))
+        access = True
+        if format.layout in ('astc', 'atc', 'fxt1'):
+            access = False
+        if format.layout == 'etc' and format.short_name() != 'etc1_rgb8':
+            access = False
+        if format.colorspace != ZS and not format.is_pure_color() and access:
+            print("   &util_format_%s_unpack_rgba_8unorm," % format.short_name())
+            print("   &util_format_%s_pack_rgba_8unorm," % format.short_name())
+            if format.layout == 's3tc' or format.layout == 'rgtc':
+                print("   &util_format_%s_fetch_rgba_8unorm," % format.short_name())
+            else:
+                print("   NULL, /* fetch_rgba_8unorm */")
+            print("   &util_format_%s_unpack_rgba_float," % format.short_name())
+            print("   &util_format_%s_pack_rgba_float," % format.short_name())
+            print("   &util_format_%s_fetch_rgba_float," % format.short_name())
+        else:
+            print("   NULL, /* unpack_rgba_8unorm */")
+            print("   NULL, /* pack_rgba_8unorm */")
+            print("   NULL, /* fetch_rgba_8unorm */")
+            print("   NULL, /* unpack_rgba_float */")
+            print("   NULL, /* pack_rgba_float */")
+            print("   NULL, /* fetch_rgba_float */")
+        if format.has_depth():
+            print("   &util_format_%s_unpack_z_32unorm," % format.short_name())
+            print("   &util_format_%s_pack_z_32unorm," % format.short_name())
+            print("   &util_format_%s_unpack_z_float," % format.short_name())
+            print("   &util_format_%s_pack_z_float," % format.short_name())
+        else:
+            print("   NULL, /* unpack_z_32unorm */")
+            print("   NULL, /* pack_z_32unorm */")
+            print("   NULL, /* unpack_z_float */")
+            print("   NULL, /* pack_z_float */")
+        if format.has_stencil():
+            print("   &util_format_%s_unpack_s_8uint," % format.short_name())
+            print("   &util_format_%s_pack_s_8uint," % format.short_name())
+        else:
+            print("   NULL, /* unpack_s_8uint */")
+            print("   NULL, /* pack_s_8uint */")
+        if format.is_pure_unsigned():
+            print("   &util_format_%s_unpack_unsigned, /* unpack_rgba_uint */" % format.short_name())
+            print("   &util_format_%s_pack_unsigned, /* pack_rgba_uint */" % format.short_name())
+            print("   &util_format_%s_unpack_signed, /* unpack_rgba_sint */" % format.short_name())
+            print("   &util_format_%s_pack_signed,  /* pack_rgba_sint */" % format.short_name())
+            print("   &util_format_%s_fetch_unsigned,  /* fetch_rgba_uint */" % format.short_name())
+            print("   NULL  /* fetch_rgba_sint */")
+        elif format.is_pure_signed():
+            print("   &util_format_%s_unpack_unsigned, /* unpack_rgba_uint */" % format.short_name())
+            print("   &util_format_%s_pack_unsigned, /* pack_rgba_uint */" % format.short_name())
+            print("   &util_format_%s_unpack_signed, /* unpack_rgba_sint */" % format.short_name())
+            print("   &util_format_%s_pack_signed,  /* pack_rgba_sint */" % format.short_name())
+            print("   NULL,  /* fetch_rgba_uint */")
+            print("   &util_format_%s_fetch_signed  /* fetch_rgba_sint */" % format.short_name())
+        else:
+            print("   NULL, /* unpack_rgba_uint */")
+            print("   NULL, /* pack_rgba_uint */")
+            print("   NULL, /* unpack_rgba_sint */")
+            print("   NULL, /* pack_rgba_sint */")
+            print("   NULL, /* fetch_rgba_uint */")
+            print("   NULL  /* fetch_rgba_sint */")
+        print("};")
+        print()
+        
+    print("const struct util_format_description *")
+    print("util_format_description(enum pipe_format format)")
+    print("{")
+    print("   if (format >= PIPE_FORMAT_COUNT) {")
+    print("      return NULL;")
+    print("   }")
+    print()
+    print("   switch (format) {")
+    for format in formats:
+        print("   case %s:" % format.name)
+        print("      return &util_format_%s_description;" % (format.short_name(),))
+    print("   default:")
+    print("      return NULL;")
+    print("   }")
+    print("}")
+    print()
+
+
+def main():
+
+    formats = []
+    for arg in sys.argv[1:]:
+        formats.extend(parse(arg))
+    write_format_table(formats)
+
+
+if __name__ == '__main__':
+    main()
diff --git a/src/util/format/u_format_tests.c b/src/util/format/u_format_tests.c
new file mode 100644 (file)
index 0000000..0c34a82
--- /dev/null
@@ -0,0 +1,1034 @@
+/**************************************************************************
+ *
+ * Copyright 2009-2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include <math.h>
+#include <float.h>
+
+#include "pipe/p_config.h"
+#include "util/u_memory.h"
+#include "util/format/u_format_tests.h"
+
+
+/*
+ * Helper macros to create the packed bytes for longer words.
+ */
+
+#define PACKED_1x8(x)          {x, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_2x8(x, y)       {x, y, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_3x8(x, y, z)    {x, y, z, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_4x8(x, y, z, w) {x, y, z, w, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_8x8(a, b, c, d, e, f, g, h) {a, b, c, d, e, f, g, h, 0, 0, 0, 0, 0, 0, 0, 0}
+
+#define PACKED_1x16(x)          {(x) & 0xff, (x) >> 8,          0,        0,          0,        0,          0,        0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_2x16(x, y)       {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8,          0,        0,          0,        0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_3x16(x, y, z)    {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8,          0,        0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_4x16(x, y, z, w) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, (w) & 0xff, (w) >> 8, 0, 0, 0, 0, 0, 0, 0, 0}
+
+#define PACKED_1x32(x)          {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24,          0,                 0,                  0,         0,          0,                 0,                  0,         0,          0,                 0,                  0,         0}
+#define PACKED_2x32(x, y)       {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24,          0,                 0,                  0,         0,          0,                 0,                  0,         0}
+#define PACKED_3x32(x, y, z)    {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24,          0,                 0,                  0,         0}
+#define PACKED_4x32(x, y, z, w) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, (w) & 0xff, ((w) >> 8) & 0xff, ((w) >> 16) & 0xff, (w) >> 24}
+
+#define UNPACKED_1x1(r, g, b, a) \
+      {{{r, g, b, a}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
+       {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
+       {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
+       {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}}
+
+#define UNPACKED_2x1(r0, g0, b0, a0, r1, g1, b1, a1) \
+      {{{r0, g0, b0, a0}, {r1, g1, b1, a1}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
+       {{ 0,  0,  0,  0}, { 0,  0,  0,  0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
+       {{ 0,  0,  0,  0}, { 0,  0,  0,  0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
+       {{ 0,  0,  0,  0}, { 0,  0,  0,  0}, {0, 0, 0, 0}, {0, 0, 0, 0}}}
+
+
+/**
+ * Test cases.
+ *
+ * These were manually entered. We could generate these
+ *
+ * To keep this to a we cover only the corner cases, which should produce
+ * good enough coverage since that pixel format transformations are afine for
+ * non SRGB formats.
+ */
+const struct util_format_test_case
+util_format_test_cases[] =
+{
+
+   /*
+    * 32-bit rendertarget formats
+    */
+
+   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3fffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   /*
+    * 16-bit rendertarget formats
+    */
+
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x03e0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x7c00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x7fff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x03e0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0x003e), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0x07c0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0xf800), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0xfffe), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x003e), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x07c0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf800), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0001), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x000f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x00f0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x0f00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x0fff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00f0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0f00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x07e0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf800), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   /*
+    * Luminance/intensity/alpha formats
+    */
+
+   {PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x0f), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
+   {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xf0), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00ff), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
+   {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xff00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   /*
+    * SRGB formats
+    */
+
+   {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xbc), UNPACKED_1x1(0.502886458033, 0.502886458033, 0.502886458033, 1.0)},
+   {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xbc), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0x00bc), UNPACKED_1x1(0.502886458033, 0.502886458033, 0.502886458033, 0.0)},
+   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0x00ff), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
+   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0xcc00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
+   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0xff00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xbc, 0x00, 0x00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xbc, 0x00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xbc), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xbc, 0x00, 0x00, 0x00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xbc, 0x00, 0x00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xbc, 0x00), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xcc), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
+   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000bc), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xcc000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
+   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000bc), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000cc), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
+   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000cc), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
+   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   /*
+    * Mixed-signed formats
+    */
+
+   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x81, 0x00, 0x00, 0x00), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x81, 0x00, 0x00), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1( 0.0,  0.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0, 0.0)},
+   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000001ff), UNPACKED_1x1( 1.0,  0.0,  0.0, 0.0)},
+   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000201), UNPACKED_1x1(-1.0,  0.0,  0.0, 0.0)},
+   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0007fc00), UNPACKED_1x1( 0.0,  1.0,  0.0, 0.0)},
+   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00080400), UNPACKED_1x1( 0.0, -1.0,  0.0, 0.0)},
+   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x1ff00000), UNPACKED_1x1( 0.0,  0.0,  1.0, 0.0)},
+   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x20100000), UNPACKED_1x1( 0.0,  0.0, -1.0, 0.0)},
+   {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), UNPACKED_1x1( 0.0,  0.0,  0.0, 1.0)},
+
+   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0011), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x01e0), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0220), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1( 0.0,  0.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0,  0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x81, 0x00), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x81), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+
+   /*
+    * Depth-stencil formats
+    */
+
+   {PIPE_FORMAT_S8_UINT, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0,   0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_S8_UINT, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(0.0, 255.0, 0.0, 0.0)},
+
+   {PIPE_FORMAT_Z16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_Z16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+
+   {PIPE_FORMAT_Z32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_Z32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+
+   {PIPE_FORMAT_Z32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_Z32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x3f800000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+
+   {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0,   0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ffffff), UNPACKED_1x1(1.0,   0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 255.0, 0.0, 0.0)},
+   {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 255.0, 0.0, 0.0)},
+
+   {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0,   0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffff00), UNPACKED_1x1(1.0,   0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 255.0, 0.0, 0.0)},
+   {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 255.0, 0.0, 0.0)},
+
+   {PIPE_FORMAT_Z24X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_Z24X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+
+   {PIPE_FORMAT_X8Z24_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_X8Z24_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+
+   {PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, PACKED_2x32(0xffffffff, 0x000000ff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0,   0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, PACKED_2x32(0xffffffff, 0x000000ff), PACKED_2x32(0x3f800000, 0x00000000), UNPACKED_1x1( 1.0,   0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, PACKED_2x32(0xffffffff, 0x000000ff), PACKED_2x32(0x00000000, 0x000000ff), UNPACKED_1x1( 0.0, 255.0, 0.0, 0.0)},
+
+   /*
+    * YUV formats
+    */
+
+   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_2x1(1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_2x1(0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_2x1(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_2x1(1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_2x1(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
+
+   /*
+    * TODO: Exercise the UV channels as well.
+    */
+   {PIPE_FORMAT_UYVY, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x10, 0x80, 0x10), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_UYVY, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0xeb, 0x80, 0x10), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_UYVY, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x10, 0x80, 0xeb), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_YUYV, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x10, 0x80, 0x10, 0x80), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_YUYV, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xeb, 0x80, 0x10, 0x80), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_YUYV, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x10, 0x80, 0xeb, 0x80), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
+
+   /*
+    * Compressed formats
+    */
+
+   {
+      PIPE_FORMAT_DXT1_RGB,
+      PACKED_8x8(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
+      PACKED_8x8(0xf2, 0xd7, 0xb0, 0x20, 0xae, 0x2c, 0x6f, 0x97),
+      {
+         {
+            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
+            {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
+            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
+            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0}
+         },
+         {
+            {0xd6/255.0, 0xff/255.0, 0x94/255.0, 0xff/255.0},
+            {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
+            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
+            {0xd6/255.0, 0xff/255.0, 0x94/255.0, 0xff/255.0}
+         },
+         {
+            {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
+            {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
+            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
+            {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0}
+         },
+         {
+            {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
+            {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0},
+            {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0},
+            {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0}
+         }
+      }
+   },
+   {
+      PIPE_FORMAT_DXT1_RGBA,
+      PACKED_8x8(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
+      PACKED_8x8(0xff, 0x2f, 0xa4, 0x72, 0xeb, 0xb2, 0xbd, 0xbe),
+      {
+         {
+            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
+            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
+            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0}
+         },
+         {
+            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
+            {0x29/255.0, 0xff/255.0, 0xff/255.0, 0xff/255.0},
+            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
+         },
+         {
+            {0x73/255.0, 0x55/255.0, 0x21/255.0, 0xff/255.0},
+            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
+         },
+         {
+            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
+            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+            {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+            {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
+         }
+      }
+   },
+   {
+      PIPE_FORMAT_DXT3_RGBA,
+      {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+      {0xe7, 0x4a, 0x8f, 0x96, 0x5b, 0xc1, 0x1c, 0x84, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a},
+      {
+         {
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x77/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xee/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xaa/255.0},
+            {0x8c/255.0, 0xff/255.0, 0xb5/255.0, 0x44/255.0}
+         },
+         {
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xff/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x88/255.0},
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x66/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x99/255.0}
+         },
+         {
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0xbb/255.0},
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x55/255.0},
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x11/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xcc/255.0}
+         },
+         {
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xcc/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x11/255.0},
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x44/255.0},
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x88/255.0}
+         }
+      }
+   },
+   {
+      PIPE_FORMAT_DXT5_RGBA,
+      {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+      {0xf8, 0x11, 0xc5, 0x0c, 0x9a, 0x73, 0xb4, 0x9c, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a},
+      {
+         {
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x74/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xf8/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xb6/255.0},
+            {0x8c/255.0, 0xff/255.0, 0xb5/255.0, 0x53/255.0}
+         },
+         {
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xf8/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x95/255.0},
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x53/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x95/255.0}
+         },
+         {
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0xb6/255.0},
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x53/255.0},
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x11/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xd7/255.0}
+         },
+         {
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xb6/255.0},
+            {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x11/255.0},
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x32/255.0},
+            {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x95/255.0}
+         }
+      }
+   },
+
+
+   /*
+    * Standard 8-bit integer formats
+    */
+
+   {PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(  0.0,   0.0,   0.0, 1.0)},
+   {PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(255.0,   0.0,   0.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1(  0.0,   0.0,   0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), UNPACKED_1x1(255.0,   0.0,   0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), UNPACKED_1x1(  0.0, 255.0,   0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), UNPACKED_1x1(255.0, 255.0,   0.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(  0.0,   0.0,   0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(255.0,   0.0,   0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1(  0.0, 255.0,   0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1(  0.0,   0.0, 255.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(255.0, 255.0, 255.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(  0.0,   0.0,   0.0,   0.0)},
+   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(255.0,   0.0,   0.0,   0.0)},
+   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1(  0.0, 255.0,   0.0,   0.0)},
+   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1(  0.0,   0.0, 255.0,   0.0)},
+   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1(  0.0,   0.0,   0.0, 255.0)},
+   {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(255.0, 255.0, 255.0, 255.0)},
+
+   {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x7f), UNPACKED_1x1( 1.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x81), UNPACKED_1x1(-1.0,  0.0,  0.0,  1.0)},
+
+   {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 1.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x81, 0x00), UNPACKED_1x1(-1.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1( 0.0,  1.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x81), UNPACKED_1x1( 0.0, -1.0,  0.0,  1.0)},
+
+   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), UNPACKED_1x1( 1.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x81, 0x00, 0x00), UNPACKED_1x1(-1.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0,  1.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x81, 0x00), UNPACKED_1x1( 0.0, -1.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0,  0.0,  1.0,  1.0)},
+   {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x81), UNPACKED_1x1( 0.0,  0.0, -1.0,  1.0)},
+
+   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 1.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x81, 0x00, 0x00, 0x00), UNPACKED_1x1(-1.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1( 0.0,  1.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x81, 0x00, 0x00), UNPACKED_1x1( 0.0, -1.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0,  0.0,  1.0,  0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x81, 0x00), UNPACKED_1x1( 0.0,  0.0, -1.0,  0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x81), UNPACKED_1x1( 0.0,  0.0,  0.0, -1.0)},
+
+   {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(   0.0,    0.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x7f), UNPACKED_1x1( 127.0,    0.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x80), UNPACKED_1x1(-128.0,    0.0,    0.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1(   0.0,    0.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 127.0,    0.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x80, 0x00), UNPACKED_1x1(-128.0,    0.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1(   0.0,  127.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x80), UNPACKED_1x1(   0.0, -128.0,    0.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(   0.0,    0.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), UNPACKED_1x1( 127.0,    0.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x80, 0x00, 0x00), UNPACKED_1x1(-128.0,    0.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), UNPACKED_1x1(   0.0,  127.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x80, 0x00), UNPACKED_1x1(   0.0, -128.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), UNPACKED_1x1(   0.0,    0.0,  127.0, 1.0)},
+   {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x80), UNPACKED_1x1(   0.0,    0.0, -128.0, 1.0)},
+
+   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(   0.0,    0.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 127.0,    0.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x00, 0x00, 0x00), UNPACKED_1x1(-128.0,    0.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1(   0.0,  127.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x80, 0x00, 0x00), UNPACKED_1x1(   0.0, -128.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), UNPACKED_1x1(   0.0,    0.0,  127.0,    0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x80, 0x00), UNPACKED_1x1(   0.0,    0.0, -128.0,    0.0)},
+   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), UNPACKED_1x1(   0.0,    0.0,    0.0,  127.0)},
+   {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x80), UNPACKED_1x1(   0.0,    0.0,    0.0, -128.0)},
+
+   /*
+    * Standard 16-bit integer formats
+    */
+
+   {PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(    0.0,     0.0,     0.0,   1.0)},
+   {PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(65535.0,     0.0,     0.0,   1.0)},
+
+   {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1(    0.0,     0.0,     0.0,   1.0)},
+   {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), UNPACKED_1x1(65535.0,     0.0,     0.0,   1.0)},
+   {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), UNPACKED_1x1(    0.0, 65535.0,     0.0,   1.0)},
+   {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0,     0.0,   1.0)},
+
+   {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1(    0.0,     0.0,     0.0,   1.0)},
+   {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), UNPACKED_1x1(65535.0,     0.0,     0.0,   1.0)},
+   {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), UNPACKED_1x1(    0.0, 65535.0,     0.0,   1.0)},
+   {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), UNPACKED_1x1(    0.0,     0.0, 65535.0,   1.0)},
+   {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0, 65535.0,   1.0)},
+
+   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(    0.0,     0.0,     0.0,     0.0)},
+   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(65535.0,     0.0,     0.0,     0.0)},
+   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), UNPACKED_1x1(    0.0, 65535.0,     0.0,     0.0)},
+   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), UNPACKED_1x1(    0.0,     0.0, 65535.0,     0.0)},
+   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), UNPACKED_1x1(    0.0,     0.0,     0.0, 65535.0)},
+   {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0, 65535.0, 65535.0)},
+
+   {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8001), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
+
+   {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8001, 0x0000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), UNPACKED_1x1(   0.0,    1.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8001), UNPACKED_1x1(   0.0,   -1.0,    0.0,    1.0)},
+
+   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8001, 0x0000, 0x0000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), UNPACKED_1x1(   0.0,    1.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8001, 0x0000), UNPACKED_1x1(   0.0,   -1.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), UNPACKED_1x1(   0.0,    0.0,    1.0,    1.0)},
+   {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8001), UNPACKED_1x1(   0.0,    0.0,   -1.0,    1.0)},
+
+   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(   0.0,    0.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(   1.0,    0.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8001, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), UNPACKED_1x1(   0.0,    1.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8001, 0x0000, 0x0000), UNPACKED_1x1(   0.0,   -1.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), UNPACKED_1x1(   0.0,    0.0,    1.0,    0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8001, 0x0000), UNPACKED_1x1(   0.0,    0.0,   -1.0,    0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8001), UNPACKED_1x1(   0.0,    0.0,    0.0,   -1.0)},
+
+   {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(     0.0,      0.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1( 32767.0,      0.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x8000), UNPACKED_1x1(-32768.0,      0.0,      0.0,   1.0)},
+
+   {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1(     0.0,      0.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), UNPACKED_1x1( 32767.0,      0.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8000, 0x0000), UNPACKED_1x1(-32768.0,      0.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), UNPACKED_1x1(     0.0,  32767.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8000), UNPACKED_1x1(     0.0, -32768.0,      0.0,   1.0)},
+
+   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1(     0.0,      0.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), UNPACKED_1x1( 32767.0,      0.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8000, 0x0000, 0x0000), UNPACKED_1x1(-32768.0,      0.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), UNPACKED_1x1(     0.0,  32767.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8000, 0x0000), UNPACKED_1x1(     0.0, -32768.0,      0.0,   1.0)},
+   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), UNPACKED_1x1(     0.0,      0.0,  32767.0,   1.0)},
+   {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8000), UNPACKED_1x1(     0.0,      0.0, -32768.0,   1.0)},
+
+   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(     0.0,      0.0,      0.0,      0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 32767.0,      0.0,      0.0,      0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(-32768.0,      0.0,      0.0,      0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), UNPACKED_1x1(     0.0,  32767.0,      0.0,      0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8000, 0x0000, 0x0000), UNPACKED_1x1(     0.0, -32768.0,      0.0,      0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), UNPACKED_1x1(     0.0,      0.0,  32767.0,      0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8000, 0x0000), UNPACKED_1x1(     0.0,      0.0, -32768.0,      0.0)},
+   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), UNPACKED_1x1(     0.0,      0.0,      0.0,  32767.0)},
+   {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8000), UNPACKED_1x1(     0.0,      0.0,      0.0, -32768.0)},
+
+   /*
+    * Standard 32-bit integer formats
+    *
+    * NOTE: We can't accurately represent integers larger than +/-0x1000000
+    * with single precision floats, so that's as far as we test.
+    */
+
+   {PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0x00000000, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xffffffff, 0x00000000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xffffffff, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xffffffff, 0x00000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+   {PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(       0.0,        0.0,        0.0,   1.0)},
+   {PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), UNPACKED_1x1(16777216.0,        0.0,        0.0,   1.0)},
+
+   {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1(       0.0,        0.0,        0.0,   1.0)},
+   {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), UNPACKED_1x1(16777216.0,        0.0,        0.0,   1.0)},
+   {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), UNPACKED_1x1(       0.0, 16777216.0,        0.0,   1.0)},
+   {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0,        0.0,   1.0)},
+
+   {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(       0.0,        0.0,        0.0,   1.0)},
+   {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1(16777216.0,        0.0,        0.0,   1.0)},
+   {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1(       0.0, 16777216.0,        0.0,   1.0)},
+   {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1(       0.0,        0.0, 16777216.0,   1.0)},
+   {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0, 16777216.0,   1.0)},
+
+   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(       0.0,        0.0,        0.0,        0.0)},
+   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(16777216.0,        0.0,        0.0,        0.0)},
+   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1(       0.0, 16777216.0,        0.0,        0.0)},
+   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1(       0.0,        0.0, 16777216.0,        0.0)},
+   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1(       0.0,        0.0,        0.0, 16777216.0)},
+   {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x01000000, 0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0, 16777216.0, 16777216.0)},
+
+   {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x7fffffff), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x80000001), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
+
+   {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x7fffffff, 0x00000000), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x80000001, 0x00000000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x7fffffff), UNPACKED_1x1(   0.0,    1.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x80000001), UNPACKED_1x1(   0.0,   -1.0,    0.0,    1.0)},
+
+   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x7fffffff, 0x00000000, 0x00000000), UNPACKED_1x1(   1.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x80000001, 0x00000000, 0x00000000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x7fffffff, 0x00000000), UNPACKED_1x1(   0.0,    1.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x80000001, 0x00000000), UNPACKED_1x1(   0.0,   -1.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x7fffffff), UNPACKED_1x1(   0.0,    0.0,    1.0,    1.0)},
+   {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x80000001), UNPACKED_1x1(   0.0,    0.0,   -1.0,    1.0)},
+
+   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(   0.0,    0.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x7fffffff, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(   1.0,    0.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x80000001, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(  -1.0,    0.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x7fffffff, 0x00000000, 0x00000000), UNPACKED_1x1(   0.0,    1.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x80000001, 0x00000000, 0x00000000), UNPACKED_1x1(   0.0,   -1.0,    0.0,    0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x7fffffff, 0x00000000), UNPACKED_1x1(   0.0,    0.0,    1.0,    0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x80000001, 0x00000000), UNPACKED_1x1(   0.0,    0.0,   -1.0,    0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x7fffffff), UNPACKED_1x1(   0.0,    0.0,    0.0,    1.0)},
+   {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x80000001), UNPACKED_1x1(   0.0,    0.0,    0.0,   -1.0)},
+
+   {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(        0.0,         0.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), UNPACKED_1x1( 16777216.0,         0.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(-16777216.0,         0.0,         0.0,   1.0)},
+
+   {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1(        0.0,         0.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), UNPACKED_1x1( 16777216.0,         0.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xff000000, 0x00000000), UNPACKED_1x1(-16777216.0,         0.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), UNPACKED_1x1(        0.0,  16777216.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xff000000), UNPACKED_1x1(        0.0, -16777216.0,         0.0,   1.0)},
+
+   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(        0.0,         0.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1( 16777216.0,         0.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xff000000, 0x00000000, 0x00000000), UNPACKED_1x1(-16777216.0,         0.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1(        0.0,  16777216.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xff000000, 0x00000000), UNPACKED_1x1(        0.0, -16777216.0,         0.0,   1.0)},
+   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1(        0.0,         0.0,  16777216.0,   1.0)},
+   {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xff000000), UNPACKED_1x1(        0.0,         0.0, -16777216.0,   1.0)},
+
+   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(        0.0,         0.0,         0.0,         0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 16777216.0,         0.0,         0.0,         0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xff000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-16777216.0,         0.0,         0.0,         0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1(        0.0,  16777216.0,         0.0,         0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xff000000, 0x00000000, 0x00000000), UNPACKED_1x1(        0.0, -16777216.0,         0.0,         0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1(        0.0,         0.0,  16777216.0,         0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xff000000, 0x00000000), UNPACKED_1x1(        0.0,         0.0, -16777216.0,         0.0)},
+   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1(        0.0,         0.0,         0.0,  16777216.0)},
+   {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xff000000), UNPACKED_1x1(        0.0,         0.0,         0.0, -16777216.0)},
+
+   /*
+    * Standard 32-bit float formats
+    */
+
+   {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(  0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x3f800000), UNPACKED_1x1(  1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0xbf800000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x00000000), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xbf800000, 0x00000000), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x3f800000), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xbf800000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0,  1.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xbf800000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x3f800000, 0x00000000), UNPACKED_1x1( 0.0,  1.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xbf800000, 0x00000000), UNPACKED_1x1( 0.0, -1.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x3f800000), UNPACKED_1x1( 0.0,  0.0,  1.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xbf800000), UNPACKED_1x1( 0.0,  0.0, -1.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0,  1.0,  1.0, 1.0)},
+
+   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xbf800000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x3f800000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  1.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xbf800000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -1.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x3f800000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  1.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xbf800000, 0x00000000), UNPACKED_1x1( 0.0,  0.0, -1.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x3f800000), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xbf800000), UNPACKED_1x1( 0.0,  0.0,  0.0, -1.0)},
+   {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0,  1.0,  1.0,  1.0)},
+
+   /*
+    * Half float formats
+    */
+
+   /* Minimum positive normal */
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x0400), UNPACKED_1x1( 6.10352E-5, 0.0, 0.0, 1.0)},
+
+   /* XXX: Now that we disable denormals this test cases fails, except on
+    * IvyBridge processors which have intrinsics dedicated to half-float
+    * packing/unpacking. */
+#if 0
+   /* Max denormal */
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x03FF), UNPACKED_1x1( 6.09756E-5, 0.0, 0.0, 1.0)},
+#endif
+
+   /* Minimum positive denormal */
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x0001), UNPACKED_1x1( 5.96046E-8, 0.0, 0.0, 1.0)},
+
+   /* Min representable value */
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfbff), UNPACKED_1x1(   -65504.0, 0.0, 0.0, 1.0)},
+
+   /* Max representable value */
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7bff), UNPACKED_1x1(    65504.0, 0.0, 0.0, 1.0)},
+
+#if !defined(PIPE_CC_MSVC)
+
+   /* NaNs */
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c01), UNPACKED_1x1(        NAN, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc01), UNPACKED_1x1(       -NAN, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1(        NAN, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(       -NAN, 0.0, 0.0, 1.0)},
+
+   /* Inf */
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1(        INFINITY, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1(       -INFINITY, 0.0, 0.0, 1.0)},
+
+#endif
+
+   /* Zero, ignore sign */
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0x7fff), PACKED_1x16(0x8000), UNPACKED_1x1( -0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0x7fff), PACKED_1x16(0x0000), UNPACKED_1x1(  0.0, 0.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x3c00), UNPACKED_1x1(  1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xbc00), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1( 0.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x3c00, 0x0000), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xbc00, 0x0000), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x3c00), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xbc00), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x3c00, 0x3c00), UNPACKED_1x1( 1.0,  1.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x3c00, 0x0000, 0x0000), UNPACKED_1x1( 1.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xbc00, 0x0000, 0x0000), UNPACKED_1x1(-1.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x3c00, 0x0000), UNPACKED_1x1( 0.0,  1.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xbc00, 0x0000), UNPACKED_1x1( 0.0, -1.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x3c00), UNPACKED_1x1( 0.0,  0.0,  1.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xbc00), UNPACKED_1x1( 0.0,  0.0, -1.0, 1.0)},
+   {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x3c00, 0x3c00, 0x3c00), UNPACKED_1x1( 1.0,  1.0,  1.0, 1.0)},
+
+   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x3c00, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 1.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xbc00, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(-1.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x3c00, 0x0000, 0x0000), UNPACKED_1x1( 0.0,  1.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xbc00, 0x0000, 0x0000), UNPACKED_1x1( 0.0, -1.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x3c00, 0x0000), UNPACKED_1x1( 0.0,  0.0,  1.0,  0.0)},
+   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xbc00, 0x0000), UNPACKED_1x1( 0.0,  0.0, -1.0,  0.0)},
+   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x3c00), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xbc00), UNPACKED_1x1( 0.0,  0.0,  0.0, -1.0)},
+   {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x3c00, 0x3c00, 0x3c00, 0x3c00), UNPACKED_1x1( 1.0,  1.0,  1.0,  1.0)},
+
+   /*
+    * 32-bit fixed point formats
+    */
+
+   {PIPE_FORMAT_R32_FIXED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(  0.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32_FIXED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00010000), UNPACKED_1x1(  1.0, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32_FIXED, PACKED_1x32(0xffffffff), PACKED_1x32(0xffff0000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00010000, 0x00000000), UNPACKED_1x1( 1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffff0000, 0x00000000), UNPACKED_1x1(-1.0,  0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00010000), UNPACKED_1x1( 0.0,  1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xffff0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00010000, 0x00010000), UNPACKED_1x1( 1.0,  1.0, 0.0, 1.0)},
+
+   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00010000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffff0000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00010000, 0x00000000), UNPACKED_1x1( 0.0,  1.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xffff0000, 0x00000000), UNPACKED_1x1( 0.0, -1.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00010000), UNPACKED_1x1( 0.0,  0.0,  1.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xffff0000), UNPACKED_1x1( 0.0,  0.0, -1.0, 1.0)},
+   {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00010000, 0x00010000, 0x00010000), UNPACKED_1x1( 1.0,  1.0,  1.0, 1.0)},
+
+   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00010000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffff0000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0,  0.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00010000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0,  1.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xffff0000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -1.0,  0.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00010000, 0x00000000), UNPACKED_1x1( 0.0,  0.0,  1.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xffff0000, 0x00000000), UNPACKED_1x1( 0.0,  0.0, -1.0,  0.0)},
+   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00010000), UNPACKED_1x1( 0.0,  0.0,  0.0,  1.0)},
+   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xffff0000), UNPACKED_1x1( 0.0,  0.0,  0.0, -1.0)},
+   {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00010000, 0x00010000, 0x00010000, 0x00010000), UNPACKED_1x1( 1.0,  1.0,  1.0,  1.0)},
+
+   /*
+    * D3D9 specific vertex formats
+    */
+
+   {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(   0.0,    0.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(1023.0,    0.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(   0.0, 1023.0,    0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(   0.0,    0.0, 1023.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3fffffff), UNPACKED_1x1(1023.0, 1023.0, 1023.0, 1.0)},
+
+   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000001ff), UNPACKED_1x1( 1.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000201), UNPACKED_1x1(-1.0,  0.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x0007fc00), UNPACKED_1x1( 0.0,  1.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00080400), UNPACKED_1x1( 0.0, -1.0,  0.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x1ff00000), UNPACKED_1x1( 0.0,  0.0,  1.0, 1.0)},
+   {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x20100000), UNPACKED_1x1( 0.0,  0.0, -1.0, 1.0)},
+
+   /*
+    * Special formats that not fit anywhere else
+    */
+
+};
+
+
+const unsigned util_format_nr_test_cases = ARRAY_SIZE(util_format_test_cases);
diff --git a/src/util/format/u_format_tests.h b/src/util/format/u_format_tests.h
new file mode 100644 (file)
index 0000000..d5f0b34
--- /dev/null
@@ -0,0 +1,71 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#ifndef U_FORMAT_TESTS_H_
+#define U_FORMAT_TESTS_H_
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+
+
+#define UTIL_FORMAT_MAX_PACKED_BYTES 32  // R64G64B64A64_FLOAT
+#define UTIL_FORMAT_MAX_UNPACKED_WIDTH 12  // ASTC 12x12
+#define UTIL_FORMAT_MAX_UNPACKED_HEIGHT 12
+
+
+/**
+ * A (packed, unpacked) color pair.
+ */
+struct util_format_test_case
+{
+   enum pipe_format format;
+
+   /**
+    * Mask of the bits that actually meaningful data. Used to mask out the
+    * "X" channels.
+    */
+   uint8_t mask[UTIL_FORMAT_MAX_PACKED_BYTES];
+
+   uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
+
+   /**
+    * RGBA.
+    */
+   double unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4];
+};
+
+
+extern const struct util_format_test_case
+util_format_test_cases[];
+
+
+extern const unsigned util_format_nr_test_cases;
+
+
+#endif /* U_FORMAT_TESTS_H_ */
diff --git a/src/util/format/u_format_yuv.c b/src/util/format/u_format_yuv.c
new file mode 100644 (file)
index 0000000..7ce77f2
--- /dev/null
@@ -0,0 +1,1130 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+/**
+ * @file
+ * YUV and RGB subsampled formats conversion.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+
+#include "util/u_debug.h"
+#include "util/format/u_format_yuv.h"
+
+
+void
+util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      float *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      uint32_t value;
+      float r, g0, g1, b;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         value = util_cpu_to_le32(*src++);
+
+         r  = ubyte_to_float((value >>  0) & 0xff);
+         g0 = ubyte_to_float((value >>  8) & 0xff);
+         b  = ubyte_to_float((value >> 16) & 0xff);
+         g1 = ubyte_to_float((value >> 24) & 0xff);
+
+         dst[0] = r;    /* r */
+         dst[1] = g0;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 1.0f; /* a */
+         dst += 4;
+
+         dst[0] = r;    /* r */
+         dst[1] = g1;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 1.0f; /* a */
+         dst += 4;
+      }
+
+      if (x < width) {
+         value = util_cpu_to_le32(*src);
+
+         r  = ubyte_to_float((value >>  0) & 0xff);
+         g0 = ubyte_to_float((value >>  8) & 0xff);
+         b  = ubyte_to_float((value >> 16) & 0xff);
+         g1 = ubyte_to_float((value >> 24) & 0xff);
+
+         dst[0] = r;    /* r */
+         dst[1] = g0;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 1.0f; /* a */
+      }
+
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                          const uint8_t *src_row, unsigned src_stride,
+                                          unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      uint8_t *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      uint32_t value;
+      uint8_t r, g0, g1, b;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         value = util_cpu_to_le32(*src++);
+
+         r  = (value >>  0) & 0xff;
+         g0 = (value >>  8) & 0xff;
+         b  = (value >> 16) & 0xff;
+         g1 = (value >> 24) & 0xff;
+
+         dst[0] = r;    /* r */
+         dst[1] = g0;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 0xff; /* a */
+         dst += 4;
+
+         dst[0] = r;    /* r */
+         dst[1] = g1;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 0xff; /* a */
+         dst += 4;
+      }
+
+      if (x < width) {
+         value = util_cpu_to_le32(*src);
+
+         r  = (value >>  0) & 0xff;
+         g0 = (value >>  8) & 0xff;
+         b  = (value >> 16) & 0xff;
+         g1 = (value >> 24) & 0xff;
+
+         dst[0] = r;    /* r */
+         dst[1] = g0;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 0xff; /* a */
+      }
+
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                       const float *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      const float *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      float r, g0, g1, b;
+      uint32_t value;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         r  = 0.5f*(src[0] + src[4]);
+         g0 = src[1];
+         g1 = src[5];
+         b  = 0.5f*(src[2] + src[6]);
+
+         value  = (uint32_t)float_to_ubyte(r);
+         value |= (uint32_t)float_to_ubyte(g0) <<  8;
+         value |= (uint32_t)float_to_ubyte(b)  << 16;
+         value |= (uint32_t)float_to_ubyte(g1) << 24;
+
+         *dst++ = util_le32_to_cpu(value);
+
+         src += 8;
+      }
+
+      if (x < width) {
+         r  = src[0];
+         g0 = src[1];
+         g1 = 0;
+         b  = src[2];
+
+         value  = (uint32_t)float_to_ubyte(r);
+         value |= (uint32_t)float_to_ubyte(g0) <<  8;
+         value |= (uint32_t)float_to_ubyte(b)  << 16;
+         value |= (uint32_t)float_to_ubyte(g1) << 24;
+
+         *dst = util_le32_to_cpu(value);
+      }
+
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      const uint8_t *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      uint32_t r, g0, g1, b;
+      uint32_t value;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         r  = (src[0] + src[4] + 1) >> 1;
+         g0 = src[1];
+         g1 = src[5];
+         b  = (src[2] + src[6] + 1) >> 1;
+
+         value  = r;
+         value |= (uint32_t)g0 <<  8;
+         value |= (uint32_t)b  << 16;
+         value |= (uint32_t)g1 << 24;
+
+         *dst++ = util_le32_to_cpu(value);
+
+         src += 8;
+      }
+
+      if (x < width) {
+         r  = src[0];
+         g0 = src[1];
+         g1 = 0;
+         b  = src[2];
+
+         value  = r;
+         value |= (uint32_t)g0 <<  8;
+         value |= (uint32_t)b  << 16;
+         value |= (uint32_t)g1 << 24;
+
+         *dst = util_le32_to_cpu(value);
+      }
+
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        unsigned i, ASSERTED unsigned j)
+{
+   assert(i < 2);
+   assert(j < 1);
+
+   dst[0] = ubyte_to_float(src[0]);             /* r */
+   dst[1] = ubyte_to_float(src[1 + 2*i]);       /* g */
+   dst[2] = ubyte_to_float(src[2]);             /* b */
+   dst[3] = 1.0f;                               /* a */
+}
+
+
+void
+util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      float *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      uint32_t value;
+      float r, g0, g1, b;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         value = util_cpu_to_le32(*src++);
+
+         g0 = ubyte_to_float((value >>  0) & 0xff);
+         r  = ubyte_to_float((value >>  8) & 0xff);
+         g1 = ubyte_to_float((value >> 16) & 0xff);
+         b  = ubyte_to_float((value >> 24) & 0xff);
+
+         dst[0] = r;    /* r */
+         dst[1] = g0;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 1.0f; /* a */
+         dst += 4;
+
+         dst[0] = r;    /* r */
+         dst[1] = g1;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 1.0f; /* a */
+         dst += 4;
+      }
+
+      if (x < width) {
+         value = util_cpu_to_le32(*src);
+
+         g0 = ubyte_to_float((value >>  0) & 0xff);
+         r  = ubyte_to_float((value >>  8) & 0xff);
+         g1 = ubyte_to_float((value >> 16) & 0xff);
+         b  = ubyte_to_float((value >> 24) & 0xff);
+
+         dst[0] = r;    /* r */
+         dst[1] = g0;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 1.0f; /* a */
+      }
+
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                          const uint8_t *src_row, unsigned src_stride,
+                                          unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      uint8_t *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      uint32_t value;
+      uint8_t r, g0, g1, b;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         value = util_cpu_to_le32(*src++);
+
+         g0 = (value >>  0) & 0xff;
+         r  = (value >>  8) & 0xff;
+         g1 = (value >> 16) & 0xff;
+         b  = (value >> 24) & 0xff;
+
+         dst[0] = r;    /* r */
+         dst[1] = g0;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 0xff; /* a */
+         dst += 4;
+
+         dst[0] = r;    /* r */
+         dst[1] = g1;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 0xff; /* a */
+         dst += 4;
+      }
+
+      if (x < width) {
+         value = util_cpu_to_le32(*src);
+
+         g0 = (value >>  0) & 0xff;
+         r  = (value >>  8) & 0xff;
+         g1 = (value >> 16) & 0xff;
+         b  = (value >> 24) & 0xff;
+
+         dst[0] = r;    /* r */
+         dst[1] = g0;   /* g */
+         dst[2] = b;    /* b */
+         dst[3] = 0xff; /* a */
+      }
+
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                       const float *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      const float *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      float r, g0, g1, b;
+      uint32_t value;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         r  = 0.5f*(src[0] + src[4]);
+         g0 = src[1];
+         g1 = src[5];
+         b  = 0.5f*(src[2] + src[6]);
+
+         value  = (uint32_t)float_to_ubyte(g0);
+         value |= (uint32_t)float_to_ubyte(r)  <<  8;
+         value |= (uint32_t)float_to_ubyte(g1) << 16;
+         value |= (uint32_t)float_to_ubyte(b)  << 24;
+
+         *dst++ = util_le32_to_cpu(value);
+
+         src += 8;
+      }
+
+      if (x < width) {
+         r  = src[0];
+         g0 = src[1];
+         g1 = 0;
+         b  = src[2];
+
+         value  = (uint32_t)float_to_ubyte(g0);
+         value |= (uint32_t)float_to_ubyte(r)  <<  8;
+         value |= (uint32_t)float_to_ubyte(g1) << 16;
+         value |= (uint32_t)float_to_ubyte(b)  << 24;
+
+         *dst = util_le32_to_cpu(value);
+      }
+
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      const uint8_t *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      uint32_t r, g0, g1, b;
+      uint32_t value;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         r  = (src[0] + src[4] + 1) >> 1;
+         g0 = src[1];
+         g1 = src[5];
+         b  = (src[2] + src[6] + 1) >> 1;
+
+         value  = g0;
+         value |= (uint32_t)r  <<  8;
+         value |= (uint32_t)g1 << 16;
+         value |= (uint32_t)b  << 24;
+
+         *dst++ = util_le32_to_cpu(value);
+
+         src += 8;
+      }
+
+      if (x < width) {
+         r  = src[0];
+         g0 = src[1];
+         g1 = 0;
+         b  = src[2];
+
+         value  = g0;
+         value |= (uint32_t)r  <<  8;
+         value |= (uint32_t)g1 << 16;
+         value |= (uint32_t)b  << 24;
+
+         *dst = util_le32_to_cpu(value);
+      }
+
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        unsigned i, ASSERTED unsigned j)
+{
+   assert(i < 2);
+   assert(j < 1);
+
+   dst[0] = ubyte_to_float(src[1]);             /* r */
+   dst[1] = ubyte_to_float(src[0 + 2*i]);       /* g */
+   dst[2] = ubyte_to_float(src[3]);             /* b */
+   dst[3] = 1.0f;                               /* a */
+}
+
+
+void
+util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                              const uint8_t *src_row, unsigned src_stride,
+                              unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      float *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      uint32_t value;
+      uint8_t y0, y1, u, v;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         value = util_cpu_to_le32(*src++);
+
+         u  = (value >>  0) & 0xff;
+         y0 = (value >>  8) & 0xff;
+         v  = (value >> 16) & 0xff;
+         y1 = (value >> 24) & 0xff;
+
+         util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 1.0f; /* a */
+         dst += 4;
+
+         util_format_yuv_to_rgb_float(y1, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 1.0f; /* a */
+         dst += 4;
+      }
+
+      if (x < width) {
+         value = util_cpu_to_le32(*src);
+
+         u  = (value >>  0) & 0xff;
+         y0 = (value >>  8) & 0xff;
+         v  = (value >> 16) & 0xff;
+         y1 = (value >> 24) & 0xff;
+
+         util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 1.0f; /* a */
+      }
+
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_uyvy_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                               const uint8_t *src_row, unsigned src_stride,
+                               unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      uint8_t *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      uint32_t value;
+      uint8_t y0, y1, u, v;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         value = util_cpu_to_le32(*src++);
+
+         u  = (value >>  0) & 0xff;
+         y0 = (value >>  8) & 0xff;
+         v  = (value >> 16) & 0xff;
+         y1 = (value >> 24) & 0xff;
+
+         util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 0xff; /* a */
+         dst += 4;
+
+         util_format_yuv_to_rgb_8unorm(y1, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 0xff; /* a */
+         dst += 4;
+      }
+
+      if (x < width) {
+         value = util_cpu_to_le32(*src);
+
+         u  = (value >>  0) & 0xff;
+         y0 = (value >>  8) & 0xff;
+         v  = (value >> 16) & 0xff;
+         y1 = (value >> 24) & 0xff;
+
+         util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 0xff; /* a */
+      }
+
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_uyvy_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                            const float *src_row, unsigned src_stride,
+                            unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      const float *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      uint8_t y0, y1, u, v;
+      uint32_t value;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         uint8_t y0, y1, u0, u1, v0, v1, u, v;
+
+         util_format_rgb_float_to_yuv(src[0], src[1], src[2],
+                                      &y0, &u0, &v0);
+         util_format_rgb_float_to_yuv(src[4], src[5], src[6],
+                                      &y1, &u1, &v1);
+
+         u = (u0 + u1 + 1) >> 1;
+         v = (v0 + v1 + 1) >> 1;
+
+         value  = u;
+         value |= (uint32_t)y0 <<  8;
+         value |= (uint32_t)v  << 16;
+         value |= (uint32_t)y1 << 24;
+
+         *dst++ = util_le32_to_cpu(value);
+
+         src += 8;
+      }
+
+      if (x < width) {
+         util_format_rgb_float_to_yuv(src[0], src[1], src[2],
+                                      &y0, &u, &v);
+         y1 = 0;
+
+         value  = u;
+         value |= (uint32_t)y0 <<  8;
+         value |= (uint32_t)v  << 16;
+         value |= (uint32_t)y1 << 24;
+
+         *dst = util_le32_to_cpu(value);
+      }
+
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_uyvy_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      const uint8_t *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      uint8_t y0, y1, u, v;
+      uint32_t value;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         uint8_t y0, y1, u0, u1, v0, v1, u, v;
+
+         util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
+                                       &y0, &u0, &v0);
+         util_format_rgb_8unorm_to_yuv(src[4], src[5], src[6],
+                                       &y1, &u1, &v1);
+
+         u = (u0 + u1 + 1) >> 1;
+         v = (v0 + v1 + 1) >> 1;
+
+         value  = u;
+         value |= (uint32_t)y0 <<  8;
+         value |= (uint32_t)v  << 16;
+         value |= (uint32_t)y1 << 24;
+
+         *dst++ = util_le32_to_cpu(value);
+
+         src += 8;
+      }
+
+      if (x < width) {
+         util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
+                                       &y0, &u, &v);
+         y1 = 0;
+
+         value  = u;
+         value |= (uint32_t)y0 <<  8;
+         value |= (uint32_t)v  << 16;
+         value |= (uint32_t)y1 << 24;
+
+         *dst = util_le32_to_cpu(value);
+      }
+
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
+                             unsigned i, ASSERTED unsigned j)
+{
+   uint8_t y, u, v;
+
+   assert(i < 2);
+   assert(j < 1);
+
+   y = src[1 + i*2];
+   u = src[0];
+   v = src[2];
+
+   util_format_yuv_to_rgb_float(y, u, v, &dst[0], &dst[1], &dst[2]);
+
+   dst[3] = 1.0f;
+}
+
+
+void
+util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                              const uint8_t *src_row, unsigned src_stride,
+                              unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      float *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      uint32_t value;
+      uint8_t y0, y1, u, v;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         value = util_cpu_to_le32(*src++);
+
+         y0 = (value >>  0) & 0xff;
+         u  = (value >>  8) & 0xff;
+         y1 = (value >> 16) & 0xff;
+         v  = (value >> 24) & 0xff;
+
+         util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 1.0f; /* a */
+         dst += 4;
+
+         util_format_yuv_to_rgb_float(y1, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 1.0f; /* a */
+         dst += 4;
+      }
+
+      if (x < width) {
+         value = util_cpu_to_le32(*src);
+
+         y0 = (value >>  0) & 0xff;
+         u  = (value >>  8) & 0xff;
+         y1 = (value >> 16) & 0xff;
+         v  = (value >> 24) & 0xff;
+
+         util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 1.0f; /* a */
+      }
+
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_yuyv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                               const uint8_t *src_row, unsigned src_stride,
+                               unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      uint8_t *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      uint32_t value;
+      uint8_t y0, y1, u, v;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         value = util_cpu_to_le32(*src++);
+
+         y0 = (value >>  0) & 0xff;
+         u  = (value >>  8) & 0xff;
+         y1 = (value >> 16) & 0xff;
+         v  = (value >> 24) & 0xff;
+
+         util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 0xff; /* a */
+         dst += 4;
+
+         util_format_yuv_to_rgb_8unorm(y1, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 0xff; /* a */
+         dst += 4;
+      }
+
+      if (x < width) {
+         value = util_cpu_to_le32(*src);
+
+         y0 = (value >>  0) & 0xff;
+         u  = (value >>  8) & 0xff;
+         y1 = (value >> 16) & 0xff;
+         v  = (value >> 24) & 0xff;
+
+         util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
+         dst[3] = 0xff; /* a */
+      }
+
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+
+void
+util_format_yuyv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                            const float *src_row, unsigned src_stride,
+                            unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      const float *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      uint8_t y0, y1, u, v;
+      uint32_t value;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         uint8_t y0, y1, u0, u1, v0, v1, u, v;
+
+         util_format_rgb_float_to_yuv(src[0], src[1], src[2],
+                                      &y0, &u0, &v0);
+         util_format_rgb_float_to_yuv(src[4], src[5], src[6],
+                                      &y1, &u1, &v1);
+
+         u = (u0 + u1 + 1) >> 1;
+         v = (v0 + v1 + 1) >> 1;
+
+         value  = y0;
+         value |= (uint32_t)u  <<  8;
+         value |= (uint32_t)y1 << 16;
+         value |= (uint32_t)v  << 24;
+
+         *dst++ = util_le32_to_cpu(value);
+
+         src += 8;
+      }
+
+      if (x < width) {
+         util_format_rgb_float_to_yuv(src[0], src[1], src[2],
+                                      &y0, &u, &v);
+         y1 = 0;
+
+         value  = y0;
+         value |= (uint32_t)u  <<  8;
+         value |= (uint32_t)y1 << 16;
+         value |= (uint32_t)v  << 24;
+
+         *dst = util_le32_to_cpu(value);
+      }
+
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_yuyv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height)
+{
+   unsigned x, y;
+
+   for (y = 0; y < height; y += 1) {
+      const uint8_t *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      uint8_t y0, y1, u, v;
+      uint32_t value;
+
+      for (x = 0; x + 1 < width; x += 2) {
+         uint8_t y0, y1, u0, u1, v0, v1, u, v;
+
+         util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
+                                       &y0, &u0, &v0);
+         util_format_rgb_8unorm_to_yuv(src[4], src[5], src[6],
+                                       &y1, &u1, &v1);
+
+         u = (u0 + u1 + 1) >> 1;
+         v = (v0 + v1 + 1) >> 1;
+
+         value  = y0;
+         value |= (uint32_t)u  <<  8;
+         value |= (uint32_t)y1 << 16;
+         value |= (uint32_t)v  << 24;
+
+         *dst++ = util_le32_to_cpu(value);
+
+         src += 8;
+      }
+
+      if (x < width) {
+         util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
+                                       &y0, &u, &v);
+         y1 = 0;
+
+         value  = y0;
+         value |= (uint32_t)u  <<  8;
+         value |= (uint32_t)y1 << 16;
+         value |= (uint32_t)v  << 24;
+
+         *dst = util_le32_to_cpu(value);
+      }
+
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
+                             unsigned i, ASSERTED unsigned j)
+{
+   uint8_t y, u, v;
+
+   assert(i < 2);
+   assert(j < 1);
+
+   y = src[0 + i*2];
+   u = src[1];
+   v = src[3];
+
+   util_format_yuv_to_rgb_float(y, u, v, &dst[0], &dst[1], &dst[2]);
+
+   dst[3] = 1.0f;
+}
+
+/* XXX: Stubbed for now */
+void
+util_format_yv12_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_yv12_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_yv12_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_yv12_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const float *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_yv12_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                             UNUSED unsigned i, UNUSED unsigned j) {}
+void
+util_format_yv16_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_yv16_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_yv16_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_yv16_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const float *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_yv16_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                             UNUSED unsigned i, UNUSED unsigned j) {}
+void
+util_format_iyuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_iyuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_iyuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_iyuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const float *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_iyuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                             UNUSED unsigned i, UNUSED unsigned j) {}
+void
+util_format_nv12_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_nv12_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_nv12_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_nv12_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const float *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_nv12_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                             UNUSED unsigned i, UNUSED unsigned j) {}
+void
+util_format_nv21_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_nv21_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_nv21_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_nv21_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const float *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_nv21_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                             UNUSED unsigned i, UNUSED unsigned j) {}
+void
+util_format_p016_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_p016_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_p016_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_p016_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                             UNUSED const float *src_row, UNUSED unsigned src_stride,
+                             UNUSED unsigned width, UNUSED unsigned height) {}
+void
+util_format_p016_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                             UNUSED unsigned i, UNUSED unsigned j) {}
+
+void
+util_format_xyuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                         UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_xyuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                          UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_xyuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
+                                       UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_xyuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                        UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_xyuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                                        UNUSED unsigned i, UNUSED unsigned j) {}
+void
+util_format_ayuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                         UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_ayuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                          UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_ayuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
+                                       UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_ayuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                        UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_ayuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                                        UNUSED unsigned i, UNUSED unsigned j) {}
+void
+util_format_r8g8_r8b8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                         UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                          UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_r8g8_r8b8_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
+                                       UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_r8g8_r8b8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                        UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_r8g8_r8b8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                                        UNUSED unsigned i, UNUSED unsigned j) {}
+
+void
+util_format_g8r8_b8r8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+                                         UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                         UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_g8r8_b8r8_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                          UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                          UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_g8r8_b8r8_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                       UNUSED const float *src_row, UNUSED unsigned src_stride,
+                                       UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
+                                        UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
+                                        UNUSED unsigned width, UNUSED unsigned height) {}
+
+void
+util_format_g8r8_b8r8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
+                                        UNUSED unsigned i, UNUSED unsigned j) {}
diff --git a/src/util/format/u_format_yuv.h b/src/util/format/u_format_yuv.h
new file mode 100644 (file)
index 0000000..0acb174
--- /dev/null
@@ -0,0 +1,430 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+/**
+ * @file
+ * YUV colorspace conversion.
+ *
+ * @author Brian Paul <brianp@vmware.com>
+ * @author Michal Krol <michal@vmware.com>
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ *
+ * See also:
+ * - http://www.fourcc.org/fccyvrgb.php
+ * - http://msdn.microsoft.com/en-us/library/ms893078
+ * - http://en.wikipedia.org/wiki/YUV
+ */
+
+
+#ifndef U_FORMAT_YUV_H_
+#define U_FORMAT_YUV_H_
+
+
+#include "pipe/p_compiler.h"
+#include "util/u_math.h"
+
+
+/*
+ * TODO: Ensure we use consistent and right floating formulas, with enough
+ * precision in the coefficients.
+ */
+
+static inline void
+util_format_rgb_float_to_yuv(float r, float g, float b,
+                             uint8_t *y, uint8_t *u, uint8_t *v)
+{
+   const float _r = CLAMP(r, 0.0f, 1.0f);
+   const float _g = CLAMP(g, 0.0f, 1.0f);
+   const float _b = CLAMP(b, 0.0f, 1.0f);
+
+   const float scale = 255.0f;
+
+   const int _y = scale * ( (0.257f * _r) + (0.504f * _g) + (0.098f * _b));
+   const int _u = scale * (-(0.148f * _r) - (0.291f * _g) + (0.439f * _b));
+   const int _v = scale * ( (0.439f * _r) - (0.368f * _g) - (0.071f * _b));
+
+   *y = _y + 16; 
+   *u = _u + 128; 
+   *v = _v + 128; 
+}
+
+
+static inline void
+util_format_yuv_to_rgb_float(uint8_t y, uint8_t u, uint8_t v,
+                             float *r, float *g, float *b)
+{
+   const int _y = y - 16;
+   const int _u = u - 128;
+   const int _v = v - 128;
+
+   const float y_factor = 255.0f / 219.0f;
+
+   const float scale = 1.0f / 255.0f;
+
+   *r = scale * (y_factor * _y               + 1.596f * _v);
+   *g = scale * (y_factor * _y - 0.391f * _u - 0.813f * _v);
+   *b = scale * (y_factor * _y + 2.018f * _u              );
+}
+
+
+static inline void
+util_format_rgb_8unorm_to_yuv(uint8_t r, uint8_t g, uint8_t b,
+                             uint8_t *y, uint8_t *u, uint8_t *v)
+{
+   *y = ((  66 * r + 129 * g +  25 * b + 128) >> 8) +  16;
+   *u = (( -38 * r -  74 * g + 112 * b + 128) >> 8) + 128;
+   *v = (( 112 * r -  94 * g -  18 * b + 128) >> 8) + 128;
+}
+
+
+static inline void
+util_format_yuv_to_rgb_8unorm(uint8_t y, uint8_t u, uint8_t v,
+                              uint8_t *r, uint8_t *g, uint8_t *b)
+{
+   const int _y = y - 16;
+   const int _u = u - 128;
+   const int _v = v - 128;
+
+   const int _r = (298 * _y            + 409 * _v + 128) >> 8;
+   const int _g = (298 * _y - 100 * _u - 208 * _v + 128) >> 8;
+   const int _b = (298 * _y + 516 * _u            + 128) >> 8;
+
+   *r = CLAMP(_r, 0, 255);
+   *g = CLAMP(_g, 0, 255);
+   *b = CLAMP(_b, 0, 255);
+}
+
+
+
+void
+util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                              const uint8_t *src_row, unsigned src_stride,
+                              unsigned width, unsigned height);
+
+void
+util_format_uyvy_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                               const uint8_t *src_row, unsigned src_stride,
+                               unsigned width, unsigned height);
+
+void
+util_format_uyvy_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                            const float *src_row, unsigned src_stride,
+                            unsigned width, unsigned height);
+
+void
+util_format_uyvy_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+
+void
+util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
+                             unsigned i, unsigned j);
+
+void
+util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                              const uint8_t *src_row, unsigned src_stride,
+                              unsigned width, unsigned height);
+
+void
+util_format_yuyv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                               const uint8_t *src_row, unsigned src_stride,
+                               unsigned width, unsigned height);
+
+void
+util_format_yuyv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                            const float *src_row, unsigned src_stride,
+                            unsigned width, unsigned height);
+
+void
+util_format_yuyv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+
+void
+util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
+                             unsigned i, unsigned j);
+
+/* XXX: Stubbed for now */
+void
+util_format_yv12_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_yv12_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_yv12_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_yv12_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                             const float *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_yv12_fetch_rgba_float(float *dst, const uint8_t *src,
+                             unsigned i, unsigned j);
+void
+util_format_yv16_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_yv16_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_yv16_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_yv16_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                             const float *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_yv16_fetch_rgba_float(float *dst, const uint8_t *src,
+                             unsigned i, unsigned j);
+void
+util_format_iyuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_iyuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_iyuv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_iyuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                             const float *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_iyuv_fetch_rgba_float(float *dst, const uint8_t *src,
+                             unsigned i, unsigned j);
+void
+util_format_nv12_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_nv12_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_nv12_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_nv12_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                             const float *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_nv12_fetch_rgba_float(float *dst, const uint8_t *src,
+                             unsigned i, unsigned j);
+void
+util_format_nv21_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_nv21_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_nv21_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_nv21_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                             const float *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_nv21_fetch_rgba_float(float *dst, const uint8_t *src,
+                             unsigned i, unsigned j);
+void
+util_format_p016_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_p016_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_p016_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                             const uint8_t *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_p016_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                             const float *src_row, unsigned src_stride,
+                             unsigned width, unsigned height);
+void
+util_format_p016_fetch_rgba_float(float *dst, const uint8_t *src,
+                             unsigned i, unsigned j);
+
+void
+util_format_xyuv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height);
+
+void
+util_format_xyuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                          const uint8_t *src_row, unsigned src_stride,
+                                          unsigned width, unsigned height);
+
+void
+util_format_xyuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                       const float *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height);
+
+void
+util_format_xyuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height);
+
+void
+util_format_xyuv_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        unsigned i, unsigned j);
+void
+util_format_ayuv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height);
+
+void
+util_format_ayuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                          const uint8_t *src_row, unsigned src_stride,
+                                          unsigned width, unsigned height);
+
+void
+util_format_ayuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                       const float *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height);
+
+void
+util_format_ayuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height);
+
+void
+util_format_ayuv_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        unsigned i, unsigned j);
+void
+util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height);
+
+void
+util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                          const uint8_t *src_row, unsigned src_stride,
+                                          unsigned width, unsigned height);
+
+void
+util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                       const float *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height);
+
+void
+util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height);
+
+void
+util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        unsigned i, unsigned j);
+
+void
+util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height);
+
+void
+util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                          const uint8_t *src_row, unsigned src_stride,
+                                          unsigned width, unsigned height);
+
+void
+util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                       const float *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height);
+
+void
+util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height);
+
+void
+util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        unsigned i, unsigned j);
+
+void
+util_format_r8g8_r8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height);
+
+void
+util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                          const uint8_t *src_row, unsigned src_stride,
+                                          unsigned width, unsigned height);
+
+void
+util_format_r8g8_r8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                       const float *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height);
+
+void
+util_format_r8g8_r8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height);
+
+void
+util_format_r8g8_r8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        unsigned i, unsigned j);
+
+void
+util_format_g8r8_b8r8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height);
+
+void
+util_format_g8r8_b8r8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                          const uint8_t *src_row, unsigned src_stride,
+                                          unsigned width, unsigned height);
+
+void
+util_format_g8r8_b8r8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
+                                       const float *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height);
+
+void
+util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
+                                        const uint8_t *src_row, unsigned src_stride,
+                                        unsigned width, unsigned height);
+
+void
+util_format_g8r8_b8r8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+                                        unsigned i, unsigned j);
+
+#endif /* U_FORMAT_YUV_H_ */
diff --git a/src/util/format/u_format_zs.c b/src/util/format/u_format_zs.c
new file mode 100644 (file)
index 0000000..d37baab
--- /dev/null
@@ -0,0 +1,896 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#include "util/format/u_format_zs.h"
+#include "util/u_math.h"
+
+
+/*
+ * z32_unorm conversion functions
+ */
+
+static inline uint16_t
+z32_unorm_to_z16_unorm(uint32_t z)
+{
+   /* z * 0xffff / 0xffffffff */
+   return z >> 16;
+}
+
+static inline uint32_t
+z16_unorm_to_z32_unorm(uint16_t z)
+{
+   /* z * 0xffffffff / 0xffff */
+   return ((uint32_t)z << 16) | z;
+}
+
+static inline uint32_t
+z32_unorm_to_z24_unorm(uint32_t z)
+{
+   /* z * 0xffffff / 0xffffffff */
+   return z >> 8;
+}
+
+static inline uint32_t
+z24_unorm_to_z32_unorm(uint32_t z)
+{
+   /* z * 0xffffffff / 0xffffff */
+   return (z << 8) | (z >> 16);
+}
+
+
+/*
+ * z32_float conversion functions
+ */
+
+static inline uint16_t
+z32_float_to_z16_unorm(float z)
+{
+   const float scale = 0xffff;
+   return (uint16_t)(z * scale + 0.5f);
+}
+
+static inline float
+z16_unorm_to_z32_float(uint16_t z)
+{
+   const float scale = 1.0 / 0xffff;
+   return (float)(z * scale);
+}
+
+static inline uint32_t
+z32_float_to_z24_unorm(float z)
+{
+   const double scale = 0xffffff;
+   return (uint32_t)(z * scale) & 0xffffff;
+}
+
+static inline float
+z24_unorm_to_z32_float(uint32_t z)
+{
+   const double scale = 1.0 / 0xffffff;
+   return (float)(z * scale);
+}
+
+static inline uint32_t
+z32_float_to_z32_unorm(float z)
+{
+   const double scale = 0xffffffff;
+   return (uint32_t)(z * scale);
+}
+
+static inline float
+z32_unorm_to_z32_float(uint32_t z)
+{
+   const double scale = 1.0 / 0xffffffff;
+   return (float)(z * scale);
+}
+
+
+void
+util_format_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   unsigned y;
+   for(y = 0; y < height; ++y) {
+      memcpy(dst_row, src_row, width);
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned y;
+   for(y = 0; y < height; ++y) {
+      memcpy(dst_row, src_row, width);
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z16_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
+                                     const uint8_t *src_row, unsigned src_stride,
+                                     unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      float *dst = dst_row;
+      const uint16_t *src = (const uint16_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint16_t value = util_cpu_to_le16(*src++);
+         *dst++ = z16_unorm_to_z32_float(value);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z16_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+                                   const float *src_row, unsigned src_stride,
+                                   unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const float *src = src_row;
+      uint16_t *dst = (uint16_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint16_t value;
+         value = z32_float_to_z16_unorm(*src++);
+         *dst++ = util_le16_to_cpu(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z16_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      uint32_t *dst = dst_row;
+      const uint16_t *src = (const uint16_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint16_t value = util_cpu_to_le16(*src++);
+         *dst++ = z16_unorm_to_z32_unorm(value);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z16_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+                                     const uint32_t *src_row, unsigned src_stride,
+                                     unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const uint32_t *src = src_row;
+      uint16_t *dst = (uint16_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint16_t value;
+         value = z32_unorm_to_z16_unorm(*src++);
+         *dst++ = util_le16_to_cpu(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z32_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
+                                     const uint8_t *src_row, unsigned src_stride,
+                                     unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      float *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_cpu_to_le32(*src++);
+         *dst++ = z32_unorm_to_z32_float(value);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z32_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+                                   const float *src_row, unsigned src_stride,
+                                   unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const float *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value;
+         value = z32_float_to_z32_unorm(*src++);
+         *dst++ = util_le32_to_cpu(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z32_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned y;
+   for(y = 0; y < height; ++y) {
+      memcpy(dst_row, src_row, width * 4);
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z32_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+                                     const uint32_t *src_row, unsigned src_stride,
+                                     unsigned width, unsigned height)
+{
+   unsigned y;
+   for(y = 0; y < height; ++y) {
+      memcpy(dst_row, src_row, width * 4);
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z32_float_unpack_z_float(float *dst_row, unsigned dst_stride,
+                                     const uint8_t *src_row, unsigned src_stride,
+                                     unsigned width, unsigned height)
+{
+   unsigned y;
+   for(y = 0; y < height; ++y) {
+      memcpy(dst_row, src_row, width * 4);
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z32_float_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+                                   const float *src_row, unsigned src_stride,
+                                   unsigned width, unsigned height)
+{
+   unsigned y;
+   for(y = 0; y < height; ++y) {
+      memcpy(dst_row, src_row, width * 4);
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z32_float_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      uint32_t *dst = dst_row;
+      const float *src = (const float *)src_row;
+      for(x = 0; x < width; ++x) {
+         *dst++ = z32_float_to_z32_unorm(*src++);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z32_float_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+                                     const uint32_t *src_row, unsigned src_stride,
+                                     unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const uint32_t *src = src_row;
+      float *dst = (float *)dst_row;
+      for(x = 0; x < width; ++x) {
+         *dst++ = z32_unorm_to_z32_float(*src++);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z24_unorm_s8_uint_unpack_z_float(float *dst_row, unsigned dst_stride,
+                                                const uint8_t *src_row, unsigned src_stride,
+                                                unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      float *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value =  util_cpu_to_le32(*src++);
+         *dst++ = z24_unorm_to_z32_float(value & 0xffffff);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z24_unorm_s8_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+                                              const float *src_row, unsigned src_stride,
+                                              unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const float *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_le32_to_cpu(*dst);
+         value &= 0xff000000;
+         value |= z32_float_to_z24_unorm(*src++);
+         *dst++ = util_cpu_to_le32(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z24_unorm_s8_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+                                                  const uint8_t *src_row, unsigned src_stride,
+                                                  unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      uint32_t *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_cpu_to_le32(*src++);
+         *dst++ = z24_unorm_to_z32_unorm(value & 0xffffff);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z24_unorm_s8_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+                                                const uint32_t *src_row, unsigned src_stride,
+                                                unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const uint32_t *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_le32_to_cpu(*dst);
+         value &= 0xff000000;
+         value |= z32_unorm_to_z24_unorm(*src++);
+         *dst++ = util_cpu_to_le32(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z24_unorm_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
+                                                   const uint8_t *src_row, unsigned src_stride,
+                                                   unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      uint8_t *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_cpu_to_le32(*src++);
+         *dst++ = value >> 24;
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z24_unorm_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
+                                                 const uint8_t *src_row, unsigned src_stride,
+                                                 unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const uint8_t *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_le32_to_cpu(*dst);
+         value &= 0x00ffffff;
+         value |= (uint32_t)*src++ << 24;
+         *dst++ = util_cpu_to_le32(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z24_unorm_s8_uint_pack_separate(uint8_t *dst_row, unsigned dst_stride,
+                                            const uint32_t *z_src_row, unsigned z_src_stride,
+                                            const uint8_t *s_src_row, unsigned s_src_stride,
+                                            unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for (y = 0; y < height; ++y) {
+      const uint32_t *z_src = z_src_row;
+      const uint8_t *s_src = s_src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for (x = 0; x < width; ++x) {
+         *dst++ = (*z_src++ & 0x00ffffff) | ((uint32_t)*s_src++ << 24);
+      }
+      dst_row += dst_stride / sizeof(*dst_row);
+      z_src_row += z_src_stride / sizeof(*z_src_row);
+      s_src_row += s_src_stride / sizeof(*s_src_row);
+   }
+}
+
+void
+util_format_s8_uint_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
+                                                const uint8_t *src_row, unsigned src_stride,
+                                                unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      float *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_cpu_to_le32(*src++);
+         *dst++ = z24_unorm_to_z32_float(value >> 8);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_s8_uint_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+                                              const float *src_row, unsigned src_stride,
+                                              unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const float *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_le32_to_cpu(*dst);
+         value &= 0x000000ff;
+         value |= z32_float_to_z24_unorm(*src++) << 8;
+         *dst++ = util_cpu_to_le32(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_s8_uint_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+                                                  const uint8_t *src_row, unsigned src_stride,
+                                                  unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      uint32_t *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_cpu_to_le32(*src++);
+         *dst++ = z24_unorm_to_z32_unorm(value >> 8);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_s8_uint_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+                                                const uint32_t *src_row, unsigned src_stride,
+                                                unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const uint32_t *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_le32_to_cpu(*dst);
+         value &= 0x000000ff;
+         value |= *src++ & 0xffffff00;
+         *dst++ = util_cpu_to_le32(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_s8_uint_z24_unorm_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
+                                                   const uint8_t *src_row, unsigned src_stride,
+                                                   unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      uint8_t *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_cpu_to_le32(*src++);
+         *dst++ = value & 0xff;
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_s8_uint_z24_unorm_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
+                                                 const uint8_t *src_row, unsigned src_stride,
+                                                 unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const uint8_t *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_le32_to_cpu(*dst);
+         value &= 0xffffff00;
+         value |= *src++;
+         *dst++ = util_cpu_to_le32(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z24x8_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      float *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_cpu_to_le32(*src++);
+         *dst++ = z24_unorm_to_z32_float(value & 0xffffff);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z24x8_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+                                     const float *src_row, unsigned src_stride,
+                                     unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const float *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value;
+         value = z32_float_to_z24_unorm(*src++);
+         *dst++ = util_le32_to_cpu(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z24x8_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      uint32_t *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_cpu_to_le32(*src++);
+         *dst++ = z24_unorm_to_z32_unorm(value & 0xffffff);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z24x8_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint32_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const uint32_t *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value;
+         value = z32_unorm_to_z24_unorm(*src++);
+         *dst++ = util_cpu_to_le32(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_x8z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
+                                       const uint8_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      float *dst = dst_row;
+      const uint32_t *src = (uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_cpu_to_le32(*src++);
+         *dst++ = z24_unorm_to_z32_float(value >> 8);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_x8z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+                                     const float *src_row, unsigned src_stride,
+                                     unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const float *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value;
+         value = z32_float_to_z24_unorm(*src++) << 8;
+         *dst++ = util_cpu_to_le32(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_x8z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+                                         const uint8_t *src_row, unsigned src_stride,
+                                         unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      uint32_t *dst = dst_row;
+      const uint32_t *src = (const uint32_t *)src_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value = util_cpu_to_le32(*src++);
+         *dst++ = z24_unorm_to_z32_unorm(value >> 8);
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_x8z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+                                       const uint32_t *src_row, unsigned src_stride,
+                                       unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const uint32_t *src = src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for(x = 0; x < width; ++x) {
+         uint32_t value;
+         value = z32_unorm_to_z24_unorm(*src++) << 8;
+         *dst++ = util_cpu_to_le32(value);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z32_float_s8x24_uint_unpack_z_float(float *dst_row, unsigned dst_stride,
+                                                   const uint8_t *src_row, unsigned src_stride,
+                                                   unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      float *dst = dst_row;
+      const float *src = (const float *)src_row;
+      for(x = 0; x < width; ++x) {
+         *dst = *src;
+         src += 2;
+         dst += 1;
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z32_float_s8x24_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+                                                 const float *src_row, unsigned src_stride,
+                                                 unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const float *src = src_row;
+      float *dst = (float *)dst_row;
+      for(x = 0; x < width; ++x) {
+         *dst = *src;
+         src += 1;
+         dst += 2;
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z32_float_s8x24_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+                                                     const uint8_t *src_row, unsigned src_stride,
+                                                     unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      uint32_t *dst = dst_row;
+      const float *src = (const float *)src_row;
+      for(x = 0; x < width; ++x) {
+         *dst = z32_float_to_z32_unorm(*src);
+         src += 2;
+         dst += 1;
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z32_float_s8x24_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+                                                   const uint32_t *src_row, unsigned src_stride,
+                                                   unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const uint32_t *src = src_row;
+      float *dst = (float *)dst_row;
+      for(x = 0; x < width; ++x) {
+         *dst++ = z32_unorm_to_z32_float(*src++);
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+void
+util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
+                                                      const uint8_t *src_row, unsigned src_stride,
+                                                      unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      uint8_t *dst = dst_row;
+      const uint8_t *src = src_row + 4;
+      for(x = 0; x < width; ++x) {
+         *dst = *src;
+         src += 8;
+         dst += 1;
+      }
+      src_row += src_stride/sizeof(*src_row);
+      dst_row += dst_stride/sizeof(*dst_row);
+   }
+}
+
+void
+util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
+                                                    const uint8_t *src_row, unsigned src_stride,
+                                                    unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for(y = 0; y < height; ++y) {
+      const uint8_t *src = src_row;
+      uint32_t *dst = ((uint32_t *)dst_row) + 1;
+      for(x = 0; x < width; ++x) {
+         *dst = util_cpu_to_le32(*src);
+         src += 1;
+         dst += 2;
+      }
+      dst_row += dst_stride/sizeof(*dst_row);
+      src_row += src_stride/sizeof(*src_row);
+   }
+}
+
+
+void
+util_format_x24s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_z24_unorm_s8_uint_unpack_s_8uint(dst_row, dst_stride,
+                                                     src_row, src_stride,
+                                                     width, height);
+}
+
+void
+util_format_x24s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_z24_unorm_s8_uint_pack_s_8uint(dst_row, dst_stride,
+                                                   src_row, src_stride,
+                                                   width, height);
+}
+
+void
+util_format_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_s8_uint_z24_unorm_unpack_s_8uint(dst_row, dst_stride,
+                                                     src_row, src_stride,
+                                                     width, height);
+}
+
+void
+util_format_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+   util_format_s8_uint_z24_unorm_pack_s_8uint(dst_row, dst_stride,
+                                                     src_row, src_stride,
+                                                     width, height);
+}
+
+void
+util_format_x32_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
+                                               const uint8_t *src_row, unsigned src_stride,
+                                               unsigned width, unsigned height)
+{
+   util_format_z32_float_s8x24_uint_unpack_s_8uint(dst_row, dst_stride,
+                                                        src_row, src_stride,
+                                                        width, height);
+
+}
+
+void
+util_format_x32_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
+                                             const uint8_t *src_row, unsigned src_stride,
+                                             unsigned width, unsigned height)
+{
+   util_format_z32_float_s8x24_uint_pack_s_8uint(dst_row, dst_stride,
+                                                       src_row, src_stride,
+                                                      width, height);
+}
diff --git a/src/util/format/u_format_zs.h b/src/util/format/u_format_zs.h
new file mode 100644 (file)
index 0000000..bed3c51
--- /dev/null
@@ -0,0 +1,214 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#ifndef U_FORMAT_ZS_H_
+#define U_FORMAT_ZS_H_
+
+
+#include "pipe/p_compiler.h"
+
+
+void
+util_format_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z16_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z16_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z16_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z16_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_float_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_float_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_float_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_float_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z24_unorm_s8_uint_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z24_unorm_s8_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z24_unorm_s8_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z24_unorm_s8_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z24_unorm_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z24_unorm_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_z24_unorm_s8_uint_pack_separate(uint8_t *dst_row, unsigned dst_stride, const uint32_t *z_src_row, unsigned z_src_stride, const uint8_t *s_src_row, unsigned s_src_stride, unsigned width, unsigned height);
+
+void
+util_format_s8_uint_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_s8_uint_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_s8_uint_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_s8_uint_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_s8_uint_z24_unorm_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_s8_uint_z24_unorm_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z24x8_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z24x8_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z24x8_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z24x8_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_x8z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_x8z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_x8z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_x8z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_float_s8x24_uint_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_float_s8x24_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_float_s8x24_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_float_s8x24_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+
+void
+util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_x24s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_x24s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_x32_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_x32_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_sride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+#endif /* U_FORMAT_ZS_H_ */
index a7990ad52cc35bfa014246adad4a6ce9d7c0174a..9300cb6e34ab3bf3845c3fc47cc7414776b12d93 100644 (file)
@@ -20,6 +20,7 @@
 
 inc_util = include_directories('.')
 
+subdir('format')
 subdir('xmlpool')
 
 files_mesa_util = files(
@@ -161,6 +162,7 @@ _libmesa_util = static_library(
   [files_mesa_util, format_srgb],
   include_directories : inc_common,
   dependencies : deps_for_libmesa_util,
+  link_with: libmesa_format,
   c_args : [c_msvc_compat_args, c_vis_args],
   build_by_default : false
 )