summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texcompress.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Add texel fetch functions for BPTC-compressed texturesNeil Roberts2014-08-121-0/+6
| | | | | | | | | | Adds functions to fetch from any of the four BPTC-compressed formats. v2: Set the alpha component to 1.0 when fetching from the half-float formats instead of leaving it uninitialised. Don't linearize the alpha component when fetching from sRGB. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add the format enums for BPTC-compressed imagesNeil Roberts2014-08-121-0/+24
| | | | | | | | | | | | | | | | | | This adds the following four Mesa image format enums which correspond to the four BPTC compressed texture formats: MESA_FORMAT_BPTC_RGBA_UNORM MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT It also updates the format information functions to handle these and the corresponding GL enums. v2: Also modify _mesa_get_format_color_encoding, _mesa_get_srgb_format_linear and _mesa_get_uncompressed_format Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix the base format for GL_COMPRESSED_RGB_BPTC_*_FLOAT_ARBNeil Roberts2014-08-121-2/+2
| | | | | | | | The signed and unsigned half-float BPTC-compressed formats were being reported as having a base format of GL_RGBA but they don't store an alpha channel so it should be GL_RGB. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix Type A _INT formats to MESA_FORMAT naming standardMark Mueller2014-01-271-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | Replace Type A _INT formats names with _SINT to match naming spec, and update type C formats as follows: s/MESA_FORMAT_R_INT8\b/MESA_FORMAT_R_SINT8/g s/MESA_FORMAT_R_INT16\b/MESA_FORMAT_R_SINT16/g s/MESA_FORMAT_R_INT32\b/MESA_FORMAT_R_SINT32/g s/MESA_FORMAT_RG_INT8\b/MESA_FORMAT_RG_SINT8/g s/MESA_FORMAT_RG_INT16\b/MESA_FORMAT_RG_SINT16/g s/MESA_FORMAT_RG_INT32\b/MESA_FORMAT_RG_SINT32/g s/MESA_FORMAT_RGB_INT8\b/MESA_FORMAT_RGB_SINT8/g s/MESA_FORMAT_RGB_INT16\b/MESA_FORMAT_RGB_SINT16/g s/MESA_FORMAT_RGB_INT32\b/MESA_FORMAT_RGB_SINT32/g s/MESA_FORMAT_RGBA_INT8\b/MESA_FORMAT_RGBA_SINT8/g s/MESA_FORMAT_RGBA_INT16\b/MESA_FORMAT_RGBA_SINT16/g s/MESA_FORMAT_RGBA_INT32\b/MESA_FORMAT_RGBA_SINT32/g s/\bMESA_FORMAT_RED_RGTC1\b/MESA_FORMAT_R_RGTC1_UNORM/g s/\bMESA_FORMAT_SIGNED_RED_RGTC1\b/MESA_FORMAT_R_RGTC1_SNORM/g s/\bMESA_FORMAT_RG_RGTC2\b/MESA_FORMAT_RG_RGTC2_UNORM/g s/\bMESA_FORMAT_SIGNED_RG_RGTC2\b/MESA_FORMAT_RG_RGTC2_SNORM/g s/\bMESA_FORMAT_L_LATC1\b/MESA_FORMAT_L_LATC1_UNORM/g s/\bMESA_FORMAT_SIGNED_L_LATC1\b/MESA_FORMAT_L_LATC1_SNORM/g s/\bMESA_FORMAT_LA_LATC2\b/MESA_FORMAT_LA_LATC2_UNORM/g s/\bMESA_FORMAT_SIGNED_LA_LATC2\b/MESA_FORMAT_LA_LATC2_SNORM/g
* mesa: change gl_format to mesa_formatMark Mueller2014-01-271-5/+5
| | | | s/\bgl_format\b/mesa_format/g. Use better name for Mesa Formats enum
* mesa: Add COMPRESSED_RGBA_S3TC_DXT1_EXT to COMPRESSED_TEXTURE_FORMATS for GLESIan Romanick2014-01-151-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ES and desktop GL specs diverge here. Yay! In desktop OpenGL, the driver can perform online compression of uncompressed texture data. GL_NUM_COMPRESSED_TEXTURE_FORMATS and GL_COMPRESSED_TEXTURE_FORMATS give the application a list of formats that it could ask the driver to compress with some expectation of quality. The GL_ARB_texture_compression spec calls this "suitable for general-purpose usage." As noted above, this means GL_COMPRESSED_RGBA_S3TC_DXT1_EXT is not included in the list. In OpenGL ES, the driver never performs compression. GL_NUM_COMPRESSED_TEXTURE_FORMATS and GL_COMPRESSED_TEXTURE_FORMATS give the application a list of formats that the driver can receive from the application. It is the *complete* list of formats. The GL_EXT_texture_compression_s3tc spec says: "New State for OpenGL ES 2.0.25 and 3.0.2 Specifications The queries for NUM_COMPRESSED_TEXTURE_FORMATS and COMPRESSED_TEXTURE_FORMATS include COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT, and COMPRESSED_RGBA_S3TC_DXT5_EXT." Note that the addition is only to the OpenGL ES specification! Signed-off-by: Ian Romanick <[email protected]> See-also: http://lists.freedesktop.org/archives/mesa-dev/2013-October/047439.html Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Brian Paul <[email protected]> Cc: "10.0" <[email protected]>
* mesa: Never advertise _S3TC compressed formatsIan Romanick2013-08-211-12/+0
| | | | | | | | | | | | The NVIDIA driver doesn't expose them, and piglit's arb_texture_compression-invalid-formats expects them to not be there. This, with the previous commit, fixes piglit arb_texture_compression-invalid-formats. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Cc: "9.2" <[email protected]>
* mesa: Only advertise GL_ETC1_RGB8_OES in ES contextsIan Romanick2013-08-211-1/+9
| | | | | | | | | There is no extension for this format in desktop GL, so an application can't give the format back to glCompressedTexImage2D. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Cc: "9.2" <[email protected]>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <[email protected]>
* swrast: Replace ImageOffsets with an ImageSlices pointer.Eric Anholt2013-04-301-1/+1
| | | | | | | | | | | | | This is a step toward allowing drivers to use their normal mapping paths, instead of requiring that all slice mappings come from an aligned offset from the first slice's map. This incidentally fixes missing slice handling in FXT1 swrast. v2: Use slice height helper function. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Restore 78-column wrapping of license text in C-style comments.Kenneth Graunke2013-04-231-3/+4
| | | | | | | | | | | | | | The previous commit introduced extra words, breaking the formatting. This text transformation was done automatically via the following shell command: $ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript where 'vimscript' is a file containing: /THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/\*\// !fmt -w 78 -p ' * ' :wq Reviewed-by: Brian Paul <[email protected]>
* mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | This brings the license text in line with the MIT License as published on the Open Source Initiative website: http://opensource.org/licenses/mit-license.php Generated automatically be the following shell command: $ git grep 'THE AUTHORS BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/THE AUTHORS/THE AUTHORS OR COPYRIGHT HOLDERS/' {} This introduces some wrapping issues, to be fixed in the next commit. Reviewed-by: Brian Paul <[email protected]>
* mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | | Generated automatically be the following shell command: $ git grep 'BRIAN PAUL BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/BRIAN PAUL/THE AUTHORS/' {} The intention here is to protect all authors, not just Brian Paul. I believe that was already the sensible interpretation, but spelling it out is probably better. More practically, it also prevents people from accidentally copy & pasting the license into a new file which says Brian is not liable when he isn't even one of the authors. Reviewed-by: Brian Paul <[email protected]>
* mesa: remove #include "mfeatures.h" from numerous source filesBrian Paul2013-04-171-1/+0
| | | | | | None of the remaining FEATURE_x symbols in mfeatures.h are used anymore. Reviewed-by: Jordan Justen <[email protected]>
* mesa: Use a single flag for the S3TC extensions that don't require on-line ↵Ian Romanick2013-01-231-1/+3
| | | | | | | | compression Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Lee Salzman <[email protected]>
* mesa: add missing texel fetch code for sRGB DXT formatsBrian Paul2012-12-261-0/+4
| | | | Fixes http://bugs.freedesktop.org/show_bug.cgi?id=58548
* mesa: reimplement _mesa_decompress_image() using new tex fetch codeBrian Paul2012-12-141-103/+7
|
* mesa: added _mesa_get_compressed_fetch_func()Brian Paul2012-12-141-0/+33
|
* mesa: Add decoding functions for GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2Anuj Phogat2012-12-071-1/+1
| | | | | | | | Data in GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 format is decoded and stored in MESA_FORMAT_SARGB. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add decoding functions for GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2Anuj Phogat2012-12-071-1/+1
| | | | | | | | Data in GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 format is decoded and stored in MESA_FORMAT_RGBA8888_REV. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add decoding functions for GL_COMPRESSED_SIGNED_RG11_EACAnuj Phogat2012-12-071-1/+1
| | | | | | | | Data in GL_COMPRESSED_SIGNED_RG11_EAC format is decoded and stored in MESA_FORMAT_SIGNED_GR1616. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add decoding functions for GL_COMPRESSED_SIGNED_R11_EACAnuj Phogat2012-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Data in GL_COMPRESSED_SIGNED_R11_EAC format is decoded and stored in MESA_FORMAT_SIGNED_R16. v2: 16 bit signed data is converted to 16 bit unsigned data by adding 2 ^ 15 and stored in an unsigned texture format. v3: 1. Handle a corner case when base code word value is -128. As per OpenGL ES 3.0 specification -128 is not an allowed value and should be truncated to -127. 2. Converting a decoded 16 bit signed data to 16 bit unsigned data by adding 2 ^ 15 gives us an output which matches the decompressed image (.ppm) generated by ericsson's etcpack tool. ericsson is also doing this conversion in their tool because .ppm image files don't support signed data. But gles 3.0 specification doesn't suggest this conversion. We need to keep the decoded data in signed format. Both signed format tests in gles3 conformance pass with these changes. Signed-off-by: Anuj Phogat <[email protected]> Tested-by: Matt Turner <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add decoding functions for GL_COMPRESSED_RG11_EACAnuj Phogat2012-12-071-1/+1
| | | | | | | | Data in GL_COMPRESSED_RG11_EAC format is decoded and stored in MESA_FORMAT_RG1616. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add decoding functions for GL_COMPRESSED_R11_EACAnuj Phogat2012-12-071-1/+1
| | | | | | | | Data in GL_COMPRESSED_R11_EAC format is decoded and stored in MESA_FORMAT_R16. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add decoding functions for GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EACAnuj Phogat2012-12-071-1/+1
| | | | | | | | Data in GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC format is decoded and stored in MESA_FORMAT_SARGB8. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add decoding functions for GL_COMPRESSED_RGBA8_ETC2_EACAnuj Phogat2012-12-071-1/+1
| | | | | | | | Data in GL_COMPRESSED_RGBA8_ETC2_EAC format is decoded and stored in MESA_FORMAT_RGBA8888_REV. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add decoding functions for GL_COMPRESSED_SRGB8_ETC2Anuj Phogat2012-12-071-1/+1
| | | | | | | | Data in GL_COMPRESSED_SRGB8_ETC2 format is decoded and stored in MESA_FORMAT_SARGB8. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add decoding functions for GL_COMPRESSED_RGB8_ETC2Anuj Phogat2012-12-071-1/+1
| | | | | | | | | Data in GL_COMPRESSED_RGB8_ETC2 format is decoded and stored in MESA_FORMAT_RGBX8888_REV. v2: Use CLAMP macro and stdbool.h Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add new MESA_FORMATs for ETC2 compressed texturesAnuj Phogat2012-12-071-0/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | It is required by OpenGL ES 3.0 to support ETC2 textures. This patch adds new MESA_FORMATs for following etc2 texture formats: GL_COMPRESSED_RGB8_ETC2 GL_COMPRESSED_SRGB8_ETC2 GL_COMPRESSED_RGBA8_ETC2_EAC GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC GL_COMPRESSED_R11_EAC GL_COMPRESSED_RG11_EAC GL_COMPRESSED_SIGNED_R11_EAC GL_COMPRESSED_SIGNED_RG11_EAC MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1 MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1 Above formats are currently available in only gles 3.0. v2: Add entries in texfetch_funcs[] array. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]> v3 (Paul Berry <[email protected]>): comment out symbols that are not implemented yet, so that this commit compiles on its own; future commits will uncomment the symbols as they become available.
* mesa: remove FEATURE_ES test in _mesa_get_compressed_formats()Brian Paul2012-10-161-2/+0
| | | | Reviewed-by: Ian Romanick <[email protected]>
* Temporarily revert "mesa: remove remaining FEATURE_* defines where protected ↵José Fonseca2012-09-151-0/+2
| | | | | | | | by API check." This reverts commit 9f37b405a3de8668a5f74c9681829688475ac3b7. Fixes windows builds.
* mesa: remove remaining FEATURE_* defines where protected by API check.Oliver McFadden2012-09-151-2/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove FEATURE_EXT_texture_sRGB define.Oliver McFadden2012-09-151-2/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove FEATURE_texture_s3tc define.Oliver McFadden2012-09-151-3/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove FEATURE_texture_fxt1 define.Oliver McFadden2012-09-151-2/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa/swrast: fix GL_TEXTURE_2D_ARRAY texture fetches for dxt formatsBrian Paul2012-08-241-4/+4
| | | | | | | As with the previous commit. This fixes the last crash in the piglit copyteximage test but there's still some failures.
* mesa/swrast: fix GL_TEXTURE_2D_ARRAY texture fetches for latc/rgtc formatsBrian Paul2012-08-241-8/+8
| | | | | | | Fix-up the texel fetch functions so that they handle 3D coords (as used for array textures) and remove the "f_2d" part from their names. Helps fix swrast crashes in piglit's copyteximage test. More to come.
* mesa: s/GLuint/gl_format/ in _mesa_compressed_format_to_glenum()Brian Paul2012-08-241-1/+1
| | | | No real change here, just use the right type.
* mesa: push row stride adjustment down into _mesa_decompress_image()Brian Paul2012-02-101-1/+11
| | | | | | | There's a mismatch in row strides for compressed textures between what Driver.MapTextureImage() returns and what the software fetch-texel functions use. Move it down a layer. The next step would be to fix this in the fetch-texel functions.
* swrast: s/Data/Map/ in swrast_texture_imageBrian Paul2012-01-241-1/+1
| | | | To indicate that it points to mapped texture memory.
* mesa: add support for GL_OES_compressed_ETC1_RGB8_textureChia-I Wu2011-12-021-0/+22
| | | | | | | | | | | Add support for GL_OES_compressed_ETC1_RGB8_texture to core mesa. There is no driver support yet. Unlike desktop GL compressed texture formats, GLES compressed texture formats usually can only be used with glCompressedTexImage2D. All other gl*Tex*Image* functions are updated to check for that. Reviewed-by: Brian Paul <[email protected]>
* mesa: move gl_texture_image::Data, RowStride, ImageOffsets to swrastBrian Paul2011-10-231-2/+2
| | | | | | Only swrast and the drivers that fall back to swrast need these fields now. This removes the last of the fields related to software rendering from gl_texture_image.
* mesa: Don't expose compressed paletted formats via ↵Ian Romanick2011-09-201-15/+17
| | | | | | | | | | | | GL_{NUM_,}COMPRESSED_TEXTURE_FORMATS Fixes a bug introduced by commit faf5d65. These formats should only be exposed in OpenGL ES 1.x. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Cc: Xun Fang <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40860
* mesa: move gl_texture_image::FetchTexel fields to swrastBrian Paul2011-09-171-4/+5
| | | | | This also involves passing swrast_texture_image instead of gl_texture_image into all the fetch functions.
* mesa: new _mesa_decompress_image() functionBrian Paul2011-09-081-0/+86
| | | | | Use the old texture fetch functions to decompress a whole image. To be used by glGetTexImage().
* gles: Fix glGet(GL_{NUM_,}COMPRESSED_TEXTURE_FORMATS_ARB)Adam Jackson2011-09-081-1/+2
| | | | | | | We'd still accept the GL_PALETTE[48]_* formats in glCompressedTexImage2D, but they wouldn't be listed if you queried whether they were supported. Signed-off-by: Adam Jackson <[email protected]>
* mesa: Make _mesa_get_compressed_formats match the texture compression specsIan Romanick2011-07-251-27/+90
| | | | | | | | | | | The implementation deviated slightly from the GL_EXT_texture_sRGB spec and from other implementations. A giant comment block was added to justify the somewhat odd behavior of this function. In addition, the interface had unnecessary cruft. The 'all' parameter was false at all callers, so it has been removed. Reviewed-by: Brian Paul <[email protected]>
* mesa: Add utility function to get base format from a GL compressed formatIan Romanick2011-07-251-0/+88
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: add ATI_texture_compression_3dcMarek Olšák2011-03-081-0/+1
| | | | | | | LUMINANCE_ALPHA_LATC2 = LUMINANCE_ALPHA_3DC, so this is easy. Note that there is no specification for 3DC, just a few white papers from ATI.
* mesa: add EXT_texture_compression_latcMarek Olšák2011-03-081-0/+18
| | | | | | | | | | | | | | | | | The encoding/decoding algorithms are shared with RGTC. Thanks to some magic with the base format, the RGTC texstore functions work for LATC too. swrast passes the related piglit tests besides two things: - The alpha channel is wrong (it's always 1), however the incorrect alpha channel makes some other tests fail too, so I guess it's unrelated to LATC. - Signed LATC fetches aren't correct yet (signed values are clamped to [0,1]), however RGTC has the same problem. Further testing (with other of my patches) shows that hardware drivers and softpipe work. BTW, ETQW uses this extension.