Mesa (master): mesa/teximage: reuse compressed format utility functions for base_format
Module: Mesa Branch: master Commit: 99b1f4751f97631011b64fabcb57acf6beae01ac URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=99b1f4751f97631011b64fabcb57acf6beae01ac Author: Nanley CheryDate: Thu Aug 27 16:29:06 2015 -0700 mesa/teximage: reuse compressed format utility functions for base_format Reuse utility functions instead of reimplementing the same logic. * _mesa_is_compressed_format() performs the required checking to determine format support in the current context. * _mesa_gl_compressed_format_base_format() returns the base format. As a side effect, we now check that we're in a desktop context when determining support for the FXT1 and RGTC formats. This is in agreement with our extension table and the glext headers. Reviewed-by: Anuj Phogat Signed-off-by: Nanley Chery --- src/mesa/main/teximage.c | 150 ++ 1 file changed, 5 insertions(+), 145 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 2a4d29d..8913a72 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -252,44 +252,11 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) ; /* fallthrough */ } - if (ctx->Extensions.TDFX_texture_compression_FXT1) { - switch (internalFormat) { - case GL_COMPRESSED_RGB_FXT1_3DFX: - return GL_RGB; - case GL_COMPRESSED_RGBA_FXT1_3DFX: - return GL_RGBA; - default: - ; /* fallthrough */ - } - } - - /* Assume that the ANGLE flag will always be set if the EXT flag is set. -*/ - if (ctx->Extensions.ANGLE_texture_compression_dxt) { - switch (internalFormat) { - case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return GL_RGB; - case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return GL_RGBA; - default: - ; /* fallthrough */ - } - } - - if (_mesa_is_desktop_gl(ctx) - && ctx->Extensions.ANGLE_texture_compression_dxt) { - switch (internalFormat) { - case GL_RGB_S3TC: - case GL_RGB4_S3TC: - return GL_RGB; - case GL_RGBA_S3TC: - case GL_RGBA4_S3TC: - return GL_RGBA; - default: - ; /* fallthrough */ - } + if (_mesa_is_compressed_format(ctx, internalFormat)) { + GLenum base_compressed = + _mesa_gl_compressed_format_base_format(internalFormat); + if (base_compressed) +return base_compressed; } if (ctx->Extensions.MESA_ycbcr_texture) { @@ -367,16 +334,10 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) case GL_SRGB8_EXT: case GL_COMPRESSED_SRGB_EXT: return GL_RGB; - case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: - return ctx->Extensions.EXT_texture_compression_s3tc ? GL_RGB : -1; case GL_SRGB_ALPHA_EXT: case GL_SRGB8_ALPHA8_EXT: case GL_COMPRESSED_SRGB_ALPHA_EXT: return GL_RGBA; - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - return ctx->Extensions.EXT_texture_compression_s3tc ? GL_RGBA : -1; case GL_SLUMINANCE_ALPHA_EXT: case GL_SLUMINANCE8_ALPHA8_EXT: case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: @@ -521,111 +482,10 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) } } - if (ctx->Extensions.ARB_texture_compression_rgtc) { - switch (internalFormat) { - case GL_COMPRESSED_RED_RGTC1: - case GL_COMPRESSED_SIGNED_RED_RGTC1: - return GL_RED; - case GL_COMPRESSED_RG_RGTC2: - case GL_COMPRESSED_SIGNED_RG_RGTC2: - return GL_RG; - default: - ; /* fallthrough */ - } - } - - if (ctx->API == API_OPENGL_COMPAT && - ctx->Extensions.EXT_texture_compression_latc) { - switch (internalFormat) { - case GL_COMPRESSED_LUMINANCE_LATC1_EXT: - case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: - return GL_LUMINANCE; - case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: - case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: - return GL_LUMINANCE_ALPHA; - default: - ; /* fallthrough */ - } - } - - if (ctx->API == API_OPENGL_COMPAT && - ctx->Extensions.ATI_texture_compression_3dc) { - switch (internalFormat) { - case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: - return GL_LUMINANCE_ALPHA; - default: - ; /* fallthrough */ - } - } - - if (_mesa_is_gles(ctx) && - ctx->Extensions.OES_compressed_ETC1_RGB8_texture) { - switch (internalFormat) { - case GL_ETC1_RGB8_OES: - return GL_RGB; - default: - ; /* fallthrough */ - } - } - if (ctx->Extensions.KHR_texture_compression_astc_ldr &&
Mesa (master): mesa/glformats: refactor compressed format support function
Module: Mesa Branch: master Commit: 29835fe19e0ca73a8017427498056ff7eb713cdd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=29835fe19e0ca73a8017427498056ff7eb713cdd Author: Nanley CheryDate: Wed Aug 26 16:36:11 2015 -0700 mesa/glformats: refactor compressed format support function Instead of case statements, use _mesa_get_format_layout() to determine if a GL format is part of a family of compressed formats. v2. restrict LATC formats to API_OPENGL_COMPAT (Ilia). rename the variable mFormat to m_format. Reviewed-by: Anuj Phogat Signed-off-by: Nanley Chery --- src/mesa/main/glformats.c | 119 +++-- 1 file changed, 40 insertions(+), 79 deletions(-) diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index eb4a02a..6cfffdb 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -28,6 +28,7 @@ #include "context.h" #include "glformats.h" #include "formats.h" +#include "texcompress.h" #include "enums.h" enum { @@ -1272,95 +1273,22 @@ _mesa_is_depth_or_stencil_format(GLenum format) GLboolean _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format) { + mesa_format m_format = _mesa_glenum_to_compressed_format(format); + + /* Some formats in this switch have an equivalent mesa_format_layout +* to the compressed formats in the layout switch below and thus +* must be handled first. +*/ switch (format) { - case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - /* Assume that the ANGLE flag will always be set if the EXT flag is set. - */ - return ctx->Extensions.ANGLE_texture_compression_dxt; case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ANGLE_texture_compression_dxt; - case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - return _mesa_is_desktop_gl(ctx) - && ctx->Extensions.EXT_texture_sRGB - && ctx->Extensions.EXT_texture_compression_s3tc; - case GL_COMPRESSED_RGB_FXT1_3DFX: - case GL_COMPRESSED_RGBA_FXT1_3DFX: - return _mesa_is_desktop_gl(ctx) - && ctx->Extensions.TDFX_texture_compression_FXT1; - case GL_COMPRESSED_RED_RGTC1: - case GL_COMPRESSED_SIGNED_RED_RGTC1: - case GL_COMPRESSED_RG_RGTC2: - case GL_COMPRESSED_SIGNED_RG_RGTC2: - return _mesa_is_desktop_gl(ctx) - && ctx->Extensions.ARB_texture_compression_rgtc; - case GL_COMPRESSED_LUMINANCE_LATC1_EXT: - case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: - case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: - case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: - return ctx->API == API_OPENGL_COMPAT - && ctx->Extensions.EXT_texture_compression_latc; case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: return ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ATI_texture_compression_3dc; - case GL_ETC1_RGB8_OES: - return _mesa_is_gles(ctx) - && ctx->Extensions.OES_compressed_ETC1_RGB8_texture; - case GL_COMPRESSED_RGB8_ETC2: - case GL_COMPRESSED_SRGB8_ETC2: - case GL_COMPRESSED_RGBA8_ETC2_EAC: - case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: - case GL_COMPRESSED_R11_EAC: - case GL_COMPRESSED_RG11_EAC: - case GL_COMPRESSED_SIGNED_R11_EAC: - case GL_COMPRESSED_SIGNED_RG11_EAC: - case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: - case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: - return _mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility; - case GL_COMPRESSED_RGBA_BPTC_UNORM: - case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM: - case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT: - case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT: - return _mesa_is_desktop_gl(ctx) && - ctx->Extensions.ARB_texture_compression_bptc; - case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: - case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: - case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: - case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: - case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: - case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: - case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: - case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: - case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: - case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: - case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: - case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: - case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: - case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: -
Mesa (master): mesa/formats: add MESA_LAYOUT_LATC
Module: Mesa Branch: master Commit: 31a5135cd793951191c4a2fb86a50253a9931454 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=31a5135cd793951191c4a2fb86a50253a9931454 Author: Nanley CheryDate: Wed Aug 26 16:25:44 2015 -0700 mesa/formats: add MESA_LAYOUT_LATC This enables us to predicate statments on a compressed format being a type of LATC format. Also, remove the comment that lists the enum (it was getting a tad long). Reviewed-by: Anuj Phogat Signed-off-by: Nanley Chery --- src/mesa/main/format_info.py |2 +- src/mesa/main/formats.c | 11 --- src/mesa/main/formats.csv|8 src/mesa/main/formats.h |1 + src/mesa/main/texcompress.c |1 + 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py index 22eb5a7..50626a85 100644 --- a/src/mesa/main/format_info.py +++ b/src/mesa/main/format_info.py @@ -111,7 +111,7 @@ def get_channel_bits(fmat, chan_name): return 1 if fmat.has_channel('a') else 0 else: return 0 - elif fmat.layout == 'rgtc': + elif fmat.layout in ('rgtc', 'latc'): return 8 if fmat.has_channel(chan_name) else 0 elif fmat.layout in ('etc1', 'etc2'): if fmat.name.endswith('_ALPHA1') and chan_name == 'a': diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 982103f..9f92007 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -188,17 +188,6 @@ _mesa_get_format_max_bits(mesa_format format) /** * Return the layout type of the given format. - * The return value will be one of: - *MESA_FORMAT_LAYOUT_ARRAY - *MESA_FORMAT_LAYOUT_PACKED - *MESA_FORMAT_LAYOUT_S3TC - *MESA_FORMAT_LAYOUT_RGTC - *MESA_FORMAT_LAYOUT_FXT1 - *MESA_FORMAT_LAYOUT_ETC1 - *MESA_FORMAT_LAYOUT_ETC2 - *MESA_FORMAT_LAYOUT_BPTC - *MESA_FORMAT_LAYOUT_ASTC - *MESA_FORMAT_LAYOUT_OTHER */ extern enum mesa_format_layout _mesa_get_format_layout(mesa_format format) diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv index 11228e0..529de31 100644 --- a/src/mesa/main/formats.csv +++ b/src/mesa/main/formats.csv @@ -294,10 +294,10 @@ MESA_FORMAT_RG_RGTC2_UNORM, rgtc , 4, 4, x128, , , MESA_FORMAT_RG_RGTC2_SNORM, rgtc , 4, 4, x128, , , , xy01, rgb # LATC1/2 compressed formats -MESA_FORMAT_L_LATC1_UNORM , rgtc , 4, 4, x64 , , , , xxx1, rgb -MESA_FORMAT_L_LATC1_SNORM , rgtc , 4, 4, x64 , , , , xxx1, rgb -MESA_FORMAT_LA_LATC2_UNORM, rgtc , 4, 4, x128, , , , xxxy, rgb -MESA_FORMAT_LA_LATC2_SNORM, rgtc , 4, 4, x128, , , , xxxy, rgb +MESA_FORMAT_L_LATC1_UNORM , latc , 4, 4, x64 , , , , xxx1, rgb +MESA_FORMAT_L_LATC1_SNORM , latc , 4, 4, x64 , , , , xxx1, rgb +MESA_FORMAT_LA_LATC2_UNORM, latc , 4, 4, x128, , , , xxxy, rgb +MESA_FORMAT_LA_LATC2_SNORM, latc , 4, 4, x128, , , , xxxy, rgb # ETC1/2 compressed formats MESA_FORMAT_ETC1_RGB8 , etc1 , 4, 4, x64 , , , , xyz1, rgb diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 2b8146c..794d599 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -66,6 +66,7 @@ enum mesa_format_layout { MESA_FORMAT_LAYOUT_PACKED, MESA_FORMAT_LAYOUT_S3TC, MESA_FORMAT_LAYOUT_RGTC, + MESA_FORMAT_LAYOUT_LATC, MESA_FORMAT_LAYOUT_FXT1, MESA_FORMAT_LAYOUT_ETC1, MESA_FORMAT_LAYOUT_ETC2, diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 394c8ba..e0294a8 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -728,6 +728,7 @@ _mesa_get_compressed_fetch_func(mesa_format format) case MESA_FORMAT_LAYOUT_FXT1: return _mesa_get_fxt_fetch_func(format); case MESA_FORMAT_LAYOUT_RGTC: + case MESA_FORMAT_LAYOUT_LATC: return _mesa_get_compressed_rgtc_func(format); case MESA_FORMAT_LAYOUT_ETC1: return _mesa_get_etc_fetch_func(format); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa/texcompress: add compressed formats to base format utility function
Module: Mesa Branch: master Commit: db2777091d70c7abd28e0a8aac16b4a416e42e81 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=db2777091d70c7abd28e0a8aac16b4a416e42e81 Author: Nanley CheryDate: Thu Aug 27 16:25:48 2015 -0700 mesa/texcompress: add compressed formats to base format utility function Add S3TC and PALETTE formats. Reviewed-by: Anuj Phogat Signed-off-by: Nanley Chery --- src/mesa/main/texcompress.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index e0294a8..84973d3 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -100,6 +100,12 @@ _mesa_gl_compressed_format_base_format(GLenum format) case GL_ETC1_RGB8_OES: case GL_COMPRESSED_RGB8_ETC2: case GL_COMPRESSED_SRGB8_ETC2: + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + case GL_PALETTE4_RGB8_OES: + case GL_PALETTE4_R5_G6_B5_OES: + case GL_PALETTE8_RGB8_OES: + case GL_PALETTE8_R5_G6_B5_OES: return GL_RGB; case GL_COMPRESSED_RGBA: @@ -117,6 +123,14 @@ _mesa_gl_compressed_format_base_format(GLenum format) case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + case GL_PALETTE4_RGBA8_OES: + case GL_PALETTE8_RGB5_A1_OES: + case GL_PALETTE4_RGBA4_OES: + case GL_PALETTE4_RGB5_A1_OES: + case GL_PALETTE8_RGBA8_OES: + case GL_PALETTE8_RGBA4_OES: return GL_RGBA; case GL_COMPRESSED_ALPHA: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): dri/common: use sysconfdir when looking for drirc
Module: Mesa Branch: master Commit: c228514c72cb2fd5fb9e510808e29204fc9e7ae1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c228514c72cb2fd5fb9e510808e29204fc9e7ae1 Author: Marcin ŚlusarzDate: Sat Sep 19 19:17:34 2015 +0200 dri/common: use sysconfdir when looking for drirc Useful when locally installed mesa has more quirks than the system one. Signed-off-by: Marcin Ślusarz Reviewed-by: Ilia Mirkin Reviewed-by: Emil Velikov --- docs/autoconf.html |9 - src/mesa/drivers/dri/common/Makefile.am |1 + src/mesa/drivers/dri/common/xmlconfig.c |6 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/autoconf.html b/docs/autoconf.html index 2ef8c63..5c29e5e 100644 --- a/docs/autoconf.html +++ b/docs/autoconf.html @@ -87,6 +87,13 @@ created in a lib64 directory at the top of the Mesa source tree. +--sysconfdir=DIR +This option specifies the directory where the configuration +files will be installed. The default is ${prefix}/etc. +Currently there's only one config file provided when dri drivers are +enabled - it's drirc. + + --enable-static, --disable-shared By default, Mesa will build shared libraries. Either of these options will force static @@ -217,7 +224,7 @@ GLX. --with-expat=DIR DEPRECATED, use PKG_CONFIG_PATH instead. The DRI-enabled libGL uses expat to -parse the DRI configuration files in /etc/drirc and +parse the DRI configuration files in ${sysconfdir}/drirc and ~/.drirc. This option allows a specific expat installation to be used. For example, --with-expat=/usr/local will search for expat headers and libraries in /usr/local/include diff --git a/src/mesa/drivers/dri/common/Makefile.am b/src/mesa/drivers/dri/common/Makefile.am index b307f10..ea52cb5 100644 --- a/src/mesa/drivers/dri/common/Makefile.am +++ b/src/mesa/drivers/dri/common/Makefile.am @@ -34,6 +34,7 @@ AM_CFLAGS = \ -I$(top_srcdir)/src/gallium/auxiliary \ $(LIBDRM_CFLAGS) \ $(DEFINES) \ + -DSYSCONFDIR=\"$(sysconfdir)\" $(VISIBILITY_CFLAGS) noinst_LTLIBRARIES = \ diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c index f17693e..b8ab480 100644 --- a/src/mesa/drivers/dri/common/xmlconfig.c +++ b/src/mesa/drivers/dri/common/xmlconfig.c @@ -935,9 +935,13 @@ static void parseOneConfigFile (XML_Parser p) { #undef BUF_SIZE } +#ifndef SYSCONFDIR +#define SYSCONFDIR "/etc" +#endif + void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info, int screenNum, const char *driverName) { -char *filenames[2] = {"/etc/drirc", NULL}; +char *filenames[2] = { SYSCONFDIR "/drirc", NULL}; char *home; uint32_t i; struct OptConfData userData; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit