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] */