diff options
Diffstat (limited to 'mesalib/src/gallium')
-rw-r--r-- | mesalib/src/gallium/Makefile.am | 4 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/Makefile.am | 4 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/Makefile.sources | 2 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_cpu_detect.c | 2 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format.c | 17 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format.csv | 80 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format.h | 2 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format_latc.c | 72 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format_parse.py | 9 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format_rgtc.c | 92 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_math.h | 1 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_sampler.c | 1 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_vbuf.c | 3 |
13 files changed, 129 insertions, 160 deletions
diff --git a/mesalib/src/gallium/Makefile.am b/mesalib/src/gallium/Makefile.am index 32a5dc709..6018e9f72 100644 --- a/mesalib/src/gallium/Makefile.am +++ b/mesalib/src/gallium/Makefile.am @@ -105,9 +105,7 @@ if HAVE_EGL_PLATFORM_WAYLAND SUBDIRS += winsys/sw/wayland endif -if NEED_WINSYS_WRAPPER SUBDIRS += winsys/sw/wrapper -endif ## ## Don't forget to bundle the remaining (non autotools) winsys' @@ -123,7 +121,7 @@ EXTRA_DIST = \ ## Gallium state trackers and their users (targets) ## -if NEED_GALLIUM_LOADER +if HAVE_LOADER_GALLIUM SUBDIRS += targets/pipe-loader endif diff --git a/mesalib/src/gallium/auxiliary/Makefile.am b/mesalib/src/gallium/auxiliary/Makefile.am index 493d306f6..4d8ba89cc 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.am +++ b/mesalib/src/gallium/auxiliary/Makefile.am @@ -1,5 +1,9 @@ AUTOMAKE_OPTIONS = subdir-objects +if HAVE_LOADER_GALLIUM +SUBDIRS := pipe-loader +endif + include Makefile.sources include $(top_srcdir)/src/gallium/Automake.inc diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources index 9bfaa0eab..58d8af71f 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.sources +++ b/mesalib/src/gallium/auxiliary/Makefile.sources @@ -1,5 +1,3 @@ -SUBDIRS := pipe-loader - C_SOURCES := \ cso_cache/cso_cache.c \ cso_cache/cso_context.c \ diff --git a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c index d2d1313f8..5d9db59d1 100644 --- a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c @@ -369,7 +369,7 @@ util_cpu_detect(void) util_cpu_caps.has_avx = ((regs2[2] >> 28) & 1) && // AVX ((regs2[2] >> 27) & 1) && // OSXSAVE ((xgetbv() & 6) == 6); // XMM & YMM - util_cpu_caps.has_f16c = (regs2[2] >> 29) & 1; + util_cpu_caps.has_f16c = ((regs2[2] >> 29) & 1) && util_cpu_caps.has_avx; util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */ #if defined(PIPE_ARCH_X86_64) util_cpu_caps.has_daz = 1; diff --git a/mesalib/src/gallium/auxiliary/util/u_format.c b/mesalib/src/gallium/auxiliary/util/u_format.c index d53dd7884..c1ce40811 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format.c +++ b/mesalib/src/gallium/auxiliary/util/u_format.c @@ -92,6 +92,23 @@ util_format_is_luminance(enum pipe_format format) } boolean +util_format_is_alpha(enum pipe_format format) +{ + const struct util_format_description *desc = + util_format_description(format); + + if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB || + desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) && + desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_0 && + desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 && + desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 && + desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X) { + return TRUE; + } + return FALSE; +} + +boolean util_format_is_pure_integer(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); diff --git a/mesalib/src/gallium/auxiliary/util/u_format.csv b/mesalib/src/gallium/auxiliary/util/u_format.csv index 17034049d..a71aaf15d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format.csv +++ b/mesalib/src/gallium/auxiliary/util/u_format.csv @@ -46,6 +46,8 @@ # - number of bits # - channel swizzle # - color space: rgb, yub, sz +# - (optional) channel encoding for big-endian targets +# - (optional) channel swizzle for big-endian targets # # See also: # - http://msdn.microsoft.com/en-us/library/bb172558.aspx (D3D9) @@ -70,20 +72,20 @@ PIPE_FORMAT_A8B8G8R8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , wzyx, r PIPE_FORMAT_X8B8G8R8_UNORM , plain, 1, 1, x8 , un8 , un8 , un8 , wzy1, rgb # PIPE_FORMAT_R8G8B8A8_UNORM is below PIPE_FORMAT_R8G8B8X8_UNORM , plain, 1, 1, un8 , un8 , un8 , x8 , xyz1, rgb -PIPE_FORMAT_B5G5R5X1_UNORM , plain, 1, 1, un5 , un5 , un5 , x1 , zyx1, rgb -PIPE_FORMAT_B5G5R5A1_UNORM , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb -PIPE_FORMAT_B4G4R4A4_UNORM , plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb -PIPE_FORMAT_B4G4R4X4_UNORM , plain, 1, 1, un4 , un4 , un4 , x4 , zyx1, rgb -PIPE_FORMAT_B5G6R5_UNORM , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb -PIPE_FORMAT_R10G10B10A2_UNORM , plain, 1, 1, un10, un10, un10, un2 , xyzw, rgb -PIPE_FORMAT_B10G10R10A2_UNORM , plain, 1, 1, un10, un10, un10, un2 , zyxw, rgb -PIPE_FORMAT_B2G3R3_UNORM , plain, 1, 1, un2 , un3 , un3 , , zyx1, rgb +PIPE_FORMAT_B5G5R5X1_UNORM , plain, 1, 1, un5 , un5 , un5 , x1 , zyx1, rgb, x1 , un5 , un5 , un5 , yzw1 +PIPE_FORMAT_B5G5R5A1_UNORM , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb, un1 , un5 , un5 , un5 , yzwx +PIPE_FORMAT_B4G4R4A4_UNORM , plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb, un4 , un4 , un4 , un4 , yzwx +PIPE_FORMAT_B4G4R4X4_UNORM , plain, 1, 1, un4 , un4 , un4 , x4 , zyx1, rgb, x4 , un4 , un4 , un4 , yzw1 +PIPE_FORMAT_B5G6R5_UNORM , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb, un5 , un6 , un5 , , xyz1 +PIPE_FORMAT_R10G10B10A2_UNORM , plain, 1, 1, un10, un10, un10, un2 , xyzw, rgb, un2 , un10, un10, un10, wzyx +PIPE_FORMAT_B10G10R10A2_UNORM , plain, 1, 1, un10, un10, un10, un2 , zyxw, rgb, un2 , un10, un10, un10, yzwx +PIPE_FORMAT_B2G3R3_UNORM , plain, 1, 1, un2 , un3 , un3 , , zyx1, rgb, un3 , un3 , un2 , , xyz1 # Luminance/Intensity/Alpha formats PIPE_FORMAT_L8_UNORM , plain, 1, 1, un8 , , , , xxx1, rgb PIPE_FORMAT_A8_UNORM , plain, 1, 1, un8 , , , , 000x, rgb PIPE_FORMAT_I8_UNORM , plain, 1, 1, un8 , , , , xxxx, rgb -PIPE_FORMAT_L4A4_UNORM , plain, 1, 1, un4 , un4 , , , xxxy, rgb +PIPE_FORMAT_L4A4_UNORM , plain, 1, 1, un4 , un4 , , , xxxy, rgb, un4 , un4 , , , yyyx PIPE_FORMAT_L8A8_UNORM , plain, 1, 1, un8 , un8 , , , xxxy, rgb PIPE_FORMAT_L16_UNORM , plain, 1, 1, un16, , , , xxx1, rgb PIPE_FORMAT_A16_UNORM , plain, 1, 1, un16, , , , 000x, rgb @@ -120,22 +122,22 @@ PIPE_FORMAT_X8R8G8B8_SRGB , plain, 1, 1, x8 , un8 , un8 , un8 , yzw1, s # Mixed-sign formats (typically used for bump map textures) PIPE_FORMAT_R8SG8SB8UX8U_NORM , plain, 1, 1, sn8 , sn8 , un8 , x8 , xyz1, rgb -PIPE_FORMAT_R10SG10SB10SA2U_NORM , plain, 1, 1, sn10, sn10, sn10, un2 , xyzw, rgb -PIPE_FORMAT_R5SG5SB6U_NORM , plain, 1, 1, sn5 , sn5 , un6 , , xyz1, rgb +PIPE_FORMAT_R10SG10SB10SA2U_NORM , plain, 1, 1, sn10, sn10, sn10, un2 , xyzw, rgb, un2 , sn10, sn10, sn10, wzyx +PIPE_FORMAT_R5SG5SB6U_NORM , plain, 1, 1, sn5 , sn5 , un6 , , xyz1, rgb, un6 , sn5 , sn5 , , zyx1 # Depth-stencil formats PIPE_FORMAT_S8_UINT , plain, 1, 1, up8 , , , , _x__, zs PIPE_FORMAT_Z16_UNORM , plain, 1, 1, un16, , , , x___, zs PIPE_FORMAT_Z32_UNORM , plain, 1, 1, un32, , , , x___, zs PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, f32 , , , , x___, zs -PIPE_FORMAT_Z24_UNORM_S8_UINT , plain, 1, 1, un24, up8 , , , xy__, zs -PIPE_FORMAT_S8_UINT_Z24_UNORM , plain, 1, 1, up8 , un24, , , yx__, zs -PIPE_FORMAT_X24S8_UINT , plain, 1, 1, x24 , up8 , , , _y__, zs -PIPE_FORMAT_S8X24_UINT , plain, 1, 1, up8 , x24 , , , _x__, zs -PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs -PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs -PIPE_FORMAT_Z32_FLOAT_S8X24_UINT , plain, 1, 1, f32 , up8 , x24, , xy__, zs -PIPE_FORMAT_X32_S8X24_UINT , plain, 1, 1, x32 , up8 , x24, , _y__, zs +PIPE_FORMAT_Z24_UNORM_S8_UINT , plain, 1, 1, un24, up8 , , , xy__, zs, up8 , un24, , , yx__ +PIPE_FORMAT_S8_UINT_Z24_UNORM , plain, 1, 1, up8 , un24, , , yx__, zs, un24, up8 , , , xy__ +PIPE_FORMAT_X24S8_UINT , plain, 1, 1, x24 , up8 , , , _y__, zs, up8 , x24 , , , _x__ +PIPE_FORMAT_S8X24_UINT , plain, 1, 1, up8 , x24 , , , _x__, zs, x24 , up8 , , , _y__ +PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs, x8 , un24, , , y___ +PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs, un24, x8 , , , x___ +PIPE_FORMAT_Z32_FLOAT_S8X24_UINT , plain, 1, 1, f32 , up8 , x24, , xy__, zs, f32 , x24 , up8, , xz__ +PIPE_FORMAT_X32_S8X24_UINT , plain, 1, 1, x32 , up8 , x24, , _y__, zs, x32 , x24 , up8, , _z__ # YUV formats # http://www.fourcc.org/yuv.php#UYVY @@ -267,9 +269,9 @@ PIPE_FORMAT_R32G32B32A32_FIXED , plain, 1, 1, h32 , h32 , h32 , h32 , xyzw, r # See also: # - http://msdn.microsoft.com/en-us/library/bb172533.aspx # A.k.a. D3DDECLTYPE_UDEC3 -PIPE_FORMAT_R10G10B10X2_USCALED , plain, 1, 1, u10 , u10 , u10 , x2 , xyz1, rgb +PIPE_FORMAT_R10G10B10X2_USCALED , plain, 1, 1, u10 , u10 , u10 , x2 , xyz1, rgb, x2 , u10 , u10 , u10 , wzy1 # A.k.a. D3DDECLTYPE_DEC3N -PIPE_FORMAT_R10G10B10X2_SNORM , plain, 1, 1, sn10, sn10, sn10 , x2 , xyz1, rgb +PIPE_FORMAT_R10G10B10X2_SNORM , plain, 1, 1, sn10, sn10, sn10 , x2 , xyz1, rgb, x2 , sn10, sn10, sn10, wzy1 PIPE_FORMAT_YV12 , other, 1, 1, x8 , x8 , x8 , x8 , xyzw, yuv PIPE_FORMAT_YV16 , other, 1, 1, x8 , x8 , x8 , x8 , xyzw, yuv @@ -278,18 +280,18 @@ PIPE_FORMAT_NV12 , other, 1, 1, x8 , x8 , x8 , x8 , xyzw, y PIPE_FORMAT_NV21 , other, 1, 1, x8 , x8 , x8 , x8 , xyzw, yuv # Usually used to implement IA44 and AI44 formats in video decoding -PIPE_FORMAT_A4R4_UNORM , plain, 1, 1, un4 , un4 , , , y00x, rgb -PIPE_FORMAT_R4A4_UNORM , plain, 1, 1, un4 , un4 , , , x00y, rgb +PIPE_FORMAT_A4R4_UNORM , plain, 1, 1, un4 , un4 , , , y00x, rgb, un4, un4 , , , x00y +PIPE_FORMAT_R4A4_UNORM , plain, 1, 1, un4 , un4 , , , x00y, rgb, un4, un4 , , , y00x PIPE_FORMAT_R8A8_UNORM , plain, 1, 1, un8 , un8 , , , x00y, rgb PIPE_FORMAT_A8R8_UNORM , plain, 1, 1, un8 , un8 , , , y00x, rgb # ARB_vertex_type_10_10_10_2_REV -PIPE_FORMAT_R10G10B10A2_USCALED , plain, 1, 1, u10, u10, u10, u2, xyzw, rgb -PIPE_FORMAT_R10G10B10A2_SSCALED , plain, 1, 1, s10, s10, s10, s2, xyzw, rgb -PIPE_FORMAT_R10G10B10A2_SNORM , plain, 1, 1, sn10, sn10, sn10, sn2, xyzw, rgb -PIPE_FORMAT_B10G10R10A2_USCALED , plain, 1, 1, u10, u10, u10, u2, zyxw, rgb -PIPE_FORMAT_B10G10R10A2_SSCALED , plain, 1, 1, s10, s10, s10, s2, zyxw, rgb -PIPE_FORMAT_B10G10R10A2_SNORM , plain, 1, 1, sn10, sn10, sn10, sn2, zyxw, rgb +PIPE_FORMAT_R10G10B10A2_USCALED , plain, 1, 1, u10 , u10 , u10 , u2 , xyzw, rgb, u2 , u10 , u10 , u10 , wzyx +PIPE_FORMAT_R10G10B10A2_SSCALED , plain, 1, 1, s10 , s10 , s10 , s2 , xyzw, rgb, s2 , s10 , s10 , s10 , wzyx +PIPE_FORMAT_R10G10B10A2_SNORM , plain, 1, 1, sn10, sn10, sn10, sn2 , xyzw, rgb, sn2 , sn10, sn10, sn10, wzyx +PIPE_FORMAT_B10G10R10A2_USCALED , plain, 1, 1, u10 , u10 , u10 , u2 , zyxw, rgb, u2 , u10 , u10 , u10 , yzwx +PIPE_FORMAT_B10G10R10A2_SSCALED , plain, 1, 1, s10 , s10 , s10 , s2 , zyxw, rgb, s2 , s10 , s10 , s10 , yzwx +PIPE_FORMAT_B10G10R10A2_SNORM , plain, 1, 1, sn10, sn10, sn10, sn2 , zyxw, rgb, sn2 , sn10, sn10, sn10, yzwx PIPE_FORMAT_R8_UINT , plain, 1, 1, up8, , , , x001, rgb PIPE_FORMAT_R8G8_UINT , plain, 1, 1, up8, up8, , , xy01, rgb @@ -351,13 +353,13 @@ PIPE_FORMAT_I32_SINT , plain, 1, 1, sp32, , , , xxxx, rgb PIPE_FORMAT_L32_SINT , plain, 1, 1, sp32, , , , xxx1, rgb PIPE_FORMAT_L32A32_SINT , plain, 1, 1, sp32, sp32, , , xxxy, rgb -PIPE_FORMAT_B10G10R10A2_UINT , plain, 1, 1, up10, up10, up10, up2, zyxw, rgb +PIPE_FORMAT_B10G10R10A2_UINT , plain, 1, 1, up10, up10, up10, up2, zyxw, rgb, up2 , up10, up10, up10, yzwx PIPE_FORMAT_R8G8B8X8_SNORM , plain, 1, 1, sn8, sn8, sn8, x8, xyz1, rgb PIPE_FORMAT_R8G8B8X8_SRGB , plain, 1, 1, un8, un8, un8, x8, xyz1, srgb PIPE_FORMAT_R8G8B8X8_UINT , plain, 1, 1, up8, up8, up8, x8, xyz1, rgb PIPE_FORMAT_R8G8B8X8_SINT , plain, 1, 1, sp8, sp8, sp8, x8, xyz1, rgb -PIPE_FORMAT_B10G10R10X2_UNORM , plain, 1, 1, un10, un10, un10, x2, zyx1, rgb +PIPE_FORMAT_B10G10R10X2_UNORM , plain, 1, 1, un10, un10, un10, x2, zyx1, rgb, x2 , un10, un10, un10, yzw1 PIPE_FORMAT_R16G16B16X16_UNORM , plain, 1, 1, un16, un16, un16, x16, xyz1, rgb PIPE_FORMAT_R16G16B16X16_SNORM , plain, 1, 1, sn16, sn16, sn16, x16, xyz1, rgb PIPE_FORMAT_R16G16B16X16_FLOAT , plain, 1, 1, f16, f16, f16, x16, xyz1, rgb @@ -378,7 +380,19 @@ PIPE_FORMAT_R16A16_UINT , plain, 1, 1, up16 , up16 , , , x00 PIPE_FORMAT_R16A16_SINT , plain, 1, 1, sp16 , sp16 , , , x00y, rgb PIPE_FORMAT_R32A32_UINT , plain, 1, 1, up32 , up32 , , , x00y, rgb PIPE_FORMAT_R32A32_SINT , plain, 1, 1, sp32 , sp32 , , , x00y, rgb -PIPE_FORMAT_R10G10B10A2_UINT , plain, 1, 1, up10 , up10 , up10, up2 , xyzw, rgb +PIPE_FORMAT_R10G10B10A2_UINT , plain, 1, 1, up10 , up10 , up10, up2 , xyzw, rgb, up2 , up10, up10, up10, wzyx -PIPE_FORMAT_B5G6R5_SRGB , plain, 1, 1, un5 , un6 , un5 , , zyx1, srgb +PIPE_FORMAT_B5G6R5_SRGB , plain, 1, 1, un5 , un6 , un5 , , zyx1, srgb, un5 , un6 , un5 , , xyz1 +PIPE_FORMAT_A8L8_UNORM , plain, 1, 1, un8 , un8 , , , yyyx, rgb +PIPE_FORMAT_A8L8_SNORM , plain, 1, 1, sn8 , sn8 , , , yyyx, rgb +PIPE_FORMAT_A8L8_SRGB , plain, 1, 1, un8 , un8 , , , yyyx, srgb +PIPE_FORMAT_A16L16_UNORM , plain, 1, 1, un16, un16, , , yyyx, rgb + +PIPE_FORMAT_G8R8_UNORM , plain, 1, 1, un8 , un8 , , , yx01, rgb +PIPE_FORMAT_G8R8_SNORM , plain, 1, 1, sn8 , sn8 , , , yx01, rgb +PIPE_FORMAT_G16R16_UNORM , plain, 1, 1, un16, un16, , , yx01, rgb +PIPE_FORMAT_G16R16_SNORM , plain, 1, 1, sn16, sn16, , , yx01, rgb + +PIPE_FORMAT_A8B8G8R8_SNORM , plain, 1, 1, sn8 , sn8 , sn8 , sn8 , wzyx, rgb +PIPE_FORMAT_X8B8G8R8_SNORM , plain, 1, 1, x8, sn8, sn8, sn8, wzy1, rgb diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h index df31400af..621574c96 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format.h +++ b/mesalib/src/gallium/auxiliary/util/u_format.h @@ -661,6 +661,8 @@ util_format_has_alpha(enum pipe_format format); boolean util_format_is_luminance(enum pipe_format format); +boolean +util_format_is_alpha(enum pipe_format format); boolean util_format_is_luminance_alpha(enum pipe_format format); diff --git a/mesalib/src/gallium/auxiliary/util/u_format_latc.c b/mesalib/src/gallium/auxiliary/util/u_format_latc.c index caab7e87a..31d72b5a0 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_latc.c +++ b/mesalib/src/gallium/auxiliary/util/u_format_latc.c @@ -27,27 +27,16 @@ #include "u_format.h" #include "u_format_rgtc.h" #include "u_format_latc.h" - -static void u_format_unsigned_encode_rgtc_ubyte(uint8_t *blkaddr, uint8_t srccolors[4][4], - int numxpixels, int numypixels); - -static void u_format_unsigned_fetch_texel_rgtc(unsigned srcRowStride, const uint8_t *pixdata, - unsigned i, unsigned j, uint8_t *value, unsigned comps); - -static void u_format_signed_encode_rgtc_ubyte(int8_t *blkaddr, int8_t srccolors[4][4], - int numxpixels, int numypixels); - -static void u_format_signed_fetch_texel_rgtc(unsigned srcRowStride, const int8_t *pixdata, - unsigned i, unsigned j, int8_t *value, unsigned comps); +#include "util/rgtc.h" void util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { /* Fix warnings here: */ - (void) u_format_unsigned_encode_rgtc_ubyte; - (void) u_format_signed_encode_rgtc_ubyte; + (void) util_format_unsigned_encode_rgtc_ubyte; + (void) util_format_signed_encode_rgtc_ubyte; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1); dst[1] = dst[0]; dst[2] = dst[0]; dst[3] = 255; @@ -79,7 +68,7 @@ util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c for(i = 0; i < 4; ++i) { float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4; uint8_t tmp_r; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); dst[0] = dst[1] = dst[2] = ubyte_to_float(tmp_r); @@ -103,7 +92,7 @@ util_format_latc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne { uint8_t tmp_r; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); dst[0] = dst[1] = dst[2] = ubyte_to_float(tmp_r); @@ -147,7 +136,7 @@ util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c for(i = 0; i < 4; ++i) { float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4; int8_t tmp_r; - u_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); + util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); dst[0] = dst[1] = dst[2] = byte_to_float_tex(tmp_r); @@ -165,7 +154,7 @@ util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne { int8_t tmp_r; - u_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1); + util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1); dst[0] = dst[1] = dst[2] = byte_to_float_tex(tmp_r); @@ -176,10 +165,10 @@ util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne void util_format_latc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2); dst[1] = dst[0]; dst[2] = dst[0]; - u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 3, 2); + util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 3, 2); } void @@ -213,8 +202,8 @@ util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c for(i = 0; i < 4; ++i) { float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4; uint8_t tmp_r, tmp_g; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); - u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); + util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); dst[0] = dst[1] = dst[2] = ubyte_to_float(tmp_r); @@ -232,8 +221,8 @@ util_format_latc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne { uint8_t tmp_r, tmp_g; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); - u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); + util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); dst[0] = dst[1] = dst[2] = ubyte_to_float(tmp_r); @@ -272,8 +261,8 @@ util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c for(i = 0; i < 4; ++i) { float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4; int8_t tmp_r, tmp_g; - u_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); - u_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); + util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); + util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); dst[0] = dst[1] = dst[2] = byte_to_float_tex(tmp_r); @@ -297,36 +286,11 @@ util_format_latc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne { int8_t tmp_r, tmp_g; - u_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2); - u_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2); + util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2); + util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2); dst[0] = dst[1] = dst[2] = byte_to_float_tex(tmp_r); dst[3] = byte_to_float_tex(tmp_g); } - -#define TAG(x) u_format_unsigned_##x -#define TYPE uint8_t -#define T_MIN 0 -#define T_MAX 255 - -#include "../../../mesa/main/texcompress_rgtc_tmp.h" - -#undef TYPE -#undef TAG -#undef T_MIN -#undef T_MAX - - -#define TAG(x) u_format_signed_##x -#define TYPE int8_t -#define T_MIN (int8_t)-128 -#define T_MAX (int8_t)127 - -#include "../../../mesa/main/texcompress_rgtc_tmp.h" - -#undef TYPE -#undef TAG -#undef T_MIN -#undef T_MAX diff --git a/mesalib/src/gallium/auxiliary/util/u_format_parse.py b/mesalib/src/gallium/auxiliary/util/u_format_parse.py index 15cc6d4fe..929017a44 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_parse.py +++ b/mesalib/src/gallium/auxiliary/util/u_format_parse.py @@ -330,6 +330,9 @@ def parse(filename): continue fields = [field.strip() for field in line.split(',')] + if len (fields) == 10: + fields += fields[4:9] + assert len (fields) == 15 name = fields[0] layout = fields[1] @@ -339,8 +342,8 @@ def parse(filename): le_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[8]] le_channels = _parse_channels(fields[4:8], layout, colorspace, le_swizzles) - be_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[8]] - be_channels = _parse_channels(fields[4:8], layout, colorspace, be_swizzles) + be_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[14]] + be_channels = _parse_channels(fields[10:14], layout, colorspace, be_swizzles) le_shift = 0 for channel in le_channels: @@ -353,6 +356,8 @@ def parse(filename): be_shift += channel.size assert le_shift == be_shift + for i in range(4): + assert (le_swizzles[i] != SWIZZLE_NONE) == (be_swizzles[i] != SWIZZLE_NONE) format = Format(name, layout, block_width, block_height, le_channels, le_swizzles, be_channels, be_swizzles, colorspace) formats.append(format) diff --git a/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c b/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c index 758e33774..159691743 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c +++ b/mesalib/src/gallium/auxiliary/util/u_format_rgtc.c @@ -26,23 +26,12 @@ #include "u_math.h" #include "u_format.h" #include "u_format_rgtc.h" - -static void u_format_unsigned_encode_rgtc_ubyte(uint8_t *blkaddr, uint8_t srccolors[4][4], - int numxpixels, int numypixels); - -static void u_format_unsigned_fetch_texel_rgtc(unsigned srcRowStride, const uint8_t *pixdata, - unsigned i, unsigned j, uint8_t *value, unsigned comps); - -static void u_format_signed_encode_rgtc_ubyte(int8_t *blkaddr, int8_t srccolors[4][4], - int numxpixels, int numypixels); - -static void u_format_signed_fetch_texel_rgtc(unsigned srcRowStride, const int8_t *pixdata, - unsigned i, unsigned j, int8_t *value, unsigned comps); +#include "util/rgtc.h" void util_format_rgtc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1); dst[1] = 0; dst[2] = 0; dst[3] = 255; @@ -61,7 +50,7 @@ util_format_rgtc1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride for(j = 0; j < bh; ++j) { for(i = 0; i < bw; ++i) { uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1); dst[1] = 0; dst[2] = 0; dst[3] = 255; @@ -89,7 +78,7 @@ util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, tmp[j][i] = src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]; } } - u_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4); + util_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4); dst += bytes_per_block; } dst_row += dst_stride / sizeof(*dst_row); @@ -108,7 +97,7 @@ util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c for(i = 0; i < 4; ++i) { float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4; uint8_t tmp_r; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); dst[0] = ubyte_to_float(tmp_r); dst[1] = 0.0; dst[2] = 0.0; @@ -136,7 +125,7 @@ util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c tmp[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]); } } - u_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4); + util_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4); dst += bytes_per_block; } dst_row += dst_stride / sizeof(*dst_row); @@ -147,7 +136,7 @@ void util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { uint8_t tmp_r; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); dst[0] = ubyte_to_float(tmp_r); dst[1] = 0.0; dst[2] = 0.0; @@ -187,7 +176,7 @@ util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c tmp[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]); } } - u_format_signed_encode_rgtc_ubyte(dst, tmp, 4, 4); + util_format_signed_encode_rgtc_ubyte(dst, tmp, 4, 4); dst += bytes_per_block; } dst_row += dst_stride / sizeof(*dst_row); @@ -206,7 +195,7 @@ util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c for(i = 0; i < 4; ++i) { float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4; int8_t tmp_r; - u_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); + util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1); dst[0] = byte_to_float_tex(tmp_r); dst[1] = 0.0; dst[2] = 0.0; @@ -223,7 +212,7 @@ void util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { int8_t tmp_r; - u_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1); + util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1); dst[0] = byte_to_float_tex(tmp_r); dst[1] = 0.0; dst[2] = 0.0; @@ -234,8 +223,8 @@ util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigne void util_format_rgtc2_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2); - u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2); + util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2); dst[2] = 0; dst[3] = 255; } @@ -253,8 +242,8 @@ util_format_rgtc2_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride for(j = 0; j < bh; ++j) { for(i = 0; i < bw; ++i) { uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2); - u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 2); + util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, dst + 1, 2); dst[2] = 0; dst[3] = 255; } @@ -282,8 +271,8 @@ util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, tmp_g[j][i] = src_row[((y + j)*src_stride/sizeof(*src_row) + (x + i)*4) + 1]; } } - u_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4); - u_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4); + util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4); + util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4); dst += bytes_per_block; } dst_row += dst_stride / sizeof(*dst_row); @@ -307,8 +296,8 @@ util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c tmp_g[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]); } } - u_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4); - u_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4); + util_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4); + util_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4); dst += bytes_per_block; } dst_row += dst_stride / sizeof(*dst_row); @@ -333,8 +322,8 @@ util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c for(i = 0; i < 4; ++i) { float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4; uint8_t tmp_r, tmp_g; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); - u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); + util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); dst[0] = ubyte_to_float(tmp_r); dst[1] = ubyte_to_float(tmp_g); dst[2] = 0.0; @@ -351,8 +340,8 @@ void util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { uint8_t tmp_r, tmp_g; - u_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); - u_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); + util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); + util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); dst[0] = ubyte_to_float(tmp_r); dst[1] = ubyte_to_float(tmp_g); dst[2] = 0.0; @@ -390,8 +379,8 @@ util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c for(i = 0; i < 4; ++i) { float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4; int8_t tmp_r, tmp_g; - u_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); - u_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); + util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2); + util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2); dst[0] = byte_to_float_tex(tmp_r); dst[1] = byte_to_float_tex(tmp_g); dst[2] = 0.0; @@ -421,8 +410,8 @@ util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c tmp_g[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]); } } - u_format_signed_encode_rgtc_ubyte(dst, tmp_r, 4, 4); - u_format_signed_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4); + util_format_signed_encode_rgtc_ubyte(dst, tmp_r, 4, 4); + util_format_signed_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4); dst += bytes_per_block; } dst_row += dst_stride / sizeof(*dst_row); @@ -439,36 +428,11 @@ void util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { int8_t tmp_r, tmp_g; - u_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2); - u_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2); + util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2); + util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2); dst[0] = byte_to_float_tex(tmp_r); dst[1] = byte_to_float_tex(tmp_g); dst[2] = 0.0; dst[3] = 1.0; } - -#define TAG(x) u_format_unsigned_##x -#define TYPE uint8_t -#define T_MIN 0 -#define T_MAX 255 - -#include "../../../mesa/main/texcompress_rgtc_tmp.h" - -#undef TYPE -#undef TAG -#undef T_MIN -#undef T_MAX - - -#define TAG(x) u_format_signed_##x -#define TYPE int8_t -#define T_MIN (int8_t)-128 -#define T_MAX (int8_t)127 - -#include "../../../mesa/main/texcompress_rgtc_tmp.h" - -#undef TYPE -#undef TAG -#undef T_MIN -#undef T_MAX diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h index 25bcfb57d..39bd40fa1 100644 --- a/mesalib/src/gallium/auxiliary/util/u_math.h +++ b/mesalib/src/gallium/auxiliary/util/u_math.h @@ -40,6 +40,7 @@ #include "pipe/p_compiler.h" +#include "util/u_debug.h" #ifdef __cplusplus diff --git a/mesalib/src/gallium/auxiliary/util/u_sampler.c b/mesalib/src/gallium/auxiliary/util/u_sampler.c index 227641bda..86799fdd5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_sampler.c +++ b/mesalib/src/gallium/auxiliary/util/u_sampler.c @@ -45,6 +45,7 @@ default_template(struct pipe_sampler_view *view, /* XXX: Check if format is compatible with texture->format. */ + view->target = texture->target; view->format = format; view->u.tex.first_level = 0; view->u.tex.last_level = texture->last_level; diff --git a/mesalib/src/gallium/auxiliary/util/u_vbuf.c b/mesalib/src/gallium/auxiliary/util/u_vbuf.c index 650df9f6a..b1b89bf1b 100644 --- a/mesalib/src/gallium/auxiliary/util/u_vbuf.c +++ b/mesalib/src/gallium/auxiliary/util/u_vbuf.c @@ -357,7 +357,8 @@ u_vbuf_set_vertex_elements_internal(struct u_vbuf *mgr, unsigned count, assert(ve); if (ve != mgr->ve) - pipe->bind_vertex_elements_state(pipe, ve->driver_cso); + pipe->bind_vertex_elements_state(pipe, ve->driver_cso); + return ve; } |