diff options
Diffstat (limited to 'mesalib/src/gallium')
-rw-r--r-- | mesalib/src/gallium/Android.mk | 22 | ||||
-rw-r--r-- | mesalib/src/gallium/Makefile.am | 174 | ||||
-rw-r--r-- | mesalib/src/gallium/SConscript | 42 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/Makefile.sources | 1 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_blitter.c | 2 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_caps.c | 2 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format.c | 4 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format.csv | 6 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format.h | 12 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format_bptc.c | 26 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format_bptc.h | 109 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format_pack.py | 2 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format_table.py | 3 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_inlines.h | 3 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_math.h | 62 |
15 files changed, 390 insertions, 80 deletions
diff --git a/mesalib/src/gallium/Android.mk b/mesalib/src/gallium/Android.mk index 85334cf69..bf99e4fb6 100644 --- a/mesalib/src/gallium/Android.mk +++ b/mesalib/src/gallium/Android.mk @@ -26,14 +26,20 @@ GALLIUM_TOP := $(call my-dir) GALLIUM_COMMON_MK := $(GALLIUM_TOP)/Android.common.mk -SUBDIRS := \ - targets/egl-static \ - state_trackers/egl \ - auxiliary +SUBDIRS := auxiliary + +# +# Gallium drivers and their respective winsys +# # swrast SUBDIRS += winsys/sw/android drivers/softpipe +# freedreno +ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),) +SUBDIRS += winsys/freedreno/drm drivers/freedreno +endif + # i915g ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),) SUBDIRS += winsys/i915/drm drivers/i915 @@ -57,6 +63,8 @@ SUBDIRS += winsys/radeon/drm ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),) SUBDIRS += drivers/r300 endif +ifneq ($(filter r600g radeonsi, $(MESA_GPU_DRIVERS)),) +SUBDIRS += drivers/radeon ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),) SUBDIRS += drivers/r600 endif @@ -64,11 +72,17 @@ ifneq ($(filter radeonsi, $(MESA_GPU_DRIVERS)),) SUBDIRS += drivers/radeonsi endif endif +endif # vmwgfx ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),) SUBDIRS += winsys/svga/drm drivers/svga endif +# +# Gallium state trackers and their users (targets) +# +SUBDIRS += state_trackers/egl targets/egl-static + mkfiles := $(patsubst %,$(GALLIUM_TOP)/%/Android.mk,$(SUBDIRS)) include $(mkfiles) diff --git a/mesalib/src/gallium/Makefile.am b/mesalib/src/gallium/Makefile.am new file mode 100644 index 000000000..1e1fd43d5 --- /dev/null +++ b/mesalib/src/gallium/Makefile.am @@ -0,0 +1,174 @@ +SUBDIRS = + +## +## Gallium auxiliary module +## + +SUBDIRS += auxiliary + +## +## Gallium pipe drivers and their respective winsys' +## + +SUBDIRS += \ + drivers/galahad \ + drivers/identity \ + drivers/noop \ + drivers/trace \ + drivers/rbug + +## freedreno/msm/kgsl +if HAVE_GALLIUM_FREEDRENO +SUBDIRS += drivers/freedreno winsys/freedreno/drm +endif + +## i915g/i915 +if HAVE_GALLIUM_I915 +SUBDIRS += drivers/i915 winsys/i915/drm +endif + +## ilo/i965 +if HAVE_GALLIUM_ILO +SUBDIRS += drivers/ilo winsys/intel/drm +endif + +## nouveau +if HAVE_GALLIUM_NOUVEAU +SUBDIRS += drivers/nouveau winsys/nouveau/drm +endif + +## vmwgfx/svga +if HAVE_GALLIUM_SVGA +SUBDIRS += drivers/svga winsys/svga/drm +endif + +## r300 +if HAVE_GALLIUM_R300 +SUBDIRS += drivers/r300 +endif + +## radeon - linked into r600 and radeonsi +if HAVE_GALLIUM_RADEON_COMMON +SUBDIRS += drivers/radeon +endif + +## r600 +if HAVE_GALLIUM_R600 +SUBDIRS += drivers/r600 +endif + +## radeonsi +if HAVE_GALLIUM_RADEONSI +SUBDIRS += drivers/radeonsi +endif + +## the radeon winsys - linked in by r300, r600 and radeonsi +if NEED_RADEON_DRM_WINSYS +SUBDIRS += winsys/radeon/drm +endif + +## swrast/softpipe +if NEED_GALLIUM_SOFTPIPE_DRIVER +SUBDIRS += drivers/softpipe + +## swrast/llvmpipe +if NEED_GALLIUM_LLVMPIPE_DRIVER +SUBDIRS += drivers/llvmpipe +endif +endif + +## vc4/rpi +if HAVE_GALLIUM_VC4 +SUBDIRS += drivers/vc4 winsys/vc4/drm +endif + +## the sw winsys' +SUBDIRS += winsys/sw/null + +if NEED_WINSYS_XLIB +SUBDIRS += winsys/sw/xlib +endif + +if HAVE_DRISW +SUBDIRS += winsys/sw/dri +endif + +if HAVE_DRI2 +SUBDIRS += winsys/sw/kms-dri +endif + +if HAVE_EGL_PLATFORM_FBDEV +SUBDIRS += winsys/sw/fbdev +endif + +if HAVE_EGL_PLATFORM_WAYLAND +SUBDIRS += winsys/sw/wayland +endif + +if NEED_WINSYS_WRAPPER +SUBDIRS += winsys/sw/wrapper +endif + + +## +## Gallium state trackers and their users (targets) +## + +if NEED_GALLIUM_LOADER +SUBDIRS += targets/pipe-loader +endif + +if HAVE_CLOVER +SUBDIRS += state_trackers/clover targets/opencl +endif + +if HAVE_DRICOMMON +SUBDIRS += state_trackers/dri targets/dri +endif + +## the egl target depends on vega +if HAVE_OPENVG +SUBDIRS += state_trackers/vega +endif + +if HAVE_GALLIUM_EGL +SUBDIRS += state_trackers/egl targets/egl-static +endif + +if HAVE_GALLIUM_GBM +SUBDIRS += state_trackers/gbm targets/gbm +endif + +if HAVE_X11_DRIVER +SUBDIRS += state_trackers/glx/xlib targets/libgl-xlib +endif + +if HAVE_ST_OMX +SUBDIRS += state_trackers/omx targets/omx +endif + +if HAVE_GALLIUM_OSMESA +SUBDIRS += state_trackers/osmesa targets/osmesa +endif + +if HAVE_ST_VDPAU +SUBDIRS += state_trackers/vdpau targets/vdpau +endif + +if HAVE_ST_XA +SUBDIRS += state_trackers/xa targets/xa +endif + +if HAVE_ST_XVMC +SUBDIRS += state_trackers/xvmc targets/xvmc +endif + +## +## Gallium tests +## + +if HAVE_GALLIUM_TESTS +SUBDIRS += \ + tests/trivial \ + tests/unit +endif diff --git a/mesalib/src/gallium/SConscript b/mesalib/src/gallium/SConscript index cb6172007..98d017e4d 100644 --- a/mesalib/src/gallium/SConscript +++ b/mesalib/src/gallium/SConscript @@ -22,34 +22,14 @@ SConscript([ ]) # -# State trackers -# - -# Needed by some state trackers -SConscript('winsys/sw/null/SConscript') - -if not env['embedded']: - SConscript('state_trackers/vega/SConscript') - if env['platform'] not in ('cygwin', 'darwin', 'haiku', 'sunos'): - SConscript('state_trackers/egl/SConscript') - - if env['x11']: - SConscript('state_trackers/glx/xlib/SConscript') - - if env['dri']: - SConscript('state_trackers/dri/SConscript') - - if env['platform'] == 'windows': - SConscript('state_trackers/wgl/SConscript') - -# # Winsys -# +# SConscript([ + 'winsys/sw/null/SConscript', 'winsys/sw/wrapper/SConscript', ]) - + if env['x11']: SConscript([ 'winsys/sw/xlib/SConscript', @@ -68,18 +48,13 @@ if env['platform'] == 'haiku': if env['dri']: SConscript([ 'winsys/sw/dri/SConscript', - ]) - - SConscript([ 'winsys/sw/kms-dri/SConscript', - ]) - - SConscript([ 'winsys/svga/drm/SConscript', ]) + # -# Targets +# State trackers and targets # SConscript([ @@ -87,19 +62,23 @@ SConscript([ ]) if not env['embedded']: + SConscript('state_trackers/vega/SConscript') if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'sunos'): SConscript([ - 'targets/egl-static/SConscript' + 'state_trackers/egl/SConscript', + 'targets/egl-static/SConscript', ]) if env['x11']: SConscript([ + 'state_trackers/glx/xlib/SConscript', 'targets/graw-xlib/SConscript', 'targets/libgl-xlib/SConscript', ]) if env['platform'] == 'windows': SConscript([ + 'state_trackers/wgl/SConscript', 'targets/graw-gdi/SConscript', 'targets/libgl-gdi/SConscript', ]) @@ -111,6 +90,7 @@ if not env['embedded']: if env['dri']: SConscript([ + 'state_trackers/dri/SConscript', 'targets/dri/SConscript', ]) diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources index 3eae9e525..9bfaa0eab 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.sources +++ b/mesalib/src/gallium/auxiliary/Makefile.sources @@ -113,6 +113,7 @@ C_SOURCES := \ util/u_format_s3tc.c \ util/u_format_rgtc.c \ util/u_format_etc.c \ + util/u_format_bptc.c \ util/u_format_tests.c \ util/u_format_yuv.c \ util/u_format_zs.c \ diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index 20fbd80d5..609e02fd1 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -1799,7 +1799,7 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter, pipe->bind_blend_state(pipe, cbsurf ? ctx->blend[PIPE_MASK_RGBA] : ctx->blend[0]); pipe->bind_depth_stencil_alpha_state(pipe, dsa_stage); - ctx->bind_fs_state(pipe, ctx->fs_empty); + ctx->bind_fs_state(pipe, cbsurf ? ctx->fs_write_one_cbuf : ctx->fs_empty); pipe->bind_vertex_elements_state(pipe, ctx->velem_state); /* set a framebuffer state */ diff --git a/mesalib/src/gallium/auxiliary/util/u_caps.c b/mesalib/src/gallium/auxiliary/util/u_caps.c index ec8938b37..cd005d68b 100644 --- a/mesalib/src/gallium/auxiliary/util/u_caps.c +++ b/mesalib/src/gallium/auxiliary/util/u_caps.c @@ -197,13 +197,11 @@ static unsigned caps_sm3[] = { UTIL_CHECK_SHADER(FRAGMENT, MAX_INSTRUCTIONS, 512), UTIL_CHECK_SHADER(FRAGMENT, MAX_INPUTS, 10), UTIL_CHECK_SHADER(FRAGMENT, MAX_TEMPS, 32), - UTIL_CHECK_SHADER(FRAGMENT, MAX_ADDRS, 1), UTIL_CHECK_SHADER(FRAGMENT, MAX_CONST_BUFFER_SIZE, 224 * 16), UTIL_CHECK_SHADER(VERTEX, MAX_INSTRUCTIONS, 512), UTIL_CHECK_SHADER(VERTEX, MAX_INPUTS, 16), UTIL_CHECK_SHADER(VERTEX, MAX_TEMPS, 32), - UTIL_CHECK_SHADER(VERTEX, MAX_ADDRS, 2), UTIL_CHECK_SHADER(VERTEX, MAX_CONST_BUFFER_SIZE, 256 * 16), UTIL_CHECK_TERMINATE diff --git a/mesalib/src/gallium/auxiliary/util/u_format.c b/mesalib/src/gallium/auxiliary/util/u_format.c index a53ed6f29..d53dd7884 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format.c +++ b/mesalib/src/gallium/auxiliary/util/u_format.c @@ -496,6 +496,10 @@ util_format_fits_8unorm(const struct util_format_description *format_desc) format_desc->format == PIPE_FORMAT_LATC2_SNORM) return FALSE; return TRUE; + case UTIL_FORMAT_LAYOUT_BPTC: + if (format_desc->format == PIPE_FORMAT_BPTC_RGBA_UNORM) + return TRUE; + return FALSE; case UTIL_FORMAT_LAYOUT_PLAIN: /* diff --git a/mesalib/src/gallium/auxiliary/util/u_format.csv b/mesalib/src/gallium/auxiliary/util/u_format.csv index 8aa5c364d..17034049d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format.csv +++ b/mesalib/src/gallium/auxiliary/util/u_format.csv @@ -160,6 +160,7 @@ PIPE_FORMAT_R8G8Bx_SNORM , other, 1, 1, sn8 , sn8 , , , x # - http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt # - http://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt # - http://www.opengl.org/registry/specs/EXT/texture_compression_latc.txt +# - http://www.opengl.org/registry/specs/ARB/texture_compression_bptc.txt # - http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt # - http://msdn.microsoft.com/en-us/library/bb694531.aspx PIPE_FORMAT_DXT1_RGB , s3tc, 4, 4, x64 , , , , xyz1, rgb @@ -183,6 +184,11 @@ PIPE_FORMAT_LATC2_SNORM , rgtc, 4, 4, x128, , , , xxxy, rg PIPE_FORMAT_ETC1_RGB8 , etc, 4, 4, x64, , , , xyz1, rgb +PIPE_FORMAT_BPTC_RGBA_UNORM , bptc, 4, 4, x128, , , , xyzw, rgb +PIPE_FORMAT_BPTC_SRGBA , bptc, 4, 4, x128, , , , xyzw, srgb +PIPE_FORMAT_BPTC_RGB_FLOAT , bptc, 4, 4, x128, , , , xyz1, rgb +PIPE_FORMAT_BPTC_RGB_UFLOAT , bptc, 4, 4, x128, , , , xyz1, rgb + # Straightforward D3D10-like formats (also used for # vertex buffer element description) # diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h index 2e2bf0240..df31400af 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format.h +++ b/mesalib/src/gallium/auxiliary/util/u_format.h @@ -79,9 +79,14 @@ enum util_format_layout { UTIL_FORMAT_LAYOUT_ETC = 6, /** + * BC6/7 Texture Compression + */ + UTIL_FORMAT_LAYOUT_BPTC = 7, + + /** * Everything else that doesn't fit in any of the above layouts. */ - UTIL_FORMAT_LAYOUT_OTHER = 7 + UTIL_FORMAT_LAYOUT_OTHER = 8 }; @@ -475,6 +480,7 @@ util_format_is_compressed(enum pipe_format format) case UTIL_FORMAT_LAYOUT_S3TC: case UTIL_FORMAT_LAYOUT_RGTC: case UTIL_FORMAT_LAYOUT_ETC: + case UTIL_FORMAT_LAYOUT_BPTC: /* XXX add other formats in the future */ return TRUE; default: @@ -911,6 +917,8 @@ util_format_srgb(enum pipe_format format) return PIPE_FORMAT_DXT5_SRGBA; case PIPE_FORMAT_B5G6R5_UNORM: return PIPE_FORMAT_B5G6R5_SRGB; + case PIPE_FORMAT_BPTC_RGBA_UNORM: + return PIPE_FORMAT_BPTC_SRGBA; default: return PIPE_FORMAT_NONE; } @@ -956,6 +964,8 @@ util_format_linear(enum pipe_format format) return PIPE_FORMAT_DXT5_RGBA; case PIPE_FORMAT_B5G6R5_SRGB: return PIPE_FORMAT_B5G6R5_UNORM; + case PIPE_FORMAT_BPTC_SRGBA: + return PIPE_FORMAT_BPTC_RGBA_UNORM; default: return format; } diff --git a/mesalib/src/gallium/auxiliary/util/u_format_bptc.c b/mesalib/src/gallium/auxiliary/util/u_format_bptc.c new file mode 100644 index 000000000..196220ee0 --- /dev/null +++ b/mesalib/src/gallium/auxiliary/util/u_format_bptc.c @@ -0,0 +1,26 @@ +#include "u_format.h" +#include "u_format_bptc.h" + +#define fake(format) \ +void \ +util_format_##format##_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) {assert(0);} \ +\ +void \ +util_format_##format##_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) {assert(0);} \ +\ +void \ +util_format_##format##_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) {assert(0);} \ +\ +void \ +util_format_##format##_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) {assert(0);} \ +\ +void \ +util_format_##format##_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) {assert(0);} \ +\ +void \ +util_format_##format##_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) {assert(0);} + +fake(bptc_rgba_unorm) +fake(bptc_srgba) +fake(bptc_rgb_float) +fake(bptc_rgb_ufloat) diff --git a/mesalib/src/gallium/auxiliary/util/u_format_bptc.h b/mesalib/src/gallium/auxiliary/util/u_format_bptc.h new file mode 100644 index 000000000..f67d071ee --- /dev/null +++ b/mesalib/src/gallium/auxiliary/util/u_format_bptc.h @@ -0,0 +1,109 @@ +/************************************************************************** + * + * Copyright 2011 Red Hat Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + +#ifndef U_FORMAT_BPTC_H_ +#define U_FORMAT_BPTC_H_ + +void +util_format_bptc_rgba_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_bptc_rgba_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgba_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgba_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgba_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + + +void +util_format_bptc_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_bptc_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + + +void +util_format_bptc_rgb_float_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_bptc_rgb_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgb_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgb_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgb_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgb_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + +void +util_format_bptc_rgb_ufloat_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); + +void +util_format_bptc_rgb_ufloat_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgb_ufloat_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgb_ufloat_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgb_ufloat_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + +void +util_format_bptc_rgb_ufloat_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); + + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_format_pack.py b/mesalib/src/gallium/auxiliary/util/u_format_pack.py index a553e2346..6ccf04c29 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_pack.py +++ b/mesalib/src/gallium/auxiliary/util/u_format_pack.py @@ -659,7 +659,7 @@ def generate_format_fetch(format, dst_channel, dst_native_type, dst_suffix): def is_format_hand_written(format): - return format.layout in ('s3tc', 'rgtc', 'etc', 'subsampled', 'other') or format.colorspace == ZS + return format.layout in ('s3tc', 'rgtc', 'etc', 'bptc', 'subsampled', 'other') or format.colorspace == ZS def generate(formats): diff --git a/mesalib/src/gallium/auxiliary/util/u_format_table.py b/mesalib/src/gallium/auxiliary/util/u_format_table.py index 81fd3996f..ad582e4f5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_table.py +++ b/mesalib/src/gallium/auxiliary/util/u_format_table.py @@ -90,6 +90,7 @@ def write_format_table(formats): print '#include "u_format_rgtc.h"' print '#include "u_format_latc.h"' print '#include "u_format_etc.h"' + print '#include "u_format_bptc.h"' print u_format_pack.generate(formats) @@ -141,7 +142,7 @@ def write_format_table(formats): if format.colorspace != ZS and not format.is_pure_color(): print " &util_format_%s_unpack_rgba_8unorm," % format.short_name() print " &util_format_%s_pack_rgba_8unorm," % format.short_name() - if format.layout == 's3tc' or format.layout == 'rgtc': + if format.layout == 's3tc' or format.layout == 'rgtc' or format.layout == 'bptc': print " &util_format_%s_fetch_rgba_8unorm," % format.short_name() else: print " NULL, /* fetch_rgba_8unorm */" diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h index e9526159a..c80ec487e 100644 --- a/mesalib/src/gallium/auxiliary/util/u_inlines.h +++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h @@ -565,6 +565,9 @@ util_pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target, unsigned nr_samples) { switch (pipe_tex_target) { + case PIPE_BUFFER: + return TGSI_TEXTURE_BUFFER; + case PIPE_TEXTURE_1D: assert(nr_samples <= 1); return TGSI_TEXTURE_1D; diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h index 2823e0570..25bcfb57d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_math.h +++ b/mesalib/src/gallium/auxiliary/util/u_math.h @@ -61,46 +61,46 @@ extern "C" { #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) #if _MSC_VER < 1400 && !defined(__cplusplus) - -static INLINE float cosf( float f ) + +static INLINE float cosf( float f ) { return (float) cos( (double) f ); } -static INLINE float sinf( float f ) +static INLINE float sinf( float f ) { return (float) sin( (double) f ); } -static INLINE float ceilf( float f ) +static INLINE float ceilf( float f ) { return (float) ceil( (double) f ); } -static INLINE float floorf( float f ) +static INLINE float floorf( float f ) { return (float) floor( (double) f ); } -static INLINE float powf( float f, float g ) +static INLINE float powf( float f, float g ) { return (float) pow( (double) f, (double) g ); } -static INLINE float sqrtf( float f ) +static INLINE float sqrtf( float f ) { return (float) sqrt( (double) f ); } -static INLINE float fabsf( float f ) +static INLINE float fabsf( float f ) { return (float) fabs( (double) f ); } -static INLINE float logf( float f ) +static INLINE float logf( float f ) { return (float) log( (double) f ); } @@ -149,28 +149,6 @@ roundf(float x) #endif /* _MSC_VER */ -#ifdef PIPE_OS_ANDROID - -static INLINE -double log2(double d) -{ - return log(d) * (1.0 / M_LN2); -} - -/* workaround a conflict with main/imports.h */ -#ifdef log2f -#undef log2f -#endif - -static INLINE -float log2f(float f) -{ - return logf(f) * (float) (1.0 / M_LN2); -} - -#endif - - #if __STDC_VERSION__ < 199901L && (!defined(__cplusplus) || defined(_MSC_VER)) static INLINE long int lrint(double d) @@ -258,7 +236,8 @@ union di { * Extract the IEEE float32 exponent. */ static INLINE signed -util_get_float32_exponent(float x) { +util_get_float32_exponent(float x) +{ union fi f; f.f = x; @@ -558,7 +537,8 @@ unsigned ffs( unsigned u ) * Find last bit set in a word. The least significant bit is 1. * Return 0 if no bits are set. */ -static INLINE unsigned util_last_bit(unsigned u) +static INLINE unsigned +util_last_bit(unsigned u) { #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) return u == 0 ? 0 : 32 - __builtin_clz(u); @@ -577,7 +557,8 @@ static INLINE unsigned util_last_bit(unsigned u) * significant bit is 1. * Return 0 if no bits are set. */ -static INLINE unsigned util_last_bit_signed(int i) +static INLINE unsigned +util_last_bit_signed(int i) { #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 407) && !defined(__INTEL_COMPILER) return 31 - __builtin_clrsb(i); @@ -595,9 +576,10 @@ static INLINE unsigned util_last_bit_signed(int i) * int i = u_bit_scan(&mymask); * ... process element i * } - * + * */ -static INLINE int u_bit_scan(unsigned *mask) +static INLINE int +u_bit_scan(unsigned *mask) { int i = ffs(*mask) - 1; *mask &= ~(1 << i); @@ -907,12 +889,14 @@ do { \ #endif -static INLINE uint32_t util_unsigned_fixed(float value, unsigned frac_bits) +static INLINE uint32_t +util_unsigned_fixed(float value, unsigned frac_bits) { return value < 0 ? 0 : (uint32_t)(value * (1<<frac_bits)); } -static INLINE int32_t util_signed_fixed(float value, unsigned frac_bits) +static INLINE int32_t +util_signed_fixed(float value, unsigned frac_bits) { return (int32_t)(value * (1<<frac_bits)); } |