aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-06-27 15:05:31 -0700
committerEric Anholt <[email protected]>2019-11-14 10:47:20 -0800
commit882ca6dfb0f3d17e0f8bc917307d915ab1718069 (patch)
tree652b9932fc1182d4d191d7970fcd10c3687fbd3b /src/gallium/auxiliary
parentac78ca4b39ce6e927f824b928d17f30c1d9273ce (diff)
util: Move gallium's PIPE_FORMAT utils to /util/format/
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 <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/Android.mk3
-rw-r--r--src/gallium/auxiliary/Makefile.sources23
-rw-r--r--src/gallium/auxiliary/SConscript12
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_offset.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch.c2
-rw-r--r--src/gallium/auxiliary/driver_ddebug/dd_draw.c2
-rw-r--r--src/gallium/auxiliary/driver_noop/noop_pipe.c2
-rw-r--r--src/gallium/auxiliary/driver_rbug/rbug_core.c2
-rw-r--r--src/gallium/auxiliary/driver_trace/tr_dump.c2
-rw-r--r--src/gallium/auxiliary/driver_trace/tr_dump_defines.h2
-rw-r--r--src/gallium/auxiliary/driver_trace/tr_dump_state.c2
-rw-r--r--src/gallium/auxiliary/driver_trace/tr_screen.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_aos.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_soa.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_type.h2
-rw-r--r--src/gallium/auxiliary/hud/hud_context.c2
-rw-r--r--src/gallium/auxiliary/meson.build31
-rw-r--r--src/gallium/auxiliary/renderonly/renderonly.c2
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.h2
-rw-r--r--src/gallium/auxiliary/translate/translate_generic.c2
-rw-r--r--src/gallium/auxiliary/translate/translate_sse.c2
-rw-r--r--src/gallium/auxiliary/util/u_blit.c2
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c2
-rw-r--r--src/gallium/auxiliary/util/u_compute.c2
-rw-r--r--src/gallium/auxiliary/util/u_debug_describe.c2
-rw-r--r--src/gallium/auxiliary/util/u_debug_gallium.c2
-rw-r--r--src/gallium/auxiliary/util/u_debug_image.c2
-rw-r--r--src/gallium/auxiliary/util/u_draw.c2
-rw-r--r--src/gallium/auxiliary/util/u_dump_state.c2
-rw-r--r--src/gallium/auxiliary/util/u_format.c991
-rw-r--r--src/gallium/auxiliary/util/u_format.csv511
-rw-r--r--src/gallium/auxiliary/util/u_format.h1510
-rw-r--r--src/gallium/auxiliary/util/u_format_bptc.c279
-rw-r--r--src/gallium/auxiliary/util/u_format_bptc.h122
-rw-r--r--src/gallium/auxiliary/util/u_format_etc.c84
-rw-r--r--src/gallium/auxiliary/util/u_format_etc.h46
-rw-r--r--src/gallium/auxiliary/util/u_format_latc.c306
-rw-r--r--src/gallium/auxiliary/util/u_format_latc.h108
-rw-r--r--src/gallium/auxiliary/util/u_format_other.c422
-rw-r--r--src/gallium/auxiliary/util/u_format_other.h134
-rw-r--r--src/gallium/auxiliary/util/u_format_pack.py761
-rw-r--r--src/gallium/auxiliary/util/u_format_parse.py405
-rw-r--r--src/gallium/auxiliary/util/u_format_rgtc.c448
-rw-r--r--src/gallium/auxiliary/util/u_format_rgtc.h114
-rw-r--r--src/gallium/auxiliary/util/u_format_s3tc.c674
-rw-r--r--src/gallium/auxiliary/util/u_format_s3tc.h218
-rw-r--r--src/gallium/auxiliary/util/u_format_table.py233
-rw-r--r--src/gallium/auxiliary/util/u_format_tests.c1034
-rw-r--r--src/gallium/auxiliary/util/u_format_tests.h71
-rw-r--r--src/gallium/auxiliary/util/u_format_yuv.c1130
-rw-r--r--src/gallium/auxiliary/util/u_format_yuv.h430
-rw-r--r--src/gallium/auxiliary/util/u_format_zs.c896
-rw-r--r--src/gallium/auxiliary/util/u_format_zs.h214
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c2
-rw-r--r--src/gallium/auxiliary/util/u_pack_color.h2
-rw-r--r--src/gallium/auxiliary/util/u_pstipple.c2
-rw-r--r--src/gallium/auxiliary/util/u_resource.c2
-rw-r--r--src/gallium/auxiliary/util/u_sampler.c2
-rw-r--r--src/gallium/auxiliary/util/u_surface.c55
-rw-r--r--src/gallium/auxiliary/util/u_surface.h6
-rw-r--r--src/gallium/auxiliary/util/u_tests.c2
-rw-r--r--src/gallium/auxiliary/util/u_threaded_context.c2
-rw-r--r--src/gallium/auxiliary/util/u_tile.c4
-rw-r--r--src/gallium/auxiliary/util/u_transfer_helper.c6
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c2
-rw-r--r--src/gallium/auxiliary/vl/vl_deint_filter.c2
-rw-r--r--src/gallium/auxiliary/vl/vl_vertex_buffers.c2
-rw-r--r--src/gallium/auxiliary/vl/vl_video_buffer.c2
78 files changed, 54 insertions, 11319 deletions
diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk
index a2d5fa60da4..f7329963770 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -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)
diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources
index 8961ae2a1e0..2cc7e8a3fc7 100644
--- a/src/gallium/auxiliary/Makefile.sources
+++ b/src/gallium/auxiliary/Makefile.sources
@@ -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 \
diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
index bdd9a1beaa1..56134da03ee 100644
--- a/src/gallium/auxiliary/SConscript
+++ b/src/gallium/auxiliary/SConscript
@@ -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',
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index db634b419a1..59bcd0dd510 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -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"
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 66a943aff42..e84fb5d6157 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -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"
diff --git a/src/gallium/auxiliary/draw/draw_pipe_offset.c b/src/gallium/auxiliary/draw/draw_pipe_offset.c
index f58e32b98a4..191bd43d117 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_offset.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_offset.c
@@ -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"
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index 33bd7b6cfd5..bd6637a6730 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -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"
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 88063ee5e48..f6918976310 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -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"
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c
index 84fd6bf37a8..17fcfa06728 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c
@@ -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"
diff --git a/src/gallium/auxiliary/driver_ddebug/dd_draw.c b/src/gallium/auxiliary/driver_ddebug/dd_draw.c
index b2ed5d5f13b..a0414a6cd5e 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_draw.c
+++ b/src/gallium/auxiliary/driver_ddebug/dd_draw.c
@@ -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"
diff --git a/src/gallium/auxiliary/driver_noop/noop_pipe.c b/src/gallium/auxiliary/driver_noop/noop_pipe.c
index 290b9982376..fe7267c39ca 100644
--- a/src/gallium/auxiliary/driver_noop/noop_pipe.c
+++ b/src/gallium/auxiliary/driver_noop/noop_pipe.c
@@ -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"
diff --git a/src/gallium/auxiliary/driver_rbug/rbug_core.c b/src/gallium/auxiliary/driver_rbug/rbug_core.c
index 66ac79385e1..d8dda8af227 100644
--- a/src/gallium/auxiliary/driver_rbug/rbug_core.c
+++ b/src/gallium/auxiliary/driver_rbug/rbug_core.c
@@ -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"
diff --git a/src/gallium/auxiliary/driver_trace/tr_dump.c b/src/gallium/auxiliary/driver_trace/tr_dump.c
index 5bee07dd54e..0be21ac6fb4 100644
--- a/src/gallium/auxiliary/driver_trace/tr_dump.c
+++ b/src/gallium/auxiliary/driver_trace/tr_dump.c
@@ -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"
diff --git a/src/gallium/auxiliary/driver_trace/tr_dump_defines.h b/src/gallium/auxiliary/driver_trace/tr_dump_defines.h
index f6e94addfa1..7c18cd13adc 100644
--- a/src/gallium/auxiliary/driver_trace/tr_dump_defines.h
+++ b/src/gallium/auxiliary/driver_trace/tr_dump_defines.h
@@ -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"
diff --git a/src/gallium/auxiliary/driver_trace/tr_dump_state.c b/src/gallium/auxiliary/driver_trace/tr_dump_state.c
index 88a50b80903..bd0d7204cff 100644
--- a/src/gallium/auxiliary/driver_trace/tr_dump_state.c
+++ b/src/gallium/auxiliary/driver_trace/tr_dump_state.c
@@ -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"
diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.c b/src/gallium/auxiliary/driver_trace/tr_screen.c
index 0d2c99cda53..a0943519ea5 100644
--- a/src/gallium/auxiliary/driver_trace/tr_screen.c
+++ b/src/gallium/auxiliary/driver_trace/tr_screen.c
@@ -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"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
index 21680dba74a..a529fe2f0ef 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
@@ -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"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c
index 636a4a6238f..7d106195d0a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c
@@ -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"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c b/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c
index 2949494c1cc..0be00130212 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c
@@ -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"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
index 938a16519cd..c5962a66699 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
@@ -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"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
index fafa67c2619..121452d7596 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c
@@ -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"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index e49ae810a5e..fa145e1c3b2 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -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"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
index f89d5fd7433..83a0755d03d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
@@ -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"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 964818bebed..9161e234c62 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -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"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.h b/src/gallium/auxiliary/gallivm/lp_bld_type.h
index 62f1f854613..9c7dc252166 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_type.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_type.h
@@ -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"
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 9e6d8fd11a0..f9733d2de4a 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -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"
diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build
index c7ae8fd53e2..9ebfcea8624 100644
--- a/src/gallium/auxiliary/meson.build
+++ b/src/gallium/auxiliary/meson.build
@@ -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')
],
diff --git a/src/gallium/auxiliary/renderonly/renderonly.c b/src/gallium/auxiliary/renderonly/renderonly.c
index d6a34400937..29ba92ae02f 100644
--- a/src/gallium/auxiliary/renderonly/renderonly.c
+++ b/src/gallium/auxiliary/renderonly/renderonly.c
@@ -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"
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.h b/src/gallium/auxiliary/tgsi/tgsi_info.h
index f0bf27ea08b..40ff9bc1172 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.h
@@ -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" {
diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c
index 9f8be2fa837..ac3310b4c5e 100644
--- a/src/gallium/auxiliary/translate/translate_generic.c
+++ b/src/gallium/auxiliary/translate/translate_generic.c
@@ -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"
diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c
index 35d29f6db40..c128ac3da7e 100644
--- a/src/gallium/auxiliary/translate/translate_sse.c
+++ b/src/gallium/auxiliary/translate/translate_sse.c
@@ -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"
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 8577486b769..1216766ee84 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -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"
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index f4bd04287c0..fd7813aae11 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -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"
diff --git a/src/gallium/auxiliary/util/u_compute.c b/src/gallium/auxiliary/util/u_compute.c
index ccf7119291b..83f8c710c73 100644
--- a/src/gallium/auxiliary/util/u_compute.c
+++ b/src/gallium/auxiliary/util/u_compute.c
@@ -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"
diff --git a/src/gallium/auxiliary/util/u_debug_describe.c b/src/gallium/auxiliary/util/u_debug_describe.c
index b78c99dd45a..8bfd970a508 100644
--- a/src/gallium/auxiliary/util/u_debug_describe.c
+++ b/src/gallium/auxiliary/util/u_debug_describe.c
@@ -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"
diff --git a/src/gallium/auxiliary/util/u_debug_gallium.c b/src/gallium/auxiliary/util/u_debug_gallium.c
index 9dad0c27c55..63a1e69c0d4 100644
--- a/src/gallium/auxiliary/util/u_debug_gallium.c
+++ b/src/gallium/auxiliary/util/u_debug_gallium.c
@@ -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
diff --git a/src/gallium/auxiliary/util/u_debug_image.c b/src/gallium/auxiliary/util/u_debug_image.c
index 4e7984886d0..9eb5e1836b3 100644
--- a/src/gallium/auxiliary/util/u_debug_image.c
+++ b/src/gallium/auxiliary/util/u_debug_image.c
@@ -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"
diff --git a/src/gallium/auxiliary/util/u_draw.c b/src/gallium/auxiliary/util/u_draw.c
index a7590f7f043..b7daa21c692 100644
--- a/src/gallium/auxiliary/util/u_draw.c
+++ b/src/gallium/auxiliary/util/u_draw.c
@@ -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"
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index 5e312bda121..422dc86754f 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -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
index 33643615294..00000000000
--- a/src/gallium/auxiliary/util/u_format.c
+++ /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 <[email protected]>
- */
-
-#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
index 61ad815d845..00000000000
--- a/src/gallium/auxiliary/util/u_format.csv
+++ /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
index f1aa116fe3a..00000000000
--- a/src/gallium/auxiliary/util/u_format.h
+++ /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
index 519a541e380..00000000000
--- a/src/gallium/auxiliary/util/u_format_bptc.c
+++ /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
index eaf3ec396ab..00000000000
--- a/src/gallium/auxiliary/util/u_format_bptc.h
+++ /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
index cc0a6ae5a86..00000000000
--- a/src/gallium/auxiliary/util/u_format_etc.c
+++ /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
index 30c3dcb920d..00000000000
--- a/src/gallium/auxiliary/util/u_format_etc.h
+++ /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
index f145081d56d..00000000000
--- a/src/gallium/auxiliary/util/u_format_latc.c
+++ /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
index 1f08887533d..00000000000
--- a/src/gallium/auxiliary/util/u_format_latc.h
+++ /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
index 213cb9fd941..00000000000
--- a/src/gallium/auxiliary/util/u_format_other.c
+++ /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
index 2f6a908bbe8..00000000000
--- a/src/gallium/auxiliary/util/u_format_other.h
+++ /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
index 6f058475bfe..00000000000
--- a/src/gallium/auxiliary/util/u_format_pack.py
+++ /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 <[email protected]>
- */
-'''
-
-
-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
index 541ae69d4dc..00000000000
--- a/src/gallium/auxiliary/util/u_format_parse.py
+++ /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
index 0b98c01a922..00000000000
--- a/src/gallium/auxiliary/util/u_format_rgtc.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/**************************************************************************
- *
- * Copyright (C) 2011 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include <stdio.h>
-#include "u_format.h"
-#include "u_format_rgtc.h"
-#include "util/u_math.h"
-#include "util/rgtc.h"
-
-void
-util_format_rgtc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
- dst[1] = 0;
- dst[2] = 0;
- dst[3] = 255;
-}
-
-void
-util_format_rgtc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- const unsigned bw = 4, bh = 4, comps = 4;
- unsigned x, y, i, j;
- unsigned block_size = 8;
-
- for(y = 0; y < height; y += bh) {
- const uint8_t *src = src_row;
- for(x = 0; x < width; x += bw) {
- for(j = 0; j < bh; ++j) {
- for(i = 0; i < bw; ++i) {
- uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
- util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
- dst[1] = 0;
- dst[2] = 0;
- dst[3] = 255;
- }
- }
- src += block_size;
- }
- src_row += src_stride;
- }
-}
-
-void
-util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row,
- unsigned src_stride, unsigned width, unsigned height)
-{
- const unsigned bw = 4, bh = 4, bytes_per_block = 8;
- unsigned x, y, i, j;
-
- for(y = 0; y < height; y += bh) {
- uint8_t *dst = dst_row;
- for(x = 0; x < width; x += bw) {
- uint8_t tmp[4][4]; /* [bh][bw][comps] */
- for(j = 0; j < bh; ++j) {
- for(i = 0; i < bw; ++i) {
- tmp[j][i] = src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4];
- }
- }
- util_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
- dst += bytes_per_block;
- }
- dst_row += dst_stride / sizeof(*dst_row);
- }
-}
-
-void
-util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- unsigned x, y, i, j;
- int block_size = 8;
- for(y = 0; y < height; y += 4) {
- const uint8_t *src = src_row;
- for(x = 0; x < width; x += 4) {
- for(j = 0; j < 4; ++j) {
- for(i = 0; i < 4; ++i) {
- float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
- uint8_t tmp_r;
- util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
- dst[0] = ubyte_to_float(tmp_r);
- dst[1] = 0.0;
- dst[2] = 0.0;
- dst[3] = 1.0;
- }
- }
- src += block_size;
- }
- src_row += src_stride;
- }
-}
-
-void
-util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- const unsigned bw = 4, bh = 4, bytes_per_block = 8;
- unsigned x, y, i, j;
-
- for(y = 0; y < height; y += bh) {
- uint8_t *dst = dst_row;
- for(x = 0; x < width; x += bw) {
- uint8_t tmp[4][4]; /* [bh][bw][comps] */
- for(j = 0; j < bh; ++j) {
- for(i = 0; i < bw; ++i) {
- tmp[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
- }
- }
- util_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
- dst += bytes_per_block;
- }
- dst_row += dst_stride / sizeof(*dst_row);
- }
-}
-
-void
-util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp_r;
- util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
- dst[0] = ubyte_to_float(tmp_r);
- dst[1] = 0.0;
- dst[2] = 0.0;
- dst[3] = 1.0;
-}
-
-void
-util_format_rgtc1_snorm_fetch_rgba_8unorm(UNUSED uint8_t *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j)
-{
- fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc1_snorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height)
-{
- fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc1_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height)
-{
- fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- const unsigned bw = 4, bh = 4, bytes_per_block = 8;
- unsigned x, y, i, j;
-
- for(y = 0; y < height; y += bh) {
- int8_t *dst = (int8_t *)dst_row;
- for(x = 0; x < width; x += bw) {
- int8_t tmp[4][4]; /* [bh][bw][comps] */
- for(j = 0; j < bh; ++j) {
- for(i = 0; i < bw; ++i) {
- tmp[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
- }
- }
- util_format_signed_encode_rgtc_ubyte(dst, tmp, 4, 4);
- dst += bytes_per_block;
- }
- dst_row += dst_stride / sizeof(*dst_row);
- }
-}
-
-void
-util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- unsigned x, y, i, j;
- int block_size = 8;
- for(y = 0; y < height; y += 4) {
- const int8_t *src = (int8_t *)src_row;
- for(x = 0; x < width; x += 4) {
- for(j = 0; j < 4; ++j) {
- for(i = 0; i < 4; ++i) {
- float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
- int8_t tmp_r;
- util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
- dst[0] = byte_to_float_tex(tmp_r);
- dst[1] = 0.0;
- dst[2] = 0.0;
- dst[3] = 1.0;
- }
- }
- src += block_size;
- }
- src_row += src_stride;
- }
-}
-
-void
-util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- int8_t tmp_r;
- util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
- dst[0] = byte_to_float_tex(tmp_r);
- dst[1] = 0.0;
- dst[2] = 0.0;
- dst[3] = 1.0;
-}
-
-
-void
-util_format_rgtc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
- util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2);
- dst[2] = 0;
- dst[3] = 255;
-}
-
-void
-util_format_rgtc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- const unsigned bw = 4, bh = 4, comps = 4;
- unsigned x, y, i, j;
- unsigned block_size = 16;
-
- for(y = 0; y < height; y += bh) {
- const uint8_t *src = src_row;
- for(x = 0; x < width; x += bw) {
- for(j = 0; j < bh; ++j) {
- for(i = 0; i < bw; ++i) {
- uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
- util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2);
- util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2);
- dst[2] = 0;
- dst[3] = 255;
- }
- }
- src += block_size;
- }
- src_row += src_stride;
- }
-}
-
-void
-util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- const unsigned bw = 4, bh = 4, bytes_per_block = 16;
- unsigned x, y, i, j;
-
- for(y = 0; y < height; y += bh) {
- uint8_t *dst = dst_row;
- for(x = 0; x < width; x += bw) {
- uint8_t tmp_r[4][4]; /* [bh][bw] */
- uint8_t tmp_g[4][4]; /* [bh][bw] */
- for(j = 0; j < bh; ++j) {
- for(i = 0; i < bw; ++i) {
- tmp_r[j][i] = src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4];
- tmp_g[j][i] = src_row[((y + j)*src_stride/sizeof(*src_row) + (x + i)*4) + 1];
- }
- }
- util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
- util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
- dst += bytes_per_block;
- }
- dst_row += dst_stride / sizeof(*dst_row);
- }
-}
-
-void
-util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off)
-{
- const unsigned bw = 4, bh = 4, bytes_per_block = 16;
- unsigned x, y, i, j;
-
- for(y = 0; y < height; y += bh) {
- uint8_t *dst = dst_row;
- for(x = 0; x < width; x += bw) {
- uint8_t tmp_r[4][4]; /* [bh][bw][comps] */
- uint8_t tmp_g[4][4]; /* [bh][bw][comps] */
- for(j = 0; j < bh; ++j) {
- for(i = 0; i < bw; ++i) {
- tmp_r[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
- tmp_g[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
- }
- }
- util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
- util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
- dst += bytes_per_block;
- }
- dst_row += dst_stride / sizeof(*dst_row);
- }
-}
-
-void
-util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_rxtc2_unorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height, 1);
-}
-
-void
-util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- unsigned x, y, i, j;
- int block_size = 16;
- for(y = 0; y < height; y += 4) {
- const uint8_t *src = src_row;
- for(x = 0; x < width; x += 4) {
- for(j = 0; j < 4; ++j) {
- for(i = 0; i < 4; ++i) {
- float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
- uint8_t tmp_r, tmp_g;
- util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
- util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
- dst[0] = ubyte_to_float(tmp_r);
- dst[1] = ubyte_to_float(tmp_g);
- dst[2] = 0.0;
- dst[3] = 1.0;
- }
- }
- src += block_size;
- }
- src_row += src_stride;
- }
-}
-
-void
-util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp_r, tmp_g;
- util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
- util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
- dst[0] = ubyte_to_float(tmp_r);
- dst[1] = ubyte_to_float(tmp_g);
- dst[2] = 0.0;
- dst[3] = 1.0;
-}
-
-
-void
-util_format_rgtc2_snorm_fetch_rgba_8unorm(UNUSED uint8_t *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j)
-{
- fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc2_snorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height)
-{
- fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc2_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height)
-{
- fprintf(stderr,"%s\n", __func__);
-}
-
-void
-util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- unsigned x, y, i, j;
- int block_size = 16;
- for(y = 0; y < height; y += 4) {
- const int8_t *src = (int8_t *)src_row;
- for(x = 0; x < width; x += 4) {
- for(j = 0; j < 4; ++j) {
- for(i = 0; i < 4; ++i) {
- float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
- int8_t tmp_r, tmp_g;
- util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
- util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
- dst[0] = byte_to_float_tex(tmp_r);
- dst[1] = byte_to_float_tex(tmp_g);
- dst[2] = 0.0;
- dst[3] = 1.0;
- }
- }
- src += block_size;
- }
- src_row += src_stride;
- }
-}
-
-void
-util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off)
-{
- const unsigned bw = 4, bh = 4, bytes_per_block = 16;
- unsigned x, y, i, j;
-
- for(y = 0; y < height; y += bh) {
- int8_t *dst = (int8_t *)dst_row;
- for(x = 0; x < width; x += bw) {
- int8_t tmp_r[4][4]; /* [bh][bw][comps] */
- int8_t tmp_g[4][4]; /* [bh][bw][comps] */
- for(j = 0; j < bh; ++j) {
- for(i = 0; i < bw; ++i) {
- tmp_r[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
- tmp_g[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
- }
- }
- util_format_signed_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
- util_format_signed_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
- dst += bytes_per_block;
- }
- dst_row += dst_stride / sizeof(*dst_row);
- }
-}
-
-void
-util_format_rgtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_rxtc2_snorm_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height, 1);
-}
-
-void
-util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- int8_t tmp_r, tmp_g;
- util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
- util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
- dst[0] = byte_to_float_tex(tmp_r);
- dst[1] = byte_to_float_tex(tmp_g);
- dst[2] = 0.0;
- dst[3] = 1.0;
-}
-
diff --git a/src/gallium/auxiliary/util/u_format_rgtc.h b/src/gallium/auxiliary/util/u_format_rgtc.h
deleted file mode 100644
index 67ac4728e56..00000000000
--- a/src/gallium/auxiliary/util/u_format_rgtc.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2011 Red Hat Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-#ifndef U_FORMAT_RGTC_H_
-#define U_FORMAT_RGTC_H_
-
-void
-util_format_rgtc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_rgtc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-
-void
-util_format_rgtc1_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_rgtc1_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-void
-util_format_rgtc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_rgtc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off);
-
-void
-util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-void
-util_format_rgtc2_snorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_rgtc2_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off);
-
-void
-util_format_rgtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-#endif
diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c
deleted file mode 100644
index 69ca62a961c..00000000000
--- a/src/gallium/auxiliary/util/u_format_s3tc.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/**************************************************************************
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- * Copyright (c) 2008 VMware, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "u_dl.h"
-#include "u_format.h"
-#include "u_format_s3tc.h"
-#include "util/format_srgb.h"
-#include "util/u_math.h"
-#include "../../../mesa/main/texcompress_s3tc_tmp.h"
-
-
-util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgb_dxt1;
-util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1;
-util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3;
-util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;
-
-util_format_dxtn_pack_t util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;
-
-
-/*
- * Pixel fetch.
- */
-
-void
-util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- util_format_dxt1_rgb_fetch(0, src, i, j, dst);
-}
-
-void
-util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- util_format_dxt1_rgba_fetch(0, src, i, j, dst);
-}
-
-void
-util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- util_format_dxt3_rgba_fetch(0, src, i, j, dst);
-}
-
-void
-util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- util_format_dxt5_rgba_fetch(0, src, i, j, dst);
-}
-
-void
-util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
- dst[0] = ubyte_to_float(tmp[0]);
- dst[1] = ubyte_to_float(tmp[1]);
- dst[2] = ubyte_to_float(tmp[2]);
- dst[3] = 1.0;
-}
-
-void
-util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
- dst[0] = ubyte_to_float(tmp[0]);
- dst[1] = ubyte_to_float(tmp[1]);
- dst[2] = ubyte_to_float(tmp[2]);
- dst[3] = ubyte_to_float(tmp[3]);
-}
-
-void
-util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
- dst[0] = ubyte_to_float(tmp[0]);
- dst[1] = ubyte_to_float(tmp[1]);
- dst[2] = ubyte_to_float(tmp[2]);
- dst[3] = ubyte_to_float(tmp[3]);
-}
-
-void
-util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
- dst[0] = ubyte_to_float(tmp[0]);
- dst[1] = ubyte_to_float(tmp[1]);
- dst[2] = ubyte_to_float(tmp[2]);
- dst[3] = ubyte_to_float(tmp[3]);
-}
-
-
-/*
- * Block decompression.
- */
-
-static inline void
-util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height,
- util_format_dxtn_fetch_t fetch,
- unsigned block_size, boolean srgb)
-{
- const unsigned bw = 4, bh = 4, comps = 4;
- unsigned x, y, i, j;
- for(y = 0; y < height; y += bh) {
- const uint8_t *src = src_row;
- for(x = 0; x < width; x += bw) {
- for(j = 0; j < bh; ++j) {
- for(i = 0; i < bw; ++i) {
- uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
- fetch(0, src, i, j, dst);
- if (srgb) {
- dst[0] = util_format_srgb_to_linear_8unorm(dst[0]);
- dst[1] = util_format_srgb_to_linear_8unorm(dst[1]);
- dst[2] = util_format_srgb_to_linear_8unorm(dst[2]);
- }
- }
- }
- src += block_size;
- }
- src_row += src_stride;
- }
-}
-
-void
-util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt1_rgb_fetch,
- 8, FALSE);
-}
-
-void
-util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt1_rgba_fetch,
- 8, FALSE);
-}
-
-void
-util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt3_rgba_fetch,
- 16, FALSE);
-}
-
-void
-util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt5_rgba_fetch,
- 16, FALSE);
-}
-
-static inline void
-util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height,
- util_format_dxtn_fetch_t fetch,
- unsigned block_size, boolean srgb)
-{
- unsigned x, y, i, j;
- for(y = 0; y < height; y += 4) {
- const uint8_t *src = src_row;
- for(x = 0; x < width; x += 4) {
- for(j = 0; j < 4; ++j) {
- for(i = 0; i < 4; ++i) {
- float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
- uint8_t tmp[4];
- fetch(0, src, i, j, tmp);
- if (srgb) {
- dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
- dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
- dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
- }
- else {
- dst[0] = ubyte_to_float(tmp[0]);
- dst[1] = ubyte_to_float(tmp[1]);
- dst[2] = ubyte_to_float(tmp[2]);
- }
- dst[3] = ubyte_to_float(tmp[3]);
- }
- }
- src += block_size;
- }
- src_row += src_stride;
- }
-}
-
-void
-util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt1_rgb_fetch,
- 8, FALSE);
-}
-
-void
-util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt1_rgba_fetch,
- 8, FALSE);
-}
-
-void
-util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt3_rgba_fetch,
- 16, FALSE);
-}
-
-void
-util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt5_rgba_fetch,
- 16, FALSE);
-}
-
-
-/*
- * Block compression.
- */
-
-static inline void
-util_format_dxtn_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src, unsigned src_stride,
- unsigned width, unsigned height,
- enum util_format_dxtn format,
- unsigned block_size, boolean srgb)
-{
- const unsigned bw = 4, bh = 4, comps = 4;
- unsigned x, y, i, j, k;
- for(y = 0; y < height; y += bh) {
- uint8_t *dst = dst_row;
- for(x = 0; x < width; x += bw) {
- uint8_t tmp[4][4][4]; /* [bh][bw][comps] */
- for(j = 0; j < bh; ++j) {
- for(i = 0; i < bw; ++i) {
- uint8_t src_tmp;
- for(k = 0; k < 3; ++k) {
- src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + k];
- if (srgb) {
- tmp[j][i][k] = util_format_linear_to_srgb_8unorm(src_tmp);
- }
- else {
- tmp[j][i][k] = src_tmp;
- }
- }
- /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
- tmp[j][i][3] = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + 3];
- }
- }
- /* even for dxt1_rgb have 4 src comps */
- util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
- dst += block_size;
- }
- dst_row += dst_stride / sizeof(*dst_row);
- }
-
-}
-
-void
-util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
- width, height, UTIL_FORMAT_DXT1_RGB,
- 8, FALSE);
-}
-
-void
-util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
- width, height, UTIL_FORMAT_DXT1_RGBA,
- 8, FALSE);
-}
-
-void
-util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
- width, height, UTIL_FORMAT_DXT3_RGBA,
- 16, FALSE);
-}
-
-void
-util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
- width, height, UTIL_FORMAT_DXT5_RGBA,
- 16, FALSE);
-}
-
-static inline void
-util_format_dxtn_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src, unsigned src_stride,
- unsigned width, unsigned height,
- enum util_format_dxtn format,
- unsigned block_size, boolean srgb)
-{
- unsigned x, y, i, j, k;
- for(y = 0; y < height; y += 4) {
- uint8_t *dst = dst_row;
- for(x = 0; x < width; x += 4) {
- uint8_t tmp[4][4][4];
- for(j = 0; j < 4; ++j) {
- for(i = 0; i < 4; ++i) {
- float src_tmp;
- for(k = 0; k < 3; ++k) {
- src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k];
- if (srgb) {
- tmp[j][i][k] = util_format_linear_float_to_srgb_8unorm(src_tmp);
- }
- else {
- tmp[j][i][k] = float_to_ubyte(src_tmp);
- }
- }
- /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
- src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + 3];
- tmp[j][i][3] = float_to_ubyte(src_tmp);
- }
- }
- util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
- dst += block_size;
- }
- dst_row += 4*dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
- width, height, UTIL_FORMAT_DXT1_RGB,
- 8, FALSE);
-}
-
-void
-util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
- width, height, UTIL_FORMAT_DXT1_RGBA,
- 8, FALSE);
-}
-
-void
-util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
- width, height, UTIL_FORMAT_DXT3_RGBA,
- 16, FALSE);
-}
-
-void
-util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
- width, height, UTIL_FORMAT_DXT5_RGBA,
- 16, FALSE);
-}
-
-
-/*
- * SRGB variants.
- */
-
-void
-util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
- dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
- dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
- dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
- dst[3] = 255;
-}
-
-void
-util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
- dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
- dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
- dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
- dst[3] = tmp[3];
-}
-
-void
-util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
- dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
- dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
- dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
- dst[3] = tmp[3];
-}
-
-void
-util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
- dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
- dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
- dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
- dst[3] = tmp[3];
-}
-
-void
-util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
- dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
- dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
- dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
- dst[3] = 1.0f;
-}
-
-void
-util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
- dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
- dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
- dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
- dst[3] = ubyte_to_float(tmp[3]);
-}
-
-void
-util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
- dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
- dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
- dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
- dst[3] = ubyte_to_float(tmp[3]);
-}
-
-void
-util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-{
- uint8_t tmp[4];
- util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
- dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
- dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
- dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
- dst[3] = ubyte_to_float(tmp[3]);
-}
-
-void
-util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt1_rgb_fetch,
- 8, TRUE);
-}
-
-void
-util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt1_rgba_fetch,
- 8, TRUE);
-}
-
-void
-util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt3_rgba_fetch,
- 16, TRUE);
-}
-
-void
-util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt5_rgba_fetch,
- 16, TRUE);
-}
-
-void
-util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt1_rgb_fetch,
- 8, TRUE);
-}
-
-void
-util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt1_rgba_fetch,
- 8, TRUE);
-}
-
-void
-util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt3_rgba_fetch,
- 16, TRUE);
-}
-
-void
-util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
- src_row, src_stride,
- width, height,
- util_format_dxt5_rgba_fetch,
- 16, TRUE);
-}
-
-void
-util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
- width, height, UTIL_FORMAT_DXT1_RGB,
- 8, TRUE);
-}
-
-void
-util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
- width, height, UTIL_FORMAT_DXT1_RGBA,
- 8, TRUE);
-}
-
-void
-util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
- width, height, UTIL_FORMAT_DXT3_RGBA,
- 16, TRUE);
-}
-
-void
-util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
- width, height, UTIL_FORMAT_DXT5_RGBA,
- 16, TRUE);
-}
-
-void
-util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
- width, height, UTIL_FORMAT_DXT1_RGB,
- 8, TRUE);
-}
-
-void
-util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
- width, height, UTIL_FORMAT_DXT1_RGBA,
- 8, TRUE);
-}
-
-void
-util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
- width, height, UTIL_FORMAT_DXT3_RGBA,
- 16, TRUE);
-}
-
-void
-util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
- width, height, UTIL_FORMAT_DXT5_RGBA,
- 16, TRUE);
-}
-
diff --git a/src/gallium/auxiliary/util/u_format_s3tc.h b/src/gallium/auxiliary/util/u_format_s3tc.h
deleted file mode 100644
index 6f188c67f95..00000000000
--- a/src/gallium/auxiliary/util/u_format_s3tc.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#ifndef U_FORMAT_S3TC_H_
-#define U_FORMAT_S3TC_H_
-
-
-#include "pipe/p_compiler.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum util_format_dxtn {
- UTIL_FORMAT_DXT1_RGB = 0x83F0,
- UTIL_FORMAT_DXT1_RGBA = 0x83F1,
- UTIL_FORMAT_DXT3_RGBA = 0x83F2,
- UTIL_FORMAT_DXT5_RGBA = 0x83F3
-};
-
-
-typedef void
-(*util_format_dxtn_fetch_t)( int src_stride,
- const uint8_t *src,
- int col, int row,
- uint8_t *dst );
-
-typedef void
-(*util_format_dxtn_pack_t)( int src_comps,
- int width, int height,
- const uint8_t *src,
- enum util_format_dxtn dst_format,
- uint8_t *dst,
- int dst_stride);
-
-extern util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch;
-extern util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch;
-extern util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch;
-extern util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch;
-
-extern util_format_dxtn_pack_t util_format_dxtn_pack;
-
-
-void
-util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
-
-
-void
-util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-void
-util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* U_FORMAT_S3TC_H_ */
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
deleted file mode 100644
index 2bc82c36f42..00000000000
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ /dev/null
@@ -1,233 +0,0 @@
-from __future__ import print_function
-
-CopyRight = '''
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-'''
-
-
-import sys
-
-from u_format_parse import *
-import u_format_pack
-
-
-def layout_map(layout):
- return 'UTIL_FORMAT_LAYOUT_' + str(layout).upper()
-
-
-def colorspace_map(colorspace):
- return 'UTIL_FORMAT_COLORSPACE_' + str(colorspace).upper()
-
-
-colorspace_channels_map = {
- 'rgb': ['r', 'g', 'b', 'a'],
- 'srgb': ['sr', 'sg', 'sb', 'a'],
- 'zs': ['z', 's'],
- 'yuv': ['y', 'u', 'v'],
-}
-
-
-type_map = {
- VOID: "UTIL_FORMAT_TYPE_VOID",
- UNSIGNED: "UTIL_FORMAT_TYPE_UNSIGNED",
- SIGNED: "UTIL_FORMAT_TYPE_SIGNED",
- FIXED: "UTIL_FORMAT_TYPE_FIXED",
- FLOAT: "UTIL_FORMAT_TYPE_FLOAT",
-}
-
-
-def bool_map(value):
- if value:
- return "TRUE"
- else:
- return "FALSE"
-
-
-swizzle_map = {
- SWIZZLE_X: "PIPE_SWIZZLE_X",
- SWIZZLE_Y: "PIPE_SWIZZLE_Y",
- SWIZZLE_Z: "PIPE_SWIZZLE_Z",
- SWIZZLE_W: "PIPE_SWIZZLE_W",
- SWIZZLE_0: "PIPE_SWIZZLE_0",
- SWIZZLE_1: "PIPE_SWIZZLE_1",
- SWIZZLE_NONE: "PIPE_SWIZZLE_NONE",
-}
-
-
-def write_format_table(formats):
- print('/* This file is autogenerated by u_format_table.py from u_format.csv. Do not edit directly. */')
- print()
- # This will print the copyright message on the top of this file
- print(CopyRight.strip())
- print()
- print('#include "u_format.h"')
- print('#include "u_format_bptc.h"')
- print('#include "u_format_s3tc.h"')
- print('#include "u_format_rgtc.h"')
- print('#include "u_format_latc.h"')
- print('#include "u_format_etc.h"')
- print()
-
- u_format_pack.generate(formats)
-
- def do_channel_array(channels, swizzles):
- print(" {")
- for i in range(4):
- channel = channels[i]
- if i < 3:
- sep = ","
- else:
- sep = ""
- if channel.size:
- print(" {%s, %s, %s, %u, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), channel.size, channel.shift, sep, "xyzw"[i], channel.name))
- else:
- print(" {0, 0, 0, 0, 0}%s" % (sep,))
- print(" },")
-
- def do_swizzle_array(channels, swizzles):
- print(" {")
- for i in range(4):
- swizzle = swizzles[i]
- if i < 3:
- sep = ","
- else:
- sep = ""
- try:
- comment = colorspace_channels_map[format.colorspace][i]
- except (KeyError, IndexError):
- comment = 'ignored'
- print(" %s%s\t/* %s */" % (swizzle_map[swizzle], sep, comment))
- print(" },")
-
- for format in formats:
- print('const struct util_format_description')
- print('util_format_%s_description = {' % (format.short_name(),))
- print(" %s," % (format.name,))
- print(" \"%s\"," % (format.name,))
- print(" \"%s\"," % (format.short_name(),))
- print(" {%u, %u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_depth, format.block_size()))
- print(" %s," % (layout_map(format.layout),))
- print(" %u,\t/* nr_channels */" % (format.nr_channels(),))
- print(" %s,\t/* is_array */" % (bool_map(format.is_array()),))
- print(" %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),))
- print(" %s,\t/* is_mixed */" % (bool_map(format.is_mixed()),))
- print(" %s,\t/* is_unorm */" % (bool_map(format.is_unorm()),))
- print(" %s,\t/* is_snorm */" % (bool_map(format.is_snorm()),))
- u_format_pack.print_channels(format, do_channel_array)
- u_format_pack.print_channels(format, do_swizzle_array)
- print(" %s," % (colorspace_map(format.colorspace),))
- access = True
- if format.layout in ('astc', 'atc', 'fxt1'):
- access = False
- if format.layout == 'etc' and format.short_name() != 'etc1_rgb8':
- access = False
- if format.colorspace != ZS and not format.is_pure_color() and access:
- print(" &util_format_%s_unpack_rgba_8unorm," % format.short_name())
- print(" &util_format_%s_pack_rgba_8unorm," % format.short_name())
- if format.layout == 's3tc' or format.layout == 'rgtc':
- print(" &util_format_%s_fetch_rgba_8unorm," % format.short_name())
- else:
- print(" NULL, /* fetch_rgba_8unorm */")
- print(" &util_format_%s_unpack_rgba_float," % format.short_name())
- print(" &util_format_%s_pack_rgba_float," % format.short_name())
- print(" &util_format_%s_fetch_rgba_float," % format.short_name())
- else:
- print(" NULL, /* unpack_rgba_8unorm */")
- print(" NULL, /* pack_rgba_8unorm */")
- print(" NULL, /* fetch_rgba_8unorm */")
- print(" NULL, /* unpack_rgba_float */")
- print(" NULL, /* pack_rgba_float */")
- print(" NULL, /* fetch_rgba_float */")
- if format.has_depth():
- print(" &util_format_%s_unpack_z_32unorm," % format.short_name())
- print(" &util_format_%s_pack_z_32unorm," % format.short_name())
- print(" &util_format_%s_unpack_z_float," % format.short_name())
- print(" &util_format_%s_pack_z_float," % format.short_name())
- else:
- print(" NULL, /* unpack_z_32unorm */")
- print(" NULL, /* pack_z_32unorm */")
- print(" NULL, /* unpack_z_float */")
- print(" NULL, /* pack_z_float */")
- if format.has_stencil():
- print(" &util_format_%s_unpack_s_8uint," % format.short_name())
- print(" &util_format_%s_pack_s_8uint," % format.short_name())
- else:
- print(" NULL, /* unpack_s_8uint */")
- print(" NULL, /* pack_s_8uint */")
- if format.is_pure_unsigned():
- print(" &util_format_%s_unpack_unsigned, /* unpack_rgba_uint */" % format.short_name())
- print(" &util_format_%s_pack_unsigned, /* pack_rgba_uint */" % format.short_name())
- print(" &util_format_%s_unpack_signed, /* unpack_rgba_sint */" % format.short_name())
- print(" &util_format_%s_pack_signed, /* pack_rgba_sint */" % format.short_name())
- print(" &util_format_%s_fetch_unsigned, /* fetch_rgba_uint */" % format.short_name())
- print(" NULL /* fetch_rgba_sint */")
- elif format.is_pure_signed():
- print(" &util_format_%s_unpack_unsigned, /* unpack_rgba_uint */" % format.short_name())
- print(" &util_format_%s_pack_unsigned, /* pack_rgba_uint */" % format.short_name())
- print(" &util_format_%s_unpack_signed, /* unpack_rgba_sint */" % format.short_name())
- print(" &util_format_%s_pack_signed, /* pack_rgba_sint */" % format.short_name())
- print(" NULL, /* fetch_rgba_uint */")
- print(" &util_format_%s_fetch_signed /* fetch_rgba_sint */" % format.short_name())
- else:
- print(" NULL, /* unpack_rgba_uint */")
- print(" NULL, /* pack_rgba_uint */")
- print(" NULL, /* unpack_rgba_sint */")
- print(" NULL, /* pack_rgba_sint */")
- print(" NULL, /* fetch_rgba_uint */")
- print(" NULL /* fetch_rgba_sint */")
- print("};")
- print()
-
- print("const struct util_format_description *")
- print("util_format_description(enum pipe_format format)")
- print("{")
- print(" if (format >= PIPE_FORMAT_COUNT) {")
- print(" return NULL;")
- print(" }")
- print()
- print(" switch (format) {")
- for format in formats:
- print(" case %s:" % format.name)
- print(" return &util_format_%s_description;" % (format.short_name(),))
- print(" default:")
- print(" return NULL;")
- print(" }")
- print("}")
- print()
-
-
-def main():
-
- formats = []
- for arg in sys.argv[1:]:
- formats.extend(parse(arg))
- write_format_table(formats)
-
-
-if __name__ == '__main__':
- main()
diff --git a/src/gallium/auxiliary/util/u_format_tests.c b/src/gallium/auxiliary/util/u_format_tests.c
deleted file mode 100644
index 94bea2363d0..00000000000
--- a/src/gallium/auxiliary/util/u_format_tests.c
+++ /dev/null
@@ -1,1034 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009-2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include <math.h>
-#include <float.h>
-
-#include "pipe/p_config.h"
-#include "util/u_memory.h"
-#include "u_format_tests.h"
-
-
-/*
- * Helper macros to create the packed bytes for longer words.
- */
-
-#define PACKED_1x8(x) {x, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_2x8(x, y) {x, y, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_3x8(x, y, z) {x, y, z, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_4x8(x, y, z, w) {x, y, z, w, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_8x8(a, b, c, d, e, f, g, h) {a, b, c, d, e, f, g, h, 0, 0, 0, 0, 0, 0, 0, 0}
-
-#define PACKED_1x16(x) {(x) & 0xff, (x) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_2x16(x, y) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_3x16(x, y, z) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_4x16(x, y, z, w) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, (w) & 0xff, (w) >> 8, 0, 0, 0, 0, 0, 0, 0, 0}
-
-#define PACKED_1x32(x) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_2x32(x, y) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_3x32(x, y, z) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, 0, 0, 0, 0}
-#define PACKED_4x32(x, y, z, w) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, (w) & 0xff, ((w) >> 8) & 0xff, ((w) >> 16) & 0xff, (w) >> 24}
-
-#define UNPACKED_1x1(r, g, b, a) \
- {{{r, g, b, a}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
- {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
- {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
- {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}}
-
-#define UNPACKED_2x1(r0, g0, b0, a0, r1, g1, b1, a1) \
- {{{r0, g0, b0, a0}, {r1, g1, b1, a1}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
- {{ 0, 0, 0, 0}, { 0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
- {{ 0, 0, 0, 0}, { 0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
- {{ 0, 0, 0, 0}, { 0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}}
-
-
-/**
- * Test cases.
- *
- * These were manually entered. We could generate these
- *
- * To keep this to a we cover only the corner cases, which should produce
- * good enough coverage since that pixel format transformations are afine for
- * non SRGB formats.
- */
-const struct util_format_test_case
-util_format_test_cases[] =
-{
-
- /*
- * 32-bit rendertarget formats
- */
-
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_UNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3fffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B10G10R10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- /*
- * 16-bit rendertarget formats
- */
-
- {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x03e0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x7c00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x7fff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x03e0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0x003e), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0x07c0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0xf800), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X1B5G5R5_UNORM, PACKED_1x16(0xfffe), PACKED_1x16(0xfffe), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x003e), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x07c0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf800), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0001), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_A1B5G5R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x000f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x00f0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x0f00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B4G4R4X4_UNORM, PACKED_1x16(0x0fff), PACKED_1x16(0x0fff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00f0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0f00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x07e0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf800), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- /*
- * Luminance/intensity/alpha formats
- */
-
- {PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x0f), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
- {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xf0), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_L4A4_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00ff), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
- {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xff00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- /*
- * SRGB formats
- */
-
- {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xbc), UNPACKED_1x1(0.502886458033, 0.502886458033, 0.502886458033, 1.0)},
- {PIPE_FORMAT_L8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xbc), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8_SRGB, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0x00bc), UNPACKED_1x1(0.502886458033, 0.502886458033, 0.502886458033, 0.0)},
- {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0x00ff), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
- {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0xcc00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
- {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0xff00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_L8A8_SRGB, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xbc, 0x00, 0x00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xbc, 0x00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xbc), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
- {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SRGB, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xbc, 0x00, 0x00, 0x00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xbc, 0x00, 0x00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xbc, 0x00), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xcc), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
- {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8A8_SRGB, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000bc), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xcc000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
- {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8A8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000bc), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_B8G8R8X8_SRGB, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000cc), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
- {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_A8R8G8B8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_X8R8G8B8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000cc), UNPACKED_1x1(0.0, 0.0, 0.0, 0.8)},
- {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_A8B8G8R8_SRGB, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000bc00), UNPACKED_1x1(0.0, 0.0, 0.502886458033, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00bc0000), UNPACKED_1x1(0.0, 0.502886458033, 0.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xbc000000), UNPACKED_1x1(0.502886458033, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_X8B8G8R8_SRGB, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- /*
- * Mixed-signed formats
- */
-
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x81, 0x00, 0x00, 0x00), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x81, 0x00, 0x00), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000001ff), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000201), UNPACKED_1x1(-1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0007fc00), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00080400), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x1ff00000), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x20100000), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
- {PIPE_FORMAT_R10SG10SB10SA2U_NORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0011), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x01e0), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0220), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x81, 0x00), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8Bx_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x81), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
-
- /*
- * Depth-stencil formats
- */
-
- {PIPE_FORMAT_S8_UINT, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_S8_UINT, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(0.0, 255.0, 0.0, 0.0)},
-
- {PIPE_FORMAT_Z16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_Z16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-
- {PIPE_FORMAT_Z32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_Z32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-
- {PIPE_FORMAT_Z32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_Z32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x3f800000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-
- {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 255.0, 0.0, 0.0)},
- {PIPE_FORMAT_Z24_UNORM_S8_UINT, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 255.0, 0.0, 0.0)},
-
- {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 255.0, 0.0, 0.0)},
- {PIPE_FORMAT_S8_UINT_Z24_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 255.0, 0.0, 0.0)},
-
- {PIPE_FORMAT_Z24X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_Z24X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-
- {PIPE_FORMAT_X8Z24_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_X8Z24_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
-
- {PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, PACKED_2x32(0xffffffff, 0x000000ff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, PACKED_2x32(0xffffffff, 0x000000ff), PACKED_2x32(0x3f800000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, PACKED_2x32(0xffffffff, 0x000000ff), PACKED_2x32(0x00000000, 0x000000ff), UNPACKED_1x1( 0.0, 255.0, 0.0, 0.0)},
-
- /*
- * YUV formats
- */
-
- {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_2x1(1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_2x1(0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_2x1(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_B8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_2x1(1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_2x1(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
-
- /*
- * TODO: Exercise the UV channels as well.
- */
- {PIPE_FORMAT_UYVY, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x10, 0x80, 0x10), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_UYVY, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0xeb, 0x80, 0x10), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_UYVY, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x10, 0x80, 0xeb), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_YUYV, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x10, 0x80, 0x10, 0x80), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_YUYV, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xeb, 0x80, 0x10, 0x80), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_YUYV, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x10, 0x80, 0xeb, 0x80), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
-
- /*
- * Compressed formats
- */
-
- {
- PIPE_FORMAT_DXT1_RGB,
- PACKED_8x8(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
- PACKED_8x8(0xf2, 0xd7, 0xb0, 0x20, 0xae, 0x2c, 0x6f, 0x97),
- {
- {
- {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
- {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
- {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
- {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0}
- },
- {
- {0xd6/255.0, 0xff/255.0, 0x94/255.0, 0xff/255.0},
- {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
- {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
- {0xd6/255.0, 0xff/255.0, 0x94/255.0, 0xff/255.0}
- },
- {
- {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
- {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
- {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
- {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0}
- },
- {
- {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
- {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0},
- {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0},
- {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0}
- }
- }
- },
- {
- PIPE_FORMAT_DXT1_RGBA,
- PACKED_8x8(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
- PACKED_8x8(0xff, 0x2f, 0xa4, 0x72, 0xeb, 0xb2, 0xbd, 0xbe),
- {
- {
- {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
- {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
- {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
- {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0}
- },
- {
- {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
- {0x29/255.0, 0xff/255.0, 0xff/255.0, 0xff/255.0},
- {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
- {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
- },
- {
- {0x73/255.0, 0x55/255.0, 0x21/255.0, 0xff/255.0},
- {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
- {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
- {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
- },
- {
- {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
- {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
- {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
- {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
- }
- }
- },
- {
- PIPE_FORMAT_DXT3_RGBA,
- {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
- {0xe7, 0x4a, 0x8f, 0x96, 0x5b, 0xc1, 0x1c, 0x84, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a},
- {
- {
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x77/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xee/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xaa/255.0},
- {0x8c/255.0, 0xff/255.0, 0xb5/255.0, 0x44/255.0}
- },
- {
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xff/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x88/255.0},
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x66/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x99/255.0}
- },
- {
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0xbb/255.0},
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x55/255.0},
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x11/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xcc/255.0}
- },
- {
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xcc/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x11/255.0},
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x44/255.0},
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x88/255.0}
- }
- }
- },
- {
- PIPE_FORMAT_DXT5_RGBA,
- {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
- {0xf8, 0x11, 0xc5, 0x0c, 0x9a, 0x73, 0xb4, 0x9c, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a},
- {
- {
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x74/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xf8/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xb6/255.0},
- {0x8c/255.0, 0xff/255.0, 0xb5/255.0, 0x53/255.0}
- },
- {
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xf8/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x95/255.0},
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x53/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x95/255.0}
- },
- {
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0xb6/255.0},
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x53/255.0},
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x11/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xd7/255.0}
- },
- {
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xb6/255.0},
- {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x11/255.0},
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x32/255.0},
- {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x95/255.0}
- }
- }
- },
-
-
- /*
- * Standard 8-bit integer formats
- */
-
- {PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(255.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), UNPACKED_1x1(255.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), UNPACKED_1x1( 0.0, 255.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), UNPACKED_1x1(255.0, 255.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(255.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1( 0.0, 255.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1( 0.0, 0.0, 255.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(255.0, 255.0, 255.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(255.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1( 0.0, 255.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1( 0.0, 0.0, 255.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1( 0.0, 0.0, 0.0, 255.0)},
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(255.0, 255.0, 255.0, 255.0)},
-
- {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x7f), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x81), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x81, 0x00), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x81), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x81, 0x00, 0x00), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x81, 0x00), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x81), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x81, 0x00, 0x00, 0x00), UNPACKED_1x1(-1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x81, 0x00, 0x00), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x81, 0x00), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x81), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
-
- {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x7f), UNPACKED_1x1( 127.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x80), UNPACKED_1x1(-128.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 127.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x80, 0x00), UNPACKED_1x1(-128.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1( 0.0, 127.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x80), UNPACKED_1x1( 0.0, -128.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), UNPACKED_1x1( 127.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x80, 0x00, 0x00), UNPACKED_1x1(-128.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0, 127.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x80, 0x00), UNPACKED_1x1( 0.0, -128.0, 0.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0, 0.0, 127.0, 1.0)},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x80), UNPACKED_1x1( 0.0, 0.0, -128.0, 1.0)},
-
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 127.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x00, 0x00, 0x00), UNPACKED_1x1(-128.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1( 0.0, 127.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x80, 0x00, 0x00), UNPACKED_1x1( 0.0, -128.0, 0.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0, 0.0, 127.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x80, 0x00), UNPACKED_1x1( 0.0, 0.0, -128.0, 0.0)},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0, 0.0, 0.0, 127.0)},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x80), UNPACKED_1x1( 0.0, 0.0, 0.0, -128.0)},
-
- /*
- * Standard 16-bit integer formats
- */
-
- {PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(65535.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), UNPACKED_1x1(65535.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), UNPACKED_1x1( 0.0, 65535.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), UNPACKED_1x1(65535.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), UNPACKED_1x1( 0.0, 65535.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), UNPACKED_1x1( 0.0, 0.0, 65535.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0, 65535.0, 1.0)},
-
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(65535.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 65535.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), UNPACKED_1x1( 0.0, 0.0, 65535.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), UNPACKED_1x1( 0.0, 0.0, 0.0, 65535.0)},
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0, 65535.0, 65535.0)},
-
- {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8001), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8001, 0x0000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8001), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8001, 0x0000, 0x0000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8001, 0x0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8001), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
-
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8001, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( -1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8001, 0x0000, 0x0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8001, 0x0000), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8001), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
-
- {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1( 32767.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x8000), UNPACKED_1x1(-32768.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), UNPACKED_1x1( 32767.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8000, 0x0000), UNPACKED_1x1(-32768.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), UNPACKED_1x1( 0.0, 32767.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8000), UNPACKED_1x1( 0.0, -32768.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), UNPACKED_1x1( 32767.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8000, 0x0000, 0x0000), UNPACKED_1x1(-32768.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), UNPACKED_1x1( 0.0, 32767.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8000, 0x0000), UNPACKED_1x1( 0.0, -32768.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), UNPACKED_1x1( 0.0, 0.0, 32767.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8000), UNPACKED_1x1( 0.0, 0.0, -32768.0, 1.0)},
-
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 32767.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(-32768.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 32767.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, -32768.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), UNPACKED_1x1( 0.0, 0.0, 32767.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8000, 0x0000), UNPACKED_1x1( 0.0, 0.0, -32768.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), UNPACKED_1x1( 0.0, 0.0, 0.0, 32767.0)},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8000), UNPACKED_1x1( 0.0, 0.0, 0.0, -32768.0)},
-
- /*
- * Standard 32-bit integer formats
- *
- * NOTE: We can't accurately represent integers larger than +/-0x1000000
- * with single precision floats, so that's as far as we test.
- */
-
- {PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0x00000000, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xffffffff, 0x00000000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xffffffff, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xffffffff, 0x00000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), UNPACKED_1x1(16777216.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), UNPACKED_1x1(16777216.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1(16777216.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 0.0, 16777216.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0, 16777216.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(16777216.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 16777216.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 16777216.0)},
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x01000000, 0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0, 16777216.0, 16777216.0)},
-
- {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x7fffffff), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x80000001), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x7fffffff, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x80000001, 0x00000000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x7fffffff), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x80000001), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x7fffffff, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x80000001, 0x00000000, 0x00000000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x7fffffff, 0x00000000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x80000001, 0x00000000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x7fffffff), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x80000001), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x7fffffff, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x80000001, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( -1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x7fffffff, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x80000001, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x7fffffff, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x80000001, 0x00000000), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x7fffffff), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x80000001), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
-
- {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), UNPACKED_1x1( 16777216.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(-16777216.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), UNPACKED_1x1( 16777216.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xff000000, 0x00000000), UNPACKED_1x1(-16777216.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xff000000), UNPACKED_1x1( 0.0, -16777216.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1( 16777216.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xff000000, 0x00000000, 0x00000000), UNPACKED_1x1(-16777216.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xff000000, 0x00000000), UNPACKED_1x1( 0.0, -16777216.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 0.0, 16777216.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xff000000), UNPACKED_1x1( 0.0, 0.0, -16777216.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 16777216.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xff000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-16777216.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xff000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -16777216.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 16777216.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xff000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, -16777216.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 16777216.0)},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xff000000), UNPACKED_1x1( 0.0, 0.0, 0.0, -16777216.0)},
-
- /*
- * Standard 32-bit float formats
- */
-
- {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x3f800000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0xbf800000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xbf800000, 0x00000000), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x3f800000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xbf800000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0, 1.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xbf800000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x3f800000, 0x00000000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xbf800000, 0x00000000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x3f800000), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xbf800000), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xbf800000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x3f800000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xbf800000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x3f800000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xbf800000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x3f800000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xbf800000), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0, 1.0, 1.0, 1.0)},
-
- /*
- * Half float formats
- */
-
- /* Minimum positive normal */
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x0400), UNPACKED_1x1( 6.10352E-5, 0.0, 0.0, 1.0)},
-
- /* XXX: Now that we disable denormals this test cases fails, except on
- * IvyBridge processors which have intrinsics dedicated to half-float
- * packing/unpacking. */
-#if 0
- /* Max denormal */
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x03FF), UNPACKED_1x1( 6.09756E-5, 0.0, 0.0, 1.0)},
-#endif
-
- /* Minimum positive denormal */
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x0001), UNPACKED_1x1( 5.96046E-8, 0.0, 0.0, 1.0)},
-
- /* Min representable value */
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfbff), UNPACKED_1x1( -65504.0, 0.0, 0.0, 1.0)},
-
- /* Max representable value */
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7bff), UNPACKED_1x1( 65504.0, 0.0, 0.0, 1.0)},
-
-#if !defined(PIPE_CC_MSVC)
-
- /* NaNs */
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c01), UNPACKED_1x1( NAN, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc01), UNPACKED_1x1( -NAN, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1( NAN, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1( -NAN, 0.0, 0.0, 1.0)},
-
- /* Inf */
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1( INFINITY, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1( -INFINITY, 0.0, 0.0, 1.0)},
-
-#endif
-
- /* Zero, ignore sign */
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0x7fff), PACKED_1x16(0x8000), UNPACKED_1x1( -0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0x7fff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x3c00), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xbc00), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x3c00, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xbc00, 0x0000), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x3c00), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xbc00), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x3c00, 0x3c00), UNPACKED_1x1( 1.0, 1.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x3c00, 0x0000, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xbc00, 0x0000, 0x0000), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x3c00, 0x0000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xbc00, 0x0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x3c00), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xbc00), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
- {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x3c00, 0x3c00, 0x3c00), UNPACKED_1x1( 1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x3c00, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xbc00, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(-1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x3c00, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xbc00, 0x0000, 0x0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x3c00, 0x0000), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xbc00, 0x0000), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
- {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x3c00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xbc00), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
- {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x3c00, 0x3c00, 0x3c00, 0x3c00), UNPACKED_1x1( 1.0, 1.0, 1.0, 1.0)},
-
- /*
- * 32-bit fixed point formats
- */
-
- {PIPE_FORMAT_R32_FIXED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32_FIXED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00010000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32_FIXED, PACKED_1x32(0xffffffff), PACKED_1x32(0xffff0000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00010000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffff0000, 0x00000000), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00010000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xffff0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32_FIXED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00010000, 0x00010000), UNPACKED_1x1( 1.0, 1.0, 0.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00010000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffff0000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00010000, 0x00000000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xffff0000, 0x00000000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00010000), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xffff0000), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
- {PIPE_FORMAT_R32G32B32_FIXED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00010000, 0x00010000, 0x00010000), UNPACKED_1x1( 1.0, 1.0, 1.0, 1.0)},
-
- {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00010000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffff0000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0, 0.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00010000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xffff0000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00010000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xffff0000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
- {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00010000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xffff0000), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
- {PIPE_FORMAT_R32G32B32A32_FIXED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00010000, 0x00010000, 0x00010000, 0x00010000), UNPACKED_1x1( 1.0, 1.0, 1.0, 1.0)},
-
- /*
- * D3D9 specific vertex formats
- */
-
- {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(1023.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1( 0.0, 1023.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1( 0.0, 0.0, 1023.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_USCALED, PACKED_1x32(0x3fffffff), PACKED_1x32(0x3fffffff), UNPACKED_1x1(1023.0, 1023.0, 1023.0, 1.0)},
-
- {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x000001ff), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00000201), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x0007fc00), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x00080400), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x1ff00000), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
- {PIPE_FORMAT_R10G10B10X2_SNORM, PACKED_1x32(0x3fffffff), PACKED_1x32(0x20100000), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
-
- /*
- * Special formats that not fit anywhere else
- */
-
-};
-
-
-const unsigned util_format_nr_test_cases = ARRAY_SIZE(util_format_test_cases);
diff --git a/src/gallium/auxiliary/util/u_format_tests.h b/src/gallium/auxiliary/util/u_format_tests.h
deleted file mode 100644
index d5f0b347bfa..00000000000
--- a/src/gallium/auxiliary/util/u_format_tests.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#ifndef U_FORMAT_TESTS_H_
-#define U_FORMAT_TESTS_H_
-
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_format.h"
-
-
-#define UTIL_FORMAT_MAX_PACKED_BYTES 32 // R64G64B64A64_FLOAT
-#define UTIL_FORMAT_MAX_UNPACKED_WIDTH 12 // ASTC 12x12
-#define UTIL_FORMAT_MAX_UNPACKED_HEIGHT 12
-
-
-/**
- * A (packed, unpacked) color pair.
- */
-struct util_format_test_case
-{
- enum pipe_format format;
-
- /**
- * Mask of the bits that actually meaningful data. Used to mask out the
- * "X" channels.
- */
- uint8_t mask[UTIL_FORMAT_MAX_PACKED_BYTES];
-
- uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
-
- /**
- * RGBA.
- */
- double unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4];
-};
-
-
-extern const struct util_format_test_case
-util_format_test_cases[];
-
-
-extern const unsigned util_format_nr_test_cases;
-
-
-#endif /* U_FORMAT_TESTS_H_ */
diff --git a/src/gallium/auxiliary/util/u_format_yuv.c b/src/gallium/auxiliary/util/u_format_yuv.c
deleted file mode 100644
index e4e66fb9f33..00000000000
--- a/src/gallium/auxiliary/util/u_format_yuv.c
+++ /dev/null
@@ -1,1130 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-/**
- * @file
- * YUV and RGB subsampled formats conversion.
- *
- * @author Jose Fonseca <[email protected]>
- */
-
-
-#include "util/u_debug.h"
-#include "util/u_format_yuv.h"
-
-
-void
-util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- float *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- uint32_t value;
- float r, g0, g1, b;
-
- for (x = 0; x + 1 < width; x += 2) {
- value = util_cpu_to_le32(*src++);
-
- r = ubyte_to_float((value >> 0) & 0xff);
- g0 = ubyte_to_float((value >> 8) & 0xff);
- b = ubyte_to_float((value >> 16) & 0xff);
- g1 = ubyte_to_float((value >> 24) & 0xff);
-
- dst[0] = r; /* r */
- dst[1] = g0; /* g */
- dst[2] = b; /* b */
- dst[3] = 1.0f; /* a */
- dst += 4;
-
- dst[0] = r; /* r */
- dst[1] = g1; /* g */
- dst[2] = b; /* b */
- dst[3] = 1.0f; /* a */
- dst += 4;
- }
-
- if (x < width) {
- value = util_cpu_to_le32(*src);
-
- r = ubyte_to_float((value >> 0) & 0xff);
- g0 = ubyte_to_float((value >> 8) & 0xff);
- b = ubyte_to_float((value >> 16) & 0xff);
- g1 = ubyte_to_float((value >> 24) & 0xff);
-
- dst[0] = r; /* r */
- dst[1] = g0; /* g */
- dst[2] = b; /* b */
- dst[3] = 1.0f; /* a */
- }
-
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-
-void
-util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- uint8_t *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- uint32_t value;
- uint8_t r, g0, g1, b;
-
- for (x = 0; x + 1 < width; x += 2) {
- value = util_cpu_to_le32(*src++);
-
- r = (value >> 0) & 0xff;
- g0 = (value >> 8) & 0xff;
- b = (value >> 16) & 0xff;
- g1 = (value >> 24) & 0xff;
-
- dst[0] = r; /* r */
- dst[1] = g0; /* g */
- dst[2] = b; /* b */
- dst[3] = 0xff; /* a */
- dst += 4;
-
- dst[0] = r; /* r */
- dst[1] = g1; /* g */
- dst[2] = b; /* b */
- dst[3] = 0xff; /* a */
- dst += 4;
- }
-
- if (x < width) {
- value = util_cpu_to_le32(*src);
-
- r = (value >> 0) & 0xff;
- g0 = (value >> 8) & 0xff;
- b = (value >> 16) & 0xff;
- g1 = (value >> 24) & 0xff;
-
- dst[0] = r; /* r */
- dst[1] = g0; /* g */
- dst[2] = b; /* b */
- dst[3] = 0xff; /* a */
- }
-
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-
-void
-util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- const float *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- float r, g0, g1, b;
- uint32_t value;
-
- for (x = 0; x + 1 < width; x += 2) {
- r = 0.5f*(src[0] + src[4]);
- g0 = src[1];
- g1 = src[5];
- b = 0.5f*(src[2] + src[6]);
-
- value = (uint32_t)float_to_ubyte(r);
- value |= (uint32_t)float_to_ubyte(g0) << 8;
- value |= (uint32_t)float_to_ubyte(b) << 16;
- value |= (uint32_t)float_to_ubyte(g1) << 24;
-
- *dst++ = util_le32_to_cpu(value);
-
- src += 8;
- }
-
- if (x < width) {
- r = src[0];
- g0 = src[1];
- g1 = 0;
- b = src[2];
-
- value = (uint32_t)float_to_ubyte(r);
- value |= (uint32_t)float_to_ubyte(g0) << 8;
- value |= (uint32_t)float_to_ubyte(b) << 16;
- value |= (uint32_t)float_to_ubyte(g1) << 24;
-
- *dst = util_le32_to_cpu(value);
- }
-
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-
-void
-util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- const uint8_t *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- uint32_t r, g0, g1, b;
- uint32_t value;
-
- for (x = 0; x + 1 < width; x += 2) {
- r = (src[0] + src[4] + 1) >> 1;
- g0 = src[1];
- g1 = src[5];
- b = (src[2] + src[6] + 1) >> 1;
-
- value = r;
- value |= (uint32_t)g0 << 8;
- value |= (uint32_t)b << 16;
- value |= (uint32_t)g1 << 24;
-
- *dst++ = util_le32_to_cpu(value);
-
- src += 8;
- }
-
- if (x < width) {
- r = src[0];
- g0 = src[1];
- g1 = 0;
- b = src[2];
-
- value = r;
- value |= (uint32_t)g0 << 8;
- value |= (uint32_t)b << 16;
- value |= (uint32_t)g1 << 24;
-
- *dst = util_le32_to_cpu(value);
- }
-
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-
-void
-util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, ASSERTED unsigned j)
-{
- assert(i < 2);
- assert(j < 1);
-
- dst[0] = ubyte_to_float(src[0]); /* r */
- dst[1] = ubyte_to_float(src[1 + 2*i]); /* g */
- dst[2] = ubyte_to_float(src[2]); /* b */
- dst[3] = 1.0f; /* a */
-}
-
-
-void
-util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- float *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- uint32_t value;
- float r, g0, g1, b;
-
- for (x = 0; x + 1 < width; x += 2) {
- value = util_cpu_to_le32(*src++);
-
- g0 = ubyte_to_float((value >> 0) & 0xff);
- r = ubyte_to_float((value >> 8) & 0xff);
- g1 = ubyte_to_float((value >> 16) & 0xff);
- b = ubyte_to_float((value >> 24) & 0xff);
-
- dst[0] = r; /* r */
- dst[1] = g0; /* g */
- dst[2] = b; /* b */
- dst[3] = 1.0f; /* a */
- dst += 4;
-
- dst[0] = r; /* r */
- dst[1] = g1; /* g */
- dst[2] = b; /* b */
- dst[3] = 1.0f; /* a */
- dst += 4;
- }
-
- if (x < width) {
- value = util_cpu_to_le32(*src);
-
- g0 = ubyte_to_float((value >> 0) & 0xff);
- r = ubyte_to_float((value >> 8) & 0xff);
- g1 = ubyte_to_float((value >> 16) & 0xff);
- b = ubyte_to_float((value >> 24) & 0xff);
-
- dst[0] = r; /* r */
- dst[1] = g0; /* g */
- dst[2] = b; /* b */
- dst[3] = 1.0f; /* a */
- }
-
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-
-void
-util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- uint8_t *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- uint32_t value;
- uint8_t r, g0, g1, b;
-
- for (x = 0; x + 1 < width; x += 2) {
- value = util_cpu_to_le32(*src++);
-
- g0 = (value >> 0) & 0xff;
- r = (value >> 8) & 0xff;
- g1 = (value >> 16) & 0xff;
- b = (value >> 24) & 0xff;
-
- dst[0] = r; /* r */
- dst[1] = g0; /* g */
- dst[2] = b; /* b */
- dst[3] = 0xff; /* a */
- dst += 4;
-
- dst[0] = r; /* r */
- dst[1] = g1; /* g */
- dst[2] = b; /* b */
- dst[3] = 0xff; /* a */
- dst += 4;
- }
-
- if (x < width) {
- value = util_cpu_to_le32(*src);
-
- g0 = (value >> 0) & 0xff;
- r = (value >> 8) & 0xff;
- g1 = (value >> 16) & 0xff;
- b = (value >> 24) & 0xff;
-
- dst[0] = r; /* r */
- dst[1] = g0; /* g */
- dst[2] = b; /* b */
- dst[3] = 0xff; /* a */
- }
-
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-
-void
-util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- const float *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- float r, g0, g1, b;
- uint32_t value;
-
- for (x = 0; x + 1 < width; x += 2) {
- r = 0.5f*(src[0] + src[4]);
- g0 = src[1];
- g1 = src[5];
- b = 0.5f*(src[2] + src[6]);
-
- value = (uint32_t)float_to_ubyte(g0);
- value |= (uint32_t)float_to_ubyte(r) << 8;
- value |= (uint32_t)float_to_ubyte(g1) << 16;
- value |= (uint32_t)float_to_ubyte(b) << 24;
-
- *dst++ = util_le32_to_cpu(value);
-
- src += 8;
- }
-
- if (x < width) {
- r = src[0];
- g0 = src[1];
- g1 = 0;
- b = src[2];
-
- value = (uint32_t)float_to_ubyte(g0);
- value |= (uint32_t)float_to_ubyte(r) << 8;
- value |= (uint32_t)float_to_ubyte(g1) << 16;
- value |= (uint32_t)float_to_ubyte(b) << 24;
-
- *dst = util_le32_to_cpu(value);
- }
-
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-
-void
-util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- const uint8_t *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- uint32_t r, g0, g1, b;
- uint32_t value;
-
- for (x = 0; x + 1 < width; x += 2) {
- r = (src[0] + src[4] + 1) >> 1;
- g0 = src[1];
- g1 = src[5];
- b = (src[2] + src[6] + 1) >> 1;
-
- value = g0;
- value |= (uint32_t)r << 8;
- value |= (uint32_t)g1 << 16;
- value |= (uint32_t)b << 24;
-
- *dst++ = util_le32_to_cpu(value);
-
- src += 8;
- }
-
- if (x < width) {
- r = src[0];
- g0 = src[1];
- g1 = 0;
- b = src[2];
-
- value = g0;
- value |= (uint32_t)r << 8;
- value |= (uint32_t)g1 << 16;
- value |= (uint32_t)b << 24;
-
- *dst = util_le32_to_cpu(value);
- }
-
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-
-void
-util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, ASSERTED unsigned j)
-{
- assert(i < 2);
- assert(j < 1);
-
- dst[0] = ubyte_to_float(src[1]); /* r */
- dst[1] = ubyte_to_float(src[0 + 2*i]); /* g */
- dst[2] = ubyte_to_float(src[3]); /* b */
- dst[3] = 1.0f; /* a */
-}
-
-
-void
-util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- float *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- uint32_t value;
- uint8_t y0, y1, u, v;
-
- for (x = 0; x + 1 < width; x += 2) {
- value = util_cpu_to_le32(*src++);
-
- u = (value >> 0) & 0xff;
- y0 = (value >> 8) & 0xff;
- v = (value >> 16) & 0xff;
- y1 = (value >> 24) & 0xff;
-
- util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 1.0f; /* a */
- dst += 4;
-
- util_format_yuv_to_rgb_float(y1, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 1.0f; /* a */
- dst += 4;
- }
-
- if (x < width) {
- value = util_cpu_to_le32(*src);
-
- u = (value >> 0) & 0xff;
- y0 = (value >> 8) & 0xff;
- v = (value >> 16) & 0xff;
- y1 = (value >> 24) & 0xff;
-
- util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 1.0f; /* a */
- }
-
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-
-void
-util_format_uyvy_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- uint8_t *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- uint32_t value;
- uint8_t y0, y1, u, v;
-
- for (x = 0; x + 1 < width; x += 2) {
- value = util_cpu_to_le32(*src++);
-
- u = (value >> 0) & 0xff;
- y0 = (value >> 8) & 0xff;
- v = (value >> 16) & 0xff;
- y1 = (value >> 24) & 0xff;
-
- util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 0xff; /* a */
- dst += 4;
-
- util_format_yuv_to_rgb_8unorm(y1, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 0xff; /* a */
- dst += 4;
- }
-
- if (x < width) {
- value = util_cpu_to_le32(*src);
-
- u = (value >> 0) & 0xff;
- y0 = (value >> 8) & 0xff;
- v = (value >> 16) & 0xff;
- y1 = (value >> 24) & 0xff;
-
- util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 0xff; /* a */
- }
-
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-
-void
-util_format_uyvy_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- const float *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- uint8_t y0, y1, u, v;
- uint32_t value;
-
- for (x = 0; x + 1 < width; x += 2) {
- uint8_t y0, y1, u0, u1, v0, v1, u, v;
-
- util_format_rgb_float_to_yuv(src[0], src[1], src[2],
- &y0, &u0, &v0);
- util_format_rgb_float_to_yuv(src[4], src[5], src[6],
- &y1, &u1, &v1);
-
- u = (u0 + u1 + 1) >> 1;
- v = (v0 + v1 + 1) >> 1;
-
- value = u;
- value |= (uint32_t)y0 << 8;
- value |= (uint32_t)v << 16;
- value |= (uint32_t)y1 << 24;
-
- *dst++ = util_le32_to_cpu(value);
-
- src += 8;
- }
-
- if (x < width) {
- util_format_rgb_float_to_yuv(src[0], src[1], src[2],
- &y0, &u, &v);
- y1 = 0;
-
- value = u;
- value |= (uint32_t)y0 << 8;
- value |= (uint32_t)v << 16;
- value |= (uint32_t)y1 << 24;
-
- *dst = util_le32_to_cpu(value);
- }
-
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-
-void
-util_format_uyvy_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- const uint8_t *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- uint8_t y0, y1, u, v;
- uint32_t value;
-
- for (x = 0; x + 1 < width; x += 2) {
- uint8_t y0, y1, u0, u1, v0, v1, u, v;
-
- util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
- &y0, &u0, &v0);
- util_format_rgb_8unorm_to_yuv(src[4], src[5], src[6],
- &y1, &u1, &v1);
-
- u = (u0 + u1 + 1) >> 1;
- v = (v0 + v1 + 1) >> 1;
-
- value = u;
- value |= (uint32_t)y0 << 8;
- value |= (uint32_t)v << 16;
- value |= (uint32_t)y1 << 24;
-
- *dst++ = util_le32_to_cpu(value);
-
- src += 8;
- }
-
- if (x < width) {
- util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
- &y0, &u, &v);
- y1 = 0;
-
- value = u;
- value |= (uint32_t)y0 << 8;
- value |= (uint32_t)v << 16;
- value |= (uint32_t)y1 << 24;
-
- *dst = util_le32_to_cpu(value);
- }
-
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-
-void
-util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, ASSERTED unsigned j)
-{
- uint8_t y, u, v;
-
- assert(i < 2);
- assert(j < 1);
-
- y = src[1 + i*2];
- u = src[0];
- v = src[2];
-
- util_format_yuv_to_rgb_float(y, u, v, &dst[0], &dst[1], &dst[2]);
-
- dst[3] = 1.0f;
-}
-
-
-void
-util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- float *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- uint32_t value;
- uint8_t y0, y1, u, v;
-
- for (x = 0; x + 1 < width; x += 2) {
- value = util_cpu_to_le32(*src++);
-
- y0 = (value >> 0) & 0xff;
- u = (value >> 8) & 0xff;
- y1 = (value >> 16) & 0xff;
- v = (value >> 24) & 0xff;
-
- util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 1.0f; /* a */
- dst += 4;
-
- util_format_yuv_to_rgb_float(y1, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 1.0f; /* a */
- dst += 4;
- }
-
- if (x < width) {
- value = util_cpu_to_le32(*src);
-
- y0 = (value >> 0) & 0xff;
- u = (value >> 8) & 0xff;
- y1 = (value >> 16) & 0xff;
- v = (value >> 24) & 0xff;
-
- util_format_yuv_to_rgb_float(y0, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 1.0f; /* a */
- }
-
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-
-void
-util_format_yuyv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- uint8_t *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- uint32_t value;
- uint8_t y0, y1, u, v;
-
- for (x = 0; x + 1 < width; x += 2) {
- value = util_cpu_to_le32(*src++);
-
- y0 = (value >> 0) & 0xff;
- u = (value >> 8) & 0xff;
- y1 = (value >> 16) & 0xff;
- v = (value >> 24) & 0xff;
-
- util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 0xff; /* a */
- dst += 4;
-
- util_format_yuv_to_rgb_8unorm(y1, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 0xff; /* a */
- dst += 4;
- }
-
- if (x < width) {
- value = util_cpu_to_le32(*src);
-
- y0 = (value >> 0) & 0xff;
- u = (value >> 8) & 0xff;
- y1 = (value >> 16) & 0xff;
- v = (value >> 24) & 0xff;
-
- util_format_yuv_to_rgb_8unorm(y0, u, v, &dst[0], &dst[1], &dst[2]);
- dst[3] = 0xff; /* a */
- }
-
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-
-void
-util_format_yuyv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- const float *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- uint8_t y0, y1, u, v;
- uint32_t value;
-
- for (x = 0; x + 1 < width; x += 2) {
- uint8_t y0, y1, u0, u1, v0, v1, u, v;
-
- util_format_rgb_float_to_yuv(src[0], src[1], src[2],
- &y0, &u0, &v0);
- util_format_rgb_float_to_yuv(src[4], src[5], src[6],
- &y1, &u1, &v1);
-
- u = (u0 + u1 + 1) >> 1;
- v = (v0 + v1 + 1) >> 1;
-
- value = y0;
- value |= (uint32_t)u << 8;
- value |= (uint32_t)y1 << 16;
- value |= (uint32_t)v << 24;
-
- *dst++ = util_le32_to_cpu(value);
-
- src += 8;
- }
-
- if (x < width) {
- util_format_rgb_float_to_yuv(src[0], src[1], src[2],
- &y0, &u, &v);
- y1 = 0;
-
- value = y0;
- value |= (uint32_t)u << 8;
- value |= (uint32_t)y1 << 16;
- value |= (uint32_t)v << 24;
-
- *dst = util_le32_to_cpu(value);
- }
-
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-
-void
-util_format_yuyv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
-
- for (y = 0; y < height; y += 1) {
- const uint8_t *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- uint8_t y0, y1, u, v;
- uint32_t value;
-
- for (x = 0; x + 1 < width; x += 2) {
- uint8_t y0, y1, u0, u1, v0, v1, u, v;
-
- util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
- &y0, &u0, &v0);
- util_format_rgb_8unorm_to_yuv(src[4], src[5], src[6],
- &y1, &u1, &v1);
-
- u = (u0 + u1 + 1) >> 1;
- v = (v0 + v1 + 1) >> 1;
-
- value = y0;
- value |= (uint32_t)u << 8;
- value |= (uint32_t)y1 << 16;
- value |= (uint32_t)v << 24;
-
- *dst++ = util_le32_to_cpu(value);
-
- src += 8;
- }
-
- if (x < width) {
- util_format_rgb_8unorm_to_yuv(src[0], src[1], src[2],
- &y0, &u, &v);
- y1 = 0;
-
- value = y0;
- value |= (uint32_t)u << 8;
- value |= (uint32_t)y1 << 16;
- value |= (uint32_t)v << 24;
-
- *dst = util_le32_to_cpu(value);
- }
-
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-
-void
-util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, ASSERTED unsigned j)
-{
- uint8_t y, u, v;
-
- assert(i < 2);
- assert(j < 1);
-
- y = src[0 + i*2];
- u = src[1];
- v = src[3];
-
- util_format_yuv_to_rgb_float(y, u, v, &dst[0], &dst[1], &dst[2]);
-
- dst[3] = 1.0f;
-}
-
-/* XXX: Stubbed for now */
-void
-util_format_yv12_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const float *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv12_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_yv16_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const float *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_yv16_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_iyuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const float *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_iyuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_nv12_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const float *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv12_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_nv21_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const float *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_nv21_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_p016_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const float *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-void
-util_format_p016_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j) {}
-
-void
-util_format_xyuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const float *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_xyuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_ayuv_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const float *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_ayuv_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j) {}
-void
-util_format_r8g8_r8b8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const float *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_r8g8_r8b8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j) {}
-
-void
-util_format_g8r8_b8r8_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const float *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
- UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
- UNUSED unsigned width, UNUSED unsigned height) {}
-
-void
-util_format_g8r8_b8r8_unorm_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
- UNUSED unsigned i, UNUSED unsigned j) {}
diff --git a/src/gallium/auxiliary/util/u_format_yuv.h b/src/gallium/auxiliary/util/u_format_yuv.h
deleted file mode 100644
index 0acb1747e43..00000000000
--- a/src/gallium/auxiliary/util/u_format_yuv.h
+++ /dev/null
@@ -1,430 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-/**
- * @file
- * YUV colorspace conversion.
- *
- * @author Brian Paul <[email protected]>
- * @author Michal Krol <[email protected]>
- * @author Jose Fonseca <[email protected]>
- *
- * See also:
- * - http://www.fourcc.org/fccyvrgb.php
- * - http://msdn.microsoft.com/en-us/library/ms893078
- * - http://en.wikipedia.org/wiki/YUV
- */
-
-
-#ifndef U_FORMAT_YUV_H_
-#define U_FORMAT_YUV_H_
-
-
-#include "pipe/p_compiler.h"
-#include "util/u_math.h"
-
-
-/*
- * TODO: Ensure we use consistent and right floating formulas, with enough
- * precision in the coefficients.
- */
-
-static inline void
-util_format_rgb_float_to_yuv(float r, float g, float b,
- uint8_t *y, uint8_t *u, uint8_t *v)
-{
- const float _r = CLAMP(r, 0.0f, 1.0f);
- const float _g = CLAMP(g, 0.0f, 1.0f);
- const float _b = CLAMP(b, 0.0f, 1.0f);
-
- const float scale = 255.0f;
-
- const int _y = scale * ( (0.257f * _r) + (0.504f * _g) + (0.098f * _b));
- const int _u = scale * (-(0.148f * _r) - (0.291f * _g) + (0.439f * _b));
- const int _v = scale * ( (0.439f * _r) - (0.368f * _g) - (0.071f * _b));
-
- *y = _y + 16;
- *u = _u + 128;
- *v = _v + 128;
-}
-
-
-static inline void
-util_format_yuv_to_rgb_float(uint8_t y, uint8_t u, uint8_t v,
- float *r, float *g, float *b)
-{
- const int _y = y - 16;
- const int _u = u - 128;
- const int _v = v - 128;
-
- const float y_factor = 255.0f / 219.0f;
-
- const float scale = 1.0f / 255.0f;
-
- *r = scale * (y_factor * _y + 1.596f * _v);
- *g = scale * (y_factor * _y - 0.391f * _u - 0.813f * _v);
- *b = scale * (y_factor * _y + 2.018f * _u );
-}
-
-
-static inline void
-util_format_rgb_8unorm_to_yuv(uint8_t r, uint8_t g, uint8_t b,
- uint8_t *y, uint8_t *u, uint8_t *v)
-{
- *y = (( 66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
- *u = (( -38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
- *v = (( 112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
-}
-
-
-static inline void
-util_format_yuv_to_rgb_8unorm(uint8_t y, uint8_t u, uint8_t v,
- uint8_t *r, uint8_t *g, uint8_t *b)
-{
- const int _y = y - 16;
- const int _u = u - 128;
- const int _v = v - 128;
-
- const int _r = (298 * _y + 409 * _v + 128) >> 8;
- const int _g = (298 * _y - 100 * _u - 208 * _v + 128) >> 8;
- const int _b = (298 * _y + 516 * _u + 128) >> 8;
-
- *r = CLAMP(_r, 0, 255);
- *g = CLAMP(_g, 0, 255);
- *b = CLAMP(_b, 0, 255);
-}
-
-
-
-void
-util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_uyvy_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_uyvy_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_uyvy_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-
-void
-util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_yuyv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_yuyv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_yuyv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-
-/* XXX: Stubbed for now */
-void
-util_format_yv12_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_yv12_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_yv12_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_yv12_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_yv12_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-void
-util_format_yv16_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_yv16_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_yv16_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_yv16_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_yv16_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-void
-util_format_iyuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_iyuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_iyuv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_iyuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_iyuv_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-void
-util_format_nv12_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_nv12_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_nv12_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_nv12_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_nv12_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-void
-util_format_nv21_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_nv21_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_nv21_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_nv21_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_nv21_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-void
-util_format_p016_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_p016_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_p016_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_p016_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-void
-util_format_p016_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-
-void
-util_format_xyuv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_xyuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_xyuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_xyuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_xyuv_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-void
-util_format_ayuv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_ayuv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_ayuv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_ayuv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_ayuv_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-void
-util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-
-void
-util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-
-void
-util_format_r8g8_r8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_r8g8_r8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_r8g8_r8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_r8g8_r8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_r8g8_r8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-
-void
-util_format_g8r8_b8r8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_g8r8_b8r8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_g8r8_b8r8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_g8r8_b8r8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height);
-
-void
-util_format_g8r8_b8r8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
- unsigned i, unsigned j);
-
-#endif /* U_FORMAT_YUV_H_ */
diff --git a/src/gallium/auxiliary/util/u_format_zs.c b/src/gallium/auxiliary/util/u_format_zs.c
deleted file mode 100644
index 98d758e97ec..00000000000
--- a/src/gallium/auxiliary/util/u_format_zs.c
+++ /dev/null
@@ -1,896 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#include "u_format_zs.h"
-#include "util/u_math.h"
-
-
-/*
- * z32_unorm conversion functions
- */
-
-static inline uint16_t
-z32_unorm_to_z16_unorm(uint32_t z)
-{
- /* z * 0xffff / 0xffffffff */
- return z >> 16;
-}
-
-static inline uint32_t
-z16_unorm_to_z32_unorm(uint16_t z)
-{
- /* z * 0xffffffff / 0xffff */
- return ((uint32_t)z << 16) | z;
-}
-
-static inline uint32_t
-z32_unorm_to_z24_unorm(uint32_t z)
-{
- /* z * 0xffffff / 0xffffffff */
- return z >> 8;
-}
-
-static inline uint32_t
-z24_unorm_to_z32_unorm(uint32_t z)
-{
- /* z * 0xffffffff / 0xffffff */
- return (z << 8) | (z >> 16);
-}
-
-
-/*
- * z32_float conversion functions
- */
-
-static inline uint16_t
-z32_float_to_z16_unorm(float z)
-{
- const float scale = 0xffff;
- return (uint16_t)(z * scale + 0.5f);
-}
-
-static inline float
-z16_unorm_to_z32_float(uint16_t z)
-{
- const float scale = 1.0 / 0xffff;
- return (float)(z * scale);
-}
-
-static inline uint32_t
-z32_float_to_z24_unorm(float z)
-{
- const double scale = 0xffffff;
- return (uint32_t)(z * scale) & 0xffffff;
-}
-
-static inline float
-z24_unorm_to_z32_float(uint32_t z)
-{
- const double scale = 1.0 / 0xffffff;
- return (float)(z * scale);
-}
-
-static inline uint32_t
-z32_float_to_z32_unorm(float z)
-{
- const double scale = 0xffffffff;
- return (uint32_t)(z * scale);
-}
-
-static inline float
-z32_unorm_to_z32_float(uint32_t z)
-{
- const double scale = 1.0 / 0xffffffff;
- return (float)(z * scale);
-}
-
-
-void
-util_format_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned y;
- for(y = 0; y < height; ++y) {
- memcpy(dst_row, src_row, width);
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned y;
- for(y = 0; y < height; ++y) {
- memcpy(dst_row, src_row, width);
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z16_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- float *dst = dst_row;
- const uint16_t *src = (const uint16_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint16_t value = util_cpu_to_le16(*src++);
- *dst++ = z16_unorm_to_z32_float(value);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z16_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const float *src = src_row;
- uint16_t *dst = (uint16_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint16_t value;
- value = z32_float_to_z16_unorm(*src++);
- *dst++ = util_le16_to_cpu(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z16_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- uint32_t *dst = dst_row;
- const uint16_t *src = (const uint16_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint16_t value = util_cpu_to_le16(*src++);
- *dst++ = z16_unorm_to_z32_unorm(value);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z16_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint32_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const uint32_t *src = src_row;
- uint16_t *dst = (uint16_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint16_t value;
- value = z32_unorm_to_z16_unorm(*src++);
- *dst++ = util_le16_to_cpu(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z32_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- float *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = z32_unorm_to_z32_float(value);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z32_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const float *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value;
- value = z32_float_to_z32_unorm(*src++);
- *dst++ = util_le32_to_cpu(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z32_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned y;
- for(y = 0; y < height; ++y) {
- memcpy(dst_row, src_row, width * 4);
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z32_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint32_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned y;
- for(y = 0; y < height; ++y) {
- memcpy(dst_row, src_row, width * 4);
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z32_float_unpack_z_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned y;
- for(y = 0; y < height; ++y) {
- memcpy(dst_row, src_row, width * 4);
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z32_float_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned y;
- for(y = 0; y < height; ++y) {
- memcpy(dst_row, src_row, width * 4);
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z32_float_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- uint32_t *dst = dst_row;
- const float *src = (const float *)src_row;
- for(x = 0; x < width; ++x) {
- *dst++ = z32_float_to_z32_unorm(*src++);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z32_float_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint32_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const uint32_t *src = src_row;
- float *dst = (float *)dst_row;
- for(x = 0; x < width; ++x) {
- *dst++ = z32_unorm_to_z32_float(*src++);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z24_unorm_s8_uint_unpack_z_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- float *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = z24_unorm_to_z32_float(value & 0xffffff);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z24_unorm_s8_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const float *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_le32_to_cpu(*dst);
- value &= 0xff000000;
- value |= z32_float_to_z24_unorm(*src++);
- *dst++ = util_cpu_to_le32(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z24_unorm_s8_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- uint32_t *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = z24_unorm_to_z32_unorm(value & 0xffffff);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z24_unorm_s8_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint32_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const uint32_t *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_le32_to_cpu(*dst);
- value &= 0xff000000;
- value |= z32_unorm_to_z24_unorm(*src++);
- *dst++ = util_cpu_to_le32(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z24_unorm_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- uint8_t *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = value >> 24;
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z24_unorm_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const uint8_t *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_le32_to_cpu(*dst);
- value &= 0x00ffffff;
- value |= (uint32_t)*src++ << 24;
- *dst++ = util_cpu_to_le32(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z24_unorm_s8_uint_pack_separate(uint8_t *dst_row, unsigned dst_stride,
- const uint32_t *z_src_row, unsigned z_src_stride,
- const uint8_t *s_src_row, unsigned s_src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for (y = 0; y < height; ++y) {
- const uint32_t *z_src = z_src_row;
- const uint8_t *s_src = s_src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for (x = 0; x < width; ++x) {
- *dst++ = (*z_src++ & 0x00ffffff) | ((uint32_t)*s_src++ << 24);
- }
- dst_row += dst_stride / sizeof(*dst_row);
- z_src_row += z_src_stride / sizeof(*z_src_row);
- s_src_row += s_src_stride / sizeof(*s_src_row);
- }
-}
-
-void
-util_format_s8_uint_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- float *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = z24_unorm_to_z32_float(value >> 8);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_s8_uint_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const float *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_le32_to_cpu(*dst);
- value &= 0x000000ff;
- value |= z32_float_to_z24_unorm(*src++) << 8;
- *dst++ = util_cpu_to_le32(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_s8_uint_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- uint32_t *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = z24_unorm_to_z32_unorm(value >> 8);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_s8_uint_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint32_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const uint32_t *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_le32_to_cpu(*dst);
- value &= 0x000000ff;
- value |= *src++ & 0xffffff00;
- *dst++ = util_cpu_to_le32(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_s8_uint_z24_unorm_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- uint8_t *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = value & 0xff;
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_s8_uint_z24_unorm_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const uint8_t *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_le32_to_cpu(*dst);
- value &= 0xffffff00;
- value |= *src++;
- *dst++ = util_cpu_to_le32(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z24x8_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- float *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = z24_unorm_to_z32_float(value & 0xffffff);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z24x8_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const float *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value;
- value = z32_float_to_z24_unorm(*src++);
- *dst++ = util_le32_to_cpu(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z24x8_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- uint32_t *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = z24_unorm_to_z32_unorm(value & 0xffffff);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z24x8_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint32_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const uint32_t *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value;
- value = z32_unorm_to_z24_unorm(*src++);
- *dst++ = util_cpu_to_le32(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_x8z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- float *dst = dst_row;
- const uint32_t *src = (uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = z24_unorm_to_z32_float(value >> 8);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_x8z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const float *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value;
- value = z32_float_to_z24_unorm(*src++) << 8;
- *dst++ = util_cpu_to_le32(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_x8z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- uint32_t *dst = dst_row;
- const uint32_t *src = (const uint32_t *)src_row;
- for(x = 0; x < width; ++x) {
- uint32_t value = util_cpu_to_le32(*src++);
- *dst++ = z24_unorm_to_z32_unorm(value >> 8);
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_x8z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint32_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const uint32_t *src = src_row;
- uint32_t *dst = (uint32_t *)dst_row;
- for(x = 0; x < width; ++x) {
- uint32_t value;
- value = z32_unorm_to_z24_unorm(*src++) << 8;
- *dst++ = util_cpu_to_le32(value);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z32_float_s8x24_uint_unpack_z_float(float *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- float *dst = dst_row;
- const float *src = (const float *)src_row;
- for(x = 0; x < width; ++x) {
- *dst = *src;
- src += 2;
- dst += 1;
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z32_float_s8x24_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
- const float *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const float *src = src_row;
- float *dst = (float *)dst_row;
- for(x = 0; x < width; ++x) {
- *dst = *src;
- src += 1;
- dst += 2;
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z32_float_s8x24_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- uint32_t *dst = dst_row;
- const float *src = (const float *)src_row;
- for(x = 0; x < width; ++x) {
- *dst = z32_float_to_z32_unorm(*src);
- src += 2;
- dst += 1;
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z32_float_s8x24_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
- const uint32_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const uint32_t *src = src_row;
- float *dst = (float *)dst_row;
- for(x = 0; x < width; ++x) {
- *dst++ = z32_unorm_to_z32_float(*src++);
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-void
-util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- uint8_t *dst = dst_row;
- const uint8_t *src = src_row + 4;
- for(x = 0; x < width; ++x) {
- *dst = *src;
- src += 8;
- dst += 1;
- }
- src_row += src_stride/sizeof(*src_row);
- dst_row += dst_stride/sizeof(*dst_row);
- }
-}
-
-void
-util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- unsigned x, y;
- for(y = 0; y < height; ++y) {
- const uint8_t *src = src_row;
- uint32_t *dst = ((uint32_t *)dst_row) + 1;
- for(x = 0; x < width; ++x) {
- *dst = util_cpu_to_le32(*src);
- src += 1;
- dst += 2;
- }
- dst_row += dst_stride/sizeof(*dst_row);
- src_row += src_stride/sizeof(*src_row);
- }
-}
-
-
-void
-util_format_x24s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_z24_unorm_s8_uint_unpack_s_8uint(dst_row, dst_stride,
- src_row, src_stride,
- width, height);
-}
-
-void
-util_format_x24s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_z24_unorm_s8_uint_pack_s_8uint(dst_row, dst_stride,
- src_row, src_stride,
- width, height);
-}
-
-void
-util_format_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_s8_uint_z24_unorm_unpack_s_8uint(dst_row, dst_stride,
- src_row, src_stride,
- width, height);
-}
-
-void
-util_format_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-{
- util_format_s8_uint_z24_unorm_pack_s_8uint(dst_row, dst_stride,
- src_row, src_stride,
- width, height);
-}
-
-void
-util_format_x32_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_z32_float_s8x24_uint_unpack_s_8uint(dst_row, dst_stride,
- src_row, src_stride,
- width, height);
-
-}
-
-void
-util_format_x32_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
- const uint8_t *src_row, unsigned src_stride,
- unsigned width, unsigned height)
-{
- util_format_z32_float_s8x24_uint_pack_s_8uint(dst_row, dst_stride,
- src_row, src_stride,
- width, height);
-}
diff --git a/src/gallium/auxiliary/util/u_format_zs.h b/src/gallium/auxiliary/util/u_format_zs.h
deleted file mode 100644
index bed3c5198e8..00000000000
--- a/src/gallium/auxiliary/util/u_format_zs.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-#ifndef U_FORMAT_ZS_H_
-#define U_FORMAT_ZS_H_
-
-
-#include "pipe/p_compiler.h"
-
-
-void
-util_format_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z16_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z16_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z16_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z16_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24_unorm_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_z24_unorm_s8_uint_pack_separate(uint8_t *dst_row, unsigned dst_stride, const uint32_t *z_src_row, unsigned z_src_stride, const uint8_t *s_src_row, unsigned s_src_stride, unsigned width, unsigned height);
-
-void
-util_format_s8_uint_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_z24_unorm_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_s8_uint_z24_unorm_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24x8_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24x8_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24x8_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z24x8_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_x8z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_x8z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_x8z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_x8z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-
-void
-util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_x24s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_x24s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_x32_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-
-void
-util_format_x32_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_sride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
-#endif /* U_FORMAT_ZS_H_ */
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 06737c58fe8..d8a5f2fc008 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -36,7 +36,7 @@
#include "util/u_gen_mipmap.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_inlines.h"
diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h
index 0166126c56f..4bf1731da0b 100644
--- a/src/gallium/auxiliary/util/u_pack_color.h
+++ b/src/gallium/auxiliary/util/u_pack_color.h
@@ -38,7 +38,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
#include "util/u_debug_gallium.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_math.h"
diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c
index 77b0458dc03..c3c2ca81780 100644
--- a/src/gallium/auxiliary/util/u_pstipple.c
+++ b/src/gallium/auxiliary/util/u_pstipple.c
@@ -45,7 +45,7 @@
#include "pipe/p_shader_tokens.h"
#include "util/u_inlines.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_memory.h"
#include "util/u_pstipple.h"
#include "util/u_sampler.h"
diff --git a/src/gallium/auxiliary/util/u_resource.c b/src/gallium/auxiliary/util/u_resource.c
index ed6c1504fd8..b27c3f3c80b 100644
--- a/src/gallium/auxiliary/util/u_resource.c
+++ b/src/gallium/auxiliary/util/u_resource.c
@@ -26,7 +26,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_math.h"
#include "util/u_resource.h"
diff --git a/src/gallium/auxiliary/util/u_sampler.c b/src/gallium/auxiliary/util/u_sampler.c
index 5da1d5fdff2..2c823d45609 100644
--- a/src/gallium/auxiliary/util/u_sampler.c
+++ b/src/gallium/auxiliary/util/u_sampler.c
@@ -26,7 +26,7 @@
**************************************************************************/
-#include "u_format.h"
+#include "util/format/u_format.h"
#include "u_sampler.h"
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index 5f07eb1cdac..718411d8d1f 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -36,7 +36,7 @@
#include "pipe/p_screen.h"
#include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_inlines.h"
#include "util/u_rect.h"
#include "util/u_surface.h"
@@ -58,59 +58,6 @@ u_surface_default_template(struct pipe_surface *surf,
/**
- * Copy 2D rect from one place to another.
- * Position and sizes are in pixels.
- * src_stride may be negative to do vertical flip of pixels from source.
- */
-void
-util_copy_rect(ubyte * dst,
- enum pipe_format format,
- unsigned dst_stride,
- unsigned dst_x,
- unsigned dst_y,
- unsigned width,
- unsigned height,
- const ubyte * src,
- int src_stride,
- unsigned src_x,
- unsigned src_y)
-{
- unsigned i;
- int src_stride_pos = src_stride < 0 ? -src_stride : src_stride;
- int blocksize = util_format_get_blocksize(format);
- int blockwidth = util_format_get_blockwidth(format);
- int blockheight = util_format_get_blockheight(format);
-
- assert(blocksize > 0);
- assert(blockwidth > 0);
- assert(blockheight > 0);
-
- dst_x /= blockwidth;
- dst_y /= blockheight;
- width = (width + blockwidth - 1)/blockwidth;
- height = (height + blockheight - 1)/blockheight;
- src_x /= blockwidth;
- src_y /= blockheight;
-
- dst += dst_x * blocksize;
- src += src_x * blocksize;
- dst += dst_y * dst_stride;
- src += src_y * src_stride_pos;
- width *= blocksize;
-
- if (width == dst_stride && width == (unsigned)src_stride)
- memcpy(dst, src, height * width);
- else {
- for (i = 0; i < height; i++) {
- memcpy(dst, src, width);
- dst += dst_stride;
- src += src_stride;
- }
- }
-}
-
-
-/**
* Copy 3D box from one place to another.
* Position and sizes are in pixels.
*/
diff --git a/src/gallium/auxiliary/util/u_surface.h b/src/gallium/auxiliary/util/u_surface.h
index f764abb04e5..f6149563e81 100644
--- a/src/gallium/auxiliary/util/u_surface.h
+++ b/src/gallium/auxiliary/util/u_surface.h
@@ -45,12 +45,6 @@ u_surface_default_template(struct pipe_surface *view,
const struct pipe_resource *texture);
extern void
-util_copy_rect(ubyte * dst, enum pipe_format format,
- unsigned dst_stride, unsigned dst_x, unsigned dst_y,
- unsigned width, unsigned height, const ubyte * src,
- int src_stride, unsigned src_x, unsigned src_y);
-
-extern void
util_copy_box(ubyte * dst,
enum pipe_format format,
unsigned dst_stride, unsigned dst_slice_stride,
diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c
index e8a93e9f98e..efd290f89b4 100644
--- a/src/gallium/auxiliary/util/u_tests.c
+++ b/src/gallium/auxiliary/util/u_tests.c
@@ -28,7 +28,7 @@
#include "util/u_tests.h"
#include "util/u_draw_quad.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_simple_shaders.h"
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 086700c88bf..daed6c6950b 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -26,7 +26,7 @@
#include "util/u_threaded_context.h"
#include "util/u_cpu_detect.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_upload_mgr.h"
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 0239b870482..5a486af41ae 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -34,8 +34,8 @@
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_format_bptc.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_bptc.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_surface.h"
diff --git a/src/gallium/auxiliary/util/u_transfer_helper.c b/src/gallium/auxiliary/util/u_transfer_helper.c
index f33d98b47a4..0ba8abdf782 100644
--- a/src/gallium/auxiliary/util/u_transfer_helper.c
+++ b/src/gallium/auxiliary/util/u_transfer_helper.c
@@ -24,9 +24,9 @@
#include "pipe/p_screen.h"
#include "util/u_box.h"
-#include "util/u_format.h"
-#include "util/u_format_rgtc.h"
-#include "util/u_format_zs.h"
+#include "util/format/u_format.h"
+#include "util/format/u_format_rgtc.h"
+#include "util/format/u_format_zs.h"
#include "util/u_inlines.h"
#include "util/u_transfer_helper.h"
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 200bfffbd39..4b8dc8e4ae6 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -88,7 +88,7 @@
#include "util/u_vbuf.h"
#include "util/u_dump.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_upload_mgr.h"
diff --git a/src/gallium/auxiliary/vl/vl_deint_filter.c b/src/gallium/auxiliary/vl/vl_deint_filter.c
index dbd6be534e9..ab64cebf806 100644
--- a/src/gallium/auxiliary/vl/vl_deint_filter.c
+++ b/src/gallium/auxiliary/vl/vl_deint_filter.c
@@ -47,7 +47,7 @@
#include "util/u_draw.h"
#include "util/u_memory.h"
#include "util/u_math.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "vl_types.h"
#include "vl_video_buffer.h"
diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
index 45a9badce21..7e6fdfaaf56 100644
--- a/src/gallium/auxiliary/vl/vl_vertex_buffers.c
+++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
@@ -26,7 +26,7 @@
**************************************************************************/
#include <assert.h>
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "vl_vertex_buffers.h"
#include "vl_types.h"
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
index b159007c2b9..ed331c94ad0 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -31,7 +31,7 @@
#include "pipe/p_context.h"
#include "pipe/p_state.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_inlines.h"
#include "util/u_sampler.h"
#include "util/u_memory.h"