diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2012-08-17 13:58:22 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2012-08-17 13:58:22 +0000 |
commit | 9c5e6654f7fbf2935a87fa3fd8ae47ff1e9a59a0 (patch) | |
tree | c90ae6d648f4f56949500d956d67f545612d1220 /lib/libGL | |
parent | ce102378455fdaa6d4037e4c9741d7fea8915117 (diff) |
Upate to libGL 7.11.2
Tested by jsg@, matthieu@ and ajacoutot@, ok mattieu@
Diffstat (limited to 'lib/libGL')
-rw-r--r-- | lib/libGL/Makefile | 9 | ||||
-rw-r--r-- | lib/libGL/dri/Makefile.inc | 6 | ||||
-rw-r--r-- | lib/libGL/dri/i915/Makefile | 4 | ||||
-rw-r--r-- | lib/libGL/dri/i965/Makefile | 26 | ||||
-rw-r--r-- | lib/libGL/dri/r300/Makefile | 7 | ||||
-rw-r--r-- | lib/libGL/dri/r600/Makefile | 4 | ||||
-rw-r--r-- | lib/libGL/dri/swrastg/Makefile | 4 | ||||
-rw-r--r-- | lib/libGL/gallium/libgallium/Makefile | 13 | ||||
-rw-r--r-- | lib/libGL/gallium/libgallium/generated/u_format_table.c | 3312 | ||||
-rw-r--r-- | lib/libGL/gallium/libgallium/generated/u_unfilled_gen.c | 80 | ||||
-rw-r--r-- | lib/libGL/gallium/libmesagallium/Makefile | 14 | ||||
-rw-r--r-- | lib/libGL/gallium/libmesagallium/generated/api_exec_es1.c | 196 | ||||
-rw-r--r-- | lib/libGL/gallium/libmesagallium/generated/api_exec_es2.c | 215 | ||||
-rw-r--r-- | lib/libGL/glsl/libglsl/Makefile | 7 | ||||
-rw-r--r-- | lib/libGL/libmesa/Makefile | 13 | ||||
-rw-r--r-- | lib/libGL/libmesa/generated/api_exec_es1.c | 196 | ||||
-rw-r--r-- | lib/libGL/libmesa/generated/api_exec_es2.c | 215 | ||||
-rw-r--r-- | lib/libGL/shlib_version | 2 |
18 files changed, 3809 insertions, 514 deletions
diff --git a/lib/libGL/Makefile b/lib/libGL/Makefile index 9387986c3..b62f95e19 100644 --- a/lib/libGL/Makefile +++ b/lib/libGL/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.30 2012/06/04 10:18:45 mpi Exp $ +# $OpenBSD: Makefile,v 1.31 2012/08/17 13:57:59 mpi Exp $ .include <bsd.xconf.mk> .if ${XENOCARA_BUILD_DRI:L} == "yes" @@ -15,8 +15,8 @@ MESA_INCLUDE= ${.CURDIR}/../../dist/Mesa/include MESA_DRI= ${.CURDIR}/../../dist/Mesa/src/mesa/drivers/dri MESA_MAJOR= 7 -MESA_MINOR= 10 -MESA_TINY= 3 +MESA_MINOR= 11 +MESA_TINY= 2 DRI_DRIVER_INSTALL_DIR= ${X11BASE}/lib/modules/dri @@ -48,6 +48,7 @@ CPPFLAGS+= \ -DPTHREADS \ -DHAVE_ALIAS \ -D_REENTRANT \ + -DMAPI_MODE_UTIL \ -DMAPI_GLAPI_CURRENT .if ${XENOCARA_BUILD_DRI:L} == "yes" @@ -76,9 +77,11 @@ INCS= \ GLAPI_SOURCES= \ glapi_dispatch.c \ glapi_entrypoint.c \ + glapi_gentable.c \ glapi_getproc.c \ glapi_nop.c \ glthread.c \ + glapi.c \ $(ASM_API) .if ${MACHINE_ARCH} == i386 diff --git a/lib/libGL/dri/Makefile.inc b/lib/libGL/dri/Makefile.inc index e705ff4b5..8caecd59d 100644 --- a/lib/libGL/dri/Makefile.inc +++ b/lib/libGL/dri/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.13 2012/07/13 12:55:32 mpi Exp $ +# $OpenBSD: Makefile.inc,v 1.14 2012/08/17 13:58:00 mpi Exp $ .include <bsd.xconf.mk> MESA= ${.CURDIR}/../../../../dist/Mesa/src/mesa @@ -15,8 +15,7 @@ COMMON_GALLIUM_SOURCES = \ COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \ driverfuncs.c \ texmem.c \ - drirenderbuffer.c \ - dri_metaops.c + drirenderbuffer.c CFLAGS+= -g -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DPTHREADS \ $(INCLUDES) $(DRIVER_DEFINES) @@ -29,6 +28,7 @@ INCLUDES = \ -I$(TOP)/src/mesa/drivers/dri/common \ -I$(TOP)/include \ -I$(TOP)/include/GL/internal \ + -I$(TOP)/src/glsl \ -I$(TOP)/src/mesa \ -I$(TOP)/src/mesa/main \ -I$(TOP)/src/mapi \ diff --git a/lib/libGL/dri/i915/Makefile b/lib/libGL/dri/i915/Makefile index f308e2afb..3444de4ce 100644 --- a/lib/libGL/dri/i915/Makefile +++ b/lib/libGL/dri/i915/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2011/10/23 13:57:36 matthieu Exp $ +# $OpenBSD: Makefile,v 1.8 2012/08/17 13:58:00 mpi Exp $ LIB= i915_dri.so @@ -14,7 +14,7 @@ DRIVER_SOURCES = \ intel_batchbuffer.c \ intel_clear.c \ intel_extensions.c \ - intel_extensions_es2.c \ + intel_extensions_es.c \ intel_mipmap_tree.c \ intel_tex_layout.c \ intel_tex_image.c \ diff --git a/lib/libGL/dri/i965/Makefile b/lib/libGL/dri/i965/Makefile index 0c90446d5..061565e73 100644 --- a/lib/libGL/dri/i965/Makefile +++ b/lib/libGL/dri/i965/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 2011/10/23 13:57:36 matthieu Exp $ +# $OpenBSD: Makefile,v 1.7 2012/08/17 13:58:00 mpi Exp $ LIB= i965_dri.so @@ -11,7 +11,7 @@ DRIVER_SOURCES = \ intel_context.c \ intel_decode.c \ intel_extensions.c \ - intel_extensions_es2.c \ + intel_extensions_es.c \ intel_fbo.c \ intel_mipmap_tree.c \ intel_regions.c \ @@ -59,7 +59,6 @@ DRIVER_SOURCES = \ brw_sf.c \ brw_sf_emit.c \ brw_sf_state.c \ - brw_state.c \ brw_state_batch.c \ brw_state_cache.c \ brw_state_dump.c \ @@ -95,14 +94,31 @@ DRIVER_SOURCES = \ gen6_urb.c \ gen6_viewport_state.c \ gen6_vs_state.c \ - gen6_wm_state.c + gen6_wm_state.c \ + gen7_cc_state.c \ + gen7_clip_state.c \ + gen7_disable.c \ + gen7_misc_state.c \ + gen7_sampler_state.c \ + gen7_sf_state.c \ + gen7_urb.c \ + gen7_viewport_state.c \ + gen7_vs_state.c \ + gen7_wm_state.c \ + gen7_wm_surface_state.c CXX_SOURCES = \ brw_cubemap_normalize.cpp \ brw_fs.cpp \ + brw_fs_emit.cpp \ + brw_fs_visitor.cpp \ brw_fs_channel_expressions.cpp \ brw_fs_reg_allocate.cpp \ - brw_fs_vector_splitting.cpp + brw_fs_schedule_instructions.cpp \ + brw_fs_vector_splitting.cpp \ + brw_shader.cpp + + SRCS = \ $(COMMON_SOURCES) \ diff --git a/lib/libGL/dri/r300/Makefile b/lib/libGL/dri/r300/Makefile index e47d4f522..ff884d9f2 100644 --- a/lib/libGL/dri/r300/Makefile +++ b/lib/libGL/dri/r300/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2011/10/23 13:57:36 matthieu Exp $ +# $OpenBSD: Makefile,v 1.6 2012/08/17 13:58:00 mpi Exp $ LIB= r300_dri.so @@ -9,7 +9,7 @@ CS_SOURCES = \ COMMON_SOURCES = \ driverfuncs.c \ - mm.c \ + drirenderbuffer.c \ utils.c \ texmem.c \ vblank.c \ @@ -70,12 +70,15 @@ COMPILER_SOURCES = \ radeon_pair_translate.c \ radeon_pair_schedule.c \ radeon_pair_regalloc.c \ + radeon_pair_dead_sources.c \ radeon_dataflow.c \ radeon_dataflow_deadcode.c \ radeon_dataflow_swizzles.c \ + radeon_list.c \ radeon_optimize.c \ radeon_remove_constants.c \ radeon_rename_regs.c \ + radeon_variable.c \ r3xx_fragprog.c \ r300_fragprog.c \ r300_fragprog_swizzle.c \ diff --git a/lib/libGL/dri/r600/Makefile b/lib/libGL/dri/r600/Makefile index eebc8a32a..28c835826 100644 --- a/lib/libGL/dri/r600/Makefile +++ b/lib/libGL/dri/r600/Makefile @@ -1,10 +1,10 @@ -# $OpenBSD: Makefile,v 1.3 2011/10/23 13:57:36 matthieu Exp $ +# $OpenBSD: Makefile,v 1.4 2012/08/17 13:58:00 mpi Exp $ LIB= r600_dri.so COMMON_SOURCES = \ driverfuncs.c \ - mm.c \ + drirenderbuffer.c \ utils.c \ texmem.c \ vblank.c \ diff --git a/lib/libGL/dri/swrastg/Makefile b/lib/libGL/dri/swrastg/Makefile index 8bac1d30b..cb3a9f241 100644 --- a/lib/libGL/dri/swrastg/Makefile +++ b/lib/libGL/dri/swrastg/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2012/07/13 12:54:20 mpi Exp $ +# $OpenBSD: Makefile,v 1.2 2012/08/17 13:58:00 mpi Exp $ LIB= swrast_dri.so @@ -45,7 +45,7 @@ LDADD= ../../gallium/libmesagallium/libmesagallium_pic.a \ # XXX This is wrong but the gallium drivers depend on libpthread # and some bindings still fail even with the LD_PRELOAD hack when # starting X. -#LDADD+= -lpthread +LDADD+= -lpthread DPADD= ../../gallium/libmesagallium/libmesagallium_pic.a .include "../../gallium/Makefile.inc" diff --git a/lib/libGL/gallium/libgallium/Makefile b/lib/libGL/gallium/libgallium/Makefile index ca1023a3b..b5846da9f 100644 --- a/lib/libGL/gallium/libgallium/Makefile +++ b/lib/libGL/gallium/libgallium/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2012/07/13 12:43:30 mpi Exp $ +# $OpenBSD: Makefile,v 1.2 2012/08/17 13:58:00 mpi Exp $ LIB= gallium @@ -50,7 +50,7 @@ C_SOURCES = \ draw_vs_exec.c \ draw_vs_ppc.c \ draw_vs_sse.c \ - draw_vs_varient.c \ + draw_vs_variant.c \ u_indices_gen.c \ u_unfilled_gen.c \ os_misc.c \ @@ -113,10 +113,13 @@ C_SOURCES = \ u_caps.c \ u_cpu_detect.c \ u_dl.c \ + u_draw.c \ u_draw_quad.c \ u_format.c \ u_format_other.c \ + u_format_latc.c \ u_format_s3tc.c \ + u_format_rgtc.c \ u_format_srgb.c \ u_format_table.c \ u_format_tests.c \ @@ -135,6 +138,7 @@ C_SOURCES = \ u_network.c \ u_math.c \ u_mm.c \ + u_pstipple.c \ u_rect.c \ u_ringbuffer.c \ u_sampler.c \ @@ -148,7 +152,8 @@ C_SOURCES = \ u_tile.c \ u_transfer.c \ u_resource.c \ - u_upload_mgr.c + u_upload_mgr.c \ + u_vbuf_mgr.c GALLIVM_SOURCES = \ lp_bld_arit.c \ @@ -156,7 +161,6 @@ GALLIVM_SOURCES = \ lp_bld_bitarit.c \ lp_bld_const.c \ lp_bld_conv.c \ - lp_bld_debug.c \ lp_bld_flow.c \ lp_bld_format_aos.c \ lp_bld_format_soa.c \ @@ -184,6 +188,7 @@ GALLIVM_SOURCES = \ draw_pt_fetch_shade_pipeline_llvm.c GALLIVM_CPP_SOURCES = \ + lp_bld_debug.cpp \ lp_bld_misc.cpp SRCS= ${C_SOURCES} diff --git a/lib/libGL/gallium/libgallium/generated/u_format_table.c b/lib/libGL/gallium/libgallium/generated/u_format_table.c index 40dd09ebf..5d02870c8 100644 --- a/lib/libGL/gallium/libgallium/generated/u_format_table.c +++ b/lib/libGL/gallium/libgallium/generated/u_format_table.c @@ -29,6 +29,8 @@ #include "u_format.h" #include "u_format_s3tc.h" +#include "u_format_rgtc.h" +#include "u_format_latc.h" #include "pipe/p_compiler.h" @@ -2116,6 +2118,127 @@ util_format_b10g10r10a2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_st } } +union util_format_b2g3r3_unorm { + uint8_t value; + struct { + unsigned b:2; + unsigned g:3; + unsigned r:3; + } chan; +}; + +static INLINE void +util_format_b2g3r3_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint8_t value = *(const uint8_t *)src; + uint8_t b; + uint8_t g; + uint8_t r; + b = (value) & 0x3; + g = (value >> 2) & 0x7; + r = value >> 5; + dst[0] = (float)(r * (1.0f/0x7)); /* r */ + dst[1] = (float)(g * (1.0f/0x7)); /* g */ + dst[2] = (float)(b * (1.0f/0x3)); /* b */ + dst[3] = 1; /* a */ + src += 1; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_b2g3r3_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint8_t value = 0; + value |= ((uint8_t)(CLAMP(src[2], 0, 1) * 0x3)) & 0x3; + value |= (((uint8_t)(CLAMP(src[1], 0, 1) * 0x7)) & 0x7) << 2; + value |= ((uint8_t)(CLAMP(src[0], 0, 1) * 0x7)) << 5; + *(uint8_t *)dst = value; + src += 4; + dst += 1; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_b2g3r3_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint8_t value = *(const uint8_t *)src; + uint8_t b; + uint8_t g; + uint8_t r; + b = (value) & 0x3; + g = (value >> 2) & 0x7; + r = value >> 5; + dst[0] = (float)(r * (1.0f/0x7)); /* r */ + dst[1] = (float)(g * (1.0f/0x7)); /* g */ + dst[2] = (float)(b * (1.0f/0x3)); /* b */ + dst[3] = 1; /* a */ +} + +static INLINE void +util_format_b2g3r3_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint8_t value = *(const uint8_t *)src; + uint8_t b; + uint8_t g; + uint8_t r; + b = (value) & 0x3; + g = (value >> 2) & 0x7; + r = value >> 5; + dst[0] = (uint8_t)(((uint32_t)r) * 0xff / 0x7); /* r */ + dst[1] = (uint8_t)(((uint32_t)g) * 0xff / 0x7); /* g */ + dst[2] = (uint8_t)(((uint32_t)b) * 0xff / 0x3); /* b */ + dst[3] = 255; /* a */ + src += 1; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_b2g3r3_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint8_t value = 0; + value |= ((uint8_t)(src[2] >> 6)) & 0x3; + value |= (((uint8_t)(src[1] >> 5)) & 0x7) << 2; + value |= ((uint8_t)(src[0] >> 5)) << 5; + *(uint8_t *)dst = value; + src += 4; + dst += 1; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + union util_format_l8_unorm { uint8_t value; struct { @@ -2782,6 +2905,2092 @@ util_format_l16_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, co } } +union util_format_a16_unorm { + uint16_t value; + struct { + uint16_t a; + } chan; +}; + +static INLINE void +util_format_a16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + uint16_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + a = value; + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = (float)(a * (1.0f/0xffff)); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_a16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)(CLAMP(src[3], 0, 1) * 0xffff); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_a16_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint16_t value = *(const uint16_t *)src; + uint16_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + a = value; + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = (float)(a * (1.0f/0xffff)); /* a */ +} + +static INLINE void +util_format_a16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + uint16_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + a = value; + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = (uint8_t)(a >> 8); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_a16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)(((uint32_t)src[3]) * 0xffff / 0xff); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_i16_unorm { + uint16_t value; + struct { + uint16_t rgba; + } chan; +}; + +static INLINE void +util_format_i16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + uint16_t rgba; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgba = value; + dst[0] = (float)(rgba * (1.0f/0xffff)); /* r */ + dst[1] = (float)(rgba * (1.0f/0xffff)); /* g */ + dst[2] = (float)(rgba * (1.0f/0xffff)); /* b */ + dst[3] = (float)(rgba * (1.0f/0xffff)); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_i16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)(CLAMP(src[3], 0, 1) * 0xffff); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_i16_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint16_t value = *(const uint16_t *)src; + uint16_t rgba; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgba = value; + dst[0] = (float)(rgba * (1.0f/0xffff)); /* r */ + dst[1] = (float)(rgba * (1.0f/0xffff)); /* g */ + dst[2] = (float)(rgba * (1.0f/0xffff)); /* b */ + dst[3] = (float)(rgba * (1.0f/0xffff)); /* a */ +} + +static INLINE void +util_format_i16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + uint16_t rgba; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgba = value; + dst[0] = (uint8_t)(rgba >> 8); /* r */ + dst[1] = (uint8_t)(rgba >> 8); /* g */ + dst[2] = (uint8_t)(rgba >> 8); /* b */ + dst[3] = (uint8_t)(rgba >> 8); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_i16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)(((uint32_t)src[3]) * 0xffff / 0xff); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_l16a16_unorm { + uint32_t value; + struct { + uint16_t rgb; + uint16_t a; + } chan; +}; + +static INLINE void +util_format_l16a16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint32_t value = *(const uint32_t *)src; + uint32_t rgb; + uint32_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + rgb = (value) & 0xffff; + a = value >> 16; + dst[0] = (float)(rgb * (1.0f/0xffff)); /* r */ + dst[1] = (float)(rgb * (1.0f/0xffff)); /* g */ + dst[2] = (float)(rgb * (1.0f/0xffff)); /* b */ + dst[3] = (float)(a * (1.0f/0xffff)); /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l16a16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint32_t value = 0; + value |= ((uint16_t)(CLAMP(src[2], 0, 1) * 0xffff)) & 0xffff; + value |= ((uint16_t)(CLAMP(src[3], 0, 1) * 0xffff)) << 16; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_l16a16_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint32_t value = *(const uint32_t *)src; + uint32_t rgb; + uint32_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + rgb = (value) & 0xffff; + a = value >> 16; + dst[0] = (float)(rgb * (1.0f/0xffff)); /* r */ + dst[1] = (float)(rgb * (1.0f/0xffff)); /* g */ + dst[2] = (float)(rgb * (1.0f/0xffff)); /* b */ + dst[3] = (float)(a * (1.0f/0xffff)); /* a */ +} + +static INLINE void +util_format_l16a16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint32_t value = *(const uint32_t *)src; + uint32_t rgb; + uint32_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + rgb = (value) & 0xffff; + a = value >> 16; + dst[0] = (uint8_t)(rgb >> 8); /* r */ + dst[1] = (uint8_t)(rgb >> 8); /* g */ + dst[2] = (uint8_t)(rgb >> 8); /* b */ + dst[3] = (uint8_t)(a >> 8); /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l16a16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint32_t value = 0; + value |= ((uint16_t)(((uint32_t)src[2]) * 0xffff / 0xff)) & 0xffff; + value |= ((uint16_t)(((uint32_t)src[3]) * 0xffff / 0xff)) << 16; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_a8_snorm { + uint8_t value; + struct { + int8_t a; + } chan; +}; + +static INLINE void +util_format_a8_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint8_t value = *(const uint8_t *)src; + int8_t a; + a = (int8_t)(value) ; + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = (float)(a * (1.0f/0x7f)); /* a */ + src += 1; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_a8_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint8_t value = 0; + value |= (uint8_t)((int8_t)(CLAMP(src[3], -1, 1) * 0x7f)) ; + *(uint8_t *)dst = value; + src += 4; + dst += 1; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_a8_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint8_t value = *(const uint8_t *)src; + int8_t a; + a = (int8_t)(value) ; + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = (float)(a * (1.0f/0x7f)); /* a */ +} + +static INLINE void +util_format_a8_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint8_t value = *(const uint8_t *)src; + int8_t a; + a = (int8_t)(value) ; + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = (uint8_t)(((uint32_t)MAX2(a, 0)) * 0xff / 0x7f); /* a */ + src += 1; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_a8_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint8_t value = 0; + value |= (uint8_t)((int8_t)(src[3] >> 1)) ; + *(uint8_t *)dst = value; + src += 4; + dst += 1; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_l8_snorm { + uint8_t value; + struct { + int8_t rgb; + } chan; +}; + +static INLINE void +util_format_l8_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint8_t value = *(const uint8_t *)src; + int8_t rgb; + rgb = (int8_t)(value) ; + dst[0] = (float)(rgb * (1.0f/0x7f)); /* r */ + dst[1] = (float)(rgb * (1.0f/0x7f)); /* g */ + dst[2] = (float)(rgb * (1.0f/0x7f)); /* b */ + dst[3] = 1; /* a */ + src += 1; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l8_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint8_t value = 0; + value |= (uint8_t)((int8_t)(CLAMP(src[2], -1, 1) * 0x7f)) ; + *(uint8_t *)dst = value; + src += 4; + dst += 1; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_l8_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint8_t value = *(const uint8_t *)src; + int8_t rgb; + rgb = (int8_t)(value) ; + dst[0] = (float)(rgb * (1.0f/0x7f)); /* r */ + dst[1] = (float)(rgb * (1.0f/0x7f)); /* g */ + dst[2] = (float)(rgb * (1.0f/0x7f)); /* b */ + dst[3] = 1; /* a */ +} + +static INLINE void +util_format_l8_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint8_t value = *(const uint8_t *)src; + int8_t rgb; + rgb = (int8_t)(value) ; + dst[0] = (uint8_t)(((uint32_t)MAX2(rgb, 0)) * 0xff / 0x7f); /* r */ + dst[1] = (uint8_t)(((uint32_t)MAX2(rgb, 0)) * 0xff / 0x7f); /* g */ + dst[2] = (uint8_t)(((uint32_t)MAX2(rgb, 0)) * 0xff / 0x7f); /* b */ + dst[3] = 255; /* a */ + src += 1; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l8_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint8_t value = 0; + value |= (uint8_t)((int8_t)(src[2] >> 1)) ; + *(uint8_t *)dst = value; + src += 4; + dst += 1; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_l8a8_snorm { + uint16_t value; + struct { + int8_t rgb; + int8_t a; + } chan; +}; + +static INLINE void +util_format_l8a8_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + int16_t rgb; + int16_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgb = ((int16_t)(value << 8) ) >> 8; + a = ((int16_t)(value) ) >> 8; + dst[0] = (float)(rgb * (1.0f/0x7f)); /* r */ + dst[1] = (float)(rgb * (1.0f/0x7f)); /* g */ + dst[2] = (float)(rgb * (1.0f/0x7f)); /* b */ + dst[3] = (float)(a * (1.0f/0x7f)); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l8a8_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)(((int8_t)(CLAMP(src[2], -1, 1) * 0x7f)) & 0xff) ; + value |= (uint16_t)(((int8_t)(CLAMP(src[3], -1, 1) * 0x7f)) << 8) ; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_l8a8_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint16_t value = *(const uint16_t *)src; + int16_t rgb; + int16_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgb = ((int16_t)(value << 8) ) >> 8; + a = ((int16_t)(value) ) >> 8; + dst[0] = (float)(rgb * (1.0f/0x7f)); /* r */ + dst[1] = (float)(rgb * (1.0f/0x7f)); /* g */ + dst[2] = (float)(rgb * (1.0f/0x7f)); /* b */ + dst[3] = (float)(a * (1.0f/0x7f)); /* a */ +} + +static INLINE void +util_format_l8a8_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + int16_t rgb; + int16_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgb = ((int16_t)(value << 8) ) >> 8; + a = ((int16_t)(value) ) >> 8; + dst[0] = (uint8_t)(((uint32_t)MAX2(rgb, 0)) * 0xff / 0x7f); /* r */ + dst[1] = (uint8_t)(((uint32_t)MAX2(rgb, 0)) * 0xff / 0x7f); /* g */ + dst[2] = (uint8_t)(((uint32_t)MAX2(rgb, 0)) * 0xff / 0x7f); /* b */ + dst[3] = (uint8_t)(((uint32_t)MAX2(a, 0)) * 0xff / 0x7f); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l8a8_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)(((int8_t)(src[2] >> 1)) & 0xff) ; + value |= (uint16_t)(((int8_t)(src[3] >> 1)) << 8) ; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_i8_snorm { + uint8_t value; + struct { + int8_t rgba; + } chan; +}; + +static INLINE void +util_format_i8_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint8_t value = *(const uint8_t *)src; + int8_t rgba; + rgba = (int8_t)(value) ; + dst[0] = (float)(rgba * (1.0f/0x7f)); /* r */ + dst[1] = (float)(rgba * (1.0f/0x7f)); /* g */ + dst[2] = (float)(rgba * (1.0f/0x7f)); /* b */ + dst[3] = (float)(rgba * (1.0f/0x7f)); /* a */ + src += 1; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_i8_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint8_t value = 0; + value |= (uint8_t)((int8_t)(CLAMP(src[3], -1, 1) * 0x7f)) ; + *(uint8_t *)dst = value; + src += 4; + dst += 1; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_i8_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint8_t value = *(const uint8_t *)src; + int8_t rgba; + rgba = (int8_t)(value) ; + dst[0] = (float)(rgba * (1.0f/0x7f)); /* r */ + dst[1] = (float)(rgba * (1.0f/0x7f)); /* g */ + dst[2] = (float)(rgba * (1.0f/0x7f)); /* b */ + dst[3] = (float)(rgba * (1.0f/0x7f)); /* a */ +} + +static INLINE void +util_format_i8_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint8_t value = *(const uint8_t *)src; + int8_t rgba; + rgba = (int8_t)(value) ; + dst[0] = (uint8_t)(((uint32_t)MAX2(rgba, 0)) * 0xff / 0x7f); /* r */ + dst[1] = (uint8_t)(((uint32_t)MAX2(rgba, 0)) * 0xff / 0x7f); /* g */ + dst[2] = (uint8_t)(((uint32_t)MAX2(rgba, 0)) * 0xff / 0x7f); /* b */ + dst[3] = (uint8_t)(((uint32_t)MAX2(rgba, 0)) * 0xff / 0x7f); /* a */ + src += 1; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_i8_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint8_t value = 0; + value |= (uint8_t)((int8_t)(src[3] >> 1)) ; + *(uint8_t *)dst = value; + src += 4; + dst += 1; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_a16_snorm { + uint16_t value; + struct { + int16_t a; + } chan; +}; + +static INLINE void +util_format_a16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + int16_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + a = (int16_t)(value) ; + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = (float)(a * (1.0f/0x7fff)); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_a16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)((int16_t)(CLAMP(src[3], -1, 1) * 0x7fff)) ; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_a16_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint16_t value = *(const uint16_t *)src; + int16_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + a = (int16_t)(value) ; + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = (float)(a * (1.0f/0x7fff)); /* a */ +} + +static INLINE void +util_format_a16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + int16_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + a = (int16_t)(value) ; + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = (uint8_t)(MAX2(a, 0) >> 7); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_a16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)((int16_t)(((uint32_t)src[3]) * 0x7fff / 0xff)) ; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_l16_snorm { + uint16_t value; + struct { + int16_t rgb; + } chan; +}; + +static INLINE void +util_format_l16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + int16_t rgb; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgb = (int16_t)(value) ; + dst[0] = (float)(rgb * (1.0f/0x7fff)); /* r */ + dst[1] = (float)(rgb * (1.0f/0x7fff)); /* g */ + dst[2] = (float)(rgb * (1.0f/0x7fff)); /* b */ + dst[3] = 1; /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)((int16_t)(CLAMP(src[2], -1, 1) * 0x7fff)) ; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_l16_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint16_t value = *(const uint16_t *)src; + int16_t rgb; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgb = (int16_t)(value) ; + dst[0] = (float)(rgb * (1.0f/0x7fff)); /* r */ + dst[1] = (float)(rgb * (1.0f/0x7fff)); /* g */ + dst[2] = (float)(rgb * (1.0f/0x7fff)); /* b */ + dst[3] = 1; /* a */ +} + +static INLINE void +util_format_l16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + int16_t rgb; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgb = (int16_t)(value) ; + dst[0] = (uint8_t)(MAX2(rgb, 0) >> 7); /* r */ + dst[1] = (uint8_t)(MAX2(rgb, 0) >> 7); /* g */ + dst[2] = (uint8_t)(MAX2(rgb, 0) >> 7); /* b */ + dst[3] = 255; /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)((int16_t)(((uint32_t)src[2]) * 0x7fff / 0xff)) ; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_l16a16_snorm { + uint32_t value; + struct { + int16_t rgb; + int16_t a; + } chan; +}; + +static INLINE void +util_format_l16a16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint32_t value = *(const uint32_t *)src; + int32_t rgb; + int32_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + rgb = ((int32_t)(value << 16) ) >> 16; + a = ((int32_t)(value) ) >> 16; + dst[0] = (float)(rgb * (1.0f/0x7fff)); /* r */ + dst[1] = (float)(rgb * (1.0f/0x7fff)); /* g */ + dst[2] = (float)(rgb * (1.0f/0x7fff)); /* b */ + dst[3] = (float)(a * (1.0f/0x7fff)); /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l16a16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint32_t value = 0; + value |= (uint32_t)(((int16_t)(CLAMP(src[2], -1, 1) * 0x7fff)) & 0xffff) ; + value |= (uint32_t)(((int16_t)(CLAMP(src[3], -1, 1) * 0x7fff)) << 16) ; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_l16a16_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint32_t value = *(const uint32_t *)src; + int32_t rgb; + int32_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + rgb = ((int32_t)(value << 16) ) >> 16; + a = ((int32_t)(value) ) >> 16; + dst[0] = (float)(rgb * (1.0f/0x7fff)); /* r */ + dst[1] = (float)(rgb * (1.0f/0x7fff)); /* g */ + dst[2] = (float)(rgb * (1.0f/0x7fff)); /* b */ + dst[3] = (float)(a * (1.0f/0x7fff)); /* a */ +} + +static INLINE void +util_format_l16a16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint32_t value = *(const uint32_t *)src; + int32_t rgb; + int32_t a; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + rgb = ((int32_t)(value << 16) ) >> 16; + a = ((int32_t)(value) ) >> 16; + dst[0] = (uint8_t)(MAX2(rgb, 0) >> 7); /* r */ + dst[1] = (uint8_t)(MAX2(rgb, 0) >> 7); /* g */ + dst[2] = (uint8_t)(MAX2(rgb, 0) >> 7); /* b */ + dst[3] = (uint8_t)(MAX2(a, 0) >> 7); /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l16a16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint32_t value = 0; + value |= (uint32_t)(((int16_t)(((uint32_t)src[2]) * 0x7fff / 0xff)) & 0xffff) ; + value |= (uint32_t)(((int16_t)(((uint32_t)src[3]) * 0x7fff / 0xff)) << 16) ; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_i16_snorm { + uint16_t value; + struct { + int16_t rgba; + } chan; +}; + +static INLINE void +util_format_i16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + int16_t rgba; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgba = (int16_t)(value) ; + dst[0] = (float)(rgba * (1.0f/0x7fff)); /* r */ + dst[1] = (float)(rgba * (1.0f/0x7fff)); /* g */ + dst[2] = (float)(rgba * (1.0f/0x7fff)); /* b */ + dst[3] = (float)(rgba * (1.0f/0x7fff)); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_i16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)((int16_t)(CLAMP(src[3], -1, 1) * 0x7fff)) ; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_i16_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + uint16_t value = *(const uint16_t *)src; + int16_t rgba; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgba = (int16_t)(value) ; + dst[0] = (float)(rgba * (1.0f/0x7fff)); /* r */ + dst[1] = (float)(rgba * (1.0f/0x7fff)); /* g */ + dst[2] = (float)(rgba * (1.0f/0x7fff)); /* b */ + dst[3] = (float)(rgba * (1.0f/0x7fff)); /* a */ +} + +static INLINE void +util_format_i16_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 uint8_t *src = src_row; + for(x = 0; x < width; x += 1) { + uint16_t value = *(const uint16_t *)src; + int16_t rgba; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + rgba = (int16_t)(value) ; + dst[0] = (uint8_t)(MAX2(rgba, 0) >> 7); /* r */ + dst[1] = (uint8_t)(MAX2(rgba, 0) >> 7); /* g */ + dst[2] = (uint8_t)(MAX2(rgba, 0) >> 7); /* b */ + dst[3] = (uint8_t)(MAX2(rgba, 0) >> 7); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_i16_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; + uint8_t *dst = dst_row; + for(x = 0; x < width; x += 1) { + uint16_t value = 0; + value |= (uint16_t)((int16_t)(((uint32_t)src[3]) * 0x7fff / 0xff)) ; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *(uint16_t *)dst = value; + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_a16_float { + uint16_t value; + struct { + uint16_t a; + } chan; +}; + +static INLINE void +util_format_a16_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) { + union util_format_a16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = util_half_to_float(pixel.chan.a); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_a16_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) { + union util_format_a16_float pixel; + pixel.chan.a = util_float_to_half(src[3]); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_a16_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + union util_format_a16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = util_half_to_float(pixel.chan.a); /* a */ +} + +static INLINE void +util_format_a16_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; + 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) { + union util_format_a16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = float_to_ubyte(util_half_to_float(pixel.chan.a)); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_a16_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; + 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) { + union util_format_a16_float pixel; + pixel.chan.a = util_float_to_half((float)(src[3] * (1.0f/0xff))); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_l16_float { + uint16_t value; + struct { + uint16_t rgb; + } chan; +}; + +static INLINE void +util_format_l16_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) { + union util_format_l16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = util_half_to_float(pixel.chan.rgb); /* r */ + dst[1] = util_half_to_float(pixel.chan.rgb); /* g */ + dst[2] = util_half_to_float(pixel.chan.rgb); /* b */ + dst[3] = 1; /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l16_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) { + union util_format_l16_float pixel; + pixel.chan.rgb = util_float_to_half(src[2]); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_l16_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + union util_format_l16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = util_half_to_float(pixel.chan.rgb); /* r */ + dst[1] = util_half_to_float(pixel.chan.rgb); /* g */ + dst[2] = util_half_to_float(pixel.chan.rgb); /* b */ + dst[3] = 1; /* a */ +} + +static INLINE void +util_format_l16_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; + 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) { + union util_format_l16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = float_to_ubyte(util_half_to_float(pixel.chan.rgb)); /* r */ + dst[1] = float_to_ubyte(util_half_to_float(pixel.chan.rgb)); /* g */ + dst[2] = float_to_ubyte(util_half_to_float(pixel.chan.rgb)); /* b */ + dst[3] = 255; /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l16_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; + 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) { + union util_format_l16_float pixel; + pixel.chan.rgb = util_float_to_half((float)(src[2] * (1.0f/0xff))); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_l16a16_float { + uint32_t value; + struct { + uint16_t rgb; + uint16_t a; + } chan; +}; + +static INLINE void +util_format_l16a16_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) { + union util_format_l16a16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = util_half_to_float(pixel.chan.rgb); /* r */ + dst[1] = util_half_to_float(pixel.chan.rgb); /* g */ + dst[2] = util_half_to_float(pixel.chan.rgb); /* b */ + dst[3] = util_half_to_float(pixel.chan.a); /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l16a16_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) { + union util_format_l16a16_float pixel; + pixel.chan.rgb = util_float_to_half(src[2]); + pixel.chan.a = util_float_to_half(src[3]); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_l16a16_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + union util_format_l16a16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = util_half_to_float(pixel.chan.rgb); /* r */ + dst[1] = util_half_to_float(pixel.chan.rgb); /* g */ + dst[2] = util_half_to_float(pixel.chan.rgb); /* b */ + dst[3] = util_half_to_float(pixel.chan.a); /* a */ +} + +static INLINE void +util_format_l16a16_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; + 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) { + union util_format_l16a16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = float_to_ubyte(util_half_to_float(pixel.chan.rgb)); /* r */ + dst[1] = float_to_ubyte(util_half_to_float(pixel.chan.rgb)); /* g */ + dst[2] = float_to_ubyte(util_half_to_float(pixel.chan.rgb)); /* b */ + dst[3] = float_to_ubyte(util_half_to_float(pixel.chan.a)); /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l16a16_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; + 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) { + union util_format_l16a16_float pixel; + pixel.chan.rgb = util_float_to_half((float)(src[2] * (1.0f/0xff))); + pixel.chan.a = util_float_to_half((float)(src[3] * (1.0f/0xff))); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_i16_float { + uint16_t value; + struct { + uint16_t rgba; + } chan; +}; + +static INLINE void +util_format_i16_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) { + union util_format_i16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = util_half_to_float(pixel.chan.rgba); /* r */ + dst[1] = util_half_to_float(pixel.chan.rgba); /* g */ + dst[2] = util_half_to_float(pixel.chan.rgba); /* b */ + dst[3] = util_half_to_float(pixel.chan.rgba); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_i16_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) { + union util_format_i16_float pixel; + pixel.chan.rgba = util_float_to_half(src[3]); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_i16_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + union util_format_i16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = util_half_to_float(pixel.chan.rgba); /* r */ + dst[1] = util_half_to_float(pixel.chan.rgba); /* g */ + dst[2] = util_half_to_float(pixel.chan.rgba); /* b */ + dst[3] = util_half_to_float(pixel.chan.rgba); /* a */ +} + +static INLINE void +util_format_i16_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; + 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) { + union util_format_i16_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = float_to_ubyte(util_half_to_float(pixel.chan.rgba)); /* r */ + dst[1] = float_to_ubyte(util_half_to_float(pixel.chan.rgba)); /* g */ + dst[2] = float_to_ubyte(util_half_to_float(pixel.chan.rgba)); /* b */ + dst[3] = float_to_ubyte(util_half_to_float(pixel.chan.rgba)); /* a */ + src += 2; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_i16_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; + 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) { + union util_format_i16_float pixel; + pixel.chan.rgba = util_float_to_half((float)(src[3] * (1.0f/0xff))); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 2; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_a32_float { + uint32_t value; + struct { + float a; + } chan; +}; + +static INLINE void +util_format_a32_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) { + union util_format_a32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = pixel.chan.a; /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_a32_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) { + union util_format_a32_float pixel; + pixel.chan.a = src[3]; + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_a32_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + union util_format_a32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = pixel.chan.a; /* a */ +} + +static INLINE void +util_format_a32_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; + 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) { + union util_format_a32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = 0; /* r */ + dst[1] = 0; /* g */ + dst[2] = 0; /* b */ + dst[3] = float_to_ubyte(pixel.chan.a); /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_a32_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; + 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) { + union util_format_a32_float pixel; + pixel.chan.a = ubyte_to_float(src[3]); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_l32_float { + uint32_t value; + struct { + float rgb; + } chan; +}; + +static INLINE void +util_format_l32_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) { + union util_format_l32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = pixel.chan.rgb; /* r */ + dst[1] = pixel.chan.rgb; /* g */ + dst[2] = pixel.chan.rgb; /* b */ + dst[3] = 1; /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l32_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) { + union util_format_l32_float pixel; + pixel.chan.rgb = src[2]; + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_l32_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + union util_format_l32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = pixel.chan.rgb; /* r */ + dst[1] = pixel.chan.rgb; /* g */ + dst[2] = pixel.chan.rgb; /* b */ + dst[3] = 1; /* a */ +} + +static INLINE void +util_format_l32_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; + 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) { + union util_format_l32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = float_to_ubyte(pixel.chan.rgb); /* r */ + dst[1] = float_to_ubyte(pixel.chan.rgb); /* g */ + dst[2] = float_to_ubyte(pixel.chan.rgb); /* b */ + dst[3] = 255; /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l32_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; + 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) { + union util_format_l32_float pixel; + pixel.chan.rgb = ubyte_to_float(src[2]); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_l32a32_float { + uint64_t value; + struct { + float rgb; + float a; + } chan; +}; + +static INLINE void +util_format_l32a32_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) { + union util_format_l32a32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = pixel.chan.rgb; /* r */ + dst[1] = pixel.chan.rgb; /* g */ + dst[2] = pixel.chan.rgb; /* b */ + dst[3] = pixel.chan.a; /* a */ + src += 8; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l32a32_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) { + union util_format_l32a32_float pixel; + pixel.chan.rgb = src[2]; + pixel.chan.a = src[3]; + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 8; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_l32a32_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + union util_format_l32a32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = pixel.chan.rgb; /* r */ + dst[1] = pixel.chan.rgb; /* g */ + dst[2] = pixel.chan.rgb; /* b */ + dst[3] = pixel.chan.a; /* a */ +} + +static INLINE void +util_format_l32a32_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; + 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) { + union util_format_l32a32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = float_to_ubyte(pixel.chan.rgb); /* r */ + dst[1] = float_to_ubyte(pixel.chan.rgb); /* g */ + dst[2] = float_to_ubyte(pixel.chan.rgb); /* b */ + dst[3] = float_to_ubyte(pixel.chan.a); /* a */ + src += 8; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_l32a32_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; + 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) { + union util_format_l32a32_float pixel; + pixel.chan.rgb = ubyte_to_float(src[2]); + pixel.chan.a = ubyte_to_float(src[3]); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 8; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +union util_format_i32_float { + uint32_t value; + struct { + float rgba; + } chan; +}; + +static INLINE void +util_format_i32_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) { + union util_format_i32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = pixel.chan.rgba; /* r */ + dst[1] = pixel.chan.rgba; /* g */ + dst[2] = pixel.chan.rgba; /* b */ + dst[3] = pixel.chan.rgba; /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_i32_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) { + union util_format_i32_float pixel; + pixel.chan.rgba = src[3]; + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + +static INLINE void +util_format_i32_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +{ + union util_format_i32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = pixel.chan.rgba; /* r */ + dst[1] = pixel.chan.rgba; /* g */ + dst[2] = pixel.chan.rgba; /* b */ + dst[3] = pixel.chan.rgba; /* a */ +} + +static INLINE void +util_format_i32_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; + 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) { + union util_format_i32_float pixel; + memcpy(&pixel, src, sizeof pixel); + dst[0] = float_to_ubyte(pixel.chan.rgba); /* r */ + dst[1] = float_to_ubyte(pixel.chan.rgba); /* g */ + dst[2] = float_to_ubyte(pixel.chan.rgba); /* b */ + dst[3] = float_to_ubyte(pixel.chan.rgba); /* a */ + src += 4; + dst += 4; + } + src_row += src_stride; + dst_row += dst_stride/sizeof(*dst_row); + } +} + +static INLINE void +util_format_i32_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; + 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) { + union util_format_i32_float pixel; + pixel.chan.rgba = ubyte_to_float(src[3]); + memcpy(dst, &pixel, sizeof pixel); + src += 4; + dst += 4; + } + dst_row += dst_stride; + src_row += src_stride/sizeof(*src_row); + } +} + union util_format_l8_srgb { uint8_t value; struct { @@ -4671,131 +6880,6 @@ util_format_r10g10b10a2_uscaled_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_ } } -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE void -util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE void -util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE void -util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE void -util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - -static INLINE void -util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) -{ -} - -static INLINE 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) -{ -} - -static INLINE 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) -{ -} - union util_format_r64_float { uint64_t value; struct { @@ -12797,6 +14881,44 @@ util_format_b10g10r10a2_unorm_description = { }; const struct util_format_description +util_format_b2g3r3_unorm_description = { + PIPE_FORMAT_B2G3R3_UNORM, + "PIPE_FORMAT_B2G3R3_UNORM", + "b2g3r3_unorm", + {1, 1, 8}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 3, /* nr_channels */ + FALSE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_UNSIGNED, TRUE, 2}, /* x = b */ + {UTIL_FORMAT_TYPE_UNSIGNED, TRUE, 3}, /* y = g */ + {UTIL_FORMAT_TYPE_UNSIGNED, TRUE, 3}, /* z = r */ + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_Z, /* r */ + UTIL_FORMAT_SWIZZLE_Y, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_1 /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_b2g3r3_unorm_unpack_rgba_8unorm, + &util_format_b2g3r3_unorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_b2g3r3_unorm_unpack_rgba_float, + &util_format_b2g3r3_unorm_pack_rgba_float, + &util_format_b2g3r3_unorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description util_format_l8_unorm_description = { PIPE_FORMAT_L8_UNORM, "PIPE_FORMAT_L8_UNORM", @@ -13025,6 +15147,728 @@ util_format_l16_unorm_description = { }; const struct util_format_description +util_format_a16_unorm_description = { + PIPE_FORMAT_A16_UNORM, + "PIPE_FORMAT_A16_UNORM", + "a16_unorm", + {1, 1, 16}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_UNSIGNED, TRUE, 16}, /* x = a */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_0, /* r */ + UTIL_FORMAT_SWIZZLE_0, /* g */ + UTIL_FORMAT_SWIZZLE_0, /* b */ + UTIL_FORMAT_SWIZZLE_X /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_a16_unorm_unpack_rgba_8unorm, + &util_format_a16_unorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_a16_unorm_unpack_rgba_float, + &util_format_a16_unorm_pack_rgba_float, + &util_format_a16_unorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_i16_unorm_description = { + PIPE_FORMAT_I16_UNORM, + "PIPE_FORMAT_I16_UNORM", + "i16_unorm", + {1, 1, 16}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_UNSIGNED, TRUE, 16}, /* x = rgba */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_X /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_i16_unorm_unpack_rgba_8unorm, + &util_format_i16_unorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_i16_unorm_unpack_rgba_float, + &util_format_i16_unorm_pack_rgba_float, + &util_format_i16_unorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_l16a16_unorm_description = { + PIPE_FORMAT_L16A16_UNORM, + "PIPE_FORMAT_L16A16_UNORM", + "l16a16_unorm", + {1, 1, 32}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 2, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_UNSIGNED, TRUE, 16}, /* x = rgb */ + {UTIL_FORMAT_TYPE_UNSIGNED, TRUE, 16}, /* y = a */ + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_Y /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_l16a16_unorm_unpack_rgba_8unorm, + &util_format_l16a16_unorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_l16a16_unorm_unpack_rgba_float, + &util_format_l16a16_unorm_pack_rgba_float, + &util_format_l16a16_unorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_a8_snorm_description = { + PIPE_FORMAT_A8_SNORM, + "PIPE_FORMAT_A8_SNORM", + "a8_snorm", + {1, 1, 8}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_SIGNED, TRUE, 8}, /* x = a */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_0, /* r */ + UTIL_FORMAT_SWIZZLE_0, /* g */ + UTIL_FORMAT_SWIZZLE_0, /* b */ + UTIL_FORMAT_SWIZZLE_X /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_a8_snorm_unpack_rgba_8unorm, + &util_format_a8_snorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_a8_snorm_unpack_rgba_float, + &util_format_a8_snorm_pack_rgba_float, + &util_format_a8_snorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_l8_snorm_description = { + PIPE_FORMAT_L8_SNORM, + "PIPE_FORMAT_L8_SNORM", + "l8_snorm", + {1, 1, 8}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_SIGNED, TRUE, 8}, /* x = rgb */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_1 /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_l8_snorm_unpack_rgba_8unorm, + &util_format_l8_snorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_l8_snorm_unpack_rgba_float, + &util_format_l8_snorm_pack_rgba_float, + &util_format_l8_snorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_l8a8_snorm_description = { + PIPE_FORMAT_L8A8_SNORM, + "PIPE_FORMAT_L8A8_SNORM", + "l8a8_snorm", + {1, 1, 16}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 2, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_SIGNED, TRUE, 8}, /* x = rgb */ + {UTIL_FORMAT_TYPE_SIGNED, TRUE, 8}, /* y = a */ + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_Y /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_l8a8_snorm_unpack_rgba_8unorm, + &util_format_l8a8_snorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_l8a8_snorm_unpack_rgba_float, + &util_format_l8a8_snorm_pack_rgba_float, + &util_format_l8a8_snorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_i8_snorm_description = { + PIPE_FORMAT_I8_SNORM, + "PIPE_FORMAT_I8_SNORM", + "i8_snorm", + {1, 1, 8}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_SIGNED, TRUE, 8}, /* x = rgba */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_X /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_i8_snorm_unpack_rgba_8unorm, + &util_format_i8_snorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_i8_snorm_unpack_rgba_float, + &util_format_i8_snorm_pack_rgba_float, + &util_format_i8_snorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_a16_snorm_description = { + PIPE_FORMAT_A16_SNORM, + "PIPE_FORMAT_A16_SNORM", + "a16_snorm", + {1, 1, 16}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_SIGNED, TRUE, 16}, /* x = a */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_0, /* r */ + UTIL_FORMAT_SWIZZLE_0, /* g */ + UTIL_FORMAT_SWIZZLE_0, /* b */ + UTIL_FORMAT_SWIZZLE_X /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_a16_snorm_unpack_rgba_8unorm, + &util_format_a16_snorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_a16_snorm_unpack_rgba_float, + &util_format_a16_snorm_pack_rgba_float, + &util_format_a16_snorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_l16_snorm_description = { + PIPE_FORMAT_L16_SNORM, + "PIPE_FORMAT_L16_SNORM", + "l16_snorm", + {1, 1, 16}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_SIGNED, TRUE, 16}, /* x = rgb */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_1 /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_l16_snorm_unpack_rgba_8unorm, + &util_format_l16_snorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_l16_snorm_unpack_rgba_float, + &util_format_l16_snorm_pack_rgba_float, + &util_format_l16_snorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_l16a16_snorm_description = { + PIPE_FORMAT_L16A16_SNORM, + "PIPE_FORMAT_L16A16_SNORM", + "l16a16_snorm", + {1, 1, 32}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 2, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_SIGNED, TRUE, 16}, /* x = rgb */ + {UTIL_FORMAT_TYPE_SIGNED, TRUE, 16}, /* y = a */ + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_Y /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_l16a16_snorm_unpack_rgba_8unorm, + &util_format_l16a16_snorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_l16a16_snorm_unpack_rgba_float, + &util_format_l16a16_snorm_pack_rgba_float, + &util_format_l16a16_snorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_i16_snorm_description = { + PIPE_FORMAT_I16_SNORM, + "PIPE_FORMAT_I16_SNORM", + "i16_snorm", + {1, 1, 16}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + TRUE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_SIGNED, TRUE, 16}, /* x = rgba */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_X /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_i16_snorm_unpack_rgba_8unorm, + &util_format_i16_snorm_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_i16_snorm_unpack_rgba_float, + &util_format_i16_snorm_pack_rgba_float, + &util_format_i16_snorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_a16_float_description = { + PIPE_FORMAT_A16_FLOAT, + "PIPE_FORMAT_A16_FLOAT", + "a16_float", + {1, 1, 16}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_FLOAT, FALSE, 16}, /* x = a */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_0, /* r */ + UTIL_FORMAT_SWIZZLE_0, /* g */ + UTIL_FORMAT_SWIZZLE_0, /* b */ + UTIL_FORMAT_SWIZZLE_X /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_a16_float_unpack_rgba_8unorm, + &util_format_a16_float_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_a16_float_unpack_rgba_float, + &util_format_a16_float_pack_rgba_float, + &util_format_a16_float_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_l16_float_description = { + PIPE_FORMAT_L16_FLOAT, + "PIPE_FORMAT_L16_FLOAT", + "l16_float", + {1, 1, 16}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_FLOAT, FALSE, 16}, /* x = rgb */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_1 /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_l16_float_unpack_rgba_8unorm, + &util_format_l16_float_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_l16_float_unpack_rgba_float, + &util_format_l16_float_pack_rgba_float, + &util_format_l16_float_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_l16a16_float_description = { + PIPE_FORMAT_L16A16_FLOAT, + "PIPE_FORMAT_L16A16_FLOAT", + "l16a16_float", + {1, 1, 32}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 2, /* nr_channels */ + TRUE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_FLOAT, FALSE, 16}, /* x = rgb */ + {UTIL_FORMAT_TYPE_FLOAT, FALSE, 16}, /* y = a */ + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_Y /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_l16a16_float_unpack_rgba_8unorm, + &util_format_l16a16_float_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_l16a16_float_unpack_rgba_float, + &util_format_l16a16_float_pack_rgba_float, + &util_format_l16a16_float_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_i16_float_description = { + PIPE_FORMAT_I16_FLOAT, + "PIPE_FORMAT_I16_FLOAT", + "i16_float", + {1, 1, 16}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_FLOAT, FALSE, 16}, /* x = rgba */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_X /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_i16_float_unpack_rgba_8unorm, + &util_format_i16_float_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_i16_float_unpack_rgba_float, + &util_format_i16_float_pack_rgba_float, + &util_format_i16_float_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_a32_float_description = { + PIPE_FORMAT_A32_FLOAT, + "PIPE_FORMAT_A32_FLOAT", + "a32_float", + {1, 1, 32}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_FLOAT, FALSE, 32}, /* x = a */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_0, /* r */ + UTIL_FORMAT_SWIZZLE_0, /* g */ + UTIL_FORMAT_SWIZZLE_0, /* b */ + UTIL_FORMAT_SWIZZLE_X /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_a32_float_unpack_rgba_8unorm, + &util_format_a32_float_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_a32_float_unpack_rgba_float, + &util_format_a32_float_pack_rgba_float, + &util_format_a32_float_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_l32_float_description = { + PIPE_FORMAT_L32_FLOAT, + "PIPE_FORMAT_L32_FLOAT", + "l32_float", + {1, 1, 32}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_FLOAT, FALSE, 32}, /* x = rgb */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_1 /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_l32_float_unpack_rgba_8unorm, + &util_format_l32_float_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_l32_float_unpack_rgba_float, + &util_format_l32_float_pack_rgba_float, + &util_format_l32_float_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_l32a32_float_description = { + PIPE_FORMAT_L32A32_FLOAT, + "PIPE_FORMAT_L32A32_FLOAT", + "l32a32_float", + {1, 1, 64}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 2, /* nr_channels */ + TRUE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_FLOAT, FALSE, 32}, /* x = rgb */ + {UTIL_FORMAT_TYPE_FLOAT, FALSE, 32}, /* y = a */ + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_Y /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_l32a32_float_unpack_rgba_8unorm, + &util_format_l32a32_float_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_l32a32_float_unpack_rgba_float, + &util_format_l32a32_float_pack_rgba_float, + &util_format_l32a32_float_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_i32_float_description = { + PIPE_FORMAT_I32_FLOAT, + "PIPE_FORMAT_I32_FLOAT", + "i32_float", + {1, 1, 32}, /* block */ + UTIL_FORMAT_LAYOUT_PLAIN, + 1, /* nr_channels */ + TRUE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_FLOAT, FALSE, 32}, /* x = rgba */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_X /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_i32_float_unpack_rgba_8unorm, + &util_format_i32_float_pack_rgba_8unorm, + NULL, /* fetch_rgba_8unorm */ + &util_format_i32_float_unpack_rgba_float, + &util_format_i32_float_pack_rgba_float, + &util_format_i32_float_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description util_format_l8_srgb_description = { PIPE_FORMAT_L8_SRGB, "PIPE_FORMAT_L8_SRGB", @@ -14170,15 +17014,15 @@ util_format_r11g11b10_float_description = { "PIPE_FORMAT_R11G11B10_FLOAT", "r11g11b10_float", {1, 1, 32}, /* block */ - UTIL_FORMAT_LAYOUT_PLAIN, - 3, /* nr_channels */ + UTIL_FORMAT_LAYOUT_OTHER, + 1, /* nr_channels */ FALSE, /* is_array */ FALSE, /* is_bitmask */ FALSE, /* is_mixed */ { - {UTIL_FORMAT_TYPE_FLOAT, FALSE, 11}, /* x = r */ - {UTIL_FORMAT_TYPE_FLOAT, FALSE, 11}, /* y = g */ - {UTIL_FORMAT_TYPE_FLOAT, FALSE, 10}, /* z = b */ + {UTIL_FORMAT_TYPE_VOID, FALSE, 32}, /* x = x */ + {0, 0, 0}, + {0, 0, 0}, {0, 0, 0} }, { @@ -14646,7 +17490,7 @@ util_format_rgtc1_unorm_description = { UTIL_FORMAT_COLORSPACE_RGB, &util_format_rgtc1_unorm_unpack_rgba_8unorm, &util_format_rgtc1_unorm_pack_rgba_8unorm, - NULL, /* fetch_rgba_8unorm */ + &util_format_rgtc1_unorm_fetch_rgba_8unorm, &util_format_rgtc1_unorm_unpack_rgba_float, &util_format_rgtc1_unorm_pack_rgba_float, &util_format_rgtc1_unorm_fetch_rgba_float, @@ -14684,7 +17528,7 @@ util_format_rgtc1_snorm_description = { UTIL_FORMAT_COLORSPACE_RGB, &util_format_rgtc1_snorm_unpack_rgba_8unorm, &util_format_rgtc1_snorm_pack_rgba_8unorm, - NULL, /* fetch_rgba_8unorm */ + &util_format_rgtc1_snorm_fetch_rgba_8unorm, &util_format_rgtc1_snorm_unpack_rgba_float, &util_format_rgtc1_snorm_pack_rgba_float, &util_format_rgtc1_snorm_fetch_rgba_float, @@ -14722,7 +17566,7 @@ util_format_rgtc2_unorm_description = { UTIL_FORMAT_COLORSPACE_RGB, &util_format_rgtc2_unorm_unpack_rgba_8unorm, &util_format_rgtc2_unorm_pack_rgba_8unorm, - NULL, /* fetch_rgba_8unorm */ + &util_format_rgtc2_unorm_fetch_rgba_8unorm, &util_format_rgtc2_unorm_unpack_rgba_float, &util_format_rgtc2_unorm_pack_rgba_float, &util_format_rgtc2_unorm_fetch_rgba_float, @@ -14760,7 +17604,7 @@ util_format_rgtc2_snorm_description = { UTIL_FORMAT_COLORSPACE_RGB, &util_format_rgtc2_snorm_unpack_rgba_8unorm, &util_format_rgtc2_snorm_pack_rgba_8unorm, - NULL, /* fetch_rgba_8unorm */ + &util_format_rgtc2_snorm_fetch_rgba_8unorm, &util_format_rgtc2_snorm_unpack_rgba_float, &util_format_rgtc2_snorm_pack_rgba_float, &util_format_rgtc2_snorm_fetch_rgba_float, @@ -14773,6 +17617,158 @@ util_format_rgtc2_snorm_description = { }; const struct util_format_description +util_format_latc1_unorm_description = { + PIPE_FORMAT_LATC1_UNORM, + "PIPE_FORMAT_LATC1_UNORM", + "latc1_unorm", + {4, 4, 64}, /* block */ + UTIL_FORMAT_LAYOUT_RGTC, + 1, /* nr_channels */ + FALSE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_VOID, FALSE, 64}, /* x = x */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_1 /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_latc1_unorm_unpack_rgba_8unorm, + &util_format_latc1_unorm_pack_rgba_8unorm, + &util_format_latc1_unorm_fetch_rgba_8unorm, + &util_format_latc1_unorm_unpack_rgba_float, + &util_format_latc1_unorm_pack_rgba_float, + &util_format_latc1_unorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_latc1_snorm_description = { + PIPE_FORMAT_LATC1_SNORM, + "PIPE_FORMAT_LATC1_SNORM", + "latc1_snorm", + {4, 4, 64}, /* block */ + UTIL_FORMAT_LAYOUT_RGTC, + 1, /* nr_channels */ + FALSE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_VOID, FALSE, 64}, /* x = x */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_1 /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_latc1_snorm_unpack_rgba_8unorm, + &util_format_latc1_snorm_pack_rgba_8unorm, + &util_format_latc1_snorm_fetch_rgba_8unorm, + &util_format_latc1_snorm_unpack_rgba_float, + &util_format_latc1_snorm_pack_rgba_float, + &util_format_latc1_snorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_latc2_unorm_description = { + PIPE_FORMAT_LATC2_UNORM, + "PIPE_FORMAT_LATC2_UNORM", + "latc2_unorm", + {4, 4, 128}, /* block */ + UTIL_FORMAT_LAYOUT_RGTC, + 1, /* nr_channels */ + FALSE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_VOID, FALSE, 128}, /* x = x */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_Y /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_latc2_unorm_unpack_rgba_8unorm, + &util_format_latc2_unorm_pack_rgba_8unorm, + &util_format_latc2_unorm_fetch_rgba_8unorm, + &util_format_latc2_unorm_unpack_rgba_float, + &util_format_latc2_unorm_pack_rgba_float, + &util_format_latc2_unorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description +util_format_latc2_snorm_description = { + PIPE_FORMAT_LATC2_SNORM, + "PIPE_FORMAT_LATC2_SNORM", + "latc2_snorm", + {4, 4, 128}, /* block */ + UTIL_FORMAT_LAYOUT_RGTC, + 1, /* nr_channels */ + FALSE, /* is_array */ + FALSE, /* is_bitmask */ + FALSE, /* is_mixed */ + { + {UTIL_FORMAT_TYPE_VOID, FALSE, 128}, /* x = x */ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }, + { + UTIL_FORMAT_SWIZZLE_X, /* r */ + UTIL_FORMAT_SWIZZLE_X, /* g */ + UTIL_FORMAT_SWIZZLE_X, /* b */ + UTIL_FORMAT_SWIZZLE_Y /* a */ + }, + UTIL_FORMAT_COLORSPACE_RGB, + &util_format_latc2_snorm_unpack_rgba_8unorm, + &util_format_latc2_snorm_pack_rgba_8unorm, + &util_format_latc2_snorm_fetch_rgba_8unorm, + &util_format_latc2_snorm_unpack_rgba_float, + &util_format_latc2_snorm_pack_rgba_float, + &util_format_latc2_snorm_fetch_rgba_float, + NULL, /* unpack_z_32unorm */ + NULL, /* pack_z_32unorm */ + NULL, /* unpack_z_float */ + NULL, /* pack_z_float */ + NULL, /* unpack_s_8uscaled */ + NULL /* pack_s_8uscaled */ +}; + +const struct util_format_description util_format_r64_float_description = { PIPE_FORMAT_R64_FLOAT, "PIPE_FORMAT_R64_FLOAT", @@ -17318,6 +20314,8 @@ util_format_description(enum pipe_format format) return &util_format_r10g10b10a2_unorm_description; case PIPE_FORMAT_B10G10R10A2_UNORM: return &util_format_b10g10r10a2_unorm_description; + case PIPE_FORMAT_B2G3R3_UNORM: + return &util_format_b2g3r3_unorm_description; case PIPE_FORMAT_L8_UNORM: return &util_format_l8_unorm_description; case PIPE_FORMAT_A8_UNORM: @@ -17330,6 +20328,44 @@ util_format_description(enum pipe_format format) return &util_format_l8a8_unorm_description; case PIPE_FORMAT_L16_UNORM: return &util_format_l16_unorm_description; + case PIPE_FORMAT_A16_UNORM: + return &util_format_a16_unorm_description; + case PIPE_FORMAT_I16_UNORM: + return &util_format_i16_unorm_description; + case PIPE_FORMAT_L16A16_UNORM: + return &util_format_l16a16_unorm_description; + case PIPE_FORMAT_A8_SNORM: + return &util_format_a8_snorm_description; + case PIPE_FORMAT_L8_SNORM: + return &util_format_l8_snorm_description; + case PIPE_FORMAT_L8A8_SNORM: + return &util_format_l8a8_snorm_description; + case PIPE_FORMAT_I8_SNORM: + return &util_format_i8_snorm_description; + case PIPE_FORMAT_A16_SNORM: + return &util_format_a16_snorm_description; + case PIPE_FORMAT_L16_SNORM: + return &util_format_l16_snorm_description; + case PIPE_FORMAT_L16A16_SNORM: + return &util_format_l16a16_snorm_description; + case PIPE_FORMAT_I16_SNORM: + return &util_format_i16_snorm_description; + case PIPE_FORMAT_A16_FLOAT: + return &util_format_a16_float_description; + case PIPE_FORMAT_L16_FLOAT: + return &util_format_l16_float_description; + case PIPE_FORMAT_L16A16_FLOAT: + return &util_format_l16a16_float_description; + case PIPE_FORMAT_I16_FLOAT: + return &util_format_i16_float_description; + case PIPE_FORMAT_A32_FLOAT: + return &util_format_a32_float_description; + case PIPE_FORMAT_L32_FLOAT: + return &util_format_l32_float_description; + case PIPE_FORMAT_L32A32_FLOAT: + return &util_format_l32a32_float_description; + case PIPE_FORMAT_I32_FLOAT: + return &util_format_i32_float_description; case PIPE_FORMAT_L8_SRGB: return &util_format_l8_srgb_description; case PIPE_FORMAT_L8A8_SRGB: @@ -17422,6 +20458,14 @@ util_format_description(enum pipe_format format) return &util_format_rgtc2_unorm_description; case PIPE_FORMAT_RGTC2_SNORM: return &util_format_rgtc2_snorm_description; + case PIPE_FORMAT_LATC1_UNORM: + return &util_format_latc1_unorm_description; + case PIPE_FORMAT_LATC1_SNORM: + return &util_format_latc1_snorm_description; + case PIPE_FORMAT_LATC2_UNORM: + return &util_format_latc2_unorm_description; + case PIPE_FORMAT_LATC2_SNORM: + return &util_format_latc2_snorm_description; case PIPE_FORMAT_R64_FLOAT: return &util_format_r64_float_description; case PIPE_FORMAT_R64G64_FLOAT: diff --git a/lib/libGL/gallium/libgallium/generated/u_unfilled_gen.c b/lib/libGL/gallium/libgallium/generated/u_unfilled_gen.c index 93897c98d..e71cd2feb 100644 --- a/lib/libGL/gallium/libgallium/generated/u_unfilled_gen.c +++ b/lib/libGL/gallium/libgallium/generated/u_unfilled_gen.c @@ -154,13 +154,9 @@ static void generate_polygon_ushort( ushort *out = (ushort*)_out; unsigned i, j; (void)j; - for (j = i = 0; j < nr; j+=6, i++) { - (out+j)[0] = (ushort)(0); - (out+j)[1] = (ushort)(i+1); - (out+j+2)[0] = (ushort)(i+1); - (out+j+2)[1] = (ushort)(i+2); - (out+j+4)[0] = (ushort)(i+2); - (out+j+4)[1] = (ushort)(0); + for (j = i = 0; j < nr; j+=2, i++) { + (out+j)[0] = (ushort)(i); + (out+j)[1] = (ushort)((i+1)%(nr/2)); } } static void generate_tris_uint( @@ -254,13 +250,9 @@ static void generate_polygon_uint( uint *out = (uint*)_out; unsigned i, j; (void)j; - for (j = i = 0; j < nr; j+=6, i++) { - (out+j)[0] = (uint)(0); - (out+j)[1] = (uint)(i+1); - (out+j+2)[0] = (uint)(i+1); - (out+j+2)[1] = (uint)(i+2); - (out+j+4)[0] = (uint)(i+2); - (out+j+4)[1] = (uint)(0); + for (j = i = 0; j < nr; j+=2, i++) { + (out+j)[0] = (uint)(i); + (out+j)[1] = (uint)((i+1)%(nr/2)); } } static void translate_tris_ubyte2ushort( @@ -366,13 +358,9 @@ static void translate_polygon_ubyte2ushort( ushort *out = (ushort*)_out; unsigned i, j; (void)j; - for (j = i = 0; j < nr; j+=6, i++) { - (out+j)[0] = (ushort)in[0]; - (out+j)[1] = (ushort)in[i+1]; - (out+j+2)[0] = (ushort)in[i+1]; - (out+j+2)[1] = (ushort)in[i+2]; - (out+j+4)[0] = (ushort)in[i+2]; - (out+j+4)[1] = (ushort)in[0]; + for (j = i = 0; j < nr; j+=2, i++) { + (out+j)[0] = (ushort)in[i]; + (out+j)[1] = (ushort)in[(i+1)%(nr/2)]; } } static void translate_tris_ubyte2uint( @@ -478,13 +466,9 @@ static void translate_polygon_ubyte2uint( uint *out = (uint*)_out; unsigned i, j; (void)j; - for (j = i = 0; j < nr; j+=6, i++) { - (out+j)[0] = (uint)in[0]; - (out+j)[1] = (uint)in[i+1]; - (out+j+2)[0] = (uint)in[i+1]; - (out+j+2)[1] = (uint)in[i+2]; - (out+j+4)[0] = (uint)in[i+2]; - (out+j+4)[1] = (uint)in[0]; + for (j = i = 0; j < nr; j+=2, i++) { + (out+j)[0] = (uint)in[i]; + (out+j)[1] = (uint)in[(i+1)%(nr/2)]; } } static void translate_tris_ushort2ushort( @@ -590,13 +574,9 @@ static void translate_polygon_ushort2ushort( ushort *out = (ushort*)_out; unsigned i, j; (void)j; - for (j = i = 0; j < nr; j+=6, i++) { - (out+j)[0] = (ushort)in[0]; - (out+j)[1] = (ushort)in[i+1]; - (out+j+2)[0] = (ushort)in[i+1]; - (out+j+2)[1] = (ushort)in[i+2]; - (out+j+4)[0] = (ushort)in[i+2]; - (out+j+4)[1] = (ushort)in[0]; + for (j = i = 0; j < nr; j+=2, i++) { + (out+j)[0] = (ushort)in[i]; + (out+j)[1] = (ushort)in[(i+1)%(nr/2)]; } } static void translate_tris_ushort2uint( @@ -702,13 +682,9 @@ static void translate_polygon_ushort2uint( uint *out = (uint*)_out; unsigned i, j; (void)j; - for (j = i = 0; j < nr; j+=6, i++) { - (out+j)[0] = (uint)in[0]; - (out+j)[1] = (uint)in[i+1]; - (out+j+2)[0] = (uint)in[i+1]; - (out+j+2)[1] = (uint)in[i+2]; - (out+j+4)[0] = (uint)in[i+2]; - (out+j+4)[1] = (uint)in[0]; + for (j = i = 0; j < nr; j+=2, i++) { + (out+j)[0] = (uint)in[i]; + (out+j)[1] = (uint)in[(i+1)%(nr/2)]; } } static void translate_tris_uint2ushort( @@ -814,13 +790,9 @@ static void translate_polygon_uint2ushort( ushort *out = (ushort*)_out; unsigned i, j; (void)j; - for (j = i = 0; j < nr; j+=6, i++) { - (out+j)[0] = (ushort)in[0]; - (out+j)[1] = (ushort)in[i+1]; - (out+j+2)[0] = (ushort)in[i+1]; - (out+j+2)[1] = (ushort)in[i+2]; - (out+j+4)[0] = (ushort)in[i+2]; - (out+j+4)[1] = (ushort)in[0]; + for (j = i = 0; j < nr; j+=2, i++) { + (out+j)[0] = (ushort)in[i]; + (out+j)[1] = (ushort)in[(i+1)%(nr/2)]; } } static void translate_tris_uint2uint( @@ -926,13 +898,9 @@ static void translate_polygon_uint2uint( uint *out = (uint*)_out; unsigned i, j; (void)j; - for (j = i = 0; j < nr; j+=6, i++) { - (out+j)[0] = (uint)in[0]; - (out+j)[1] = (uint)in[i+1]; - (out+j+2)[0] = (uint)in[i+1]; - (out+j+2)[1] = (uint)in[i+2]; - (out+j+4)[0] = (uint)in[i+2]; - (out+j+4)[1] = (uint)in[0]; + for (j = i = 0; j < nr; j+=2, i++) { + (out+j)[0] = (uint)in[i]; + (out+j)[1] = (uint)in[(i+1)%(nr/2)]; } } void u_unfilled_init( void ) diff --git a/lib/libGL/gallium/libmesagallium/Makefile b/lib/libGL/gallium/libmesagallium/Makefile index ce9db71d6..54dedbee4 100644 --- a/lib/libGL/gallium/libmesagallium/Makefile +++ b/lib/libGL/gallium/libmesagallium/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2012/07/13 12:43:34 mpi Exp $ +# $OpenBSD: Makefile,v 1.2 2012/08/17 13:58:00 mpi Exp $ LIB= mesagallium @@ -103,6 +103,7 @@ MAIN_SOURCES = \ multisample.c \ nvprogram.c \ pack.c \ + pbo.c \ pixel.c \ pixelstore.c \ pixeltransfer.c \ @@ -114,6 +115,7 @@ MAIN_SOURCES = \ readpix.c \ remap.c \ renderbuffer.c \ + samplerobj.c \ scissor.c \ shaderapi.c \ shaderobj.c \ @@ -122,10 +124,10 @@ MAIN_SOURCES = \ stencil.c \ syncobj.c \ texcompress.c \ + texcompress_rgtc.c \ texcompress_s3tc.c \ texcompress_fxt1.c \ texenv.c \ - texenvprogram.c \ texfetch.c \ texformat.c \ texgen.c \ @@ -134,9 +136,9 @@ MAIN_SOURCES = \ texobj.c \ texpal.c \ texparam.c \ - texrender.c \ texstate.c \ texstore.c \ + texturebarrier.c \ transformfeedback.c \ uniforms.c \ varray.c \ @@ -145,6 +147,9 @@ MAIN_SOURCES = \ vtxfmt.c \ ${MAIN_ES_SOURCES} +MAIN_CXX_SOURCES = \ + ff_fragment_shader.cpp + # math MATH_SOURCES= \ m_debug_clip.c \ @@ -203,8 +208,10 @@ STATETRACKER_SOURCES = \ st_cb_queryobj.c \ st_cb_rasterpos.c \ st_cb_readpixels.c \ + st_cb_syncobj.c \ st_cb_strings.c \ st_cb_texture.c \ + st_cb_texturebarrier.c \ st_cb_viewport.c \ st_cb_xformfb.c \ st_context.c \ @@ -272,6 +279,7 @@ MESAGALLIUM_SOURCES = \ ${DRISW_SOURCES} MESAGALLIUM_CXX_SOURCES = \ + ${MAIN_CXX_SOURCES} \ ${SHADER_CXX_SOURCES} SRCS= ${MESAGALLIUM_SOURCES} \ diff --git a/lib/libGL/gallium/libmesagallium/generated/api_exec_es1.c b/lib/libGL/gallium/libmesagallium/generated/api_exec_es1.c index 54b3f0d62..e4d9566e0 100644 --- a/lib/libGL/gallium/libmesagallium/generated/api_exec_es1.c +++ b/lib/libGL/gallium/libmesagallium/generated/api_exec_es1.c @@ -1,17 +1,23 @@ /* DO NOT EDIT ************************************************* * THIS FILE AUTOMATICALLY GENERATED BY THE es_generator.py SCRIPT - * API specification file: /share/OpenBSD/xenocara/lib/libGL/libmesa/generated/../../../../dist/Mesa/src/mesa/main/APIspec.xml + * API specification file: /usr/xenocara/lib/libGL/gallium/libmesagallium/generated/../../../../../dist/Mesa/src/mesa/main/APIspec.xml * GLES version: GLES1.1 - * date: 2011-05-15 15:41:33 + * date: 2012-07-13 17:41:04 */ #include "GLES/gl.h" #include "GLES/glext.h" #include "main/mfeatures.h" +#include "main/compiler.h" +#include "main/api_exec.h" #if FEATURE_ES1 +#ifndef GLAPIENTRYP +#define GLAPIENTRYP GL_APIENTRYP +#endif + /* These types are needed for the Mesa veneer, but are not defined in * the standard GLES headers. @@ -23,49 +29,6 @@ typedef double GLclampd; extern void *_mesa_get_current_context(void); extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... ); -#include "main/compiler.h" -#include "main/api_exec.h" -#include "main/remap.h" - -/* cannot include main/dispatch.h here */ -#ifdef IN_DRI_DRIVER -#define _GLAPI_USE_REMAP_TABLE -#endif -/* glapi uses GLAPIENTRY while GLES headers define GL_APIENTRY */ -#ifndef GLAPIENTRY -#define GLAPIENTRY GL_APIENTRY -#endif -#include "es1api/glapi/glapitable.h" -#include "es1api/glapi/glapioffsets.h" -#include "es1api/glapi/glapidispatch.h" - -#if FEATURE_remap_table - -#if !FEATURE_GL -int driDispatchRemapTable[driDispatchRemapTable_size]; -#endif - -#define need_MESA_remap_table - -#include "es1api/main/remap_helper.h" - -void -_mesa_init_remap_table_es1(void) -{ - _mesa_do_init_remap_table(_mesa_function_pool, - driDispatchRemapTable_size, - MESA_remap_table_functions); -} - -void -_mesa_map_static_functions_es1(void) -{ -} - -#endif - -typedef void (*_glapi_proc)(void); /* generic function pointer */ - /************************************************************* * Generated functions begin here */ @@ -586,10 +549,11 @@ static void GL_APIENTRY _es_ClipPlanex(GLenum plane, const GLfixed *equation) _mesa_ClipPlane(plane, converted_equation); } -extern void GL_APIENTRY _vbo_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -#define _es_Color4f _vbo_Color4f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +#define _check_Color4f _es_Color4f -extern void GL_APIENTRY _vbo_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +extern void GL_APIENTRY _es_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); static void GL_APIENTRY _es_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { GLfloat converted_red; @@ -602,10 +566,10 @@ static void GL_APIENTRY _es_Color4ub(GLubyte red, GLubyte green, GLubyte blue, G converted_blue = (GLfloat) (blue / 255.0f); converted_alpha = (GLfloat) (alpha / 255.0f); - _vbo_Color4f(converted_red, converted_green, converted_blue, converted_alpha); + _es_Color4f(converted_red, converted_green, converted_blue, converted_alpha); } -extern void GL_APIENTRY _vbo_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +extern void GL_APIENTRY _es_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); static void GL_APIENTRY _es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { GLfloat converted_red; @@ -618,7 +582,7 @@ static void GL_APIENTRY _es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GL converted_blue = (GLfloat) (blue / 65536.0f); converted_alpha = (GLfloat) (alpha / 65536.0f); - _vbo_Color4f(converted_red, converted_green, converted_blue, converted_alpha); + _es_Color4f(converted_red, converted_green, converted_blue, converted_alpha); } extern void GL_APIENTRY _mesa_ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); @@ -2548,8 +2512,9 @@ static void * GL_APIENTRY _es_MapBufferOES(GLenum target, GLenum access) return _mesa_MapBufferARB(target, access); } -extern void GL_APIENTRY _vbo_Materialf(GLenum face, GLenum pname, GLfloat param); -static void GL_APIENTRY _es_Materialf(GLenum face, GLenum pname, GLfloat param) +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_Materialf(GLenum face, GLenum pname, GLfloat param); +static void GL_APIENTRY _check_Materialf(GLenum face, GLenum pname, GLfloat param) { switch(face) { case GL_FRONT_AND_BACK: @@ -2566,11 +2531,12 @@ static void GL_APIENTRY _es_Materialf(GLenum face, GLenum pname, GLfloat param) return; } - _vbo_Materialf(face, pname, param); + _es_Materialf(face, pname, param); } -extern void GL_APIENTRY _vbo_Materialfv(GLenum face, GLenum pname, const GLfloat * params); -static void GL_APIENTRY _es_Materialfv(GLenum face, GLenum pname, const GLfloat *params) +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_Materialfv(GLenum face, GLenum pname, const GLfloat * params); +static void GL_APIENTRY _check_Materialfv(GLenum face, GLenum pname, const GLfloat *params) { switch(face) { case GL_FRONT_AND_BACK: @@ -2592,10 +2558,10 @@ static void GL_APIENTRY _es_Materialfv(GLenum face, GLenum pname, const GLfloat return; } - _vbo_Materialfv(face, pname, params); + _es_Materialfv(face, pname, params); } -extern void GL_APIENTRY _vbo_Materialf(GLenum face, GLenum pname, GLfloat param); +extern void GL_APIENTRY _es_Materialf(GLenum face, GLenum pname, GLfloat param); static void GL_APIENTRY _es_Materialx(GLenum face, GLenum pname, GLfixed param) { GLfloat converted_param; @@ -2617,10 +2583,10 @@ static void GL_APIENTRY _es_Materialx(GLenum face, GLenum pname, GLfixed param) converted_param = (GLfloat) (param / 65536.0f); - _vbo_Materialf(face, pname, converted_param); + _es_Materialf(face, pname, converted_param); } -extern void GL_APIENTRY _vbo_Materialfv(GLenum face, GLenum pname, GLfloat const * params); +extern void GL_APIENTRY _es_Materialfv(GLenum face, GLenum pname, GLfloat const * params); static void GL_APIENTRY _es_Materialxv(GLenum face, GLenum pname, const GLfixed *params) { register unsigned int i; @@ -2654,7 +2620,7 @@ static void GL_APIENTRY _es_Materialxv(GLenum face, GLenum pname, const GLfixed converted_params[i] = (GLfloat) (params[i] / 65536.0f); } - _vbo_Materialfv(face, pname, converted_params); + _es_Materialfv(face, pname, converted_params); } extern void GL_APIENTRY _mesa_MatrixMode(GLenum mode); @@ -2740,8 +2706,9 @@ static void GL_APIENTRY _es_MultiDrawElementsEXT(GLenum mode, const GLsizei *cou _mesa_MultiDrawElementsEXT(mode, count, type, indices, primcount); } -extern void GL_APIENTRY _vbo_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -static void GL_APIENTRY _es_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +static void GL_APIENTRY _check_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { switch(texture) { case GL_TEXTURE0: @@ -2782,10 +2749,10 @@ static void GL_APIENTRY _es_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t return; } - _vbo_MultiTexCoord4f(texture, s, t, r, q); + _es_MultiTexCoord4f(texture, s, t, r, q); } -extern void GL_APIENTRY _vbo_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +extern void GL_APIENTRY _es_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q); static void GL_APIENTRY _es_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { GLfloat converted_s; @@ -2837,13 +2804,14 @@ static void GL_APIENTRY _es_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t converted_r = (GLfloat) (r / 65536.0f); converted_q = (GLfloat) (q / 65536.0f); - _vbo_MultiTexCoord4f(texture, converted_s, converted_t, converted_r, converted_q); + _es_MultiTexCoord4f(texture, converted_s, converted_t, converted_r, converted_q); } -extern void GL_APIENTRY _vbo_Normal3f(GLfloat nx, GLfloat ny, GLfloat nz); -#define _es_Normal3f _vbo_Normal3f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_Normal3f(GLfloat nx, GLfloat ny, GLfloat nz); +#define _check_Normal3f _es_Normal3f -extern void GL_APIENTRY _vbo_Normal3f(GLfloat nx, GLfloat ny, GLfloat nz); +extern void GL_APIENTRY _es_Normal3f(GLfloat nx, GLfloat ny, GLfloat nz); static void GL_APIENTRY _es_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz) { GLfloat converted_nx; @@ -2854,7 +2822,7 @@ static void GL_APIENTRY _es_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz) converted_ny = (GLfloat) (ny / 65536.0f); converted_nz = (GLfloat) (nz / 65536.0f); - _vbo_Normal3f(converted_nx, converted_ny, converted_nz); + _es_Normal3f(converted_nx, converted_ny, converted_nz); } extern void GL_APIENTRY _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid * pointer); @@ -4131,10 +4099,34 @@ static void GL_APIENTRY _es_TexImage2D(GLenum target, GLint level, GLint interna } switch(internalFormat) { case GL_ALPHA: + if (format != GL_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_RGB: + if (format != GL_RGB) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_RGBA: + if (format != GL_RGBA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_LUMINANCE: + if (format != GL_LUMINANCE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_LUMINANCE_ALPHA: + if (format != GL_LUMINANCE_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } break; default: _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=%d)", internalFormat); @@ -4617,14 +4609,66 @@ extern void GL_APIENTRY _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei #define _es_Viewport _mesa_Viewport +#include "glapi/glapi.h" + +#if FEATURE_remap_table + +/* define esLocalRemapTable */ +#include "es1api/main/dispatch.h" + +#define need_MESA_remap_table +#include "es1api/main/remap_helper.h" + +static void +init_remap_table(void) +{ + _glthread_DECLARE_STATIC_MUTEX(mutex); + static GLboolean initialized = GL_FALSE; + const struct gl_function_pool_remap *remap = MESA_remap_table_functions; + int i; + + _glthread_LOCK_MUTEX(mutex); + if (initialized) { + _glthread_UNLOCK_MUTEX(mutex); + return; + } + + for (i = 0; i < esLocalRemapTable_size; i++) { + GLint offset; + const char *spec; + + /* sanity check */ + ASSERT(i == remap[i].remap_index); + spec = _mesa_function_pool + remap[i].pool_index; + + offset = _mesa_map_function_spec(spec); + esLocalRemapTable[i] = offset; + } + initialized = GL_TRUE; + _glthread_UNLOCK_MUTEX(mutex); +} + +#else /* FEATURE_remap_table */ + +#include "es1api/main/dispatch.h" + +static INLINE void +init_remap_table(void) +{ +} + +#endif /* FEATURE_remap_table */ + struct _glapi_table * _mesa_create_exec_table_es1(void) { struct _glapi_table *exec; - exec = _mesa_alloc_dispatch_table(sizeof *exec); + + exec = _mesa_alloc_dispatch_table(_gloffset_COUNT); if (exec == NULL) return NULL; + init_remap_table(); SET_ActiveTexture(exec, _es_ActiveTexture); SET_AlphaFunc(exec, _es_AlphaFunc); @@ -4649,7 +4693,7 @@ _mesa_create_exec_table_es1(void) SET_ClientActiveTexture(exec, _es_ClientActiveTexture); SET_ClipPlanef(exec, _es_ClipPlanef); SET_ClipPlanex(exec, _es_ClipPlanex); - SET_Color4f(exec, _es_Color4f); + SET_Color4f(exec, _check_Color4f); SET_Color4ub(exec, _es_Color4ub); SET_Color4x(exec, _es_Color4x); SET_ColorMask(exec, _es_ColorMask); @@ -4746,8 +4790,8 @@ _mesa_create_exec_table_es1(void) SET_LoadMatrixx(exec, _es_LoadMatrixx); SET_LogicOp(exec, _es_LogicOp); SET_MapBufferOES(exec, _es_MapBufferOES); - SET_Materialf(exec, _es_Materialf); - SET_Materialfv(exec, _es_Materialfv); + SET_Materialf(exec, _check_Materialf); + SET_Materialfv(exec, _check_Materialfv); SET_Materialx(exec, _es_Materialx); SET_Materialxv(exec, _es_Materialxv); SET_MatrixMode(exec, _es_MatrixMode); @@ -4755,9 +4799,9 @@ _mesa_create_exec_table_es1(void) SET_MultMatrixx(exec, _es_MultMatrixx); SET_MultiDrawArraysEXT(exec, _es_MultiDrawArraysEXT); SET_MultiDrawElementsEXT(exec, _es_MultiDrawElementsEXT); - SET_MultiTexCoord4f(exec, _es_MultiTexCoord4f); + SET_MultiTexCoord4f(exec, _check_MultiTexCoord4f); SET_MultiTexCoord4x(exec, _es_MultiTexCoord4x); - SET_Normal3f(exec, _es_Normal3f); + SET_Normal3f(exec, _check_Normal3f); SET_Normal3x(exec, _es_Normal3x); SET_NormalPointer(exec, _es_NormalPointer); SET_Orthof(exec, _es_Orthof); diff --git a/lib/libGL/gallium/libmesagallium/generated/api_exec_es2.c b/lib/libGL/gallium/libmesagallium/generated/api_exec_es2.c index d28291b0e..f00b3d4db 100644 --- a/lib/libGL/gallium/libmesagallium/generated/api_exec_es2.c +++ b/lib/libGL/gallium/libmesagallium/generated/api_exec_es2.c @@ -1,17 +1,23 @@ /* DO NOT EDIT ************************************************* * THIS FILE AUTOMATICALLY GENERATED BY THE es_generator.py SCRIPT - * API specification file: /share/OpenBSD/xenocara/lib/libGL/libmesa/generated/../../../../dist/Mesa/src/mesa/main/APIspec.xml + * API specification file: /usr/xenocara/lib/libGL/gallium/libmesagallium/generated/../../../../../dist/Mesa/src/mesa/main/APIspec.xml * GLES version: GLES2.0 - * date: 2011-05-15 15:41:34 + * date: 2012-07-13 17:41:05 */ #include "GLES2/gl2.h" #include "GLES2/gl2ext.h" #include "main/mfeatures.h" +#include "main/compiler.h" +#include "main/api_exec.h" #if FEATURE_ES2 +#ifndef GLAPIENTRYP +#define GLAPIENTRYP GL_APIENTRYP +#endif + /* These types are needed for the Mesa veneer, but are not defined in * the standard GLES headers. @@ -23,49 +29,6 @@ typedef double GLclampd; extern void *_mesa_get_current_context(void); extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... ); -#include "main/compiler.h" -#include "main/api_exec.h" -#include "main/remap.h" - -/* cannot include main/dispatch.h here */ -#ifdef IN_DRI_DRIVER -#define _GLAPI_USE_REMAP_TABLE -#endif -/* glapi uses GLAPIENTRY while GLES headers define GL_APIENTRY */ -#ifndef GLAPIENTRY -#define GLAPIENTRY GL_APIENTRY -#endif -#include "es2api/glapi/glapitable.h" -#include "es2api/glapi/glapioffsets.h" -#include "es2api/glapi/glapidispatch.h" - -#if FEATURE_remap_table - -#if !FEATURE_GL -int driDispatchRemapTable[driDispatchRemapTable_size]; -#endif - -#define need_MESA_remap_table - -#include "es2api/main/remap_helper.h" - -void -_mesa_init_remap_table_es2(void) -{ - _mesa_do_init_remap_table(_mesa_function_pool, - driDispatchRemapTable_size, - MESA_remap_table_functions); -} - -void -_mesa_map_static_functions_es2(void) -{ -} - -#endif - -typedef void (*_glapi_proc)(void); /* generic function pointer */ - /************************************************************* * Generated functions begin here */ @@ -1768,12 +1731,52 @@ static void GL_APIENTRY _es_TexImage2D(GLenum target, GLint level, GLint interna } switch(internalFormat) { case GL_ALPHA: + if (format != GL_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_RGB: + if (format != GL_RGB) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_RGBA: + if (format != GL_RGBA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_LUMINANCE: + if (format != GL_LUMINANCE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_LUMINANCE_ALPHA: + if (format != GL_LUMINANCE_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_DEPTH_COMPONENT: + if (format != GL_DEPTH_COMPONENT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_DEPTH_STENCIL_OES: + if (format != GL_DEPTH_STENCIL_OES) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; + case GL_BGRA_EXT: + if (format != GL_BGRA_EXT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } break; default: _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=%d)", internalFormat); @@ -1824,6 +1827,12 @@ static void GL_APIENTRY _es_TexImage2D(GLenum target, GLint level, GLint interna return; } break; + case GL_BGRA_EXT: + if (type != GL_UNSIGNED_BYTE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_OPERATION, "glTexImage2D(format=0x%x)", format); + return; + } + break; default: _mesa_error(_mesa_get_current_context(), GL_INVALID_OPERATION, "glTexImage2D(format=0x%x)", format); return; @@ -2113,6 +2122,12 @@ static void GL_APIENTRY _es_TexSubImage2D(GLenum target, GLint level, GLint xoff return; } break; + case GL_BGRA_EXT: + if (type != GL_UNSIGNED_BYTE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_OPERATION, "glTexSubImage2D(format=0x%x)", format); + return; + } + break; default: _mesa_error(_mesa_get_current_context(), GL_INVALID_OPERATION, "glTexSubImage2D(format=0x%x)", format); return; @@ -2243,29 +2258,37 @@ extern void GL_APIENTRY _mesa_UseProgramObjectARB(GLuint program); extern void GL_APIENTRY _mesa_ValidateProgramARB(GLuint program); #define _es_ValidateProgram _mesa_ValidateProgramARB -extern void GL_APIENTRY _vbo_VertexAttrib1f(GLuint index, GLfloat x); -#define _es_VertexAttrib1f _vbo_VertexAttrib1f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib1f(GLuint index, GLfloat x); +#define _check_VertexAttrib1f _es_VertexAttrib1f -extern void GL_APIENTRY _vbo_VertexAttrib1fv(GLuint index, const GLfloat * v); -#define _es_VertexAttrib1fv _vbo_VertexAttrib1fv +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib1fv(GLuint index, const GLfloat * v); +#define _check_VertexAttrib1fv _es_VertexAttrib1fv -extern void GL_APIENTRY _vbo_VertexAttrib2f(GLuint index, GLfloat x, GLfloat y); -#define _es_VertexAttrib2f _vbo_VertexAttrib2f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib2f(GLuint index, GLfloat x, GLfloat y); +#define _check_VertexAttrib2f _es_VertexAttrib2f -extern void GL_APIENTRY _vbo_VertexAttrib2fv(GLuint index, const GLfloat * v); -#define _es_VertexAttrib2fv _vbo_VertexAttrib2fv +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib2fv(GLuint index, const GLfloat * v); +#define _check_VertexAttrib2fv _es_VertexAttrib2fv -extern void GL_APIENTRY _vbo_VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); -#define _es_VertexAttrib3f _vbo_VertexAttrib3f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); +#define _check_VertexAttrib3f _es_VertexAttrib3f -extern void GL_APIENTRY _vbo_VertexAttrib3fv(GLuint index, const GLfloat * v); -#define _es_VertexAttrib3fv _vbo_VertexAttrib3fv +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib3fv(GLuint index, const GLfloat * v); +#define _check_VertexAttrib3fv _es_VertexAttrib3fv -extern void GL_APIENTRY _vbo_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -#define _es_VertexAttrib4f _vbo_VertexAttrib4f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +#define _check_VertexAttrib4f _es_VertexAttrib4f -extern void GL_APIENTRY _vbo_VertexAttrib4fv(GLuint index, const GLfloat * v); -#define _es_VertexAttrib4fv _vbo_VertexAttrib4fv +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib4fv(GLuint index, const GLfloat * v); +#define _check_VertexAttrib4fv _es_VertexAttrib4fv extern void GL_APIENTRY _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); static void GL_APIENTRY _es_VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) @@ -2300,14 +2323,66 @@ extern void GL_APIENTRY _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei #define _es_Viewport _mesa_Viewport +#include "glapi/glapi.h" + +#if FEATURE_remap_table + +/* define esLocalRemapTable */ +#include "es2api/main/dispatch.h" + +#define need_MESA_remap_table +#include "es2api/main/remap_helper.h" + +static void +init_remap_table(void) +{ + _glthread_DECLARE_STATIC_MUTEX(mutex); + static GLboolean initialized = GL_FALSE; + const struct gl_function_pool_remap *remap = MESA_remap_table_functions; + int i; + + _glthread_LOCK_MUTEX(mutex); + if (initialized) { + _glthread_UNLOCK_MUTEX(mutex); + return; + } + + for (i = 0; i < esLocalRemapTable_size; i++) { + GLint offset; + const char *spec; + + /* sanity check */ + ASSERT(i == remap[i].remap_index); + spec = _mesa_function_pool + remap[i].pool_index; + + offset = _mesa_map_function_spec(spec); + esLocalRemapTable[i] = offset; + } + initialized = GL_TRUE; + _glthread_UNLOCK_MUTEX(mutex); +} + +#else /* FEATURE_remap_table */ + +#include "es2api/main/dispatch.h" + +static INLINE void +init_remap_table(void) +{ +} + +#endif /* FEATURE_remap_table */ + struct _glapi_table * _mesa_create_exec_table_es2(void) { struct _glapi_table *exec; - exec = _mesa_alloc_dispatch_table(sizeof *exec); + + exec = _mesa_alloc_dispatch_table(_gloffset_COUNT); if (exec == NULL) return NULL; + init_remap_table(); SET_ActiveTexture(exec, _es_ActiveTexture); SET_AttachShader(exec, _es_AttachShader); @@ -2454,14 +2529,14 @@ _mesa_create_exec_table_es2(void) SET_UnmapBufferOES(exec, _es_UnmapBufferOES); SET_UseProgram(exec, _es_UseProgram); SET_ValidateProgram(exec, _es_ValidateProgram); - SET_VertexAttrib1f(exec, _es_VertexAttrib1f); - SET_VertexAttrib1fv(exec, _es_VertexAttrib1fv); - SET_VertexAttrib2f(exec, _es_VertexAttrib2f); - SET_VertexAttrib2fv(exec, _es_VertexAttrib2fv); - SET_VertexAttrib3f(exec, _es_VertexAttrib3f); - SET_VertexAttrib3fv(exec, _es_VertexAttrib3fv); - SET_VertexAttrib4f(exec, _es_VertexAttrib4f); - SET_VertexAttrib4fv(exec, _es_VertexAttrib4fv); + SET_VertexAttrib1f(exec, _check_VertexAttrib1f); + SET_VertexAttrib1fv(exec, _check_VertexAttrib1fv); + SET_VertexAttrib2f(exec, _check_VertexAttrib2f); + SET_VertexAttrib2fv(exec, _check_VertexAttrib2fv); + SET_VertexAttrib3f(exec, _check_VertexAttrib3f); + SET_VertexAttrib3fv(exec, _check_VertexAttrib3fv); + SET_VertexAttrib4f(exec, _check_VertexAttrib4f); + SET_VertexAttrib4fv(exec, _check_VertexAttrib4fv); SET_VertexAttribPointer(exec, _es_VertexAttribPointer); SET_Viewport(exec, _es_Viewport); diff --git a/lib/libGL/glsl/libglsl/Makefile b/lib/libGL/glsl/libglsl/Makefile index a404aa459..90d92558e 100644 --- a/lib/libGL/glsl/libglsl/Makefile +++ b/lib/libGL/glsl/libglsl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2011/10/31 18:36:06 matthieu Exp $ +# $OpenBSD: Makefile,v 1.5 2012/08/17 13:58:00 mpi Exp $ .include <bsd.xconf.mk> MESA= ${.CURDIR}/../../../../dist/Mesa/src/mesa @@ -15,6 +15,7 @@ LIBGLCPP_SOURCES = \ GLCPP_SOURCES = \ $(LIBGLCPP_SOURCES) \ + ralloc.c \ glcpp.c C_SOURCES = \ @@ -41,6 +42,7 @@ CXX_SOURCES = \ ir_expression_flattening.cpp \ ir_function.cpp \ ir_function_can_inline.cpp \ + ir_function_detect_recursion.cpp \ ir_hierarchical_visitor.cpp \ ir_hv_accept.cpp \ ir_import_prototypes.cpp \ @@ -73,6 +75,7 @@ CXX_SOURCES = \ opt_constant_propagation.cpp \ opt_constant_variable.cpp \ opt_copy_propagation.cpp \ + opt_copy_propagation_elements.cpp \ opt_dead_code.cpp \ opt_dead_code_local.cpp \ opt_dead_functions.cpp \ @@ -90,7 +93,7 @@ LIB= libglsl SRCS= \ $(C_SOURCES) \ - $(CXX_SOURCES) + $(CXX_SOURCES) \ OBJS+= $(C_SOURCES:.c=.so) $(CXX_SOURCES:.cpp=.so) diff --git a/lib/libGL/libmesa/Makefile b/lib/libGL/libmesa/Makefile index 1d2fef524..3f8a22ad0 100644 --- a/lib/libGL/libmesa/Makefile +++ b/lib/libGL/libmesa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.13 2011/12/03 15:36:21 miod Exp $ +# $OpenBSD: Makefile,v 1.14 2012/08/17 13:58:00 mpi Exp $ MESA= ${.CURDIR}/../../../dist/Mesa/src/mesa MAPI= ${.CURDIR}/../../../dist/Mesa/src/mapi @@ -102,6 +102,7 @@ MAIN_SOURCES = \ multisample.c \ nvprogram.c \ pack.c \ + pbo.c \ pixel.c \ pixelstore.c \ pixeltransfer.c \ @@ -113,6 +114,7 @@ MAIN_SOURCES = \ readpix.c \ remap.c \ renderbuffer.c \ + samplerobj.c \ scissor.c \ shaderapi.c \ shaderobj.c \ @@ -121,10 +123,10 @@ MAIN_SOURCES = \ stencil.c \ syncobj.c \ texcompress.c \ + texcompress_rgtc.c \ texcompress_s3tc.c \ texcompress_fxt1.c \ texenv.c \ - texenvprogram.c \ texfetch.c \ texformat.c \ texgen.c \ @@ -133,9 +135,9 @@ MAIN_SOURCES = \ texobj.c \ texpal.c \ texparam.c \ - texrender.c \ texstate.c \ texstore.c \ + texturebarrier.c \ transformfeedback.c \ uniforms.c \ varray.c \ @@ -144,6 +146,9 @@ MAIN_SOURCES = \ vtxfmt.c \ $(MAIN_ES_SOURCES) +MAIN_CXX_SOURCES = \ + ff_fragment_shader.cpp + # math MATH_SOURCES= \ m_debug_clip.c \ @@ -184,6 +189,7 @@ SWRAST_SOURCES= \ s_stencil.c \ s_texcombine.c \ s_texfilter.c \ + s_texrender.c \ s_triangle.c \ s_zoom.c @@ -319,6 +325,7 @@ MESA_SOURCES = \ $(ASM_C_SOURCES) MESA_CXX_SOURCES = \ + $(MAIN_CXX_SOURCES) \ $(SHADER_CXX_SOURCES) SRCS= ${MESA_SOURCES} \ diff --git a/lib/libGL/libmesa/generated/api_exec_es1.c b/lib/libGL/libmesa/generated/api_exec_es1.c index 54b3f0d62..6b8b4f8b3 100644 --- a/lib/libGL/libmesa/generated/api_exec_es1.c +++ b/lib/libGL/libmesa/generated/api_exec_es1.c @@ -1,17 +1,23 @@ /* DO NOT EDIT ************************************************* * THIS FILE AUTOMATICALLY GENERATED BY THE es_generator.py SCRIPT - * API specification file: /share/OpenBSD/xenocara/lib/libGL/libmesa/generated/../../../../dist/Mesa/src/mesa/main/APIspec.xml + * API specification file: /usr/xenocara/lib/libGL/libmesa/generated/../../../../dist/Mesa/src/mesa/main/APIspec.xml * GLES version: GLES1.1 - * date: 2011-05-15 15:41:33 + * date: 2012-07-13 17:40:03 */ #include "GLES/gl.h" #include "GLES/glext.h" #include "main/mfeatures.h" +#include "main/compiler.h" +#include "main/api_exec.h" #if FEATURE_ES1 +#ifndef GLAPIENTRYP +#define GLAPIENTRYP GL_APIENTRYP +#endif + /* These types are needed for the Mesa veneer, but are not defined in * the standard GLES headers. @@ -23,49 +29,6 @@ typedef double GLclampd; extern void *_mesa_get_current_context(void); extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... ); -#include "main/compiler.h" -#include "main/api_exec.h" -#include "main/remap.h" - -/* cannot include main/dispatch.h here */ -#ifdef IN_DRI_DRIVER -#define _GLAPI_USE_REMAP_TABLE -#endif -/* glapi uses GLAPIENTRY while GLES headers define GL_APIENTRY */ -#ifndef GLAPIENTRY -#define GLAPIENTRY GL_APIENTRY -#endif -#include "es1api/glapi/glapitable.h" -#include "es1api/glapi/glapioffsets.h" -#include "es1api/glapi/glapidispatch.h" - -#if FEATURE_remap_table - -#if !FEATURE_GL -int driDispatchRemapTable[driDispatchRemapTable_size]; -#endif - -#define need_MESA_remap_table - -#include "es1api/main/remap_helper.h" - -void -_mesa_init_remap_table_es1(void) -{ - _mesa_do_init_remap_table(_mesa_function_pool, - driDispatchRemapTable_size, - MESA_remap_table_functions); -} - -void -_mesa_map_static_functions_es1(void) -{ -} - -#endif - -typedef void (*_glapi_proc)(void); /* generic function pointer */ - /************************************************************* * Generated functions begin here */ @@ -586,10 +549,11 @@ static void GL_APIENTRY _es_ClipPlanex(GLenum plane, const GLfixed *equation) _mesa_ClipPlane(plane, converted_equation); } -extern void GL_APIENTRY _vbo_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -#define _es_Color4f _vbo_Color4f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +#define _check_Color4f _es_Color4f -extern void GL_APIENTRY _vbo_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +extern void GL_APIENTRY _es_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); static void GL_APIENTRY _es_Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { GLfloat converted_red; @@ -602,10 +566,10 @@ static void GL_APIENTRY _es_Color4ub(GLubyte red, GLubyte green, GLubyte blue, G converted_blue = (GLfloat) (blue / 255.0f); converted_alpha = (GLfloat) (alpha / 255.0f); - _vbo_Color4f(converted_red, converted_green, converted_blue, converted_alpha); + _es_Color4f(converted_red, converted_green, converted_blue, converted_alpha); } -extern void GL_APIENTRY _vbo_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +extern void GL_APIENTRY _es_Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); static void GL_APIENTRY _es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { GLfloat converted_red; @@ -618,7 +582,7 @@ static void GL_APIENTRY _es_Color4x(GLfixed red, GLfixed green, GLfixed blue, GL converted_blue = (GLfloat) (blue / 65536.0f); converted_alpha = (GLfloat) (alpha / 65536.0f); - _vbo_Color4f(converted_red, converted_green, converted_blue, converted_alpha); + _es_Color4f(converted_red, converted_green, converted_blue, converted_alpha); } extern void GL_APIENTRY _mesa_ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); @@ -2548,8 +2512,9 @@ static void * GL_APIENTRY _es_MapBufferOES(GLenum target, GLenum access) return _mesa_MapBufferARB(target, access); } -extern void GL_APIENTRY _vbo_Materialf(GLenum face, GLenum pname, GLfloat param); -static void GL_APIENTRY _es_Materialf(GLenum face, GLenum pname, GLfloat param) +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_Materialf(GLenum face, GLenum pname, GLfloat param); +static void GL_APIENTRY _check_Materialf(GLenum face, GLenum pname, GLfloat param) { switch(face) { case GL_FRONT_AND_BACK: @@ -2566,11 +2531,12 @@ static void GL_APIENTRY _es_Materialf(GLenum face, GLenum pname, GLfloat param) return; } - _vbo_Materialf(face, pname, param); + _es_Materialf(face, pname, param); } -extern void GL_APIENTRY _vbo_Materialfv(GLenum face, GLenum pname, const GLfloat * params); -static void GL_APIENTRY _es_Materialfv(GLenum face, GLenum pname, const GLfloat *params) +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_Materialfv(GLenum face, GLenum pname, const GLfloat * params); +static void GL_APIENTRY _check_Materialfv(GLenum face, GLenum pname, const GLfloat *params) { switch(face) { case GL_FRONT_AND_BACK: @@ -2592,10 +2558,10 @@ static void GL_APIENTRY _es_Materialfv(GLenum face, GLenum pname, const GLfloat return; } - _vbo_Materialfv(face, pname, params); + _es_Materialfv(face, pname, params); } -extern void GL_APIENTRY _vbo_Materialf(GLenum face, GLenum pname, GLfloat param); +extern void GL_APIENTRY _es_Materialf(GLenum face, GLenum pname, GLfloat param); static void GL_APIENTRY _es_Materialx(GLenum face, GLenum pname, GLfixed param) { GLfloat converted_param; @@ -2617,10 +2583,10 @@ static void GL_APIENTRY _es_Materialx(GLenum face, GLenum pname, GLfixed param) converted_param = (GLfloat) (param / 65536.0f); - _vbo_Materialf(face, pname, converted_param); + _es_Materialf(face, pname, converted_param); } -extern void GL_APIENTRY _vbo_Materialfv(GLenum face, GLenum pname, GLfloat const * params); +extern void GL_APIENTRY _es_Materialfv(GLenum face, GLenum pname, GLfloat const * params); static void GL_APIENTRY _es_Materialxv(GLenum face, GLenum pname, const GLfixed *params) { register unsigned int i; @@ -2654,7 +2620,7 @@ static void GL_APIENTRY _es_Materialxv(GLenum face, GLenum pname, const GLfixed converted_params[i] = (GLfloat) (params[i] / 65536.0f); } - _vbo_Materialfv(face, pname, converted_params); + _es_Materialfv(face, pname, converted_params); } extern void GL_APIENTRY _mesa_MatrixMode(GLenum mode); @@ -2740,8 +2706,9 @@ static void GL_APIENTRY _es_MultiDrawElementsEXT(GLenum mode, const GLsizei *cou _mesa_MultiDrawElementsEXT(mode, count, type, indices, primcount); } -extern void GL_APIENTRY _vbo_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -static void GL_APIENTRY _es_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +static void GL_APIENTRY _check_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { switch(texture) { case GL_TEXTURE0: @@ -2782,10 +2749,10 @@ static void GL_APIENTRY _es_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t return; } - _vbo_MultiTexCoord4f(texture, s, t, r, q); + _es_MultiTexCoord4f(texture, s, t, r, q); } -extern void GL_APIENTRY _vbo_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +extern void GL_APIENTRY _es_MultiTexCoord4f(GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q); static void GL_APIENTRY _es_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { GLfloat converted_s; @@ -2837,13 +2804,14 @@ static void GL_APIENTRY _es_MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t converted_r = (GLfloat) (r / 65536.0f); converted_q = (GLfloat) (q / 65536.0f); - _vbo_MultiTexCoord4f(texture, converted_s, converted_t, converted_r, converted_q); + _es_MultiTexCoord4f(texture, converted_s, converted_t, converted_r, converted_q); } -extern void GL_APIENTRY _vbo_Normal3f(GLfloat nx, GLfloat ny, GLfloat nz); -#define _es_Normal3f _vbo_Normal3f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_Normal3f(GLfloat nx, GLfloat ny, GLfloat nz); +#define _check_Normal3f _es_Normal3f -extern void GL_APIENTRY _vbo_Normal3f(GLfloat nx, GLfloat ny, GLfloat nz); +extern void GL_APIENTRY _es_Normal3f(GLfloat nx, GLfloat ny, GLfloat nz); static void GL_APIENTRY _es_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz) { GLfloat converted_nx; @@ -2854,7 +2822,7 @@ static void GL_APIENTRY _es_Normal3x(GLfixed nx, GLfixed ny, GLfixed nz) converted_ny = (GLfloat) (ny / 65536.0f); converted_nz = (GLfloat) (nz / 65536.0f); - _vbo_Normal3f(converted_nx, converted_ny, converted_nz); + _es_Normal3f(converted_nx, converted_ny, converted_nz); } extern void GL_APIENTRY _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid * pointer); @@ -4131,10 +4099,34 @@ static void GL_APIENTRY _es_TexImage2D(GLenum target, GLint level, GLint interna } switch(internalFormat) { case GL_ALPHA: + if (format != GL_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_RGB: + if (format != GL_RGB) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_RGBA: + if (format != GL_RGBA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_LUMINANCE: + if (format != GL_LUMINANCE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_LUMINANCE_ALPHA: + if (format != GL_LUMINANCE_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } break; default: _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=%d)", internalFormat); @@ -4617,14 +4609,66 @@ extern void GL_APIENTRY _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei #define _es_Viewport _mesa_Viewport +#include "glapi/glapi.h" + +#if FEATURE_remap_table + +/* define esLocalRemapTable */ +#include "es1api/main/dispatch.h" + +#define need_MESA_remap_table +#include "es1api/main/remap_helper.h" + +static void +init_remap_table(void) +{ + _glthread_DECLARE_STATIC_MUTEX(mutex); + static GLboolean initialized = GL_FALSE; + const struct gl_function_pool_remap *remap = MESA_remap_table_functions; + int i; + + _glthread_LOCK_MUTEX(mutex); + if (initialized) { + _glthread_UNLOCK_MUTEX(mutex); + return; + } + + for (i = 0; i < esLocalRemapTable_size; i++) { + GLint offset; + const char *spec; + + /* sanity check */ + ASSERT(i == remap[i].remap_index); + spec = _mesa_function_pool + remap[i].pool_index; + + offset = _mesa_map_function_spec(spec); + esLocalRemapTable[i] = offset; + } + initialized = GL_TRUE; + _glthread_UNLOCK_MUTEX(mutex); +} + +#else /* FEATURE_remap_table */ + +#include "es1api/main/dispatch.h" + +static INLINE void +init_remap_table(void) +{ +} + +#endif /* FEATURE_remap_table */ + struct _glapi_table * _mesa_create_exec_table_es1(void) { struct _glapi_table *exec; - exec = _mesa_alloc_dispatch_table(sizeof *exec); + + exec = _mesa_alloc_dispatch_table(_gloffset_COUNT); if (exec == NULL) return NULL; + init_remap_table(); SET_ActiveTexture(exec, _es_ActiveTexture); SET_AlphaFunc(exec, _es_AlphaFunc); @@ -4649,7 +4693,7 @@ _mesa_create_exec_table_es1(void) SET_ClientActiveTexture(exec, _es_ClientActiveTexture); SET_ClipPlanef(exec, _es_ClipPlanef); SET_ClipPlanex(exec, _es_ClipPlanex); - SET_Color4f(exec, _es_Color4f); + SET_Color4f(exec, _check_Color4f); SET_Color4ub(exec, _es_Color4ub); SET_Color4x(exec, _es_Color4x); SET_ColorMask(exec, _es_ColorMask); @@ -4746,8 +4790,8 @@ _mesa_create_exec_table_es1(void) SET_LoadMatrixx(exec, _es_LoadMatrixx); SET_LogicOp(exec, _es_LogicOp); SET_MapBufferOES(exec, _es_MapBufferOES); - SET_Materialf(exec, _es_Materialf); - SET_Materialfv(exec, _es_Materialfv); + SET_Materialf(exec, _check_Materialf); + SET_Materialfv(exec, _check_Materialfv); SET_Materialx(exec, _es_Materialx); SET_Materialxv(exec, _es_Materialxv); SET_MatrixMode(exec, _es_MatrixMode); @@ -4755,9 +4799,9 @@ _mesa_create_exec_table_es1(void) SET_MultMatrixx(exec, _es_MultMatrixx); SET_MultiDrawArraysEXT(exec, _es_MultiDrawArraysEXT); SET_MultiDrawElementsEXT(exec, _es_MultiDrawElementsEXT); - SET_MultiTexCoord4f(exec, _es_MultiTexCoord4f); + SET_MultiTexCoord4f(exec, _check_MultiTexCoord4f); SET_MultiTexCoord4x(exec, _es_MultiTexCoord4x); - SET_Normal3f(exec, _es_Normal3f); + SET_Normal3f(exec, _check_Normal3f); SET_Normal3x(exec, _es_Normal3x); SET_NormalPointer(exec, _es_NormalPointer); SET_Orthof(exec, _es_Orthof); diff --git a/lib/libGL/libmesa/generated/api_exec_es2.c b/lib/libGL/libmesa/generated/api_exec_es2.c index d28291b0e..114515b30 100644 --- a/lib/libGL/libmesa/generated/api_exec_es2.c +++ b/lib/libGL/libmesa/generated/api_exec_es2.c @@ -1,17 +1,23 @@ /* DO NOT EDIT ************************************************* * THIS FILE AUTOMATICALLY GENERATED BY THE es_generator.py SCRIPT - * API specification file: /share/OpenBSD/xenocara/lib/libGL/libmesa/generated/../../../../dist/Mesa/src/mesa/main/APIspec.xml + * API specification file: /usr/xenocara/lib/libGL/libmesa/generated/../../../../dist/Mesa/src/mesa/main/APIspec.xml * GLES version: GLES2.0 - * date: 2011-05-15 15:41:34 + * date: 2012-07-13 17:40:05 */ #include "GLES2/gl2.h" #include "GLES2/gl2ext.h" #include "main/mfeatures.h" +#include "main/compiler.h" +#include "main/api_exec.h" #if FEATURE_ES2 +#ifndef GLAPIENTRYP +#define GLAPIENTRYP GL_APIENTRYP +#endif + /* These types are needed for the Mesa veneer, but are not defined in * the standard GLES headers. @@ -23,49 +29,6 @@ typedef double GLclampd; extern void *_mesa_get_current_context(void); extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... ); -#include "main/compiler.h" -#include "main/api_exec.h" -#include "main/remap.h" - -/* cannot include main/dispatch.h here */ -#ifdef IN_DRI_DRIVER -#define _GLAPI_USE_REMAP_TABLE -#endif -/* glapi uses GLAPIENTRY while GLES headers define GL_APIENTRY */ -#ifndef GLAPIENTRY -#define GLAPIENTRY GL_APIENTRY -#endif -#include "es2api/glapi/glapitable.h" -#include "es2api/glapi/glapioffsets.h" -#include "es2api/glapi/glapidispatch.h" - -#if FEATURE_remap_table - -#if !FEATURE_GL -int driDispatchRemapTable[driDispatchRemapTable_size]; -#endif - -#define need_MESA_remap_table - -#include "es2api/main/remap_helper.h" - -void -_mesa_init_remap_table_es2(void) -{ - _mesa_do_init_remap_table(_mesa_function_pool, - driDispatchRemapTable_size, - MESA_remap_table_functions); -} - -void -_mesa_map_static_functions_es2(void) -{ -} - -#endif - -typedef void (*_glapi_proc)(void); /* generic function pointer */ - /************************************************************* * Generated functions begin here */ @@ -1768,12 +1731,52 @@ static void GL_APIENTRY _es_TexImage2D(GLenum target, GLint level, GLint interna } switch(internalFormat) { case GL_ALPHA: + if (format != GL_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_RGB: + if (format != GL_RGB) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_RGBA: + if (format != GL_RGBA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_LUMINANCE: + if (format != GL_LUMINANCE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_LUMINANCE_ALPHA: + if (format != GL_LUMINANCE_ALPHA) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_DEPTH_COMPONENT: + if (format != GL_DEPTH_COMPONENT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; case GL_DEPTH_STENCIL_OES: + if (format != GL_DEPTH_STENCIL_OES) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } + break; + case GL_BGRA_EXT: + if (format != GL_BGRA_EXT) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=0x%x)", internalFormat); + return; + } break; default: _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, "glTexImage2D(internalFormat=%d)", internalFormat); @@ -1824,6 +1827,12 @@ static void GL_APIENTRY _es_TexImage2D(GLenum target, GLint level, GLint interna return; } break; + case GL_BGRA_EXT: + if (type != GL_UNSIGNED_BYTE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_OPERATION, "glTexImage2D(format=0x%x)", format); + return; + } + break; default: _mesa_error(_mesa_get_current_context(), GL_INVALID_OPERATION, "glTexImage2D(format=0x%x)", format); return; @@ -2113,6 +2122,12 @@ static void GL_APIENTRY _es_TexSubImage2D(GLenum target, GLint level, GLint xoff return; } break; + case GL_BGRA_EXT: + if (type != GL_UNSIGNED_BYTE) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_OPERATION, "glTexSubImage2D(format=0x%x)", format); + return; + } + break; default: _mesa_error(_mesa_get_current_context(), GL_INVALID_OPERATION, "glTexSubImage2D(format=0x%x)", format); return; @@ -2243,29 +2258,37 @@ extern void GL_APIENTRY _mesa_UseProgramObjectARB(GLuint program); extern void GL_APIENTRY _mesa_ValidateProgramARB(GLuint program); #define _es_ValidateProgram _mesa_ValidateProgramARB -extern void GL_APIENTRY _vbo_VertexAttrib1f(GLuint index, GLfloat x); -#define _es_VertexAttrib1f _vbo_VertexAttrib1f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib1f(GLuint index, GLfloat x); +#define _check_VertexAttrib1f _es_VertexAttrib1f -extern void GL_APIENTRY _vbo_VertexAttrib1fv(GLuint index, const GLfloat * v); -#define _es_VertexAttrib1fv _vbo_VertexAttrib1fv +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib1fv(GLuint index, const GLfloat * v); +#define _check_VertexAttrib1fv _es_VertexAttrib1fv -extern void GL_APIENTRY _vbo_VertexAttrib2f(GLuint index, GLfloat x, GLfloat y); -#define _es_VertexAttrib2f _vbo_VertexAttrib2f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib2f(GLuint index, GLfloat x, GLfloat y); +#define _check_VertexAttrib2f _es_VertexAttrib2f -extern void GL_APIENTRY _vbo_VertexAttrib2fv(GLuint index, const GLfloat * v); -#define _es_VertexAttrib2fv _vbo_VertexAttrib2fv +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib2fv(GLuint index, const GLfloat * v); +#define _check_VertexAttrib2fv _es_VertexAttrib2fv -extern void GL_APIENTRY _vbo_VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); -#define _es_VertexAttrib3f _vbo_VertexAttrib3f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); +#define _check_VertexAttrib3f _es_VertexAttrib3f -extern void GL_APIENTRY _vbo_VertexAttrib3fv(GLuint index, const GLfloat * v); -#define _es_VertexAttrib3fv _vbo_VertexAttrib3fv +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib3fv(GLuint index, const GLfloat * v); +#define _check_VertexAttrib3fv _es_VertexAttrib3fv -extern void GL_APIENTRY _vbo_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -#define _es_VertexAttrib4f _vbo_VertexAttrib4f +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +#define _check_VertexAttrib4f _es_VertexAttrib4f -extern void GL_APIENTRY _vbo_VertexAttrib4fv(GLuint index, const GLfloat * v); -#define _es_VertexAttrib4fv _vbo_VertexAttrib4fv +/* this function is special and is defined elsewhere */ +extern void GL_APIENTRY _es_VertexAttrib4fv(GLuint index, const GLfloat * v); +#define _check_VertexAttrib4fv _es_VertexAttrib4fv extern void GL_APIENTRY _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); static void GL_APIENTRY _es_VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) @@ -2300,14 +2323,66 @@ extern void GL_APIENTRY _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei #define _es_Viewport _mesa_Viewport +#include "glapi/glapi.h" + +#if FEATURE_remap_table + +/* define esLocalRemapTable */ +#include "es2api/main/dispatch.h" + +#define need_MESA_remap_table +#include "es2api/main/remap_helper.h" + +static void +init_remap_table(void) +{ + _glthread_DECLARE_STATIC_MUTEX(mutex); + static GLboolean initialized = GL_FALSE; + const struct gl_function_pool_remap *remap = MESA_remap_table_functions; + int i; + + _glthread_LOCK_MUTEX(mutex); + if (initialized) { + _glthread_UNLOCK_MUTEX(mutex); + return; + } + + for (i = 0; i < esLocalRemapTable_size; i++) { + GLint offset; + const char *spec; + + /* sanity check */ + ASSERT(i == remap[i].remap_index); + spec = _mesa_function_pool + remap[i].pool_index; + + offset = _mesa_map_function_spec(spec); + esLocalRemapTable[i] = offset; + } + initialized = GL_TRUE; + _glthread_UNLOCK_MUTEX(mutex); +} + +#else /* FEATURE_remap_table */ + +#include "es2api/main/dispatch.h" + +static INLINE void +init_remap_table(void) +{ +} + +#endif /* FEATURE_remap_table */ + struct _glapi_table * _mesa_create_exec_table_es2(void) { struct _glapi_table *exec; - exec = _mesa_alloc_dispatch_table(sizeof *exec); + + exec = _mesa_alloc_dispatch_table(_gloffset_COUNT); if (exec == NULL) return NULL; + init_remap_table(); SET_ActiveTexture(exec, _es_ActiveTexture); SET_AttachShader(exec, _es_AttachShader); @@ -2454,14 +2529,14 @@ _mesa_create_exec_table_es2(void) SET_UnmapBufferOES(exec, _es_UnmapBufferOES); SET_UseProgram(exec, _es_UseProgram); SET_ValidateProgram(exec, _es_ValidateProgram); - SET_VertexAttrib1f(exec, _es_VertexAttrib1f); - SET_VertexAttrib1fv(exec, _es_VertexAttrib1fv); - SET_VertexAttrib2f(exec, _es_VertexAttrib2f); - SET_VertexAttrib2fv(exec, _es_VertexAttrib2fv); - SET_VertexAttrib3f(exec, _es_VertexAttrib3f); - SET_VertexAttrib3fv(exec, _es_VertexAttrib3fv); - SET_VertexAttrib4f(exec, _es_VertexAttrib4f); - SET_VertexAttrib4fv(exec, _es_VertexAttrib4fv); + SET_VertexAttrib1f(exec, _check_VertexAttrib1f); + SET_VertexAttrib1fv(exec, _check_VertexAttrib1fv); + SET_VertexAttrib2f(exec, _check_VertexAttrib2f); + SET_VertexAttrib2fv(exec, _check_VertexAttrib2fv); + SET_VertexAttrib3f(exec, _check_VertexAttrib3f); + SET_VertexAttrib3fv(exec, _check_VertexAttrib3fv); + SET_VertexAttrib4f(exec, _check_VertexAttrib4f); + SET_VertexAttrib4fv(exec, _check_VertexAttrib4fv); SET_VertexAttribPointer(exec, _es_VertexAttribPointer); SET_Viewport(exec, _es_Viewport); diff --git a/lib/libGL/shlib_version b/lib/libGL/shlib_version index 56246d02b..262f3bc13 100644 --- a/lib/libGL/shlib_version +++ b/lib/libGL/shlib_version @@ -1,2 +1,2 @@ -major=12 +major=13 minor=0 |